org.jurvis.awt
Class JvAbstractLayoutManager2

java.lang.Object
  extended by org.jurvis.awt.JvAbstractLayoutManager
      extended by org.jurvis.awt.JvAbstractLayoutManager2
All Implemented Interfaces:
LayoutManager, LayoutManager2
Direct Known Subclasses:
JvColumnLayout

public abstract class JvAbstractLayoutManager2
extends JvAbstractLayoutManager
implements LayoutManager2

This class provides a skeletal implementation of the LayoutManager2 interface, to minimize the effort required to implement this interface.

Author:
Neil W. Weber

Field Summary
protected  HashMap constraintsMap
          The constraints for each component.
 
Fields inherited from class org.jurvis.awt.JvAbstractLayoutManager
gap
 
Constructor Summary
JvAbstractLayoutManager2()
          Construct a new JvAbstractLayoutManager2.
 
Method Summary
 void addLayoutComponent(Component comp, Object constraints)
          Adds the specified component to the layout, using the specified constraint object.
 float getLayoutAlignmentX(Container target)
          Returns the alignment along the x axis.
 float getLayoutAlignmentY(Container target)
          Returns the alignment along the y axis.
 void invalidateLayout(Container target)
          Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
 Dimension maximumLayoutSize(Container target)
          Returns the maximum size of this component.
 void removeLayoutComponent(Component comp)
          Removes the specified component from the layout.
 void setConstraints(Component comp, Object constraints)
          Sets the constraints for the specified component in this layout.
 
Methods inherited from class org.jurvis.awt.JvAbstractLayoutManager
addLayoutComponent, minimumLayoutSize, preferredLayoutSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.LayoutManager
addLayoutComponent, layoutContainer, minimumLayoutSize, preferredLayoutSize
 

Field Detail

constraintsMap

protected HashMap constraintsMap
The constraints for each component. Keyed by the component itself.

Constructor Detail

JvAbstractLayoutManager2

public JvAbstractLayoutManager2()
Construct a new JvAbstractLayoutManager2.

Method Detail

addLayoutComponent

public void addLayoutComponent(Component comp,
                               Object constraints)
Adds the specified component to the layout, using the specified constraint object.

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

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Removes the specified component from the layout.

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

setConstraints

public void setConstraints(Component comp,
                           Object constraints)
Sets the constraints for the specified component in this layout.

Parameters:
comp - the component to be modified
constraints - the constraints to be applied

maximumLayoutSize

public Dimension maximumLayoutSize(Container target)
Returns the maximum size of this component.

Specified by:
maximumLayoutSize in interface LayoutManager2
Returns:
Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)

getLayoutAlignmentX

public float getLayoutAlignmentX(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 LayoutManager2
Returns:
0.5

getLayoutAlignmentY

public float getLayoutAlignmentY(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 LayoutManager2
Returns:
0.5

invalidateLayout

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

Specified by:
invalidateLayout in interface LayoutManager2


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.