com.altair.hwm.toolkit.utils
Class HWMPageConstraints

java.lang.Object
  extended by com.altair.hwm.toolkit.utils.HWMPageConstraints
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class HWMPageConstraints
extends java.lang.Object
implements java.io.Externalizable

Title: HWMPageConstraints

Description: This is the constraints object that will be used to layout the components in a HWMPageLayout manner.

Company: Altair Engineering, Inc.

See Also:
Serialized Form

Field Summary
static int POS_ANCHOR
          If the position is anchor, then the component will be repositioned from the anchor end (to maintain the distance from the right/bottom end of the container) when the page resizes.
static int POS_FIXED
          If the position is fixed, then the component will not be repositioned or resized from the fixed end when the page resizes.
static int POS_FREE
          If the position is FREE, then the width/height will be maintained.
static int POS_RELATIVE
          If the position is relative, then the component will be repositioned from the relative end (to maintain the distance from the left/top end of the container) when the page resizes.
static java.lang.String STR_POS_ANCHOR
          The constraint type as a string
static java.lang.String STR_POS_FIXED
          The constraint type as a string
static java.lang.String STR_POS_FREE
          The constraint type as a string
static java.lang.String STR_POS_RELATIVE
          The constraint type as a string
static java.lang.String VERSION
          The version for this class
 
Constructor Summary
HWMPageConstraints()
          Constructor All the constraints are set to POS_FIXED
HWMPageConstraints(int nLeftPosType, int nTopPosType, int nRightPosType, int nBottomPosType)
          Constructor
 
Method Summary
 int GetBottomConstraintType()
          Returns the type of constraint set to the bototm side
 float GetBottomConstraintValue()
          Returns the value of constraint set to the bototm side
 java.lang.Object GetID()
          Gets the id associated with this constraint
 int GetLeftConstraintType()
          Returns the type of constraint set to the left side
 float GetLeftConstraintValue()
          Returns the value of constraint set to the left side
 int GetRightConstraintType()
          Returns the type of constraint set to the right side
 float GetRightConstraintValue()
          Returns the value of constraint set to the right side
 int GetTopConstraintType()
          Returns the type of constraint set to the top side
 float GetTopConstraintValue()
          Returns the value of constraint set to the top side
 void readExternal(java.io.ObjectInput objInput)
          This method belongs to the Externalizable interface and is called to save this object
 void ReadVersion1_0(java.io.ObjectInput objInput)
          Reads version 1.0 of this class
 void SetConstraints(int nLeftPosType, int nTopPosType, int nRightPosType, int nBottomPosType)
          Set the values for the constraints.
 void SetEvaluateConstraints(boolean bEvalConstraints)
          Set the flag to evaluate constraints.
 void SetID(java.lang.Object objID)
          Sets the id
 void SetPosition(float fLeftPos, float fTopPos, float fRightPos, float fBottomPos)
          Set the values for the constraints
static int toInt(java.lang.String strConstraint)
          Given a String, returns the constraint type as a int.
 java.lang.String toString()
          Get a string representation of the constraints set.
static java.lang.String toString(int nConstraint)
          Gets the constraint type as a string.
 void writeExternal(java.io.ObjectOutput objOutput)
          This method belongs to the Externalizable interface and is called to save this object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
The version for this class

See Also:
Constant Field Values

POS_FREE

public static final int POS_FREE
If the position is FREE, then the width/height will be maintained. This will be used along with other options.

See Also:
Constant Field Values

POS_FIXED

public static final int POS_FIXED
If the position is fixed, then the component will not be repositioned or resized from the fixed end when the page resizes. It will stay where it is. The component will however be snapped to the grid.

See Also:
Constant Field Values

POS_RELATIVE

public static final int POS_RELATIVE
If the position is relative, then the component will be repositioned from the relative end (to maintain the distance from the left/top end of the container) when the page resizes. This may lead to the change in the component's position but not size. If the left/right side is made relative then the right/left type does not matter respectively. The same holds for top/bottom type.

See Also:
Constant Field Values

POS_ANCHOR

public static final int POS_ANCHOR
If the position is anchor, then the component will be repositioned from the anchor end (to maintain the distance from the right/bottom end of the container) when the page resizes. This may lead to the component being repositioned but not resized wrt to the anchored end.

See Also:
Constant Field Values

STR_POS_FREE

public static final java.lang.String STR_POS_FREE
The constraint type as a string

See Also:
Constant Field Values

STR_POS_FIXED

public static final java.lang.String STR_POS_FIXED
The constraint type as a string

See Also:
Constant Field Values

STR_POS_RELATIVE

public static final java.lang.String STR_POS_RELATIVE
The constraint type as a string

See Also:
Constant Field Values

STR_POS_ANCHOR

public static final java.lang.String STR_POS_ANCHOR
The constraint type as a string

See Also:
Constant Field Values
Constructor Detail

HWMPageConstraints

public HWMPageConstraints()
Constructor All the constraints are set to POS_FIXED


HWMPageConstraints

public HWMPageConstraints(int nLeftPosType,
                          int nTopPosType,
                          int nRightPosType,
                          int nBottomPosType)
Constructor

