Class WSelectToggle
- java.lang.Object
-
- com.github.bordertech.wcomponents.AbstractWComponent
-
- com.github.bordertech.wcomponents.WSelectToggle
-
- All Implemented Interfaces:
AjaxTarget
,Disableable
,Labelable
,WComponent
,WebComponent
,Serializable
public class WSelectToggle extends AbstractWComponent implements Disableable, AjaxTarget, Labelable
This is component can be used to select all/none within a containing component, for example a
WPanel
orWFieldSet
containingWCheckBox
es, or aWDataTable
with multiple row selection enabled.Note that the target component must render out with an ID, so a plain
WComponent
orWContainer
is not suitable.- Since:
- 1.0.0
- Author:
- Yiannis Paschalidis
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WSelectToggle.SelectToggleModel
Holds the extrinsic state information of a WSelectToggle.static class
WSelectToggle.State
Describes the tri-state nature of a selectToggle.-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractWComponent
AbstractWComponent.WComponentRef
-
-
Field Summary
-
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 WSelectToggle()
Creates a client-side WSelectToggle.WSelectToggle(boolean clientSide)
Deprecated.1.2.8 all select toggle must be client side.WSelectToggle(boolean clientSide, WComponent target)
Deprecated.1.2.58 all select toggle must be client side.WSelectToggle(WComponent target)
Creates a WSelectToggle for the given target.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected WSelectToggle.SelectToggleModel
getComponentModel()
Returns the effective component model for this component.protected WSelectToggle.SelectToggleModel
getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified.WSelectToggle.State
getState()
WComponent
getTarget()
void
handleRequest(Request request)
Override handleRequest to handle selection toggling if server-side processing is being used.boolean
isClientSide()
Deprecated.1.2.58 all select toggle must be client side.boolean
isDisabled()
Indicates whether the select toggle is disabled.boolean
isRenderAsText()
Indicates whether the control should render as text.protected ComponentModel
newComponentModel()
Creates a new component model appropriate for this component.void
setClientSide(boolean clientSide)
Deprecated.1.2.58 all select toggle must be client side.void
setDisabled(boolean disabled)
Sets whether the select toggle is disabled.void
setRenderAsText(boolean renderAsText)
Sets whether the control should render as text.void
setState(WSelectToggle.State state)
Sets the state.void
setTarget(WComponent target)
Sets the target.-
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, preparePaintComponent, 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, showErrorIndicatorsForComponent, showWarningIndicators, showWarningIndicatorsForComponent, tidyUpUIContext, tidyUpUIContextForTree, toString, validate, validateComponent, 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.WComponent
addHtmlClass, addHtmlClass, forward, getAccessibleText, getAttribute, getBaseUrl, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getTabIndex, getTag, getToolTip, 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
-
WSelectToggle
public WSelectToggle()
Creates a client-side WSelectToggle.
-
WSelectToggle
public WSelectToggle(boolean clientSide)
Deprecated.1.2.8 all select toggle must be client side.Creates a WSelectToggle.- Parameters:
clientSide
- if true, selection is handled client-side
-
WSelectToggle
public WSelectToggle(WComponent target)
Creates a WSelectToggle for the given target.- Parameters:
target
- the target container.
-
WSelectToggle
public WSelectToggle(boolean clientSide, WComponent target)
Deprecated.1.2.58 all select toggle must be client side.Creates a WSelectToggle for the given target.- Parameters:
clientSide
- if true, selection is handled client-side.target
- the target container.
-
-
Method Detail
-
handleRequest
public void handleRequest(Request request)
Override handleRequest to handle selection toggling if server-side processing is being used.- Specified by:
handleRequest
in interfaceWComponent
- Overrides:
handleRequest
in classAbstractWComponent
- Parameters:
request
- the request being responded to.
-
isClientSide
public boolean isClientSide()
Deprecated.1.2.58 all select toggle must be client side.Indicates whether the toggle should occur client- or server-side.- Returns:
- true if the toggle should occur client-side, false for server-side.
-
setClientSide
public void setClientSide(boolean clientSide)
Deprecated.1.2.58 all select toggle must be client side.Sets whether the toggle should occur client- or server-side.- Parameters:
clientSide
- true for client-side, false for server-side.
-
getTarget
public WComponent getTarget()
- Returns:
- Returns the target.
-
setTarget
public void setTarget(WComponent target)
Sets the target.- Parameters:
target
- The target to set.
-
isRenderAsText
public boolean isRenderAsText()
Indicates whether the control should render as text.- Returns:
- true to render as text, false to render as a checkbox.
-
setRenderAsText
public void setRenderAsText(boolean renderAsText)
Sets whether the control should render as text.- Parameters:
renderAsText
- true to render as text, false to render as a checkbox.
-
getState
public WSelectToggle.State getState()
- Returns:
- the current state.
-
setState
public void setState(WSelectToggle.State state)
Sets the state.- Parameters:
state
- the state to set.
-
isDisabled
public boolean isDisabled()
Indicates whether the select toggle is disabled.- Specified by:
isDisabled
in interfaceDisableable
- Returns:
- true if the toggle is disabled, otherwise false.
-
setDisabled
public void setDisabled(boolean disabled)
Sets whether the select toggle is disabled.- Specified by:
setDisabled
in interfaceDisableable
- Parameters:
disabled
- if true, the input is disabled. If false, it is enabled.
-
newComponentModel
protected ComponentModel newComponentModel()
Creates a new component model appropriate for this component.- Overrides:
newComponentModel
in classAbstractWComponent
- Returns:
- a new SelectToggleModel.
-
getComponentModel
protected WSelectToggle.SelectToggleModel 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 classAbstractWComponent
- Returns:
- the effective component model
-
getOrCreateComponentModel
protected WSelectToggle.SelectToggleModel 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 classAbstractWComponent
- Returns:
- the model for this component
-
-