|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.writersforge.catalan.layout.Relation
A constraints-based relationship between two LayoutArea objects. The Relation consists of an attractor, the anchor point for the relationship, and a satellite, the "floating" area that the relationship applies to. A Relation does not affect the position of the attractor, only the satellite.
A Relation object is essentially a fancy vector, with direction, magnitude, and an optional distance. The direction is a collection of relationship states, like edge attraction, horizontal/vertical orientation, etc. The magnitude determines the strength of the relationship; stronger magnitudes will win out over weaker magnitudes if more than one Relation contends for a scarce position in the layout. A third optional parameter is the desired distance between two parallel edges of the areas. A Relation can suggest that an area should be, for example, within 50 units of the target area, or at least 25 units away from it, or indented 10 units to the left of it. The LayoutEngine uses Relations to make these layout decisions when rendering a Page.
The relation is valid if the following equation is true:
satellite-edge + distance OP attractor-edgewhere satellite-edge is the appropriate leading/trailing edge on the area being laid out, attractor-edge is the leading/trailing edge on the target (already laid out) area, and OP is the comparison operator, one of: =, !=, <, <=, >, >=. The placement of the satellite-edge is typically the variable parameter during the layout process. In a given Relation, the attractor-edge and distance can both be assumed to be constants.
| Nested Class Summary | |
static class |
Relation.Above
Convenience class to constrain an area that must remain vertically above the previous area in the layout. |
static class |
Relation.Below
Convenience class to constrain an area that must remain vertically below the previous area in the layout. |
static class |
Relation.Indent
Convenience class to constrain an area that must remain indented to the right of the previous area in the layout (leftward indentation can be achieved with a negative distance). |
| Field Summary | |
static int |
ABOVE_AT_MASK
Vertically above the attractor, at exactly distance |
static int |
ABOVE_MASK
Vertically above the attractor, with no comparison operator specified |
static int |
ABOVE_MAX_MASK
Vertically above the attractor, no further than distance |
static int |
ABOVE_MIN_MASK
Vertically above the attractor, no closer than distance |
static int |
BELOW_AT_MASK
Vertically below the attractor, at exactly distance |
static int |
BELOW_MASK
Vertically below the attractor, at exactly distance |
static int |
BELOW_MAX_MASK
Vertically below the attractor, no further than distance |
static int |
BELOW_MIN_MASK
Vertically below the attractor, no closer than distance |
static int |
EQUAL_MASK
Require equal to distance |
static int |
GREATER_THAN_EQUAL_MASK
Require greater than or equal to distance |
static int |
GREATER_THAN_MASK
Require greater than distance |
static int |
HEAVY_WEIGHT
Very important Relation, only override if critical |
static int |
HORIZONTAL_MASK
Apply relation along horizontal axis |
static int |
INDENT_MASK
Horizontally indented to the left of the attractor (can be negative for indentation to the right) |
static int |
LEADING_ATTRACTOR_EDGE_MASK
Relate to leading edge in attractor |
static int |
LEADING_SATELLITE_EDGE_MASK
Relate to leading edge in satellite |
static int |
LESS_THAN_EQUAL_MASK
Require less than or equal to distance |
static int |
LESS_THAN_MASK
Require less than distance |
static int |
LIGHT_WEIGHT
Optional Relation, use as a fallback, if nothing else needs the position |
static int |
MANDATORY_WEIGHT
The highest valid Relation, cannot be ignored |
static int |
MEDIUM_WEIGHT
Moderately important Relation, should think twice before overriding |
static int |
MINIMAL_WEIGHT
The lowest valid Relation weight, overridden by anything |
static int |
NOT_EQUAL_MASK
Require not equal to distance |
static int |
TRAILING_ATTRACTOR_EDGE_MASK
Relate to trailing edge in attractor |
static int |
TRAILING_SATELLITE_EDGE_MASK
Relate to trailing edge in satellite |
static int |
VERTICAL_MASK
Apply relation along vertical axis |
| Constructor Summary | |
Relation(LayoutArea target,
int mask,
int weight)
Creates a new instance of Relation. |
|
Relation(LayoutArea target,
int mask,
int weight,
int distance)
Creates a new instance of Relation |
|
| Method Summary | |
int |
getDistance()
Getter for property distance, a scalar measure to use with comparisons. |
LayoutArea |
getTarget()
Getter for property target, the LayoutArea (attractor) to bind to. |
int |
getWeight()
Getter for property weight, how important this relationship is. |
boolean |
isEqual()
Does the Relation allow distances exactly equal to the distance property? |
boolean |
isGreaterThan()
Does the Relation allow distances greater than the distance property? |
boolean |
isLeadingAttractorEdge()
Does the Relation refer to the leading edge of the attractor area? |
boolean |
isLeadingSatelliteEdge()
Does the Relation refer to the leading edge of the satellite area? |
boolean |
isLessThan()
Does the Relation allow distances less than the distance property? |
boolean |
isVertical()
Is the Relation oriented along the horizontal axis? |
void |
setDistance(int distance)
Setter for property distance, a scalar measure to use with comparisons. |
java.lang.String |
toString()
Returns this object as a String |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int VERTICAL_MASK
public static final int HORIZONTAL_MASK
public static final int LEADING_ATTRACTOR_EDGE_MASK
public static final int TRAILING_ATTRACTOR_EDGE_MASK
public static final int LEADING_SATELLITE_EDGE_MASK
public static final int TRAILING_SATELLITE_EDGE_MASK
public static final int LESS_THAN_MASK
public static final int EQUAL_MASK
public static final int GREATER_THAN_MASK
public static final int LESS_THAN_EQUAL_MASK
public static final int GREATER_THAN_EQUAL_MASK
public static final int NOT_EQUAL_MASK
public static final int INDENT_MASK
public static final int ABOVE_MASK
public static final int ABOVE_AT_MASK
public static final int ABOVE_MAX_MASK
public static final int ABOVE_MIN_MASK
public static final int BELOW_MASK
public static final int BELOW_AT_MASK
public static final int BELOW_MAX_MASK
public static final int BELOW_MIN_MASK
public static final int MINIMAL_WEIGHT
public static final int LIGHT_WEIGHT
public static final int MEDIUM_WEIGHT
public static final int HEAVY_WEIGHT
public static final int MANDATORY_WEIGHT
| Constructor Detail |
public Relation(LayoutArea target,
int mask,
int weight)
target - the attractor area this Relation refers tomask - a bitmask of initializers for this Relationweight - the magnitude of importance for this Relation
public Relation(LayoutArea target,
int mask,
int weight,
int distance)
target - the attractor area this Relation refers tomask - a bitmask of initializers for this Relationweight - the magnitude of importance for this Relationdistance - a scalar measure to use with comparisons| Method Detail |
public int getWeight()
public int getDistance()
satellite-edge + distance OP attractor-edgewhere satellite-edge is the appropriate leading/trailing edge on the area being laid out, attractor-edge is the leading/trailing edge on the target (already laid out) area, and OP is the comparison operator, one of: =, !=, <, <=, >, >=.
public void setDistance(int distance)
satellite-edge + distance OP attractor-edgewhere satellite-edge is the appropriate leading/trailing edge on the area being laid out, attractor-edge is the leading/trailing edge on the target (already laid out) area, and OP is the comparison operator, one of: =, !=, <, <=, >, >=.
distance - New value of property distance.public LayoutArea getTarget()
public boolean isVertical()
public boolean isLeadingSatelliteEdge()
public boolean isLeadingAttractorEdge()
public boolean isEqual()
public boolean isLessThan()
public boolean isGreaterThan()
public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||