Package jaxx.runtime.swing
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>contextslist of already loaded context (since theCardLayout.vectorattribute is package visible...protected booleanuseOnlyVisibleComponentDimensionA flag to compute dimension only on visible component. -
Constructor Summary
Constructors Constructor Description CardLayout2() -
Method Summary
Modifier and Type Method Description voidaddLayoutComponent(java.awt.Component comp, java.lang.Object constraints)protected voidcheckConstraints(java.lang.String constraints)protected voidcheckContainer(java.awt.Container container)booleancontains(java.io.Serializable constraints)Test if a constrains is contained in the layout.java.awt.ComponentgetComponent(java.awt.Container container, java.lang.String constraints)java.io.Serializable[]getContexts()java.awt.ComponentgetVisibleComponent(java.awt.Container container)Obtain the visible component in the container.booleanisUseOnlyVisibleComponentDimension()voidlayoutContainer(java.awt.Container parent)Lays out the specified container using this card layout.java.awt.DimensionmaximumLayoutSize(java.awt.Container target)Returns the maximum dimensions for this layout given the components in the specified target container.java.awt.DimensionminimumLayoutSize(java.awt.Container parent)Calculates the minimum size for the specified panel.java.awt.DimensionpreferredLayoutSize(java.awt.Container parent)Determines the preferred size of the container argument using this card layout.voidremoveLayoutComponent(java.awt.Component comp, java.io.Serializable constraints)voidreset(java.awt.Container parent)remove from cardlayout and linked container all his components.voidsetUseOnlyVisibleComponentDimension(boolean useOnlyVisibleComponentDimension)Methods inherited from class java.awt.CardLayout
addLayoutComponent, first, getHgap, getLayoutAlignmentX, getLayoutAlignmentY, getVgap, invalidateLayout, last, next, previous, removeLayoutComponent, setHgap, setVgap, show, toStringMethods 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> contextslist of already loaded context (since theCardLayout.vectorattribute is package visible... -
useOnlyVisibleComponentDimension
protected boolean useOnlyVisibleComponentDimensionA 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:
addLayoutComponentin interfacejava.awt.LayoutManager2- Overrides:
addLayoutComponentin classjava.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:
truesi l'identifiant est deja present dans le layout,falseotherwise.
-
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:
preferredLayoutSizein interfacejava.awt.LayoutManager- Overrides:
preferredLayoutSizein classjava.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:
minimumLayoutSizein interfacejava.awt.LayoutManager- Overrides:
minimumLayoutSizein classjava.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:
maximumLayoutSizein interfacejava.awt.LayoutManager2- Overrides:
maximumLayoutSizein classjava.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 theparentcontainer is reshaped to be the size of the container, minus space for surrounding insets, horizontal gaps, and vertical gaps.- Specified by:
layoutContainerin interfacejava.awt.LayoutManager- Overrides:
layoutContainerin classjava.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()
-