com.imagero.gui.awt
Class RainLayout

java.lang.Object
  extended bycom.imagero.gui.awt.RainLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2, java.io.Serializable

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

 RainLayout supports:
      both horizontal and vertical orientation,
      ordering of Components according to Comparator provided by Container.
      inverse order of components
      Components can be layed out in one row or in multiple rows
      row hiding: show only one row and hide all other rows
      and many other features

 Constraints:
      GROW (Component can grow),
      SHRINK (Component can shrink),
      FLEX (Component can shrink and grow) and
      FIXED (Component can't shrink or grow)

 Layout policies:
      LAYOUT_POLICY_COMPUTE - preferred size is computed
      LAYOUT_POLICY_ASK - width of target container used as preferred width (X_AXIS) or height of target container used as preferred height (Y_AXIS)
      LAYOUT_POLICY_EXPLICITE_PIXELS - width (in pixels) was explicitly set
      LAYOUT_POLICY_EXPLICITE_COLUMNS - column count was explicitly set

 

See Also:
Serialized Form

Field Summary
static java.lang.String FIXED
          component cannot grow or shrink
static java.lang.String FLEX
          component can both shrink and grow
static java.lang.String GROW
          component can grow
static int LAYOUT_POLICY_ASK
          width of parent returned as preferred width, preferred height computed, based on width (X_AXIS) or height of parent returned as preferred height, preferred width computed, based on height (Y_AXIS)
static int LAYOUT_POLICY_COMPUTE
          preferred size is computed - like doing most layout managers
static int LAYOUT_POLICY_EXPLICITE_COLUMNS
          column count was explicitly set
static int LAYOUT_POLICY_EXPLICITE_PIXELS
          width (in pixels) was explicitly set
static java.lang.String SHRINK
          component can shrink
static int X_AXIS
           
static int Y_AXIS
           
 
Constructor Summary
RainLayout()
          create horizontal single row RainLayout with hgap=0 and vgap=0
RainLayout(int axis)
          create single row RainLayout with hgap=0 and vgap=0
RainLayout(int axis, int hgap, int vgap)
          create single row RainLayout
RainLayout(int axis, int hgap, int vgap, int layoutPolicy)
          create new RainLayout
 
Method Summary
 void addLayoutComponent(java.awt.Component comp, java.lang.Object constraints)
          Adds the specified component to the layout, using the specified constraint object.
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          If the layout manager uses a per-component string, adds the component comp to the layout, associating it with the string specified by name.
 int getAxis()
           
 int getColumnCount()
           
 java.lang.Object getConstraints(java.lang.Object o)
           
 java.lang.Object getDefaultConstraints()
          default constraints are used if supplied constraints was null
 int getExplicitSize()
           
 int getHeight(java.awt.Component c)
           
 int getHgap()
           
 float getLayoutAlignmentX(java.awt.Container target)
          Returns the alignment along the x axis.
 float getLayoutAlignmentY(java.awt.Container target)
          Returns the alignment along the y axis.
 int getLayoutPolicy()
           
 int getRowCount(java.awt.Container c)
           
 int getShownRow()
           
 int getVgap()
           
 int getWidth(java.awt.Component c)
           
 int getX(java.awt.Component c)
           
 int getY(java.awt.Component c)
           
 void invalidateLayout(java.awt.Container target)
          Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
 boolean isAcrossStretch()
           
 boolean isReversedComponentOrder()
           
 boolean isReverseRowOrder()
           
 boolean isShowOneRow()
           
 boolean isWrap()
           
 void layoutContainer(java.awt.Container parent)
          Lays out the specified container.
 java.awt.Dimension maximumLayoutSize(java.awt.Container parent)
          Calculates the maximum size dimensions for the specified container, given the components it contains.
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          Calculates the minimum size dimensions for the specified container, given the components it contains.
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          Calculates the preferred size dimensions for the specified container, given the components it contains.
 void removeLayoutComponent(java.awt.Component comp)
          Removes the specified component from the layout.
 void setAcrossStretch(boolean acrossStretch)
           
 void setAxis(int axis)
           
 void setColumnCount(int columnCount)
           
 void setDefaultConstraints(java.lang.Object constraints)
          default constraints are used if supplied constraints was null
 void setExplicitSize(int explicitSize)
           
 void setHgap(int hgap)
           
 void setLayoutPolicy(int policy)
           
 void setReversedComponentOrder(boolean reversedComponentOrder)
           
 void setReverseRowOrder(boolean reverseRowOrder)
           
 void setShownRow(int shownRow)
           
 void setShowOneRow(boolean showOneRow)
           
 void setVgap(int vgap)
           
 void setWrap(boolean wrap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIXED

public static final java.lang.String FIXED
component cannot grow or shrink

See Also:
Constant Field Values

FLEX

public static final java.lang.String FLEX
component can both shrink and grow

See Also:
Constant Field Values

GROW

public static final java.lang.String GROW
component can grow

See Also:
Constant Field Values

LAYOUT_POLICY_ASK

public static final int LAYOUT_POLICY_ASK
width of parent returned as preferred width, preferred height computed, based on width (X_AXIS) or height of parent returned as preferred height, preferred width computed, based on height (Y_AXIS)

See Also:
Constant Field Values

LAYOUT_POLICY_COMPUTE

public static final int LAYOUT_POLICY_COMPUTE
preferred size is computed - like doing most layout managers

See Also:
Constant Field Values

LAYOUT_POLICY_EXPLICITE_COLUMNS

public static final int LAYOUT_POLICY_EXPLICITE_COLUMNS
column count was explicitly set

See Also:
Constant Field Values

LAYOUT_POLICY_EXPLICITE_PIXELS

public static final int LAYOUT_POLICY_EXPLICITE_PIXELS
width (in pixels) was explicitly set

See Also:
Constant Field Values

SHRINK

public static final java.lang.String SHRINK
component can shrink

See Also:
Constant Field Values

X_AXIS

public static final int X_AXIS
See Also:
Constant Field Values

Y_AXIS

public static final int Y_AXIS
See Also:
Constant Field Values
Constructor Detail

RainLayout

public RainLayout()
create horizontal single row RainLayout with hgap=0 and vgap=0


RainLayout

public RainLayout(int axis)
create single row RainLayout with hgap=0 and vgap=0

Parameters:
axis - layout axis
See Also:
X_AXIS, Y_AXIS

RainLayout

public RainLayout(int axis,
                  int hgap,
                  int vgap)
create single row RainLayout

Parameters:
axis - layout axis
hgap - horizontal gap
vgap - vertical gap
See Also:
X_AXIS, Y_AXIS

RainLayout

public RainLayout(int axis,
                  int hgap,
                  int vgap,
                  int layoutPolicy)
create new RainLayout

Parameters:
axis -
hgap -
vgap -
layoutPolicy -
See Also:
X_AXIS, Y_AXIS, LAYOUT_POLICY_ASK, LAYOUT_POLICY_COMPUTE, LAYOUT_POLICY_EXPLICITE_COLUMNS, LAYOUT_POLICY_EXPLICITE_PIXELS
Method Detail

addLayoutComponent

public void addLayoutComponent(java.awt.Component comp,
                               java.lang.Object constraints)
Description copied from interface: java.awt.LayoutManager2
Adds the specified component to the layout, using the specified constraint object.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager2
Parameters:
comp - the component to be added
constraints - where/how the component is added to the layout.

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Description copied from interface: java.awt.LayoutManager
If the layout manager uses a per-component string, adds the component comp to the layout, associating it with the string specified by name.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager
Parameters:
name - the string to be associated with the component
comp - the component to be added

getAxis

public int getAxis()

getColumnCount

public int getColumnCount()

getConstraints

public java.lang.Object getConstraints(java.lang.Object o)

getDefaultConstraints

public java.lang.Object getDefaultConstraints()
default constraints are used if supplied constraints was null


getExplicitSize

public int getExplicitSize()

getHeight

public int getHeight(java.awt.Component c)

getHgap

public int getHgap()

getLayoutAlignmentX

public float getLayoutAlignmentX(java.awt.Container target)
Description copied from interface: java.awt.LayoutManager2
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

getLayoutAlignmentY

public float getLayoutAlignmentY(java.awt.Container target)
Description copied from interface: java.awt.LayoutManager2
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

getLayoutPolicy

public int getLayoutPolicy()

getRowCount

public int getRowCount(java.awt.Container c)

getShownRow

public int getShownRow()

getVgap

public int getVgap()

getWidth

public int getWidth(java.awt.Component c)

getX

public int getX(java.awt.Component c)

getY

public int getY(java.awt.Component c)

invalidateLayout

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

Specified by:
invalidateLayout in interface java.awt.LayoutManager2

isAcrossStretch

public boolean isAcrossStretch()

isReversedComponentOrder

public boolean isReversedComponentOrder()

isReverseRowOrder

public boolean isReverseRowOrder()

isShowOneRow

public boolean isShowOneRow()

isWrap

public boolean isWrap()

layoutContainer

public void layoutContainer(java.awt.Container parent)
Description copied from interface: java.awt.LayoutManager
Lays out the specified container.

Specified by:
layoutContainer in interface java.awt.LayoutManager
Parameters:
parent - the container to be laid out

maximumLayoutSize

public java.awt.Dimension maximumLayoutSize(java.awt.Container parent)
Description copied from interface: java.awt.LayoutManager2
Calculates the maximum size dimensions for the specified container, given the components it contains.

Specified by:
maximumLayoutSize in interface java.awt.LayoutManager2
See Also:
Component.getMaximumSize(), LayoutManager

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Description copied from interface: java.awt.LayoutManager
Calculates the minimum size dimensions for the specified container, given the components it contains.

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - the component to be laid out
See Also:
LayoutManager.preferredLayoutSize(java.awt.Container)

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Description copied from interface: java.awt.LayoutManager
Calculates the preferred size dimensions for the specified container, given the components it contains.

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - the container to be laid out
See Also:
LayoutManager.minimumLayoutSize(java.awt.Container)

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Description copied from interface: java.awt.LayoutManager
Removes the specified component from the layout.

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

setAcrossStretch

public void setAcrossStretch(boolean acrossStretch)

setAxis

public void setAxis(int axis)

setColumnCount

public void setColumnCount(int columnCount)

setDefaultConstraints

public void setDefaultConstraints(java.lang.Object constraints)
default constraints are used if supplied constraints was null


setExplicitSize

public void setExplicitSize(int explicitSize)

setHgap

public void setHgap(int hgap)

setLayoutPolicy

public void setLayoutPolicy(int policy)

setReversedComponentOrder

public void setReversedComponentOrder(boolean reversedComponentOrder)

setReverseRowOrder

public void setReverseRowOrder(boolean reverseRowOrder)

setShownRow

public void setShownRow(int shownRow)

setShowOneRow

public void setShowOneRow(boolean showOneRow)

setVgap

public void setVgap(int vgap)

setWrap

public void setWrap(boolean wrap)