net.sf.sdedit.message
Class Message

java.lang.Object
  extended by net.sf.sdedit.message.Message
All Implemented Interfaces:
Constants
Direct Known Subclasses:
Answer, ForwardMessage

public abstract class Message
extends Object
implements Constants

A Message implementation is responsible for drawing a message and changing the diagram's state in order to reflect the effects of a message.

Author:
Markus Strauch

Field Summary
protected  Diagram 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
protected Message(Lifeline sender, Lifeline receiver, Diagram diagram, MessageData data)
           
 
Method Summary
protected  void extendLifelines(int amount)
          Draws all lifelines according to their current states, from verticalPosition to verticalPosition+amount.
 Arrow getArrow()
           
 Lifeline getCallee()
          Returns the callee of the message (the receiver).
 Lifeline getCaller()
          Returns the caller of the message (the sender)
 Configuration getConfiguration()
          Returns the diagram configuration.
 MessageData getData()
          Returns the MessageData object belonging to this message.
 Diagram getDiagram()
          Returns the diagram on which the message is to be drawn.
abstract  String getText()
          Returns the text of the message, the string the message arrow is labeled by.
 int getThread()
           
 boolean isSynchronous()
          Returns true if at least one of the caller or callee is an actor.
protected  void setArrow(Arrow arrow)
           
 String toString()
          Returns a string representation of this message, in particular of the caller and the callee lifeline.
abstract  void updateView()
          Creates some space on the diagram, so that the message arrow and its label can be drawn, then draws them and creates some more space.
protected  int v()
          Shorthand method - returns the diagram's current vertical position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

diagram

protected final Diagram diagram
Constructor Detail

Message

protected Message(Lifeline sender,
                  Lifeline receiver,
                  Diagram diagram,
                  MessageData data)
Method Detail

toString

public String toString()
Returns a string representation of this message, in particular of the caller and the callee lifeline.

Overrides:
toString in class Object
Returns:
a string representation of this message

getThread

public final int getThread()

setArrow

protected final void setArrow(Arrow arrow)

getArrow

public final Arrow getArrow()

updateView

public abstract void updateView()
Creates some space on the diagram, so that the message arrow and its label can be drawn, then draws them and creates some more space. Changes the state of the diagram so that the effects of the message are reflected. When creating space, the lifelines that do not participate in the message must be drawn according to their current state (via extendLifelines(int).


getDiagram

public final Diagram getDiagram()
Returns the diagram on which the message is to be drawn.

Returns:
the diagram on which the message is to be drawn

getCallee

public final Lifeline getCallee()
Returns the callee of the message (the receiver).

Returns:
the callee of the message (the receiver)

getCaller

public final Lifeline getCaller()
Returns the caller of the message (the sender)

Returns:
the caller of the message (the sender)

getData

public final MessageData getData()
Returns the MessageData object belonging to this message.

Returns:
the MessageData object belonging to this message

getConfiguration

public final Configuration getConfiguration()
Returns the diagram configuration.

Returns:
the diagram configuration

isSynchronous

public boolean isSynchronous()
Returns true if at least one of the caller or callee is an actor.

Returns:
true if at least one of the caller or callee is an actor

extendLifelines

protected final void extendLifelines(int amount)
Draws all lifelines according to their current states, from verticalPosition to verticalPosition+amount.

Parameters:
amount - denotes the vertical size of the portion of the lifelines that is drawn by this method

getText

public abstract String getText()
Returns the text of the message, the string the message arrow is labeled by.

Returns:
the text of the message, the string the message arrow is labeled by

v

protected final int v()
Shorthand method - returns the diagram's current vertical position.

Returns:
the diagram's current vertical position


Copyright © 2011. All Rights Reserved.