org.niffty
Class Barline

java.lang.Object
  |
  +--org.niffty.HeirarchyNode
        |
        +--org.niffty.MusicSymbol
              |
              +--org.niffty.Barline
All Implemented Interfaces:
Anchored

public class Barline
extends MusicSymbol

A Barline has a type, extends to, number of staves and optional tags: thickness, width and line quality.


Nested Class Summary
static class Barline.ExtendsTo
          A Barline.ExtendsTo has constants for the legal "extends to" values.
static class Barline.Type
          A Barline.Type has constants for the legal barline types.
 
Field Summary
 
Fields inherited from class org.niffty.MusicSymbol
_tags
 
Constructor Summary
Barline(Barline.Type type, Barline.ExtendsTo extendsTo, int numberOfStaves, Tags tags)
          Creates a new Barline with the given parameters.
 
Method Summary
 void draw(java.awt.Graphics graphics)
          Draw this object
 Barline.ExtendsTo getExtendsTo()
          Returns the "extends to" value.
 int getNumberOfStaves()
          Returns the number of staves used if getExtendsTo() is ExtendsTo.BOTTOM_OF_STAFF
 FinalPoint getScreenHotspot()
          This is a method of the Anchored interface.
 Barline.Type getType()
          Returns the type of barline.
 void invalidate()
          This is automatically called after the object is modified to force this to recompute all its values when the "get" method is called for the value.
 java.lang.String toString()
           
 
Methods inherited from class org.niffty.MusicSymbol
findDefaultAnchor, findLeftPositionedX, findMultiNodes, getIndex, getParentTimeSlice, getTags, isLeftPositionedSymbol, nextInstanceOfInScore, previousInstanceOf, previousInstanceOfInScore, previousInstanceOfInStaff
 
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, wait, wait, wait
 

Constructor Detail

Barline

public Barline(Barline.Type type,
               Barline.ExtendsTo extendsTo,
               int numberOfStaves,
               Tags tags)
Creates a new Barline with the given parameters.

Parameters:
type - the Type constant. This must not be null.
extendsTo - the ExtendsTo constant. This must not be null.
numberOfStaves - see getNumberOfStaves()
tags - the tags for this music symbol. If this is null, then this uses an empty Tags object.
Method Detail

getType

public Barline.Type getType()
Returns the type of barline.


getExtendsTo

public Barline.ExtendsTo getExtendsTo()
Returns the "extends to" value.


getNumberOfStaves

public int getNumberOfStaves()
Returns the number of staves used if getExtendsTo() is ExtendsTo.BOTTOM_OF_STAFF


invalidate

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

Overrides:
invalidate in class MusicSymbol

getScreenHotspot

public FinalPoint getScreenHotspot()
Description copied from class: MusicSymbol
This is a method of the Anchored interface. As a default, just return the hotspot of the parent time slice. It is expected that the subclass will override this.

Specified by:
getScreenHotspot in interface Anchored
Overrides:
getScreenHotspot in class MusicSymbol
Returns:
The position of the hotspot in screen coordinates from top-left of screen (not relative to an anchor). This is a FinalPoint and not a Point so that the class can give access to its screen hotspot object knowing that the caller will not modify it. This is more efficient that returning a new Point every time getScreenHotspot() is called.
See Also:
FinalPoint.newPoint()

draw

public void draw(java.awt.Graphics graphics)
Draw this object

Overrides:
draw in class MusicSymbol

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object