TPTP 4.1.0 Platform Project
Public API Specification

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

java.lang.Object
  extended byorg.eclipse.hyades.uml2sd.ui.core.GraphNode
      extended byorg.eclipse.hyades.uml2sd.ui.core.Lifeline

public class Lifeline
extends GraphNode

Lifeline is the UML2 lifeline graphical representation.
Each lifeline owns a set of event occurrences. An event occurrence is the base element in UML2 to set an event in a sequence diagram.
Event occurence define the drawing order of graph node along a lifeline. In this lifeline implementation, event occurrences are just integer index. The event occurrences with the same value on different lifelines will correspond the same y corrdinate value.


Field Summary
protected  int category
           
protected  int eventOccurrence
          The current event occurrence created in the lifeline
protected  boolean hasTime
           
protected  int indexInFrame
          The lifeline position in the containing frame
static java.lang.String LIFELINE_TAG
           
 
Fields inherited from class org.eclipse.hyades.uml2sd.ui.core.GraphNode
bnodes, bSort, endEventOccurrence, fnodes, fSort, hasChilds, indexes, nodes, prefId, startEventOccurrence
 
Constructor Summary
Lifeline()
           
 
Method Summary
 void addExecution(BasicExecutionOccurrence exec)
          Adds the execution occurence given in paramater to the lifeline.
A Execution Occurence is never drawn in the frame intead it is added to a lifeline
 boolean contains(int _x, int _y)
          Returns true if the graph node contains the point given in parameter, return false otherwise.
 void draw(IGC context)
          Draws the graph node in the given context
 void draw(IGC context, int x, int y)
          Force the lifeline to be drawn at the given coordinate
protected  void drawName(IGC context)
           
 java.lang.String getArrayId()
          Return the node type for all class instances.
 int getEventOccurrence()
          Returns the last created event occurrence along the lifeline.
 int getExecOccurrenceDrawIndex()
          Returns the index of the first visible Execution Occurrence in the execution occurrence array.
Execution Occurrences are Y ordered in this array
 java.util.List getExecutions()
          Returns the list of execution occurence on this lifeline
protected  Frame getFrame()
          Returns the frame which this lifeline is drawn
 int getHeight()
          Returns the graph node height
 int getIndex()
          Returns the lifeline position in de the containing frame
 int getNewEventOccurrence()
          Creates a new event occurrence along the lifeline.
 GraphNode getNodeAt(int x, int y)
          Returns the graph node which contains the point given in parameter WARNING: Only graph nodes in the current visible area can be returned
 java.lang.String getToolTipText()
          Returns the tooltip text for the lifeline It is the combinaison between the categorie name(if any) and the lifeline name
 int getWidth()
          Returns the graph node width
 int getX()
          Returns the x coordinate of the graph node
 int getY()
          Returns the y coordinate of the graph node
 boolean hasTimeInfo()
           
 void highlightExecOccurrenceRegion(IGC context, int startEvent, int nbEvent, IColor color)
          Draws the select execution occurence region using the given color
 boolean isVisible(int vx, int vy, int vwidth, int vheight)
          Returns the lifeline visibility for the given visible area
 boolean positiveDistanceToPoint(int x, int y)
          Return true if the distance from the GraphNode to the given point is positif
 void setCategory(int arrayIndex)
          Set the lifeline categorie for this lifeline.
 void setCurrentEventOccurrence(int eventOcc)
          Set the lifeline event occurrence to the value given in parameter This only change the current event occurrence, greater event created on this lifeline are still valid and usable.
protected  void setFrame(Frame parentFrame)
          Set the frame on which this lifeline must be drawn
protected  void setIndex(int index)
          Set the lifeline position index in the containing frame
protected  void setTimeInfo(boolean value)
           
 
Methods inherited from class org.eclipse.hyades.uml2sd.ui.core.GraphNode
addNode, contains, drawChildsNodes, drawFocus, getBackComparator, getComparator, getEndOccurrence, getName, getNodeFromListAt, getNodeList, getStartOccurrence, hasFocus, isSameAs, isSelected, 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

indexInFrame

protected int indexInFrame
The lifeline position in the containing frame


eventOccurrence

protected int eventOccurrence
The current event occurrence created in the lifeline


LIFELINE_TAG

public static final java.lang.String LIFELINE_TAG
See Also:
Constant Field Values

category

protected int category

hasTime

