com.altair.hwm.toolkit.utils
Class HWMPageLayout

java.lang.Object
  extended by com.altair.hwm.toolkit.utils.HWMPageLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2

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

Title: HWMPageLayout

Description: This is the layout manager to which will place the components according to the HWMPageConstraints. The component can be fixed or relative to the page.

NOTE: THIS CAN BE USED ONLY FOR SWING CONTAINERS

Company: Altair Engineering, Inc.


Field Summary
static int GRID_SIZE
          The grid size to use
 
Constructor Summary
HWMPageLayout()
          Constructor
 
Method Summary
 void addLayoutComponent(java.awt.Component comp, java.lang.Object objConstraints)
          LayoutManager2 method which is called when a component is added to the parent.
 void addLayoutComponent(java.lang.String strName, java.awt.Component comp)
          LayoutManager method Adds the specified component with the specified name to the layout.
 HWMPageConstraints[] GetAllConstraints()
          Returns array of constraints
 HWMPageConstraints GetConstraints(java.awt.Component comp)
          Gets the constraints for the component
 float getLayoutAlignmentX(java.awt.Container containerTarget)
          LayoutManager2 method Returns the alignment along the x axis.
 float getLayoutAlignmentY(java.awt.Container containerTarget)
          LayoutManager2 method Returns the alignment along the y axis.
 void invalidateLayout(java.awt.Container containerTarget)
          LayoutManager2 method Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
 void layoutContainer(java.awt.Container containerTarget)
          LayoutManager method Lays out the specified container using this layout.
 java.awt.Dimension maximumLayoutSize(java.awt.Container containerTarget)
          LayoutManager2 method Returns the maximum dimensions for this layout given the components in the specified containerTarget container.
 java.awt.Dimension minimumLayoutSize(java.awt.Container containerTarget)
          LayoutManager method Determines the minimum size of the container using this layout
 java.awt.Dimension preferredLayoutSize(java.awt.Container containerTarget)
          LayoutManager method Determines the preferred size of the container using this layout
 void removeLayoutComponent(java.awt.Component comp)
          LayoutManager method Removes the specified component from this layout.
 void SetConstraints(java.awt.Component comp, HWMPageConstraints hwmPageConstraints)
          Sets the constraints for the component.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRID_SIZE

public static int GRID_SIZE
The grid size to use

Constructor Detail

HWMPageLayout

public HWMPageLayout()
Constructor

Method Detail

addLayoutComponent

public void addLayoutComponent(java.awt.Component comp,
                               java.lang.Object objConstraints)
                        throws java.lang.IllegalArgumentException
LayoutManager2 method which is called when a component is added to the parent.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager2
Parameters:
comp - The component that is to be added to the container
objConstraints - The constraints that need to be followed to place the component in the container which will be the HWMPageConstraints object.
Throws:
java.lang.IllegalArgumentException

SetConstraints

public void SetConstraints(java.awt.Component comp,
                           HWMPageConstraints hwmPageConstraints)
Sets the constraints for the component. Since the preferred size may have changed... calculate the preferred size using all the components in the container.

Parameters:
comp - The component whose constrainst should be set
hwmPageConstraints - The constraints to follow while laying out the component

GetConstraints

public HWMPageConstraints GetConstraints(java.awt.Component comp)
Gets the constraints for the component

Parameters:
comp - The component whose constrainst should be set
Returns:
HWMPageConstraints The constraints that is used while laying out the component

GetAllConstraints

public HWMPageConstraints[] GetAllConstraints()
Returns array of constraints

Returns:
HWMPageConstraints[] The array of constraints

maximumLayoutSize

public java.awt.Dimension maximumLayoutSize(java.awt.Container containerTarget)
LayoutManager2 method Returns the maximum dimensions for this layout given the components in the specified containerTarget container.

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

getLayoutAlignmentX

public float getLayoutAlignmentX(java.awt.Container containerTarget)
LayoutManager2 method 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:
containerTarget - the component which needs to be laid out

getLayoutAlignmentY

public float getLayoutAlignmentY(java.awt.Container containerTarget)
LayoutManager2 method 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:
containerTarget - the component which needs to be laid out

invalidateLayout

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

Specified by:
invalidateLayout in interface java.awt.LayoutManager2

addLayoutComponent

public void addLayoutComponent(java.lang.String strName,
                               java.awt.Component comp)
                        throws java.lang.UnsupportedOperationException
LayoutManager method Adds the specified component with the specified name to the layout. This is not supported

Specified by:
addLayoutComponent in interface java.awt.LayoutManager
Parameters:
strName - the name of the component.
comp - the component to be added.
Throws:
java.lang.UnsupportedOperationException

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
LayoutManager method Removes the specified component from this layout.

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

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container containerTarget)
LayoutManager method Determines the preferred size of the container using this layout

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Parameters:
containerTarget - the container in which to do the layout.

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container containerTarget)
LayoutManager method Determines the minimum size of the container using this layout

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
containerTarget - the container in which to do the layout.

layoutContainer

public void layoutContainer(java.awt.Container containerTarget)
LayoutManager method Lays out the specified container using this layout. This method reshapes components in the specified container in order to satisfy the contraints for the component.

Specified by:
layoutContainer in interface java.awt.LayoutManager
Parameters:
containerTarget - the container in which to do the layout.