chrriis.uihierarchy.constraints
Class ExplicitHConstraints

java.lang.Object
  extended bychrriis.uihierarchy.constraints.ExplicitHConstraints
All Implemented Interfaces:
LayoutHConstraints

public class ExplicitHConstraints
extends Object
implements LayoutHConstraints

The constraints for an Explicit layout (www.zookitec.com). Constraints are manipulated by the createConstraints method, if they are a String.

The format is of the form "inherit, key1=expression1, key2=expression2, ...". Inherit is optional and can have two forms: "inherit" or "inherit=mappedName". The inherit keyword is used to first apply some earlier constraints before applying a new set of constraints. This allows chaining of constraints. If used with a mapped name then it will use the constraints applied to the level that was mapped, else it will use the previous sibbling's constraints.

Possible keys are (case is insensitive):
x, y, originX, originY, bottom, right, width and height.

The expressions are combinations of constants, component-based constraints, and functions. An example can be: "5+comp.top*max(3, 4)", where "comp" is a component that was mapped to this name.
The word "container", if not mapped, can be used to refer to the parent container.

Constants are double values. Possible forms are integer form (e.g. "5") or double form (e.g. "5.0").
Predefined supported constants are: bottom, center, left, right and top.

Component-based constraints are:
For component, container and group: bottom, right, width, height, left, top.
For component only: minHeight, minWidth, maxHeight, maxWidth, prefHeight, prefWidth.
For group only: heightMax, heightMin, heightSum, widthMax, widthMin, widthSum, prefHeightMax, prefHeightMin, prefHeightSum, prefWidthMax, prefWidthMin and prefWidthSum.
There are two possibilities to use a group: the mapped name matches several components, or use a form like "[mappedName1, mappedName2, ...].top".
Additionaly, there is support for the xFraction() and yFraction() methods, by using "mappedName.x" or "mappedName.y" followed by a division or a multiplication. An example could be "x=container.x/2".

Supported functions are:
min(exp1, exp2, ...), max(exp1, exp2, ...), bound(exp1, exp2, exp3), gridX(int, exp) and gridY(int, exp).

The properties heightZeroIfInvisible and widthZeroIfInvisible can be set by using "= true" or "= false".

Version:
1.1 2003.11.03
Author:
Christopher Deckers (chrriis@brainlex.com)

Constructor Summary
ExplicitHConstraints()
           
 
Method Summary
 Object createConstraints(SingleLevelAccessor accessor, Container parentContainer, Object constraints)
          Create the constraints for an Explicit layout, if the parameter is a String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExplicitHConstraints

public ExplicitHConstraints()
Method Detail

createConstraints

public Object createConstraints(SingleLevelAccessor accessor,
                                Container parentContainer,
                                Object constraints)
Create the constraints for an Explicit layout, if the parameter is a String.

Specified by:
createConstraints in interface LayoutHConstraints
Parameters:
accessor - The accessor of the level for which to create the constraints.
parentContainer - The parent container.
constraints - The constraints of the component.
Returns:
The ExplicitConstraints constraints.
See Also:
HLeaf.map(java.lang.String), HNode.map(java.lang.String), HRootNode.map(java.lang.String)