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 classWCardManager.CardManagerModelHolds 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 voidadd(WComponent component)Override add so that components are added to the (invisible) container.protected WInvisibleContainergetCardContainer()protected WCardManager.CardManagerModelgetComponentModel()Returns the effective component model for this component.protected WCardManager.CardManagerModelgetOrCreateComponentModel()Retrieves the model for this component so that it can be modified.WComponentgetVisible()Returns the visible component (card) for the given context.voidhandleRequest(Request request)Since none of the children are visible to standard processing, handleRequest has been overridden so that the visible card is processed.voidmakeVisible(WComponent component)Sets the visible component (card) for the given context.protected WCardManager.CardManagerModelnewComponentModel()Creates a new component model appropriate for this component.protected voidpaintComponent(RenderContext renderContext)Since none of the children are visible to standard processing, paintComponent has been overridden so that the visible card is painted.protected voidpreparePaintComponent(Request request)Since none of the children are visible to standard processing, preparePaintComponent has been overridden so that the visible card is prepared.voidremove(WComponent component)Override remove so that components are removed from the (invisible) container.voidremoveAll()Override removeAll so that all components are removed from the (invisible) container.voidshowErrorIndicators(List<Diagnostic> diags)Override method to show Error indicators on the visible card.voidshowWarningIndicators(List<Diagnostic> diags)Override method to show Warning indicators on the visible card.StringtoString()Creates a String representation of this component; usually for debugging purposes.protected voidvalidateComponent(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:
addin interfaceMutableContainer- Overrides:
addin 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:
removein interfaceMutableContainer- Overrides:
removein 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:
removeAllin interfaceMutableContainer- Overrides:
removeAllin 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:
handleRequestin interfaceWComponent- Overrides:
handleRequestin 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:
preparePaintComponentin 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:
paintComponentin 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:
validateComponentin 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:
showErrorIndicatorsin interfaceWComponent- Overrides:
showErrorIndicatorsin 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:
showWarningIndicatorsin interfaceWComponent- Overrides:
showWarningIndicatorsin classAbstractWComponent- Parameters:
diags- the list of diagnostics containing warnings.
-
toString
public String toString()
Description copied from class:AbstractWComponentCreates a String representation of this component; usually for debugging purposes.- Overrides:
toStringin 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:
newComponentModelin 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:
getComponentModelin 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:
getOrCreateComponentModelin classAbstractWComponent- Returns:
- the model for this component
-
-