public MultipleCharPropertyWidget(ConfiguredPropertyDescriptor propertyDescriptor,
AbstractBeanJobBuilder<?, ?, ?> beanJobBuilder) {
super(beanJobBuilder, propertyDescriptor);
_textFieldPanel = new DCPanel();
_textFieldPanel.setLayout(new VerticalLayout(2));
char[] currentValue = (char[]) beanJobBuilder.getConfiguredProperty(propertyDescriptor);
if (currentValue == null) {
currentValue = new char[1];
}
updateComponents(currentValue);
final JButton addButton = WidgetFactory.createSmallButton("images/actions/add.png");
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addCharField();
fireValueChanged();
}
});
final JButton removeButton = WidgetFactory.createSmallButton("images/actions/remove.png");
removeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int componentCount = _textFieldPanel.getComponentCount();
if (componentCount > 0) {
_textFieldPanel.remove(componentCount - 1);
_textFieldPanel.updateUI();
fireValueChanged();
}
}
});
final DCPanel buttonPanel = new DCPanel();
buttonPanel.setBorder(new EmptyBorder(0, 4, 0, 0));
buttonPanel.setLayout(new VerticalLayout(2));
buttonPanel.add(addButton);
buttonPanel.add(removeButton);
final DCPanel outerPanel = new DCPanel();
outerPanel.setLayout(new BorderLayout());