org.writersforge.catalan.layout
Class LayoutGroup

java.lang.Object
  |
  +--org.writersforge.catalan.layout.LayoutArea
        |
        +--org.writersforge.catalan.layout.LayoutGroup

public class LayoutGroup
extends LayoutArea

Grouping container for other LayoutArea objects. The LayoutGroup can hold zero or more child areas arranged in a single direction, vertically or horizontally. More complex layouts are possible by embedding groups within groups.

Author:
jsheets

Field Summary
static int HORIZONTAL
          Group child areas in a horizontal direction
static int VERTICAL
          Group child areas in a vertical direction
 
Constructor Summary
LayoutGroup(AreaStyle style)
          Creates a new instance of LayoutGroup.
LayoutGroup(AreaStyle style, int orientation)
          Creates a new instance of LayoutGroup with the given orientation.
 
Method Summary
 void addChildren(LayoutArea child)
          Appends a new child LayoutArea object into this area.
 void addChildren(LayoutArea[] children)
          Appends an array of child LayoutArea objects into this area.
 LayoutArea[] getChildren()
          Getter for property children, the child layout areas.
 LayoutArea getChildren(int index)
          Indexed getter for property children, the child layout areas.
 int getOrientation()
          Getter for property orientation, flow orientation of the children in this group
 boolean isRenderable()
          Determines if this area has renderable content.
 void setChildren(int index, LayoutArea children)
          Indexed setter for property children, the child layout areas.
 void setChildren(LayoutArea[] children)
          Setter for property children, the child layout areas.
 java.lang.String toString()
          Converts the area object into String form.
 
Methods inherited from class org.writersforge.catalan.layout.LayoutArea
canBreakAt, getExtents, getHeight, getHint, getRenderableExtents, getStyle, getWidth, getX, getY, isBreakable, setExtents, setHeight, setHint, setWidth, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERTICAL

public static final int VERTICAL
Group child areas in a vertical direction

See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
Group child areas in a horizontal direction

See Also:
Constant Field Values
Constructor Detail

LayoutGroup

public LayoutGroup(AreaStyle style)
Creates a new instance of LayoutGroup. Defaults to vertical orientation.

Parameters:
style - the base style for this area

LayoutGroup

public LayoutGroup(AreaStyle style,
                   int orientation)
Creates a new instance of LayoutGroup with the given orientation.

Parameters:
style - the base style for this area
orientation - the flow orientation of this group; can be either VERTICAL or HORIZONTAL
Method Detail

getOrientation

public int getOrientation()
Getter for property orientation, flow orientation of the children in this group

Returns:
Value of property orientation.

isRenderable

public boolean isRenderable()
Determines if this area has renderable content. Layout engines can use this to optimize area traversals. Areas which are not renderable should not expect to pass through to the Renderer.

A LayoutGroup is renderable if it contains any children. A border will not be drawn for an empty group.

Overrides:
isRenderable in class LayoutArea
Returns:
true if this area has visible content

getChildren

public LayoutArea getChildren(int index)
Indexed getter for property children, the child layout areas.

Overrides:
getChildren in class LayoutArea
Parameters:
index - Index of the property.
Returns:
Value of the property at index.

getChildren

public LayoutArea[] getChildren()
Getter for property children, the child layout areas.

Overrides:
getChildren in class LayoutArea
Returns:
Value of property children.

setChildren

public void setChildren(int index,
                        LayoutArea children)
Indexed setter for property children, the child layout areas.

Overrides:
setChildren in class LayoutArea
Parameters:
index - Index of the property.
children - New value of the property at index.

setChildren

public void setChildren(LayoutArea[] children)
Setter for property children, the child layout areas.

Overrides:
setChildren in class LayoutArea
Parameters:
children - New value of property children.

addChildren

public void addChildren(LayoutArea child)
Appends a new child LayoutArea object into this area.

Overrides:
addChildren in class LayoutArea
Parameters:
child - new LayoutArea object to append

addChildren

public void addChildren(LayoutArea[] children)
Appends an array of child LayoutArea objects into this area.

Overrides:
addChildren in class LayoutArea
Parameters:
children - new LayoutArea objects to append

toString

public java.lang.String toString()
Converts the area object into String form.

Overrides:
toString in class LayoutArea
Returns:
a String representation of this object