jimmc.roots
Class RootsBox

java.lang.Object
  |
  +--jimmc.treepar.Box
        |
        +--jimmc.roots.RootsBox

public class RootsBox
extends Box

RootsBox is a version of Box specialized for use with the roots package.


Field Summary
protected  int currentY
          The current connector location.
protected  java.lang.String fatherKey
          The key of our father.
protected  java.lang.String motherKey
          The key of our mother.
 int parentConnOffset
          The offset of the parent connectors from the top/bottom
protected  java.lang.StringBuffer textBuffer
          Our text.
 
Fields inherited from class jimmc.treepar.Box
connectors, connectorVector, layout, name, orderSet, origin, positionSet, row, rowNumber, rowNumberSet, rowOrder, size, text, textLines, textPosition
 
Constructor Summary
RootsBox(Layout layout, java.lang.String name)
          Create a new box.
 
Method Summary
protected  void addConnector(java.lang.String text, java.lang.String childKey)
          Add a connector.
 void addSection(java.lang.String text, java.lang.String childKey)
          Add a section of text, optionally with a child connector.
protected  int countLines(java.lang.String s)
          Count the number of newlines found in the string.
protected  int countWidth(java.lang.String s)
          Count the length of the longest line.
 void done()
           
protected  int firstLineLength(java.lang.String s)
          Return the number of characters in the first line.
 void setParentKeys(java.lang.String fatherKey, java.lang.String motherKey)
          Add parent connectors.
 
Methods inherited from class jimmc.treepar.Box
addConnector, addNetForce, addToBounds, clearRowNumber, clearRowOrder, connectorsDone, contains, dump, dump, getHitText, getLength, getR, getThickness, isPositionSet, isRowOrderSet, moveR, paint, setConnectorsRowOrder, setPositionSet, setR, setRow, setRowNumber, setRowOrder, setS, setSize, setText, setTextPosition, setupDone, textDone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textBuffer

protected java.lang.StringBuffer textBuffer
Our text.

fatherKey

protected java.lang.String fatherKey
The key of our father.

motherKey

protected java.lang.String motherKey
The key of our mother.

currentY

protected int currentY
The current connector location. Starts at 0 and goes more negative with each connector. When done() is called, all connector positions are adjusted.

parentConnOffset

public int parentConnOffset
The offset of the parent connectors from the top/bottom
Constructor Detail

RootsBox

public RootsBox(Layout layout,
                java.lang.String name)
Create a new box.
Method Detail

addSection

public void addSection(java.lang.String text,
                       java.lang.String childKey)
Add a section of text, optionally with a child connector.
Parameters:
text - The text for this section. This text gets appended to the text in the Box.
childKey - The key of the child for the east-side connector for this section, or null if no connector.

addConnector

protected void addConnector(java.lang.String text,
                            java.lang.String childKey)
Add a connector.

setParentKeys

public void setParentKeys(java.lang.String fatherKey,
                          java.lang.String motherKey)
Add parent connectors.
Parameters:
fatherKey - Key for the father, used for a west connector near the top of the box. Null means no connector.
motherKey - Key for the mother, used for a west connector near the bottom of the box.

done

public void done()

countLines

protected int countLines(java.lang.String s)
Count the number of newlines found in the string.
Overrides:
countLines in class Box

countWidth

protected int countWidth(java.lang.String s)
Count the length of the longest line.
Overrides:
countWidth in class Box
Following copied from class: jimmc.treepar.Box
Returns:
The number of characters in the longest line.

firstLineLength

protected int firstLineLength(java.lang.String s)
Return the number of characters in the first line.