org.openbp.swing.components.wizard
Class WizardLayout

java.lang.Object
  extended by org.openbp.swing.components.wizard.WizardLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2, java.io.Serializable

public class WizardLayout
extends java.lang.Object
implements java.awt.LayoutManager2, java.io.Serializable

Deck layout. WizardLayout treats each component in the container as a card. Only one card is visible at a time, and the container acts like a deck of cards. The ordering of cards is determined by the container's own internal ordering of its component objects. DeckLayout defines a set of methods that allow an application to flip through the cards sequentially, or to show a specified card. The addLayoutComponent method can be used to associate a string identifier with a given card for faster random access.

Author:
Heiko Erhardt
See Also:
Serialized Form

Constructor Summary
WizardLayout()
          Constructor.
 
Method Summary
 void addLayoutComponent(java.awt.Component c, java.lang.Object constraints)
          Adds the specified component to this deck layout's internal table, by name.
 void addLayoutComponent(java.lang.String name, java.awt.Component c)
          Deprecated. replaced by addLayoutComponent(Component, Object)
 void clearLayoutComponents()
          Clears all components from the layout.
 float getLayoutAlignmentX(java.awt.Container parent)
          Returns the alignment along the x axis.
 float getLayoutAlignmentY(java.awt.Container parent)
          Returns the alignment along the y axis.
 void invalidateLayout(java.awt.Container target)
          Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
 void layoutContainer(java.awt.Container parent)
          Lays out the specified container using this deck layout.
 java.awt.Dimension maximumLayoutSize(java.awt.Container target)
          Returns the maximum dimensions for this layout given the component in the specified target container.
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          Calculates the minimum size for the specified page.
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          Calculates the preferred size for the specified page.
 void removeLayoutComponent(java.awt.Component c)
          Removes the specified component from the layout.
 void show(java.awt.Container parent, java.awt.Component activeComponent)
          Shows the specified component.
 void show(java.awt.Container parent, java.lang.String name)
          Shows the specified component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WizardLayout

public WizardLayout()
Constructor.

Method Detail

show

public void show(java.awt.Container parent,
                 java.lang.String name)
Shows the specified component.

Parameters:
parent - Name of the parent container in which to do the layout
name - Name of the component to show

show

public void show(java.awt.Container parent,
                 java.awt.Component activeComponent)
Shows the specified component.

Parameters:
parent - Name of the parent container in which to do the layout
activeComponent - Component to show

addLayoutComponent

public void addLayoutComponent(java.awt.Component c,
                               java.lang.Object constraints)
Adds the specified component to this deck layout's internal table, by name. The object specified by constraints must be a string. The deck layout stores this string as a key-value pair that can be used for random access to a particular card. By calling the show method, an application can display the component with the specified name.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager2
Parameters:
c - The component to be added
constraints - A name that identifies the component

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component c)
Deprecated. replaced by addLayoutComponent(Component, Object)

Not used.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component c)
Removes the specified component from the layout.

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Parameters:
c - The component to be removed

clearLayoutComponents

public void clearLayoutComponents()
Clears all components from the layout.


preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Calculates the preferred size for the specified page.

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - The name of the parent container
Returns:
minimum dimensions required to lay out the components

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Calculates the minimum size for the specified page.

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - The name of the parent container
Returns:
minimum dimensions required to lay out the components

maximumLayoutSize

public java.awt.Dimension maximumLayoutSize(java.awt.Container target)
Returns the maximum dimensions for this layout given the component in the specified target container.

Specified by:
maximumLayoutSize in interface java.awt.LayoutManager2
Parameters:
target - The component which needs to be laid out

layoutContainer

public void layoutContainer(java.awt.Container parent)
Lays out the specified container using this deck layout. Each component in the parent container is reshaped to be the same size as the container, minus insets, horizontal and vertical gaps.

Specified by:
layoutContainer in interface java.awt.LayoutManager
Parameters:
parent - Container that owns the layout

getLayoutAlignmentX

public float getLayoutAlignmentX(java.awt.Container parent)
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

Specified by:
getLayoutAlignmentX in interface java.awt.LayoutManager2
Parameters:
parent - Container that owns the layout
Returns:
The alignment

getLayoutAlignmentY

public float getLayoutAlignmentY(java.awt.Container parent)
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

Specified by:
getLayoutAlignmentY in interface java.awt.LayoutManager2
Parameters:
parent - Container that owns the layout
Returns:
The alignment

invalidateLayout

public void invalidateLayout(java.awt.Container target)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

Specified by:
invalidateLayout in interface java.awt.LayoutManager2
Parameters:
target - Container that owns the layout


Copyright © 2011. All Rights Reserved.