return new ColorComboBox();
}
protected Binding doBind(JComponent control, FormModel formModel, String formPropertyPath,
Map context) {
final ColorComboBox colorComboBox = (ColorComboBox)control;
return new CustomBinding(formModel, formPropertyPath, Color.class) {
protected JComponent doBindControl() {
colorComboBox.setSelectedColor((Color)getValue());
colorComboBox.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED){
controlValueChanged(colorComboBox.getSelectedColor());
}
}
});
return colorComboBox;
}
protected void readOnlyChanged() {
colorComboBox.setEnabled(isEnabled() && !isReadOnly());
}
protected void enabledChanged() {
colorComboBox.setEnabled(isEnabled() && !isReadOnly());
}
protected void valueModelChanged(Object newValue) {
colorComboBox.setSelectedColor((Color)newValue);
}
};
}