XTemplate to render it's drop down list. A custom template can be specified to customize the display of the drop down list. See {@link #setTemplate(XTemplate)}. A custom PropertyEditor can be used to "format" the value that is displayed in the combo's text field. For example: combo.setPropertyEditor(new ListModelPropertyEditor<State>() { public String getStringValue(State value) { return value.getAbbr() + " " + value.getName(); } }); A ModelProcessor can be used to "format" the values in the drop down list: combo.getView().setModelProcessor(new ModelProcessor<State>() { public State prepareData(State model) { model.set("test", model.getAbbr() + " " + model.getName()); return model; } }); JComboBox implementation we provide our own "patch". First of all it has correct preferred and minimum sizes that has sense when combo box is editable. Also this implementation fixes some bugs with clicking of default button. The SUN's combo box eats first "Enter" if the selected value from the list and changed it. They say that combo box "commit" changes and only second "Enter" clicks default button. This implementation clicks the default button immediately. As the result of our patch combo box has internal wrapper for ComboBoxEditor. It means that getEditor method always returns not the same value you set by setEditor method. Moreover adding and removing of action listeners isn't supported by the implementation of wrapper.
@author Vladimir Kondratyev
JSP: <-- Example One --> <s:bean name="struts.util.Counter" var="year"> <s:param name="first" value="text('firstBirthYear')"/> <s:param name="last" value="2000"/> <s:combobox label="Birth year" size="6" maxlength="4" name="birthYear" list="#year"/> </s:bean> <-- Example Two --> <-- Example Two --> Velocity: #tag( ComboBox "label=Birth year" "size=6" "maxlength=4" "name=birthYear" "list=#year" )
Non-XUL extension. It is used to replace XUL menulist. This class is more flexible than menulist, such as {@link #setAutocomplete}{@link #setAutodrop}.
Default {@link #getZclass}: z-combobox.(since 3.5.0)
Events: onOpen, onSelect, onAfterRender
Developers can listen to the onOpen event and initializes it when {@link org.zkoss.zk.ui.event.OpenEvent#isOpen} is true, and/orclean up if false.
onAfterRender is sent when the model's data has been rendered.(since 5.0.4)
Besides assign a list model, you could assign a renderer (a {@link ComboitemRenderer} instance) to a combobox, such thatthe combobox will use this renderer to render the data returned by {@link ListModel#getElementAt}. If not assigned, the default renderer, which assumes a label per combo item, is used. In other words, the default renderer adds a label to a row by calling toString against the object returned by {@link ListModel#getElementAt}. (since 3.0.2)
Note: to have better performance, onOpen is sent only if a non-deferrable event listener is registered (see {@link org.zkoss.zk.ui.event.Deferrable}).
Like {@link Datebox}, the value of a read-only comobobox ( {@link #isReadonly}) can be changed by dropping down the list and selecting an combo item (though users cannot type anything in the input box). @author tomyeh @see Comboitem
Non-XUL extension. It is used to replace XUL menulist. This class is more flexible than menulist, such as {@link #setAutocomplete} {@link #setAutodrop}.
Default {@link #getZclass}: z-combobox.(since 3.5.0)
Events: onOpen, onSelect
Developers can listen to the onOpen event and initializes it when {@link org.zkoss.zk.ui.event.OpenEvent#isOpen} is true, and/or clean up iffalse. *
Besides assign a list model, you could assign a renderer (a {@link ComboitemRenderer} instance) to a combobox, such that the comboboxwill use this renderer to render the data returned by {@link ListModel#getElementAt}. If not assigned, the default renderer, which assumes a label per combo item, is used. In other words, the default renderer adds a label to a row by calling toString against the object returned by {@link ListModel#getElementAt}.
Note: to have better performance, onOpen is sent only if a non-deferrable event listener is registered (see {@link org.zkoss.zk.ui.event.Deferrable}).
Like {@link Datebox}, the value of a read-only comobobox ( {@link #isReadonly}) can be changed by dropping down the list and selecting an combo item (though users cannot type anything in the input box). @author tomyeh @see Comboitem @since 3.5.2
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |