Class WSelectionBox
public class WSelectionBox extends WComboBox
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.SingleSelection
mode, or setSelectedIndexes()
and getSelectedIndexes()
for
SelectionMode.ExtendedSelection
mode. The WComboBox.activated()
and WComboBox.sactivated()
signals are not emited in the SelectionMode.ExtendedSelection
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
Constructors Constructor Description WSelectionBox()
Constructor.WSelectionBox(WContainerWidget parent)
Constructor. -
Method Summary
Modifier and Type Method Description void
clearSelection()
Clears the current selection.java.util.Set<java.lang.Integer>
getSelectedIndexes()
Returns the current selection (inSelectionMode.ExtendedSelection
mode).SelectionMode
getSelectionMode()
Returns the selection mode.int
getVerticalSize()
Returns the number of items that are visible.protected void
setFormData(WObject.FormData formData)
void
setSelectedIndexes(java.util.Set<java.lang.Integer> selection)
Sets the selection (inSelectionMode.ExtendedSelection
mode).void
setSelectionMode(SelectionMode mode)
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, getEmptyText, getLabel, getPlaceholderText, getTabIndex, getValidator, isCanReceiveFocus, isReadOnly, propagateSetEnabled, remove, render, selected, setEmptyText, setEnabled, setHidden, setPlaceholderText, setReadOnly, setToolTip, setValidator, validate, validated
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, 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, jsStringLiteral, jsStringLiteral, parentResized, parentResized, propagateSetVisible, removeScript, removeStyleClass, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFloatSide, setFocus, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setOffsets, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setVerticalAlignment, updateSignalConnection, voidEventSignal
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, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, removeChild, removeStyleClass, render, resize, scheduleRender, scheduleRender, scheduleRender, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setObjectName, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
Methods inherited from class eu.webtoolkit.jwt.WObject
addChild, getObjectName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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 SingleSelection. You can change to
SelectionMode.ExtendedSelection
to allow selection of multiple items. -
getSelectionMode
Returns the selection mode.- Overrides:
getSelectionMode
in classWComboBox
- See Also:
setSelectionMode(SelectionMode mode)
-
getSelectedIndexes
public java.util.Set<java.lang.Integer> getSelectedIndexes()Returns the current selection (inSelectionMode.ExtendedSelection
mode).Get the list of currently selected items. This method is only defined when
getSelectionMode()
isSelectionMode.ExtendedSelection
. Otherwise, you should useWComboBox.getCurrentIndex()
to get item currently selected.- See Also:
WComboBox.getCurrentIndex()
-
setSelectedIndexes
public void setSelectedIndexes(java.util.Set<java.lang.Integer> selection)Sets the selection (inSelectionMode.ExtendedSelection
mode).For an
SelectionMode.ExtendedSelection
mode, set the list of currently selected items.- See Also:
getSelectedIndexes()
-
clearSelection
public void clearSelection()Clears the current selection.Clears the current selection.
-
setFormData
- Overrides:
setFormData
in classWComboBox
-