org.niffty
Class Page

java.lang.Object
  |
  +--org.niffty.HeirarchyNode
        |
        +--org.niffty.Page

public class Page
extends HeirarchyNode

A Page encapsulates the page information of a ScoreData. A Page has a PageHeader and any number of StaffSystem, NIFFFontSymbol, NIFFCustomGraphicSymbol, NIFFText, or NIFFLine.

See Also:
ScoreData

Constructor Summary
Page(PageHeader pageHeader)
          Creates a new Page with the given PageHeader and an empty StaffSystem list.
 
Method Summary
 void addSystem(StaffSystem staffSystem)
          Add the given staffSystem to the StaffSystem list.
 void draw(java.awt.Graphics graphics)
           
 int getIndex()
          Return the index of this Page in the parent's page list.
 PageHeader getPageHeader()
           
 ScoreData getParentData()
          Return the parent ScoreData.
 Score getParentScore()
          Return the ultimate Score object of which this is a child.
 double getStaffSpacingY()
          Return the Y distance in screen coordinates between one staff and the next.
 StaffSystem getSystem(int index)
          Return the StaffSystem in the staff system list at the given index.
 int getSystemCount()
          Return the number of staff systems in the staff system list.
 void invalidate()
          This is automatically called after the object is modified to force this and all child objects to recompute their values when the "get" method is called for the value.
 void print(java.lang.String indent, java.io.PrintStream output)
          This prints the page info including all staff systems.
 
Methods inherited from class org.niffty.HeirarchyNode
addChild, getChild, getChildCount, getParentNode, nextInHeirarchy, previousInHeirarchy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Page

public Page(PageHeader pageHeader)
Creates a new Page with the given PageHeader and an empty StaffSystem list. The parent pointer will be set when this is added to a ScoreData.

Parameters:
pageHeader - the header for this Page
Method Detail

addSystem

public void addSystem(StaffSystem staffSystem)
Add the given staffSystem to the StaffSystem list. This does not call invalidate(), but you may need to before displaying.

Parameters:
staffSystem - the StaffSystem to add. It is an error if this is already the child of an object.
Throws:
HeirarchyException - if the staffSystem has already been added as a child to another object.
See Also:
invalidate()

getParentData

public ScoreData getParentData()
Return the parent ScoreData.


getPageHeader

public PageHeader getPageHeader()

getSystemCount

public int getSystemCount()
Return the number of staff systems in the staff system list.


getSystem

public StaffSystem getSystem(int index)
Return the StaffSystem in the staff system list at the given index.

Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is negative or not less than the number of nodes in the child node list.

getIndex

public int getIndex()
Return the index of this Page in the parent's page list.

Overrides:
getIndex in class HeirarchyNode
Throws:
HeirarchyException - if this does not have a parent.

getStaffSpacingY

public double getStaffSpacingY()
Return the Y distance in screen coordinates between one staff and the next. This is a double instead of an int so that we don't lose precision.


invalidate

public void invalidate()
This is automatically called after the object is modified to force this and all child objects to recompute their values when the "get" method is called for the value.


getParentScore

public Score getParentScore()
Return the ultimate Score object of which this is a child.


draw

public void draw(java.awt.Graphics graphics)

print

public void print(java.lang.String indent,
                  java.io.PrintStream output)
This prints the page info including all staff systems.

Parameters:
indent - A string such as " " to print at the beginning of the line
output - the PrintStream to print to, such as System.out