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_
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the current selection.Returns the current selection (inSelectionMode.Extended
mode).Returns the selection mode.int
Returns the number of items that are visible.protected void
setFormData
(WObject.FormData formData) void
setSelectedIndexes
(Set<Integer> selection) Sets the selection (inSelectionMode.Extended
mode).void
Sets the selection mode.void
setVerticalSize
(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, setValueText
Methods inherited from class eu.webtoolkit.jwt.WFormWidget
changed, enableAjax, getLabel, getPlaceholderText, getTabIndex, getValidator, isCanReceiveFocus, isReadOnly, propagateSetEnabled, remove, render, setEnabled, setHidden, setPlaceholderText, setReadOnly, setToolTip, setValidator, validate, validated, validatorChanged
Methods 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, unsetDraggable
Methods 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, 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, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemoved
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, render, resize, scheduleRender, scheduleRender, scheduleRender, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
Methods 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.Extended
to allow selection of multiple items. -
getSelectionMode
Returns the selection mode.- Overrides:
getSelectionMode
in classWComboBox
- See Also:
-
getSelectedIndexes
Returns the current selection (inSelectionMode.Extended
mode).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.Extended
mode).For an
SelectionMode.Extended
mode, set the list of currently selected items.- See Also:
-
clearSelection
public void clearSelection()Clears the current selection.Clears the current selection.
-
setFormData
- Overrides:
setFormData
in classWComboBox
-