Class WMultiSelect
-
- All Implemented Interfaces:
AjaxTarget
,AjaxTrigger
,BeanAware
,BeanBound
,BeanProviderBound
,DataBound
,Diagnosable
,Disableable
,Input
,Labelable
,Mandatable
,SelectionToggleable
,SubordinateTarget
,SubordinateTrigger
,WComponent
,WebComponent
,Serializable
- Direct Known Subclasses:
WMultiSelectPair
public class WMultiSelect extends AbstractWMultiSelectList implements AjaxTrigger, AjaxTarget, SubordinateTrigger, SubordinateTarget, SelectionToggleable
The WMultiSelect input component allows the user to select one or more options from a list. The list of options that can be selected are supplied at construction time as a parameter in the constructor or via the
AbstractWSelectList.setOptions(List)
method. The list of options are java objects that are rendered using their toString() by default.Use the
getSelected
method to determine which of the list of options were chosen by the user. Note that getSelectedOptions will return a sub-set of the object instances supplied in the original list of options.- Since:
- 1.0.0
- Author:
- Jonathan Austin
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WMultiSelect.MultiSelectModel
Holds the extrinsic state information of the component.-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractWMultiSelectList
AbstractWMultiSelectList.MultiSelectionModel
-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractWSelectList
AbstractWSelectList.SelectionModel
-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractInput
AbstractInput.InputModel
-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractWComponent
AbstractWComponent.WComponentRef
-
-
Field Summary
-
Fields inherited from class com.github.bordertech.wcomponents.AbstractWMultiSelectList
EMPTY, NO_SELECTION
-
Fields inherited from interface com.github.bordertech.wcomponents.WComponent
DEFAULT_APPLICATION_ID, DEFAULT_INTERNAL_ID, DEFAULT_NO_ID, ID_CONTEXT_SEPERATOR, ID_FRAMEWORK_ASSIGNED_SEPERATOR, ID_VALIDATION_PATTERN
-
-
Constructor Summary
Constructors Constructor Description WMultiSelect()
Creates an empty WMultiSelect.WMultiSelect(Object table)
Creates a WMultiSelect with the options provided by the given table.WMultiSelect(Object[] options)
Creates a WMultiSelect containing the specified options.WMultiSelect(List options)
Creates a WMultiSelect containing the specified options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected WMultiSelect.MultiSelectModel
getComponentModel()
Returns the effective component model for this component.protected WMultiSelect.MultiSelectModel
getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified.int
getRows()
protected WMultiSelect.MultiSelectModel
newComponentModel()
Creates a new Component model.void
setRows(int rows)
Sets the maximum number of rows that are visible in the list at any one time.void
toggleSelection(boolean selected)
Sets the selections for this component.-
Methods inherited from class com.github.bordertech.wcomponents.AbstractWMultiSelectList
doHandleInvalidOption, doHandleRequest, getData, getMaxSelect, getMinSelect, getNewSelections, getNotSelected, getRequestValue, getSelected, getSelectedOptionsAsArray, getValue, getValueAsString, isEmpty, preparePaintComponent, setData, setMaxSelect, setMinSelect, setSelected, setSelected, validateComponent
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractWSelectList
getAjaxTarget, getCode, getDesc, getDescEncode, getListCacheKey, getLookupTable, getOptionIndex, getOptions, isAjax, isAllowNoSelection, isEditable, isPresent, isSelectionOrderable, isSubmitOnChange, optionToCode, optionToCode, optionToString, setAjaxTarget, setDescEncode, setEditable, setLookupTable, setOptions, setOptions, setSubmitOnChange
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractInput
addValidator, beforeHandleRequest, createMandatoryDiagnostic, doHandleChanged, getActionCommand, getActionObject, getActionOnChange, getDefaultSubmitButton, getDiagnostics, getValidators, handleRequest, isChangedInLastRequest, isCurrentAjaxTrigger, isDisabled, isMandatory, isReadOnly, setActionObject, setActionOnChange, setChangedInLastRequest, setDefaultSubmitButton, setDisabled, setMandatory, setMandatory, setReadOnly, showErrorIndicatorsForComponent, showIndicatorsForComponent, showWarningIndicatorsForComponent, toString
-
Methods inherited from class com.github.bordertech.wcomponents.WBeanComponent
addBeanToScratchMap, doUpdateBeanValue, getBean, getBeanFromScratchMap, getBeanId, getBeanProperty, getBeanProvider, getBeanScratchMap, getBeanValue, isBeanInScratchMap, isChanged, isSearchAncestors, isUseRequestScopeScratchMap, removeBeanFromScratchMap, resetData, setBean, setBeanId, setBeanProperty, setBeanProvider, setSearchAncestors, updateBeanValue
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractWComponent
addHtmlClass, addHtmlClass, addNotify, afterPaint, assertAddSupported, beforePaint, createErrorDiagnostic, createErrorDiagnostic, forward, getAccessibleText, getAttribute, getBaseUrl, getDefaultModel, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getScratchMap, getTabIndex, getTag, getTemplate, getTemplateMarkUp, getToolTip, hasNoComponentModel, hasTabIndex, initialiseComponentModel, invokeLater, invokeLaters, isDebugStructure, isDefaultState, isFlagSet, isHidden, isInitialised, isLocked, isTracking, isTrackingEnabled, isValidate, isVisible, paint, paintComponent, preparePaint, removeAttribute, removeComponentModel, removeHtmlClass, removeHtmlClass, removeNotify, replaceWComponent, reset, serviceRequest, setAccessibleText, setAttribute, setEnvironment, setFlag, setFocussed, setHidden, setHtmlClass, setHtmlClass, setIdName, setInitialised, setLocked, setTag, setToolTip, setTrackingEnabled, setValidate, setVisible, showErrorIndicators, showWarningIndicators, tidyUpUIContext, tidyUpUIContextForTree, validate, writeReplace
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.bordertech.wcomponents.BeanAware
getBean, getBeanProperty, getBeanValue, setBeanProperty
-
Methods inherited from interface com.github.bordertech.wcomponents.BeanBound
isSearchAncestors, setBean
-
Methods inherited from interface com.github.bordertech.wcomponents.BeanProviderBound
getBeanId, setBeanId, setBeanProvider
-
Methods inherited from interface com.github.bordertech.wcomponents.WComponent
addHtmlClass, addHtmlClass, forward, getAccessibleText, getAttribute, getBaseUrl, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getTabIndex, getTag, getToolTip, handleRequest, hasTabIndex, invokeLater, isDefaultState, isHidden, isInitialised, isLocked, isTracking, isTrackingEnabled, isValidate, isVisible, paint, preparePaint, removeAttribute, removeHtmlClass, removeHtmlClass, reset, serviceRequest, setAccessibleText, setAttribute, setEnvironment, setFocussed, setHtmlClass, setHtmlClass, setIdName, setInitialised, setLocked, setTag, setToolTip, setTrackingEnabled, setValidate, setVisible, showErrorIndicators, showWarningIndicators, tidyUpUIContextForTree, validate
-
-
-
-
Constructor Detail
-
WMultiSelect
public WMultiSelect()
Creates an empty WMultiSelect.
-
WMultiSelect
public WMultiSelect(Object[] options)
Creates a WMultiSelect containing the specified options.- Parameters:
options
- the options to display.
-
WMultiSelect
public WMultiSelect(List options)
Creates a WMultiSelect containing the specified options.- Parameters:
options
- the options to display.
-
WMultiSelect
public WMultiSelect(Object table)
Creates a WMultiSelect with the options provided by the given table.- Parameters:
table
- the table to obtain the list's options from.
-
-
Method Detail
-
setRows
public void setRows(int rows)
Sets the maximum number of rows that are visible in the list at any one time. If the number of rows is less than two, then the default number of rows will be displayed.- Parameters:
rows
- the number of rows to display.
-
getRows
public int getRows()
- Returns:
- the number of rows to display in the list.
-
toggleSelection
public void toggleSelection(boolean selected)
Description copied from interface:SelectionToggleable
Sets the selections for this component.- Specified by:
toggleSelection
in interfaceSelectionToggleable
- Parameters:
selected
- if true, select everything. If false, deselect everything.
-
newComponentModel
protected WMultiSelect.MultiSelectModel newComponentModel()
Creates a new Component model.- Overrides:
newComponentModel
in classAbstractWMultiSelectList
- Returns:
- a new MultiSelectModel.
-
getComponentModel
protected WMultiSelect.MultiSelectModel getComponentModel()
Returns the effective component model for this component. Subclass may override this method to narrow the return type to their specific model type.- Overrides:
getComponentModel
in classAbstractWMultiSelectList
- Returns:
- the effective component model
-
getOrCreateComponentModel
protected WMultiSelect.MultiSelectModel getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified. If this method is called during request processing, and a session specific model does not yet exist, then a new model is created. Subclasses may override this method to narrow the return type to their specific model type.- Overrides:
getOrCreateComponentModel
in classAbstractWMultiSelectList
- Returns:
- the model for this component
-
-