in taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellConfigurationPanel.java [180:222]
public PortComponent(final ActivityPortConfiguration portConfiguration,
ValidatingTextGroup validatingTextGroup) {
this.validatingTextGroup = validatingTextGroup;
nameField = new ValidatingTextField(portConfiguration.getName());
nameField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
portConfiguration.setName(nameField.getText());
}
@Override
public void insertUpdate(DocumentEvent e) {
portConfiguration.setName(nameField.getText());
}
@Override
public void changedUpdate(DocumentEvent e) {
portConfiguration.setName(nameField.getText());
}
});
validatingTextGroup.addValidTextComponent(nameField);
depthModel = new SpinnerNumberModel(portConfiguration.getDepth(), 0, 100, 1);
depthModel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
portConfiguration.setDepth(depthModel.getNumber().intValue());
}
});
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.WEST;
add(new JLabel("Name"), c);
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1;
add(nameField, c);
c.fill = GridBagConstraints.NONE;
c.weightx = 0;
add(new JLabel("Depth"), c);
add(new JSpinner(depthModel), c);
}