Class WTab
-
- All Implemented Interfaces:
AccessKeyable
,Container
,Disableable
,NamingContextable
,SubordinateTarget
,WComponent
,WebComponent
,Serializable
public class WTab extends AbstractNamingContextContainer implements Disableable, SubordinateTarget, AccessKeyable
WTab encapsulates a tab on a tab set. The contents may or may not be rendered, depending on the tab mode. This class is not intended to be instantiated outsideWTabSet
's addTab methods.- Since:
- 1.0.0
- Author:
- Yiannis Paschalidis
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WTab.TabModel
Holds the extrinsic state information of a WTab.-
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 Modifier Constructor Description protected
WTab(WComponent content, WDecoratedLabel label, WTabSet.TabMode mode)
Creates a new tab.protected
WTab(WComponent content, WDecoratedLabel label, WTabSet.TabMode mode, char accessKey)
Creates a new tab.protected
WTab(WComponent content, String tabName, WTabSet.TabMode mode)
Creates a new tab.protected
WTab(WComponent content, String tabName, WTabSet.TabMode mode, char accessKey)
Creates a new tab.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char
getAccessKey()
protected WTab.TabModel
getComponentModel()
Returns the effective component model for this component.WComponent
getContent()
WTabSet.TabMode
getMode()
protected WTab.TabModel
getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified.WDecoratedLabel
getTabLabel()
void
handleRequest(Request request)
Subclasses should override this method in order to provide specific request handling logic.boolean
isDisabled()
Indicates whether the WTabSet is disabled in the given context.boolean
isOpen()
Indicates whether this tab is open in the given context.protected WTab.TabModel
newComponentModel()
Creates a new Component model.protected void
preparePaintComponent(Request request)
Override preparePaintComponent in order to correct the visibility of the tab's content before it is rendered.void
setAccessKey(char accessKey)
Set the access key on the component.void
setContent(WComponent content)
Sets the tab content.void
setDisabled(boolean disabled)
Sets whether the WTabSet is disabled.void
setMode(WTabSet.TabMode mode)
Set the mode of operation for this tab.void
setText(String text, Serializable... args)
A convenience method to set the body text of the decorated label.String
toString()
Creates a String representation of this component; usually for debugging purposes.-
Methods inherited from class com.github.bordertech.wcomponents.AbstractNamingContextContainer
getNamingContextId, isNamingContext, setNamingContext
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractContainer
getChildAt, getChildCount, getChildren, getIndexOfChild
-
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, showErrorIndicatorsForComponent, showWarningIndicators, showWarningIndicatorsForComponent, tidyUpUIContext, tidyUpUIContextForTree, 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.AccessKeyable
getAccessKeyAsString
-
Methods inherited from interface com.github.bordertech.wcomponents.Container
getChildAt, getChildCount, getChildren, getIndexOfChild
-
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
-
WTab
protected WTab(WComponent content, String tabName, WTabSet.TabMode mode)
Creates a new tab.- Parameters:
content
- the tab contenttabName
- the tab labelmode
- the| tab mode
.
-
WTab
protected WTab(WComponent content, String tabName, WTabSet.TabMode mode, char accessKey)
Creates a new tab.- Parameters:
content
- the tab contenttabName
- the tab labelmode
- the| tab mode
.accessKey
- the access key used to activate this tab
-
WTab
protected WTab(WComponent content, WDecoratedLabel label, WTabSet.TabMode mode)
Creates a new tab.- Parameters:
content
- the tab contentlabel
- the tab label, which may contain rich content.mode
- the| tab mode
.
-
WTab
protected WTab(WComponent content, WDecoratedLabel label, WTabSet.TabMode mode, char accessKey)
Creates a new tab.- Parameters:
content
- the tab contentlabel
- the tab label, which may contain rich content.mode
- the| tab mode
.accessKey
- the access key used to activate this tab
-
-
Method Detail
-
isOpen
public boolean isOpen()
Indicates whether this tab is open in the given context.- Returns:
- true if this tab is open in the given context, otherwise false.
-
getContent
public WComponent getContent()
- Returns:
- the tab content.
-
setContent
public void setContent(WComponent content)
Sets the tab content.- Parameters:
content
- the tab content.
-
setMode
public void setMode(WTabSet.TabMode mode)
Set the mode of operation for this tab. See #692.- Parameters:
mode
- the tab mode.
-
getMode
public WTabSet.TabMode getMode()
- Returns:
- the tab mode.
-
getAccessKey
public char getAccessKey()
- Specified by:
getAccessKey
in interfaceAccessKeyable
- Returns:
- the component's access key.
-
setAccessKey
public void setAccessKey(char accessKey)
Description copied from interface:AccessKeyable
Set the access key on the component.- Specified by:
setAccessKey
in interfaceAccessKeyable
- Parameters:
accessKey
- the key that will form a keyboard shortcut to the component.
-
isDisabled
public boolean isDisabled()
Indicates whether the WTabSet is disabled in the given context.- Specified by:
isDisabled
in interfaceDisableable
- Returns:
- true if the input is disabled, otherwise false.
-
setDisabled
public void setDisabled(boolean disabled)
Sets whether the WTabSet is disabled.- Specified by:
setDisabled
in interfaceDisableable
- Parameters:
disabled
- true to disable this tab, false to enable.
-
handleRequest
public void handleRequest(Request request)
Subclasses should override this method in order to provide specific request handling logic. For example, a text field may set its value to the value of a request parameter.- Specified by:
handleRequest
in interfaceWComponent
- Overrides:
handleRequest
in classAbstractWComponent
- Parameters:
request
- the request being responded to.
-
preparePaintComponent
protected void preparePaintComponent(Request request)
Override preparePaintComponent in order to correct the visibility of the tab's content before it is rendered.- Overrides:
preparePaintComponent
in classAbstractWComponent
- Parameters:
request
- the request being responded to.
-
getTabLabel
public WDecoratedLabel getTabLabel()
- Returns:
- the tab label.
-
setText
public void setText(String text, Serializable... args)
A convenience method to set the body text of the decorated label.- Parameters:
text
- the text to set, usingMessageFormat
syntax.args
- optional arguments for the message format string.
-
toString
public String toString()
Description copied from class:AbstractWComponent
Creates a String representation of this component; usually for debugging purposes.- Overrides:
toString
in classAbstractWComponent
- Returns:
- a String representation of this component, for debugging purposes.
-
newComponentModel
protected WTab.TabModel newComponentModel()
Creates a new Component model.- Overrides:
newComponentModel
in classAbstractWComponent
- Returns:
- a new TabSetModel.
-
getComponentModel
protected WTab.TabModel 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 WTab.TabModel 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
-
-