TPTP 4.4.0 Platform Project
Public API Specification

org.eclipse.hyades.uml2sd.ui.core
Class BaseMessage

java.lang.Object
  extended byorg.eclipse.hyades.uml2sd.ui.core.GraphNode
      extended byorg.eclipse.hyades.uml2sd.ui.core.BaseMessage
Direct Known Subclasses:
AsyncMessage, SyncMessage

public abstract class BaseMessage
extends GraphNode

The base UML2 syncMessages implementation.
This abstract class only define one event occurrence to attach to the message.
Usually a message has two event occurences attached, one for both ends. But some syncMessages(like synchrone syncMessages) only need one event occurrence to represent the time when they appear. Others kind of message representations (like asynchronous syncMessages) will be responsible to define the missing second eventOccurrence property.

See Also:
Lifeline for more event occurence details

Field Summary
protected  Lifeline endLifeline
          The lifeline which receive the message
protected  Lifeline startLifeline
          The lifeline which send the message
protected  boolean visible
           
 
Fields inherited from class org.eclipse.hyades.uml2sd.ui.core.GraphNode
bnodes, bSort, endEventOccurrence, fnodes, fSort, hasChilds, indexes, nodes, prefId, startEventOccurrence
 
Constructor Summary
BaseMessage()
           
 
Method Summary
 boolean contains(int _x, int _y)
          Returns true if the message or the message label contains the point given in parameter
 void draw(IGC context)
          Draws the graph node in the given context
 void drawFocus(IGC context)
           
 void drawRot(int x, int y, int w, int h, IGC context)
           
 Lifeline getEndLifeline()
          Returns the lifeline which has received this message.
 int getEventOccurrence()
          Returns the event occurence when is message occurs.
 int getHeight()
          Returns the graph node height
 Lifeline getStartLifeline()
          Returns the lifeline from which this message has been sent.
 int getWidth()
          Returns the graph node width
protected  int getWidth(boolean quick)
          Returns the graph node width.
 int getX()
          Returns the x coordinate of the graph node
protected  int getX(boolean quick)
          Returns the graph node x coordinate.
 int getY()
          Returns the y coordinate of the graph node
protected  boolean isMessageEndInActivation(int event)
          Determines if the given event occurence occurs on a execution occurence owned by the receiving lifeline.
protected  boolean isMessageStartInActivation(int event)
          Determines if the given eventOccurence occurs on a executionOccurence owned by the sending lifeline.
 boolean isSameAs(GraphNode message)
          Determine if two messages are identicals.
 boolean isVisible()
           
 boolean isVisible(int x, int y, int width, int height)
          Returns the GraphNode visibility for the given visible area.
 void setEndLifeline(Lifeline lifeline)
          Set the lifeline which has receive this message.
protected  void setEventOccurrence(int occurrence)
          Set the event occurrence when this message occurs.
 void setStartLifeline(Lifeline lifeline)
          Set the lifeline from which this message has been sent.
 void setVisible(boolean value)
           
 
Methods inherited from class org.eclipse.hyades.uml2sd.ui.core.GraphNode
addNode, contains, drawChildsNodes, getArrayId, getBackComparator, getComparator, getEndOccurrence, getName, getNodeAt, getNodeFromListAt, getNodeList, getStartOccurrence, hasFocus, isSelected, positiveDistanceToPoint, resetIndex, setFocused, setName, setSelected, updateIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

startLifeline

protected Lifeline startLifeline
The lifeline which send the message


endLifeline

protected Lifeline endLifeline
The lifeline which receive the message


visible

protected boolean visible
Constructor Detail

BaseMessage

public BaseMessage()
Method Detail

getX

public int getX()
Description copied from class: GraphNode
Returns the x coordinate of the graph node

Specified by:
getX in class GraphNode
Returns:
the x coordinate

getY

public int getY()
Description copied from class: GraphNode
Returns the y coordinate of the graph node

Specified by:
getY in class GraphNode
Returns:
the y coordinate

getWidth

public int getWidth()
Description copied from class: GraphNode
Returns the graph node width

Specified by:
getWidth in class GraphNode
Returns:
the graph node width

getHeight

public int getHeight()
Description copied from class: GraphNode
Returns the graph node height

Specified by:
getHeight in class GraphNode
Returns:
the graph node height

getX

