Package org.nuiton.jaxx.runtime.swing
Class CardLayout2
- java.lang.Object
-
- java.awt.CardLayout
-
- org.nuiton.jaxx.runtime.swing.CardLayout2
-
- All Implemented Interfaces:
LayoutManager,LayoutManager2,Serializable
- Direct Known Subclasses:
CardLayout2Ext
public class CardLayout2 extends CardLayout
An override of the awtCardLayout. 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 methodcontains(Serializable). We had also another method to obtain the current visible component in a container layouted by the class, via the methodgetVisibleComponent(Container).- Version:
- 1.0
- Author:
- Tony Chemit - dev@tchemit.fr
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLayoutComponent(Component comp, Object constraints)protected voidcheckConstraints(String constraints)protected voidcheckContainer(Container container)booleancontains(Serializable constraints)Test if a constrains is contained in the layout.ComponentgetComponent(Container container, String constraints)Serializable[]getContexts()ComponentgetVisibleComponent(Container container)Obtain the visible component in the container.booleanisUseOnlyVisibleComponentDimension()voidlayoutContainer(Container parent)Lays out the specified container using this card layout.DimensionmaximumLayoutSize(Container target)Returns the maximum dimensions for this layout given the components in the specified target container.DimensionminimumLayoutSize(Container parent)Calculates the minimum size for the specified panel.DimensionpreferredLayoutSize(Container parent)Determines the preferred size of the container argument using this card layout.voidremoveLayoutComponent(Component comp, Serializable constraints)voidreset(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, toString
-
-
-
-
Field Detail
-
contexts
protected final List<Serializable> contexts
list of already loaded context (since theCardLayout.vectorattribute 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.
-
-
Method Detail
-
addLayoutComponent
public void addLayoutComponent(Component comp, Object constraints)
- Specified by:
addLayoutComponentin interfaceLayoutManager2- Overrides:
addLayoutComponentin classCardLayout
-
removeLayoutComponent
public void removeLayoutComponent(Component comp, Serializable constraints)
-
contains
public boolean contains(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 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.
-
preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)
Determines the preferred size of the container argument using this card layout.- Specified by:
preferredLayoutSizein interfaceLayoutManager- Overrides:
preferredLayoutSizein classCardLayout- 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:
minimumLayoutSizein interfaceLayoutManager- Overrides:
minimumLayoutSizein classCardLayout- 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:
maximumLayoutSizein interfaceLayoutManager2- Overrides:
maximumLayoutSizein classCardLayout- 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 theparentcontainer is reshaped to be the size of the container, minus space for surrounding insets, horizontal gaps, and vertical gaps.- Specified by:
layoutContainerin interfaceLayoutManager- Overrides:
layoutContainerin classCardLayout- 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
-
checkContainer
protected void checkContainer(Container container)
-
checkConstraints
protected void checkConstraints(String constraints)
-
getContexts
public Serializable[] getContexts()
-
-