Class WSelectionBox
By default, a selection box may be used to let the user select one item from a list. This may
be changed to multiple selection mode using setSelectionMode().
The current selection may be set and read using WComboBox#setCurrentIndex() and WComboBox.getCurrentIndex(), for SelectionMode.Single mode, or setSelectedIndexes() and getSelectedIndexes() for
SelectionMode.Extended mode. The WComboBox.activated() and WComboBox.sactivated() signals are not emited in the SelectionMode.Extended mode, use
the WFormWidget.changed() signal.
WSelectionBox is an MVC view class, using a simple string list model by default. The model may
be populated using WComboBox#addItem() or WComboBox#insertItem() and the contents can
be cleared through WComboBox.clear(). These methods manipulate the underlying WComboBox.getModel().
To use the selectionbox with a custom model instead of the default WStringListModel,
use WComboBox#setModel().
WSelectionBox is an inline widget.
CSS
The widget corresponds to the HTML <select> tag and does not provide
styling. It can be styled using inline or external CSS as appropriate.
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData -
Field Summary
Fields inherited from class eu.webtoolkit.jwt.WInteractWidget
dragTouchEndSlot_, dragTouchSlot_, noDefault -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the current selection.Returns the current selection (inSelectionMode.Extendedmode).Returns the selection mode.intReturns the number of items that are visible.protected voidsetFormData(WObject.FormData formData) voidsetSelectedIndexes(Set<Integer> selection) Sets the selection (inSelectionMode.Extendedmode).voidSets the selection mode.voidsetVerticalSize(int items) Sets the number of items that are visible.Methods inherited from class eu.webtoolkit.jwt.WComboBox
activated, addItem, clear, findText, getCount, getCurrentIndex, getCurrentText, getItemText, getModel, getValueText, insertItem, isNoSelectionEnabled, refresh, removeItem, sactivated, setCurrentIndex, setItemText, setModel, setModelColumn, setNoSelectionEnabled, setValueTextMethods inherited from class eu.webtoolkit.jwt.WFormWidget
changed, enableAjax, getLabel, getPlaceholderText, getRealValidator, getTabIndex, getValidator, hasValidatorChanged, isCanReceiveFocus, isReadOnly, propagateSetEnabled, remove, render, setEnabled, setHidden, setPlaceholderText, setReadOnly, setToolTip, setValidator, validate, validated, validatorChangedMethods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, getMouseOverDelay, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, setDraggable, setDraggable, setDraggable, setDraggable, setMouseOverDelay, setPopup, touchEnded, touchMoved, touchStarted, unsetDraggableMethods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, beingDeleted, blurred, callJavaScriptMember, childrenChanged, createDomElement, doJavaScript, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getDomChanges, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, hideToolTip, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, iterateChildren, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, parentResized, propagateSetVisible, removeScript, removeStyleClass, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFlexBox, setFloatSide, setFocus, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setVerticalAlignment, showToolTip, showToolTipOnHover, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemovedMethods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, applyThemeStyles, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, render, resize, scheduleRender, scheduleRender, scheduleRender, scheduleThemeStyleApply, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, trMethods inherited from class eu.webtoolkit.jwt.WObject
getObjectName
-
Constructor Details
-
WSelectionBox
Constructor. -
WSelectionBox
public WSelectionBox()Constructor.
-
-
Method Details
-
getVerticalSize
public int getVerticalSize()Returns the number of items that are visible. -
setVerticalSize
public void setVerticalSize(int items) Sets the number of items that are visible.If more items are available, a scroll-bar is provided.
-
setSelectionMode
Sets the selection mode.The default selection mode is
SelectionMode.Single. You can change toSelectionMode.Extendedto allow selection of multiple items. -
getSelectionMode
Returns the selection mode.- Overrides:
getSelectionModein classWComboBox- See Also:
-
getSelectedIndexes
Returns the current selection (inSelectionMode.Extendedmode).Get the list of currently selected items. This method is only defined when
getSelectionMode()isSelectionMode.Extended. Otherwise, you should useWComboBox.getCurrentIndex()to get item currently selected.- See Also:
-
setSelectedIndexes
Sets the selection (inSelectionMode.Extendedmode).For an
SelectionMode.Extendedmode, set the list of currently selected items.- See Also:
-
clearSelection
public void clearSelection()Clears the current selection.Clears the current selection.
-
setFormData
- Overrides:
setFormDatain classWComboBox
-