protected boolean hasTime
Constructor Detail

Lifeline

public Lifeline()
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

setCategory

public void setCategory(int arrayIndex)
Set the lifeline categorie for this lifeline.

Parameters:
arrayIndex - the index of the categorie to use
See Also:
Frame.setLifelineCategories(LifelineCategories[])

getToolTipText

public java.lang.String getToolTipText()
Returns the tooltip text for the lifeline It is the combinaison between the categorie name(if any) and the lifeline name

Returns:
the tooltip text

getExecOccurrenceDrawIndex

public int getExecOccurrenceDrawIndex()
Returns the index of the first visible Execution Occurrence in the execution occurrence array.
Execution Occurrences are Y ordered in this array

Returns:
the first visible Execution Occurrence

setFrame

protected void setFrame(Frame parentFrame)
Set the frame on which this lifeline must be drawn

Parameters:
parentFrame -

getFrame

protected Frame getFrame()
Returns the frame which this lifeline is drawn

Returns:
the Frame

setIndex

protected void setIndex(int index)
Set the lifeline position index in the containing frame

Parameters:
index - the lifeline X position

getIndex

public int getIndex()
Returns the lifeline position in de the containing frame

Returns:
the X position

setCurrentEventOccurrence

public void setCurrentEventOccurrence(int eventOcc)
Set the lifeline event occurrence to the value given in parameter This only change the current event occurrence, greater event created on this lifeline are still valid and usable. This also need to inform the frame of the operation mostly to store in the frame the greater event found in the diagram (used to determine the frame height)


getEventOccurrence

public int getEventOccurrence()
Returns the last created event occurrence along the lifeline.

Returns:
the current event occurence

getNewEventOccurrence

public int getNewEventOccurrence()
Creates a new event occurrence along the lifeline.

Returns:
the new created event occurence

addExecution

public void addExecution(BasicExecutionOccurrence exec)
Adds the execution occurence given in paramater to the lifeline.
A Execution Occurence is never drawn in the frame intead it is added to a lifeline

Parameters:
exec - the execution occurence to add

setTimeInfo

protected void setTimeInfo(boolean value)

hasTimeInfo

public boolean hasTimeInfo()
Returns:
true if at least one execution occurrence has time info

getExecutions

public java.util.List getExecutions()
Returns the list of execution occurence on this lifeline

Returns:
the execution occurrence list

contains

public boolean contains(int _x,
                        int _y)
Description copied from class: GraphNode
Returns true if the graph node contains the point given in parameter, return false otherwise.

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

isVisible

public boolean isVisible(int vx,
                         int vy,
                         int vwidth,
                         int vheight)
Returns the lifeline visibility for the given visible area

Overrides:
isVisible in class GraphNode
Parameters:
vx -
vy -
vwidth -
vheight -
Returns:
true if visible false otherwise

drawName

protected void drawName(IGC context)

draw

public void draw(IGC context,
                 int x,
                 int y)
Force the lifeline to be drawn at the given coordinate

Parameters:
context - - the context to draw into

highlightExecOccurrenceRegion

public void highlightExecOccurrenceRegion(IGC context,
                                          int startEvent,
                                          int nbEvent,
                                          IColor color)
Draws the select execution occurence region using the given color

Parameters:
context - the graphical context
startEvent - the region start
nbEvent - the region hight
color - the color to use

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

getArrayId

public java.lang.String getArrayId()
Description copied from class: GraphNode
Return the node type for all class instances. This id is used to store the same nodes kind in the same ordered array.

Specified by:
getArrayId in class GraphNode
Returns:
the node type identifier

positiveDistanceToPoint

public boolean positiveDistanceToPoint(int x,
                                       int y)
Description copied from class: GraphNode
Return true if the distance from the GraphNode to the given point is positif

Overrides:
positiveDistanceToPoint in class GraphNode
Parameters:
x - the point x coordinate
y - the point y coordinate
Returns:
true if positif false otherwise

getNodeAt

public GraphNode getNodeAt(int x,
                           int y)
Description copied from class: GraphNode
Returns the graph node which contains the point given in parameter WARNING: Only graph nodes in the current visible area can be returned

Overrides:
getNodeAt in class GraphNode
Parameters:
x - the x coordinate of the point to test
y - the y coordinate of the point to test
Returns:
the graph node containing the point given in parameter, null otherwise

TPTP 4.1.0 Platform Project
Public API Specification