Interface ICombobox
-
- All Superinterfaces:
IAnyGroup<ICombobox>,IChildable<ICombobox,IComboitem>,IChildrenOfInputgroup<ICombobox>,IComponent<ICombobox>,IHtmlBasedComponent<ICombobox>,IInputElement<ICombobox,java.lang.String>,IReadonly<ICombobox>,ITextboxBase<ICombobox>,IXulElement<ICombobox>
public interface ICombobox extends ITextboxBase<ICombobox>, IChildable<ICombobox,IComboitem>, IAnyGroup<ICombobox>
ImmutableComboboxcomponentA combobox is a special text box that embeds a drop-down list. With comboboxes, users are allowed to select from a drop-down list, in addition to entering the text manually.
Support @Action
Name Action Type onSelect ActionData: SelectData
Represents an action caused by user's the list selection is changed at the client.onOpen ActionData: OpenData
Denotes that the user has opened or closed a component. Note: unlikeonClose, this action is only a notification. The client sends this action after opening or closing the component.
It is useful to implement load-on-demand by listening to theonOpenaction, and creating components when the first time the component is opened.Mouseless Entry
Alt+DOWNto pop up the list.Alt+UPorESCto close the list.UPandDOWNto change the selection of the items from the list.ENTERto confirm the change of selection.ESCto abort the change of selection. It is meaningful ifinstantSelectis false.
Autocomplete
By default, it will autocomplete your input with the first item in the list that has the same starting string in a case-insensitive way.
- Author:
- katherine
- See Also:
Combobox
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classICombobox.BuilderBuilds instances of typeICombobox.static classICombobox.UpdaterBuilds an updater of typeIComboboxforUiAgent.smartUpdate(Locator, SmartUpdater).-
Nested classes/interfaces inherited from interface org.zkoss.stateless.sul.ITextboxBase
ITextboxBase.Type
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.StringgetEmptySearchMessage()Returns the empty search message if any.default java.lang.StringgetIconSclass()Returns the iconSclass name of this Combobox.java.lang.StringgetPopupWidth()Returns the width of the popup of this componentdefault intgetSelectedIndex()Returns the index of the selected item, or -1 if not selected.default java.lang.StringgetWidgetClass()Returns the client widget class.default booleanisAutocomplete()Returns whether to automatically complete this text box by matching the nearest item (IComboitem.default booleanisAutodrop()Returns whether to automatically drop the list if users is changing this text box.default booleanisButtonVisible()Returns whether the button (on the right of the timebox) is visible.default booleanisInstantSelect()Returns true if onSelect event is sent as soon as user selects using keyboard navigation.default booleanisOpen()Returns whether this combobox is open.static IComboboxof(java.lang.Iterable<? extends IComboitem> children)Returns the instance with the givenIComboitemchildren.static IComboboxof(java.lang.String value)Returns the instance with the given value.static IComboboxof(IComboitem... children)Returns the instance with the givenIComboitemchildren.static IComboboxofConstraint(java.lang.String constraint)Returns the instance with the given constraint.static IComboboxofId(java.lang.String id)Returns the instance with the given id.IComboboxwithAutocomplete(boolean autocomplete)Returns a copy ofthisimmutable component with the specifiedautocomplete.IComboboxwithAutodrop(boolean autodrop)Returns a copy ofthisimmutable component with the specifiedautodrop.IComboboxwithButtonVisible(boolean buttonVisible)Returns a copy ofthisimmutable component with the specifiedbuttonVisible.IComboboxwithEmptySearchMessage(java.lang.String emptySearchMessage)Returns a copy ofthisimmutable component with the specifiedemptySearchMessage.IComboboxwithIconSclass(java.lang.String iconSclass)Returns a copy ofthisimmutable component with the specifiediconSclass.IComboboxwithInstantSelect(boolean instantSelect)Returns a copy ofthisimmutable component with the specifiedinstantSelect.IComboboxwithOpen(boolean open)Returns a copy ofthisimmutable component with the specifiedsclass.IComboboxwithPopupWidth(java.lang.String popupWidth)Returns a copy ofthisimmutable component with the specifiedpopupWidth.IComboboxwithSelectedIndex(int selectedIndex)Returns a copy ofthisimmutable component with the specifiedselectedIndex.-
Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildren
-
Methods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverrides
-
Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex
-
Methods inherited from interface org.zkoss.stateless.sul.IInputElement
getCols, getConstraint, getErrorboxIconSclass, getErrorboxSclass, getErrorMessage, getInputAttributes, getInstant, getMaxlength, getName, getPlaceholder, getValue, isDisabled, isInplace, withCols, withConstraint, withDisabled, withErrorboxIconSclass, withErrorboxSclass, withErrorMessage, withInplace, withInputAttributes, withInstant, withMaxlength, withName, withPlaceholder
-
Methods inherited from interface org.zkoss.stateless.sul.IReadonly
isReadonly, withReadonly
-
Methods inherited from interface org.zkoss.stateless.sul.ITextboxBase
getRows, getType, isMultiline, isSubmitByEnter, isTabbable, withMultiline, withRows, withSubmitByEnter, withTabbable, withType, withType, withValue
-
Methods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
-
-
-
Field Detail
-
DEFAULT
static final ICombobox DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Detail
-
getWidgetClass
default java.lang.String getWidgetClass()
Returns the client widget class.Default:
"zul.inp.Combobox"- Specified by:
getWidgetClassin interfaceIComponent<ICombobox>
-
getPopupWidth
@Nullable java.lang.String getPopupWidth()
Returns the width of the popup of this componentDefault:
null
-
withPopupWidth
ICombobox withPopupWidth(@Nullable java.lang.String popupWidth)
Returns a copy ofthisimmutable component with the specifiedpopupWidth.Sets the width of the popup of this component. If the input is a percentage, the popup width will be calculated by multiplying the width of this component with the percentage. (e.g. if the input string is
130%, and the width of this component is300px, the popup width will be390px = 300px * 130%) Others will be set directly.- Parameters:
popupWidth- The width of the popup of this component.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getEmptySearchMessage
@Nullable java.lang.String getEmptySearchMessage()
Returns the empty search message if any. Default:null
-
withEmptySearchMessage
ICombobox withEmptySearchMessage(@Nullable java.lang.String emptySearchMessage)
Returns a copy ofthisimmutable component with the specifiedemptySearchMessage.Sets empty search message. This message would be displayed, when no matching results was found. Note: it's meaningless if no model case.
- Parameters:
emptySearchMessage- The empty search message to display.Default:
null.- Returns:
- A modified copy of the
thisobject
-
getSelectedIndex
default int getSelectedIndex()
Returns the index of the selected item, or -1 if not selected.
-
withSelectedIndex
ICombobox withSelectedIndex(int selectedIndex)
Returns a copy ofthisimmutable component with the specifiedselectedIndex.Deselects the currently selected items and selects the item with the given index.
Note: if the label of
IComboitemhas the same more than one, the firstIComboitemwill be selected at client side, it is a limitation ofIComboboxand it is different fromIListbox.- Parameters:
selectedIndex- The selected index of the combobox.Default:
-1, meaning not selected.- Returns:
- A modified copy of the
thisobject
-
isAutodrop
default boolean isAutodrop()
Returns whether to automatically drop the list if users is changing this text box.Default:
false.
-
withAutodrop
ICombobox withAutodrop(boolean autodrop)
Returns a copy ofthisimmutable component with the specifiedautodrop.Sets whether to automatically drop the list if users is changing this text box.
- Parameters:
autodrop-trueto enable the auto-drop facility.Default:
false.- Returns:
- A modified copy of the
thisobject
-
isAutocomplete
default boolean isAutocomplete()
Returns whether to automatically complete this text box by matching the nearest item (IComboitem. It is also known as auto-type-ahead.If true, the nearest item will be searched and the text box is updated automatically. If false, user has to click the item or use the DOWN or UP keys to select it back.
Don't confuse it with the auto-completion feature mentioned by other framework. Such kind of auto-completion is supported well by listening to the
onChangingaction.Default:
true
-
withAutocomplete
ICombobox withAutocomplete(boolean autocomplete)
Returns a copy ofthisimmutable component with the specifiedautocomplete.Sets whether to automatically complete this text box by matching the nearest item (
IComboitem.- Parameters:
autocomplete-falseto disable the auto-completion feature.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isButtonVisible
default boolean isButtonVisible()
Returns whether the button (on the right of the timebox) is visible.Default:
true.
-
withButtonVisible
ICombobox withButtonVisible(boolean buttonVisible)
Returns a copy ofthisimmutable component with the specifiedbuttonVisible.Sets whether the button (on the right of the combobox) is visible.
- Parameters:
buttonVisible-falseto disable the button visibility.Default:
true.- Returns:
- A modified copy of the
thisobject
-
isInstantSelect
default boolean isInstantSelect()
Returns true if onSelect event is sent as soon as user selects using keyboard navigation.Default:
true
-
withInstantSelect
ICombobox withInstantSelect(boolean instantSelect)
Returns a copy ofthisimmutable component with the specifiedinstantSelect.Sets the instantSelect attribute. When the attribute is true,
onSelectaction will be fired as soon as user selects using keyboard navigation. If the attribute is false, user needs to pressEnter keyto finish the selection using keyboard navigation.- Parameters:
instantSelect-falseto disable the button visibility.Default:
true.- Returns:
- A modified copy of the
thisobject
-
getIconSclass
default java.lang.String getIconSclass()
Returns the iconSclass name of this Combobox.Default:
Combobox.ICON_SCLASS
-
withIconSclass
ICombobox withIconSclass(java.lang.String iconSclass)
Returns a copy ofthisimmutable component with the specifiediconSclass.Sets the iconSclass name of this Combobox.
- Parameters:
iconSclass- The iconSclass name of this Combobox.Default:
Combobox.ICON_SCLASS- Returns:
- A modified copy of the
thisobject
-
isOpen
default boolean isOpen()
Returns whether this combobox is open.Default:
false.
-
withOpen
ICombobox withOpen(boolean open)
Returns a copy ofthisimmutable component with the specifiedsclass.Sets whether this combobox is open or not.
- Parameters:
open-trueto open the dropdown.Default:
false- Returns:
- A modified copy of the
thisobject
-
of
static ICombobox of(java.lang.String value)
Returns the instance with the given value.- Parameters:
value- The value of the component
-
of
static ICombobox of(java.lang.Iterable<? extends IComboitem> children)
Returns the instance with the givenIComboitemchildren.- Parameters:
children- The children ofIComboitem
-
of
static ICombobox of(IComboitem... children)
Returns the instance with the givenIComboitemchildren.- Parameters:
children- The children ofIComboitem
-
ofConstraint
static ICombobox ofConstraint(java.lang.String constraint)
Returns the instance with the given constraint.- Parameters:
constraint- The combobox constraint
-
ofId
static ICombobox ofId(java.lang.String id)
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-
-