net.sf.sdedit.drawable
Class Arrow

java.lang.Object
  extended by net.sf.sdedit.drawable.Drawable
      extended by net.sf.sdedit.drawable.SequenceElement
          extended by net.sf.sdedit.drawable.Arrow
All Implemented Interfaces:
Constants
Direct Known Subclasses:
BroadcastArrow, LoopArrow

public class Arrow
extends SequenceElement

An arrow is the graphical representation of a message.

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
  Arrow(Message message, ArrowStroke stroke, Direction align, int y)
          Creates a new Arrow.
protected Arrow(Message message, Lifeline boundary0, Lifeline boundary1, ArrowStroke stroke, Direction align, int y)
           
 
Method Summary
 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().
protected  void drawArrowHead(Graphics2D g, int x, int y, int sgn)
          Draws the head of a message arrow onto the diagram display.
protected  void drawText(Graphics2D g2d)
           
 Point getAnchor()
          Returns the point in the middle of this arrow, the one that serves as an anchor when a connection to a Note is made.
 int getInnerHeight()
          Returns the sum of the height of the text and the space between the text and the arrow.
static int getInnerHeight(Message message)
           
 Message getMessage()
          Returns the Message that this arrow represents.
 Point[] getPoints()
          Returns an array of two points, representing the end points of the arrow.
 int getSpace()
          Returns the amount of pixels between the end point of this arrow and the border of the lifeline it reaches.
protected  ArrowStroke getStroke()
           
 Point getTextPosition()
          Returns the point where the message text is written.
protected  void overrideColor(Graphics2D g2d)
           
 void setSpace(int space)
          Sets the amount of pixels between the end point of this arrow and the border of the lifeline it reaches.
 
Methods inherited from class net.sf.sdedit.drawable.SequenceElement
configuration, diagram, drawMultilineString, getAlign, getLeftEndpoint, getLeftLimit, getRightEndpoint, getRightLimit, 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, intersects, 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

Arrow

protected Arrow(Message message,
                Lifeline boundary0,
                Lifeline boundary1,
                ArrowStroke stroke,
                Direction align,
                int y)

Arrow

public Arrow(Message message,
             ArrowStroke stroke,
             Direction align,
             int y)
Creates a new Arrow.

Parameters:
message - the message that the arrow represents
stroke - the type of the arrow (solid, dashed, or invisible for Primitive messages
align - denotes the direction of the arrow
y - the vertical position of the arrow
Method Detail

getPoints

public final Point[] getPoints()
Returns an array of two points, representing the end points of the arrow. The first entry is the point where the arrow starts, the second is where the arrow ends.

Returns:
an array of two points, representing the end points of the arrow

getTextPosition

public Point getTextPosition()
Returns the point where the message text is written.

Returns:
the point where the message text is written

getInnerHeight

public int getInnerHeight()
Returns the sum of the height of the text and the space between the text and the arrow. In other words, this is the height minus the half height of the arrow head.

Returns:
the sum of the height of the text and the space between the text and the arrow

getInnerHeight

public static int getInnerHeight(Message message)

getSpace

public final int getSpace()
Returns the amount of pixels between the end point of this arrow and the border of the lifeline it reaches. This is 0 for ordinary arrows and a positive number for constructor and destructor arrows.

Overrides:
getSpace in class SequenceElement
Returns:
the amount of pixels between the end point of this arrow and the left border of the lifeline it reaches

setSpace

public final void setSpace(int space)
Sets the amount of pixels between the end point of this arrow and the border of the lifeline it reaches. This is 0 for ordinary arrows and a positive number for constructor and destructor arrows.

Parameters:
space - the amount of pixels between the end point of this arrow and the left border of the lifeline it reaches

overrideColor

protected void overrideColor(Graphics2D g2d)

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
See Also:
Drawable.draw(java.awt.Graphics2D)

drawText

protected void drawText(Graphics2D g2d)

getAnchor

public Point getAnchor()
Returns the point in the middle of this arrow, the one that serves as an anchor when a connection to a Note is made.

Returns:
the point in the middle of this arrow

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
See Also:
Drawable.computeLayoutInformation()

drawArrowHead

protected final void drawArrowHead(Graphics2D g,
                                   int x,
                                   int y,
                                   int sgn)
Draws the head of a message arrow onto the diagram display.

Parameters:
g - the graphics context of the diagram display
closed - flag denoting whether the arrow head is closed (filled) or not
x - the horizontal position where to start drawing the arrow
y - the vertical position of the middle point of the arrow
sgn - 1, if the arrow is directed from the right to the left, -1 otherwise

getMessage

public final Message getMessage()
Returns the Message that this arrow represents.

Returns:
the Message that this arrow represents

getStroke

protected final ArrowStroke getStroke()


Copyright © 2011. All Rights Reserved.