return hfm;
}
protected Field createLabelAndChoiceField(String label, Object[] choices, final Object initialChoice, final Execution execution) {
final ObjectChoiceField choiceField = new ObjectChoiceField(label, choices);
if (initialChoice != null) {
choiceField.setSelectedIndex(initialChoice);
FieldChangeListener changeListener = new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
if (context == ChoiceField.CONTEXT_CHANGE_OPTION) {
Object selection = choiceField.getChoice(choiceField.getSelectedIndex());
if (selection != null) {
if (!execution.execute(selection)) {
choiceField.setSelectedIndex(initialChoice);
}
}
}
}
};
choiceField.setChangeListener(changeListener);
}
return choiceField;
}