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
    • Constructor Detail

      • WCardManager

        public WCardManager()
        Creates a WCardManager.
    • 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.
      • 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 interface WComponent
        Overrides:
        handleRequest in class AbstractWComponent
        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 class AbstractWComponent
        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 class AbstractWComponent
        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 class AbstractWComponent
        Parameters:
        diags - the list to add validation diagnostics to.
      • toString

        public String toString()
        Description copied from class: AbstractWComponent
        Creates a String representation of this component; usually for debugging purposes.
        Overrides:
        toString in class AbstractWComponent
        Returns:
        a String representation of this component, for debugging purposes.
      • 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 class AbstractWComponent
        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 class AbstractWComponent
        Returns:
        the model for this component