public static void activate(Field masterField, RelatedGuiField relatedGuiField) { RequestComboBox comboBox = (RequestComboBox) masterField.getComponent(); RelatedFieldValueUpdater listener = new RelatedFieldValueUpdater(relatedGuiField, relatedGuiField.getComponent(), comboBox); comboBox.getDataSource().addPropertyChangeListener(DataSource.SELECTED_ROW_PROPERTY, listener); listener.updateValue(); }
void updateValue() { String value = comboBox.getSelectedValue(relatedGuiField.getName()); for (FieldSetter fieldSetter : FIELD_SETTERS) { if (fieldSetter.handle(relatedGuiFieldComponent)) { fieldSetter.setValue(relatedGuiFieldComponent, value); break; } } }