public class WCollapsible extends AbstractNamingContextContainer implements AjaxTarget, SubordinateTarget, Marginable
The WCollapsible component enables a given component to be expanded/collapsed (shown/hidden) via clicking on the collapsible's header section. When a user clicks the heading, the visibility of the collapsible's content is toggled.
Various modes of operation
are supported, which allow developers to tune performance by only
loading content when it is needed.
Modifier and Type | Class and Description |
---|---|
static class |
WCollapsible.CollapsibleMode
The available types of collapsible mode.
|
static class |
WCollapsible.CollapsibleModel
Holds the extrinsic state information of a WCollapsible.
|
AbstractWComponent.WComponentRef
DEFAULT_APPLICATION_ID, DEFAULT_INTERNAL_ID, DEFAULT_NO_ID, ID_CONTEXT_SEPERATOR, ID_FRAMEWORK_ASSIGNED_SEPERATOR, ID_VALIDATION_PATTERN
Constructor and Description |
---|
WCollapsible(WComponent content,
String heading)
Creates a WCollapsible with the given content and heading.
|
WCollapsible(WComponent content,
String heading,
WCollapsible.CollapsibleMode mode)
Creates a WCollapsible with the given content and heading.
|
WCollapsible(WComponent content,
String heading,
WCollapsible.CollapsibleMode mode,
CollapsibleGroup group)
Creates a WCollapsible with the given content, heading and group.
|
WCollapsible(WComponent content,
WDecoratedLabel label)
Creates a WCollapsible with the given content and heading.
|
WCollapsible(WComponent content,
WDecoratedLabel label,
WCollapsible.CollapsibleMode mode)
Creates a WCollapsible with the given content and heading.
|
WCollapsible(WComponent content,
WDecoratedLabel label,
WCollapsible.CollapsibleMode mode,
CollapsibleGroup group)
Creates a WCollapsible with the given content, heading and group.
|
Modifier and Type | Method and Description |
---|---|
protected WCollapsible.CollapsibleModel |
getComponentModel()
Returns the effective component model for this component.
|
WComponent |
getContent() |
WDecoratedLabel |
getDecoratedLabel() |
String |
getGroupName()
The group name that this collapsible component belongs to.
|
String |
getHeading()
Deprecated.
use
getDecoratedLabel() .getText() |
HeadingLevel |
getHeadingLevel() |
Margin |
getMargin()
Get the margin for the component, or null if not set.
|
WCollapsible.CollapsibleMode |
getMode() |
protected WCollapsible.CollapsibleModel |
getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified.
|
void |
handleRequest(Request request)
Override handleRequest to perform processing necessary for this component.
|
boolean |
isCollapsed()
Indicates whether the collapsible is collapsed in the given context.
|
protected WCollapsible.CollapsibleModel |
newComponentModel()
Creates a new component model appropriate for this component.
|
protected void |
preparePaintComponent(Request request)
Override preparePaintComponent in order to toggle the visibility of the content, or to register the appropriate
ajax operation.
|
void |
setCollapsed(boolean collapsed)
Sets whether the collapsible is collapsed in the given context.
|
void |
setGroup(CollapsibleGroup group)
Set the
CollapsibleGroup that this component belongs to. |
void |
setHeading(String heading)
Deprecated.
use
getDecoratedLabel() .setText(String) |
void |
setHeadingLevel(HeadingLevel headingLevel) |
void |
setMargin(Margin margin)
Set the margin for the component, or null for no margin.
|
void |
setMode(WCollapsible.CollapsibleMode mode)
Sets this WCollapsible's mode of operation.
|
String |
toString()
Creates a String representation of this component; usually for debugging purposes.
|
getNamingContextId, isNamingContext, setNamingContext
getChildAt, getChildCount, getChildren, getIndexOfChild
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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
getChildAt, getChildCount, getChildren, getIndexOfChild
public WCollapsible(WComponent content, String heading)
content
- the content to display inside the collapsible.heading
- the collapsible's heading.public WCollapsible(WComponent content, WDecoratedLabel label)
content
- the content to display inside the collapsible.label
- the collapsible's heading.public WCollapsible(WComponent content, String heading, WCollapsible.CollapsibleMode mode)
content
- the content to display inside the collapsible.heading
- the collapsible's heading.mode
- the mode of the collapsiblepublic WCollapsible(WComponent content, WDecoratedLabel label, WCollapsible.CollapsibleMode mode)
content
- the content to display inside the collapsible.label
- the collapsible's heading.mode
- the mode of the collapsiblepublic WCollapsible(WComponent content, String heading, WCollapsible.CollapsibleMode mode, CollapsibleGroup group)
content
- the content to display inside the collapsible.heading
- the collapsible's heading.mode
- the mode of the collapsiblegroup
- the CollapsibleGroup
that this collapsible belongs to.public WCollapsible(WComponent content, WDecoratedLabel label, WCollapsible.CollapsibleMode mode, CollapsibleGroup group)
content
- the content to display inside the collapsible.label
- the collapsible's heading.mode
- the mode of the collapsiblegroup
- the CollapsibleGroup
that this collapsible belongs to.public WCollapsible.CollapsibleMode getMode()
public void setMode(WCollapsible.CollapsibleMode mode)
mode
- the mode of operation.public void setMargin(Margin margin)
setMargin
in interface Marginable
margin
- the margin for the componentpublic Margin getMargin()
getMargin
in interface Marginable
public boolean isCollapsed()
public void setCollapsed(boolean collapsed)
collapsed
- true if the collapsible is to be collapsed for the given user, false if expanded.public WComponent getContent()
public WDecoratedLabel getDecoratedLabel()
@Deprecated public String getHeading()
getDecoratedLabel()
.getText()@Deprecated public void setHeading(String heading)
getDecoratedLabel()
.setText(String)heading
- the heading text to set.public String getGroupName()
WComponent.getName()
.public void setGroup(CollapsibleGroup group)
CollapsibleGroup
that this component belongs to. This will enable a WCollapsibleToggle
component to target the group.group
- the group to setpublic HeadingLevel getHeadingLevel()
public void setHeadingLevel(HeadingLevel headingLevel)
headingLevel
- the collapsible's heading levelpublic void handleRequest(Request request)
handleRequest
in interface WComponent
handleRequest
in class AbstractWComponent
request
- the request being responded to.protected void preparePaintComponent(Request request)
preparePaintComponent
in class AbstractWComponent
request
- the request being responded topublic String toString()
AbstractWComponent
toString
in class AbstractWComponent
protected WCollapsible.CollapsibleModel newComponentModel()
newComponentModel
in class AbstractWComponent
protected WCollapsible.CollapsibleModel getComponentModel()
getComponentModel
in class AbstractWComponent
protected WCollapsible.CollapsibleModel getOrCreateComponentModel()
getOrCreateComponentModel
in class AbstractWComponent
Copyright © 2021. All rights reserved.