net.sf.sdedit.drawable
Class Note

java.lang.Object
  extended by net.sf.sdedit.drawable.Drawable
      extended by net.sf.sdedit.drawable.SequenceElement
          extended by net.sf.sdedit.drawable.Note
All Implemented Interfaces:
Constants

public class Note
extends SequenceElement

A Note is a sequence element that looks like a piece of paper with some text on it. It appears on the right of a lifeline. It can optionally be connected to messages or points in lifelines by dotted lines. If a note is labeled with a string starting with "link:" it represents a hyperlink to another sequence diagram in another tab.

Author:
Markus Strauch

Field Summary
 
Fields inherited from class net.sf.sdedit.drawable.SequenceElement
configuration, diagram
 
Fields inherited from interface net.sf.sdedit.Constants
ACTIVE_LIFELINE_COLOR, ANTI_ALIAS, dashed, DEFAULT_CODE_FONT, DEFAULT_CURSOR, DEFAULT_ENCODING_SCHEME, dotted, emptyStroke, GLOBAL_CONF_FILE, HAND_CURSOR, MOVE_CURSOR, SAVE_AS_FILE_PROPERTY, SAVE_AS_TYPE_PROPERTY, solid, TEST_FREEHEP_CLASSNAME, thick, thick_dashed, THREAD_COLORS
 
Constructor Summary
Note(Lifeline location, int number, String[] text, boolean consuming)
          Creates a new Note.
 
Method Summary
 void addTarget(Point target)
          Adds a point such that a dotted line from the note to the point appears on the diagram.
 void computeLayoutInformation()
          This method is called when and if the left and top positions of the drawable components of a sequence diagram are fixed.
 void draw(Graphics2D g2d)
          Draws the sequence diagram element into the given Graphics2D context, using the rectangle starting at Drawable.getTop(), Drawable.getLeft(), sized Drawable.getHeight(), Drawable.getWidth().
 URI getLink()
          Returns the diagram file, represented as a URI that is to be opened when the note is clicked.
 Lifeline getLocation()
          Returns the lifeline to the left of the note.
 int getNumber()
          Returns the unique number of the note.
 boolean intersects(Rectangle rectangle)
          Returns true if this drawable component's bounds intersect the rectangle given.
 boolean isConsuming()
          Returns the flag denoting if the note consumes its own vertical space.
 void setLink(URI link)
          Sets the diagram file, represented as a URI that is to be opened when the note is clicked.
 
Methods inherited from class net.sf.sdedit.drawable.SequenceElement
configuration, diagram, drawMultilineString, getAlign, getLeftEndpoint, getLeftLimit, getRightEndpoint, getRightLimit, getSpace, leftPadding, rightPadding, setLeftEndpoint, setLeftLimit, setRightEndpoint, setRightLimit, textHeight, textWidth
 
Methods inherited from class net.sf.sdedit.drawable.Drawable
contains, drawMultilineString, getBottom, getHeight, getLeft, getRight, getTop, getWidth, isVisible, setBottom, setHeight, setLeft, setRight, setTop, setVisible, setWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Note

public Note(Lifeline location,
            int number,
            String[] text,
            boolean consuming)
Creates a new Note.

Parameters:
location - the lifeline on the left of the note
number - the unique number of the note
text - the multiline text that appears inside the note box
consuming - flag denoting if the note consumes its own vertical space
Method Detail

isConsuming

public boolean isConsuming()
Returns the flag denoting if the note consumes its own vertical space. If this flag is false, messages that do not concern the lifelines on the left and on the right of the note can consume the space.

Returns:
the flag denoting if this note consumes its own vertical space.

getNumber

public int getNumber()
Returns the unique number of the note.

Returns:
the unique number of the note.

addTarget

public void addTarget(Point target)
Adds a point such that a dotted line from the note to the point appears on the diagram.

Parameters:
target - a point such that a dotted line from the note to the point appears on the diagram

getLocation

public Lifeline getLocation()
Returns the lifeline to the left of the note.

Returns:
the lifeline to the left of the note

setLink

public void setLink(URI link)
Sets the diagram file, represented as a URI that is to be opened when the note is clicked. The URI will be resolved against the location of the file of the diagram to which this note belongs.

Parameters:
link - the diagram file that is to be opened when the note is clicked

getLink

public URI getLink()
Returns the diagram file, represented as a URI that is to be opened when the note is clicked. The URI will be resolved against the location of the file of the diagram to which this note belongs.

Returns:
the diagram file, represented as a URI that is to be opened when the note is clicked

computeLayoutInformation

public void computeLayoutInformation()
Description copied from class: Drawable
This method is called when and if the left and top positions of the drawable components of a sequence diagram are fixed. Its purpose is to use this information to compute even finer layout information, such as the width of the component.

Specified by:
computeLayoutInformation in class Drawable

draw

public void draw(Graphics2D g2d)
Description copied from class: Drawable
Draws the sequence diagram element into the given Graphics2D context, using the rectangle starting at Drawable.getTop(), Drawable.getLeft(), sized Drawable.getHeight(), Drawable.getWidth().

Specified by:
draw in class Drawable
Parameters:
g2d - the Graphics2D context to draw this drawable sequence diagram element into

intersects

public boolean intersects(Rectangle rectangle)
Description copied from class: Drawable
Returns true if this drawable component's bounds intersect the rectangle given.

Overrides:
intersects in class Drawable
Parameters:
rectangle - a rectangle specifiying an area of the sequence diagram
Returns:
true if this drawable component's bounds intersect the rectangle


Copyright © 2011. All Rights Reserved.