de.kosi.gui.util
Class CellLayout

java.lang.Object
  |
  +--de.kosi.gui.util.CellLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2

public class CellLayout
extends java.lang.Object
implements java.awt.LayoutManager2

A layout manager, very similar to GridBagLayout.


Field Summary
protected  java.util.Hashtable hashtable
          A hashtable for contraints objects.
 float horizontalAlignment
          Not implemented yet.
 boolean maintainAspectRatio
          Not implemented yet.
 float verticalAlignment
          Not implemented yet.
 
Constructor Summary
CellLayout()
          Creates a new cell layout.
 
Method Summary
 void addLayoutComponent(java.awt.Component component, 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 component)
          Adds the specified component with the specified name to the layout.
protected  java.awt.geom.Rectangle2D.Float getCellBounds(java.awt.Container container)
          Gets the bounds of the cells of the given container.
 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.
 java.awt.Dimension getMinimumCellSize(java.awt.Container container)
          Gets the mimumum size of a cell for the given container.
 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 container)
          ays out the container in the specified panel.
 java.awt.Dimension maximumLayoutSize(java.awt.Container container)
          Returns the maximum size of this component.
 java.awt.Dimension minimumLayoutSize(java.awt.Container container)
          Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
 java.awt.Dimension preferredLayoutSize(java.awt.Container container)
          Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.
 void removeLayoutComponent(java.awt.Component component)
          Removes the specified component from the layout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashtable

protected java.util.Hashtable hashtable
A hashtable for contraints objects.

maintainAspectRatio

public boolean maintainAspectRatio
Not implemented yet.

horizontalAlignment

public float horizontalAlignment
Not implemented yet.

verticalAlignment

public float verticalAlignment
Not implemented yet.
Constructor Detail

CellLayout

public CellLayout()
Creates a new cell layout.
Method Detail

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component component)
Adds the specified component with the specified name to the layout.
Specified by:
addLayoutComponent in interface java.awt.LayoutManager
Parameters:
name - the component name
component - the component to be added

layoutContainer

public void layoutContainer(java.awt.Container container)
ays out the container in the specified panel.
Specified by:
layoutContainer in interface java.awt.LayoutManager
Parameters:
container - the component which needs to be laid out.

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container container)
Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
container - the component to be laid out
Returns:
the minimum layout size of the container.

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container container)
Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.
Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Parameters:
container - the component to be laid out
Returns:
the preferred layout size of the container.

maximumLayoutSize

public java.awt.Dimension maximumLayoutSize(java.awt.Container container)
Returns the maximum size of this component.
Specified by:
maximumLayoutSize in interface java.awt.LayoutManager2
Parameters:
container - the container which needs to be laid out.
Returns:
the maximum size of this component.

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component component)
Removes the specified component from the layout.
Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Parameters:
component - the component to be removed.

addLayoutComponent

public void addLayoutComponent(java.awt.Component component,
                               java.lang.Object constraints)
Adds the specified component to the layout, using the specified constraint object. The constraint object becomes being put into the hashtable with the component as its key.
Specified by:
addLayoutComponent in interface java.awt.LayoutManager2
Parameters:
component - the component to be added
constraints - where/how the component is added to the layout.

getLayoutAlignmentX

public float getLayoutAlignmentX(java.awt.Container target)
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:
target - the container whos layout alignment has to be retrieved.
Returns:
a value from 0 to 1.

getLayoutAlignmentY

public float getLayoutAlignmentY(java.awt.Container target)
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:
target - the container whos layout alignment has to be retrieved.
Returns:
a value from 0 to 1.

invalidateLayout

public void invalidateLayout(java.awt.Container target)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. Doesnt do anything.
Specified by:
invalidateLayout in interface java.awt.LayoutManager2
Parameters:
target - the container of the components of which the information should be invalidated.

getCellBounds

protected java.awt.geom.Rectangle2D.Float getCellBounds(java.awt.Container container)
Gets the bounds of the cells of the given container.
Parameters:
container - the container to get the cell bounds of.
Returns:
the bounds of the cells.

getMinimumCellSize

public java.awt.Dimension getMinimumCellSize(java.awt.Container container)
Gets the mimumum size of a cell for the given container.
Parameters:
container - The container to get the minimum cell size for.
Returns:
the minimum size of a single cell in pixels.