Class WCardManager
-
- All Implemented Interfaces:
Container
,MutableContainer
,NamingContextable
,WComponent
,WebComponent
,Serializable
public class WCardManager extends AbstractMutableContainer
A WCardManager is a wcomponent used to control the visibility of its child components. It can help to think of a WCardManager as a deck of cards, where only the top most card is visible. The WCardManager enables you to add cards to the deck (using the "add" method) and to select which of the cards to place on the top of the deck (using the "makeVisible" method).
You would expect a WComponent that is using a WCardManager to support its functionality, to add all the cards it will need in its constructor. Note that the first card added will be the default visible component. Implementations of the Action interface are normally used to change which card is visible.
- Since:
- 1.0.0
- Author:
- James Gifford, Martin Shevchenko
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WCardManager.CardManagerModel
Holds the extrinsic state information of a CardManager.-
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 WCardManager()
Creates a WCardManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(WComponent component)
Override add so that components are added to the (invisible) container.protected WInvisibleContainer
getCardContainer()
protected WCardManager.CardManagerModel
getComponentModel()
Returns the effective component model for this component.protected WCardManager.CardManagerModel
getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified.WComponent
getVisible()
Returns the visible component (card) for the given context.void
handleRequest(Request request)
Since none of the children are visible to standard processing, handleRequest has been overridden so that the visible card is processed.void
makeVisible(WComponent component)
Sets the visible component (card) for the given context.protected WCardManager.CardManagerModel
newComponentModel()
Creates a new component model appropriate for this component.protected void
paintComponent(RenderContext renderContext)
Since none of the children are visible to standard processing, paintComponent has been overridden so that the visible card is painted.protected void
preparePaintComponent(Request request)
Since none of the children are visible to standard processing, preparePaintComponent has been overridden so that the visible card is prepared.void
remove(WComponent component)
Override remove so that components are removed from the (invisible) container.void
removeAll()
Override removeAll so that all components are removed from the (invisible) container.void
showErrorIndicators(List<Diagnostic> diags)
Override method to show Error indicators on the visible card.void
showWarningIndicators(List<Diagnostic> diags)
Override method to show Warning indicators on the visible card.String
toString()
Creates a String representation of this component; usually for debugging purposes.protected void
validateComponent(List<Diagnostic> diags)
Since none of the children are visible to standard processing, validateComponent has been overridden so that the visible card is processed.-
Methods inherited from class com.github.bordertech.wcomponents.AbstractMutableContainer
add
-
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, 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, showErrorIndicatorsForComponent, showWarningIndicatorsForComponent, 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.Container
getChildAt, getChildCount, getChildren, getIndexOfChild
-
Methods inherited from interface com.github.bordertech.wcomponents.NamingContextable
getNamingContextId, isNamingContext
-
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, tidyUpUIContextForTree, validate
-
-
-
-
Method Detail
-
getCardContainer
protected WInvisibleContainer getCardContainer()
- Returns:
- the card container
-
getVisible
public WComponent getVisible()
Returns the visible component (card) for the given context.- Returns:
- the visible component.
-
makeVisible
public void makeVisible(WComponent component)
Sets the visible component (card) for the given context.- Parameters:
component
- the visible component.
-
add
public void add(WComponent component)
Override add so that components are added to the (invisible) container.- Specified by:
add
in interfaceMutableContainer
- Overrides:
add
in classAbstractMutableContainer
- Parameters:
component
- the component to add.
-
remove
public void remove(WComponent component)
Override remove so that components are removed from the (invisible) container.- Specified by:
remove
in interfaceMutableContainer
- Overrides:
remove
in classAbstractMutableContainer
- Parameters:
component
- the component to remove.
-
removeAll
public void removeAll()
Override removeAll so that all components are removed from the (invisible) container.- Specified by:
removeAll
in interfaceMutableContainer
- Overrides:
removeAll
in classAbstractMutableContainer
-
handleRequest
public void handleRequest(Request request)
Since none of the children are visible to standard processing, handleRequest has been overridden so that the visible card is processed.- Specified by:
handleRequest
in interfaceWComponent
- Overrides:
handleRequest
in classAbstractWComponent
- Parameters:
request
- the request being responded to.
-
preparePaintComponent
protected void preparePaintComponent(Request request)
Since none of the children are visible to standard processing, preparePaintComponent has been overridden so that the visible card is prepared.- Overrides:
preparePaintComponent
in classAbstractWComponent
- Parameters:
request
- the request being responded to.
-
paintComponent
protected void paintComponent(RenderContext renderContext)
Since none of the children are visible to standard processing, paintComponent has been overridden so that the visible card is painted.- Overrides:
paintComponent
in classAbstractWComponent
- Parameters:
renderContext
- the RenderContext to paint to.
-
validateComponent
protected void validateComponent(List<Diagnostic> diags)
Since none of the children are visible to standard processing, validateComponent has been overridden so that the visible card is processed.- Overrides:
validateComponent
in classAbstractWComponent
- Parameters:
diags
- the list to add validation diagnostics to.
-
showErrorIndicators
public void showErrorIndicators(List<Diagnostic> diags)
Override method to show Error indicators on the visible card.- Specified by:
showErrorIndicators
in interfaceWComponent
- Overrides:
showErrorIndicators
in classAbstractWComponent
- Parameters:
diags
- the list of diagnostics containing errors.
-
showWarningIndicators
public void showWarningIndicators(List<Diagnostic> diags)
Override method to show Warning indicators on the visible card.- Specified by:
showWarningIndicators
in interfaceWComponent
- Overrides:
showWarningIndicators
in classAbstractWComponent
- Parameters:
diags
- the list of diagnostics containing warnings.
-
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 WCardManager.CardManagerModel newComponentModel()
Creates a new component model appropriate for this component.- Overrides:
newComponentModel
in classAbstractWComponent
- Returns:
- a new CardManagerModel.
-
getComponentModel
protected WCardManager.CardManagerModel 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 WCardManager.CardManagerModel 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
-
-