protected int getX(boolean quick)
Returns the graph node x coordinate.
Depending on the quick parameter a approximative or exact value is return.
The approximative value does not take into account if both message ends are connected to a Lifeline Execution Occurrence.
Execution occurrence on a lifeline increase the vertical line width which represent the lifeline, this directly affect the message x coordinate and width.

This method is typically used to faster execute none graphical operation like tooltip lookup.

Parameters:
quick - true to get an approximative value
false to get the exact x value
Returns:
the graph node x coordinate

getWidth

protected int getWidth(boolean quick)
Returns the graph node width.
Depending on the quick parameter a approximative or exact value is returned.
The approximative value does not take into account if both message ends are connected to a Lifeline Execution Occurrence.
Execution occurrence on a lifeline increase the vertical line width which represent the lifeline, this directly affect the message x coordinate and width.

This method is typically used to faster execute none graphical operation like tooltip lookup.

Parameters:
quick - true to get an approximative value
false to get the exact x value
Returns:
the graph node width

isVisible

public boolean isVisible(int x,
                         int y,
                         int width,
                         int height)
Description copied from class: GraphNode
Returns the GraphNode visibility for the given visible area. Wrong visibity calculation, may strongly impact drawing performance

Overrides:
isVisible in class GraphNode
Returns:
true if visible false otherwise

setVisible

public void setVisible(boolean value)

isVisible

public boolean isVisible()

setStartLifeline

public void setStartLifeline(Lifeline lifeline)
Set the lifeline from which this message has been sent.

Parameters:
lifeline - - the message sender

getStartLifeline

public Lifeline getStartLifeline()
Returns the lifeline from which this message has been sent.

Returns:
the message sender

getEndLifeline

public Lifeline getEndLifeline()
Returns the lifeline which has received this message.

Returns:
the message receiver

setEndLifeline

public void setEndLifeline(Lifeline lifeline)
Set the lifeline which has receive this message.

Parameters:
lifeline - the message receiver

setEventOccurrence

protected void setEventOccurrence(int occurrence)
Set the event occurrence when this message occurs.

Parameters:
occurrence - the event occurence to assign to this message.
See Also:
Lifeline for more event occurence details

getEventOccurrence

public int getEventOccurrence()
Returns the event occurence when is message occurs.

Returns:
the event occurrence assigned to this message.
See Also:
Lifeline for more event occurence details

isMessageStartInActivation

protected boolean isMessageStartInActivation(int event)
Determines if the given eventOccurence occurs on a executionOccurence owned by the sending lifeline.
WARNING: this method will return a valid result only for execution occurrences which are visibles in the View.
As consequence this method is only used for drawing purpose, especially to determine the exact message x coordinate and width.

Parameters:
event - the event occurence to test
Returns:
true if occurs on a execution occurence owned by the sending lifeine, false otherwise
See Also:
getX(boolean)

isMessageEndInActivation

protected boolean isMessageEndInActivation(int event)
Determines if the given event occurence occurs on a execution occurence owned by the receiving lifeline.
WARNING: this method will return a valid result only for execution occurrences which are visibles in the View.
As consequence this method is only used for drawing purpose, especially to determine the exact message x coordinate and width.

Parameters:
event - the event occurence to test
Returns:
true if occurs on a execution occurence owned by the receiving lifeline, false otherwise
See Also:
getX(boolean)

contains

public boolean contains(int _x,
                        int _y)
Returns true if the message or the message label contains the point given in parameter

Specified by:
contains in class GraphNode
Parameters:
_x - the x coordinate of the point to test containment
y the y coordinate of the point to test containment
Returns:
true if contained, false otherwise

draw

public void draw(IGC context)
Description copied from class: GraphNode
Draws the graph node in the given context

Specified by:
draw in class GraphNode
Parameters:
context - the graphical context to draw in

isSameAs

public boolean isSameAs(GraphNode message)
Determine if two messages are identicals. This default implementation considers that overlaping messages with same coordinates are identicals.

Overrides:
isSameAs in class GraphNode
Parameters:
message - - the message to compare with
Returns:
true if identical false otherwise

drawRot

public void drawRot(int x,
                    int y,
                    int w,
                    int h,
                    IGC context)

drawFocus

public void drawFocus(IGC context)
Overrides:
drawFocus in class GraphNode

TPTP 4.4.0 Platform Project
Public API Specification