Parameters:
nLeftPosType - The way the component should be placed and repositioned in the component.
nTopPosType - The way the component should be placed and repositioned in the component.
nRightPosType - The way the component should be placed and repositioned in the component.
nBottomPosType - The way the component should be placed and repositioned in the component. All the above can be one of the following: POS_FREE, POS_FIXED, POS_RELATIVE or POS_ANCHOR The illegal types are : If left is POS_RELATIVE and right is POS_FIXED If top is POS_RELATIVE and bottom is POS_FIXED
Method Detail

SetConstraints

public void SetConstraints(int nLeftPosType,
                           int nTopPosType,
                           int nRightPosType,
                           int nBottomPosType)
                    throws java.lang.IllegalArgumentException
Set the values for the constraints. If the left is set to POS_RELATIVE... then right is automatically set to POS_FREE and vice versa. If the top is set to POS_RELATIVE, then the bottom is automatically set to POS_FREE and vice versa.

Parameters:
nLeftPosType - The way the component should be placed and repositioned in the component.
nTopPosType - The way the component should be placed and repositioned in the component.
nRightPosType - The way the component should be placed and repositioned in the component.
nBottomPosType - The way the component should be placed and repositioned in the component. All the above can be one of the following: POS_FREE, POS_FIXED, POS_RELATIVE or POS_ANCHOR The illegal types are : If left is POS_RELATIVE and right is POS_FIXED If left is POS_FREE and right is POS_FREE If top is POS_RELATIVE and bottom is POS_FIXED If top is POS_FREE and bottom is POS_FREE
Throws:
java.lang.IllegalArgumentException

SetPosition

public void SetPosition(float fLeftPos,
                        float fTopPos,
                        float fRightPos,
                        float fBottomPos)
Set the values for the constraints

Parameters:
fLeftPos - The left position of the component. It can be absolute or a % depending on the m_nLeftPosType value.
fTopPos - The top position of the component. It can be absolute or a % depending on the m_nTopPosType value.
fRightPos - The right position of the component. It can be absolute or a % depending on the m_nRightPosType value.
fBottomPos - The bottom position of the component. It can be absolute or a % depending on the m_nBottomPosType value.

SetID

public void SetID(java.lang.Object objID)
Sets the id

Parameters:
objID - The id to associate this constraint with

GetID

public java.lang.Object GetID()
Gets the id associated with this constraint

Parameters:
Object - The id associated with this constraint

GetLeftConstraintType

public int GetLeftConstraintType()
Returns the type of constraint set to the left side

Returns:
int The constraint type set for left side

GetTopConstraintType

public int GetTopConstraintType()
Returns the type of constraint set to the top side

Returns:
int The constraint type set for top side

GetRightConstraintType

public int GetRightConstraintType()
Returns the type of constraint set to the right side

Returns:
int The constraint type set for right side

GetBottomConstraintType

public int GetBottomConstraintType()
Returns the type of constraint set to the bototm side

Returns:
int The constraint type set for bototm side

GetLeftConstraintValue

public float GetLeftConstraintValue()
Returns the value of constraint set to the left side

Returns:
float The constraint value set for left side

GetTopConstraintValue

public float GetTopConstraintValue()
Returns the value of constraint set to the top side

Returns:
float The constraint value set for top side

GetRightConstraintValue

public float GetRightConstraintValue()
Returns the value of constraint set to the right side

Returns:
float The constraint value set for right side

GetBottomConstraintValue

public float GetBottomConstraintValue()
Returns the value of constraint set to the bototm side

Returns:
float The constraint value set for bototm side

ReadVersion1_0

public void ReadVersion1_0(java.io.ObjectInput objInput)
                    throws java.io.IOException,
                           java.lang.ClassNotFoundException
Reads version 1.0 of this class

Parameters:
objInput - The input stream that needs to be read
Throws:
IOException, - ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException

readExternal

public void readExternal(java.io.ObjectInput objInput)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
This method belongs to the Externalizable interface and is called to save this object

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
objInput - The input stream that needs to be read
Throws:
IOException, - ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput objOutput)
                   throws java.io.IOException
This method belongs to the Externalizable interface and is called to save this object

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
objOutput - The input stream that needs to be read
Throws:
java.io.IOException

toString

public java.lang.String toString()
Get a string representation of the constraints set.

Overrides:
toString in class java.lang.Object
Returns:
String The string representation of the constraints set.

toString

public static java.lang.String toString(int nConstraint)
                                 throws java.lang.Exception
Gets the constraint type as a string.

Parameters:
nConstraint - can be POS_FIXED, POS_FREE, POS_RELATIVE, POS_ANCHOR
Returns:
String The string representation of the constraint.
Throws:
java.lang.Exception

toInt

public static int toInt(java.lang.String strConstraint)
                 throws java.lang.Exception
Given a String, returns the constraint type as a int.

Parameters:
strConstraint - can be Fixed, Free, Relative, Anchor
Returns:
int The integer representation of the constraint.
Throws:
java.lang.Exception

SetEvaluateConstraints

public void SetEvaluateConstraints(boolean bEvalConstraints)
Set the flag to evaluate constraints. If true, the distances from the margins of the page will be reevaluated based on the components current position

Parameters:
bEvalConstraints -