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