jaxx.runtime.swing
Class CardLayout2

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

public class CardLayout2
extends 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(java.io.Serializable).

We had also another method to obtain the current visible component in a container layouted by the class, via the method getVisibleComponent(java.awt.Container).

Version:
1.0
Author:
chemit
See Also:
Serialized Form

Field Summary
protected  List<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
CardLayout2()
           
 
Method Summary
 void addLayoutComponent(Component comp, Object constraints)
           
 boolean contains(Serializable constraints)
          Test if a constrains is contained in the layout.
 Component getComponent(Container container, String constraints)
           
 Component getVisibleComponent(Container container)
          Obtain the visible component in the container.
 boolean isUseOnlyVisibleComponentDimension()
           
 void layoutContainer(Container parent)
          Lays out the specified container using this card layout.
 Dimension maximumLayoutSize(Container target)
          Returns the maximum dimensions for this layout given the components in the specified target container.
 Dimension minimumLayoutSize(Container parent)
          Calculates the minimum size for the specified panel.
 Dimension preferredLayoutSize(Container parent)
          Determines the preferred size of the container argument using this card layout.
 void reset(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 Detail

contexts

protected List<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 Detail

CardLayout2

public CardLayout2()
Method Detail

addLayoutComponent

public void addLayoutComponent(Component comp,
                               Object constraints)
Specified by:
addLayoutComponent in interface LayoutManager2
Overrides:
addLayoutComponent in class CardLayout

contains

public boolean contains(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 autrement.

getVisibleComponent

public Component getVisibleComponent(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 Component getComponent(Container container,
                              String constraints)

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Determines the preferred size of the container argument using this card layout.

Specified by:
preferredLayoutSize in interface LayoutManager
Overrides:
preferredLayoutSize in class 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 Dimension minimumLayoutSize(Container parent)
Calculates the minimum size for the specified panel.

Specified by:
minimumLayoutSize in interface LayoutManager
Overrides:
minimumLayoutSize in class 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 Dimension maximumLayoutSize(Container target)
Returns the maximum dimensions for this layout given the components in the specified target container.

Specified by:
maximumLayoutSize in interface LayoutManager2
Overrides:
maximumLayoutSize in class 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(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 LayoutManager
Overrides:
layoutContainer in class 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(Container parent)
remove from cardlayout and linked container all his components.

Parameters:
parent - the parent container linked with the layout


Copyright © 2008-2010 CodeLutin. All Rights Reserved.