Class CardLayout2

java.lang.Object
java.awt.CardLayout
jaxx.runtime.swing.CardLayout2
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2, java.io.Serializable
Direct Known Subclasses:
CardLayout2Ext

public class CardLayout2
extends java.awt.CardLayout
An override of the awt CardLayout. Because in the original layout is not overridable : everything is package level accessible. This new class offers to test if a constrains (as a Serializable) is actually dealed by the layout, via the method contains(Serializable). We had also another method to obtain the current visible component in a container layouted by the class, via the method getVisibleComponent(Container).
Version:
1.0
Author:
Tony Chemit - chemit@codelutin.com
See Also:
Serialized Form
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected java.util.List<java.io.Serializable> contexts
    list of already loaded context (since the CardLayout.vector attribute is package visible...
    protected boolean useOnlyVisibleComponentDimension
    A flag to compute dimension only on visible component.
  • Constructor Summary

    Constructors
    Constructor Description
    CardLayout2()  
  • Method Summary

    Modifier and Type Method Description
    void addLayoutComponent​(java.awt.Component comp, java.lang.Object constraints)  
    protected void checkConstraints​(java.lang.String constraints)  
    protected void checkContainer​(java.awt.Container container)  
    boolean contains​(java.io.Serializable constraints)
    Test if a constrains is contained in the layout.
    java.awt.Component getComponent​(java.awt.Container container, java.lang.String constraints)  
    java.io.Serializable[] getContexts()  
    java.awt.Component getVisibleComponent​(java.awt.Container container)
    Obtain the visible component in the container.
    boolean isUseOnlyVisibleComponentDimension()  
    void layoutContainer​(java.awt.Container parent)
    Lays out the specified container using this card layout.
    java.awt.Dimension maximumLayoutSize​(java.awt.Container target)
    Returns the maximum dimensions for this layout given the components in the specified target container.
    java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)
    Calculates the minimum size for the specified panel.
    java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)
    Determines the preferred size of the container argument using this card layout.
    void removeLayoutComponent​(java.awt.Component comp, java.io.Serializable constraints)  
    void reset​(java.awt.Container parent)
    remove from cardlayout and linked container all his components.
    void setUseOnlyVisibleComponentDimension​(boolean useOnlyVisibleComponentDimension)  

    Methods inherited from class java.awt.CardLayout

    addLayoutComponent, first, getHgap, getLayoutAlignmentX, getLayoutAlignmentY, getVgap, invalidateLayout, last, next, previous, removeLayoutComponent, setHgap, setVgap, show, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • contexts

      protected java.util.List<java.io.Serializable> contexts
      list of already loaded context (since the CardLayout.vector attribute is package visible...
    • useOnlyVisibleComponentDimension

      protected boolean useOnlyVisibleComponentDimension
      A flag to compute dimension only on visible component. This is usefull when we only care of the visible component.
  • Constructor Details

    • CardLayout2

      public CardLayout2()
  • Method Details

    • addLayoutComponent

      public void addLayoutComponent​(java.awt.Component comp, java.lang.Object constraints)
      Specified by:
      addLayoutComponent in interface java.awt.LayoutManager2
      Overrides:
      addLayoutComponent in class java.awt.CardLayout
    • removeLayoutComponent

      public void removeLayoutComponent​(java.awt.Component comp, java.io.Serializable constraints)
    • contains

      public boolean contains​(java.io.Serializable constraints)
      Test if a constrains is contained in the layout.
      Parameters:
      constraints - l'identifiant a tester
      Returns:
      true si l'identifiant est deja present dans le layout, false otherwise.
    • getVisibleComponent

      public java.awt.Component getVisibleComponent​(java.awt.Container container)
      Obtain the visible component in the container.
      Parameters:
      container - the container using this layout
      Returns:
      the component visible in the container.
    • getComponent

      public java.awt.Component getComponent​(java.awt.Container container, java.lang.String constraints)
    • preferredLayoutSize

      public java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)
      Determines the preferred size of the container argument using this card layout.
      Specified by:
      preferredLayoutSize in interface java.awt.LayoutManager
      Overrides:
      preferredLayoutSize in class java.awt.CardLayout
      Parameters:
      parent - the parent container in which to do the layout
      Returns:
      the preferred dimensions to lay out the subcomponents of the specified container
      See Also:
      Container.getPreferredSize(), CardLayout.minimumLayoutSize(java.awt.Container)
    • minimumLayoutSize

      public java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)
      Calculates the minimum size for the specified panel.
      Specified by:
      minimumLayoutSize in interface java.awt.LayoutManager
      Overrides:
      minimumLayoutSize in class java.awt.CardLayout
      Parameters:
      parent - the parent container in which to do the layout
      Returns:
      the minimum dimensions required to lay out the subcomponents of the specified container
      See Also:
      Container.doLayout(), CardLayout.preferredLayoutSize(java.awt.Container)
    • maximumLayoutSize

      public java.awt.Dimension maximumLayoutSize​(java.awt.Container target)
      Returns the maximum dimensions for this layout given the components in the specified target container.
      Specified by:
      maximumLayoutSize in interface java.awt.LayoutManager2
      Overrides:
      maximumLayoutSize in class java.awt.CardLayout
      Parameters:
      target - the component which needs to be laid out
      See Also:
      Container, minimumLayoutSize(java.awt.Container), preferredLayoutSize(java.awt.Container)
    • layoutContainer

      public void layoutContainer​(java.awt.Container parent)
      Lays out the specified container using this card layout. Each component in the parent container is reshaped to be the size of the container, minus space for surrounding insets, horizontal gaps, and vertical gaps.
      Specified by:
      layoutContainer in interface java.awt.LayoutManager
      Overrides:
      layoutContainer in class java.awt.CardLayout
      Parameters:
      parent - the parent container in which to do the layout
      See Also:
      Container.doLayout()
    • isUseOnlyVisibleComponentDimension

      public boolean isUseOnlyVisibleComponentDimension()
    • setUseOnlyVisibleComponentDimension

      public void setUseOnlyVisibleComponentDimension​(boolean useOnlyVisibleComponentDimension)
    • reset

      public void reset​(java.awt.Container parent)
      remove from cardlayout and linked container all his components.
      Parameters:
      parent - the parent container linked with the layout
    • checkContainer

      protected void checkContainer​(java.awt.Container container)
    • checkConstraints

      protected void checkConstraints​(java.lang.String constraints)
    • getContexts

      public java.io.Serializable[] getContexts()