dk.klafbang.tincpn.animation.plugin
Class MSC

java.lang.Object
  extended by dk.klafbang.tincpn.animation.plugin.MSC
All Implemented Interfaces:
dk.klafbang.tincpn.animation.AnimationController

public class MSC
extends java.lang.Object
implements dk.klafbang.tincpn.animation.AnimationController

This animation objects allows you to draw message-sequence charts easily.

Since:
1.0
Author:
Michael Westergaard

Constructor Summary
MSC(java.lang.String name, java.lang.String id)
          Constructs a MSC object.
 
Method Summary
 void addEvent(java.lang.String from, java.lang.String to, java.lang.String text)
          Add an event from one process to another with the given text.
 void addEventStyle(java.lang.String from, java.lang.String to, java.lang.String text, java.lang.String style)
          Add an event from one process to another with the given text and style.
 void addInternalEvent(java.lang.String process, java.lang.String text)
          Add an internal event to the given process.
 void addInternalEventStyle(java.lang.String process, java.lang.String text, java.lang.String style)
          Add an internal event to the given process.
 void addLine(java.lang.String text)
           
 void addProcess(java.lang.String name)
          Add a new process to the MSC.
 void addProcessStyle(java.lang.String name, java.lang.String style)
          Add a new process to the MSC.
 java.lang.String createStyle(java.lang.String foreground, java.lang.String background, int width)
          Create a new style.
 void dropEvent(java.lang.String identifier)
          Drop a dangling event.
 void endEvent(java.lang.String identifier, java.lang.String to)
          Attach a dangling event to an end process.
 void endEventStyle(java.lang.String identifier, java.lang.String to, java.lang.String style)
          Attach a dangling event to an end process and updates its style.
 dk.klafbang.tincpn.gui.sheet.Sheet getSheet()
           
 java.lang.String startEvent(java.lang.String from, java.lang.String text)
          Add an event starting at a process, but which does not end anywhere with the given text.
 java.lang.String startEventStyle(java.lang.String from, java.lang.String text, java.lang.String style)
          Add an event starting at a process, but which does not end anywhere with the given text and style.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MSC

public MSC(java.lang.String name,
           java.lang.String id)
Constructs a MSC object.

Parameters:
name - of the MSC
id -
Method Detail

getSheet

public dk.klafbang.tincpn.gui.sheet.Sheet getSheet()
Specified by:
getSheet in interface dk.klafbang.tincpn.animation.AnimationController
See Also:
AnimationController.getSheet()

createStyle

public java.lang.String createStyle(java.lang.String foreground,
                                    java.lang.String background,
                                    int width)
                             throws java.lang.NumberFormatException
Create a new style.

Parameters:
foreground - the foreground color as a string "0xRRGGBB" where RR, GG, BB are hexadecimal encodings of the color's red, green, and blue components. E.g. 0xff0000 would represent a bright red, 0xffff00 a bright yellow, and 0x7f7fff a light blue.
background - the background color in the same format as the foreground color.
width - the linewidth (100 is the default value for events, 200 the default for processes, 0 is a hair-line, more than 400 looks stupid)
Returns:
an id representing this style
Throws:
java.lang.NumberFormatException

addProcess

public void addProcess(java.lang.String name)
Add a new process to the MSC.

Parameters:
name - the name of the new Process

addProcessStyle

public void addProcessStyle(java.lang.String name,
                            java.lang.String style)
Add a new process to the MSC.

Parameters:
name - the name of the new Process
style - a style id returned by createStyle

addEvent

public void addEvent(java.lang.String from,
                     java.lang.String to,
                     java.lang.String text)
              throws java.lang.Exception
Add an event from one process to another with the given text.

Parameters:
from - the name of the process to create the event from
to - the name of the process to create the event to
text - the text of the event
Throws:
java.lang.Exception

addEventStyle

public void addEventStyle(java.lang.String from,
                          java.lang.String to,
                          java.lang.String text,
                          java.lang.String style)
                   throws java.lang.Exception
Add an event from one process to another with the given text and style.

Parameters:
from - the name of the process to create the event from
to - the name of the process to create the event to
text - the text of the event
style - a style id returned by createStyle
Throws:
java.lang.Exception

startEvent

public java.lang.String startEvent(java.lang.String from,
                                   java.lang.String text)
                            throws java.lang.Exception
Add an event starting at a process, but which does not end anywhere with the given text.

Parameters:
from - name of the process to create the event from
text - the text of the event
Returns:
an id for this event, which can be used to terminate it later
Throws:
java.lang.Exception

startEventStyle

public java.lang.String startEventStyle(java.lang.String from,
                                        java.lang.String text,
                                        java.lang.String style)
                                 throws java.lang.Exception
Add an event starting at a process, but which does not end anywhere with the given text and style.

Parameters:
from - name of the process to create the event from
text - the text of the event
style - a style id returned by createStyle
Returns:
an id for this event, which can be used to terminate it later
Throws:
java.lang.Exception

endEvent

public void endEvent(java.lang.String identifier,
                     java.lang.String to)
              throws java.lang.Exception
Attach a dangling event to an end process.

Parameters:
identifier - the id returned by startEvent
to - name of the process to end the event on
Throws:
java.lang.Exception

endEventStyle

public void endEventStyle(java.lang.String identifier,
                          java.lang.String to,
                          java.lang.String style)
                   throws java.lang.Exception
Attach a dangling event to an end process and updates its style.

Parameters:
identifier - the id returned by startEvent
to - name of the process to end the event on
style - a style id returned by createStyle
Throws:
java.lang.Exception

dropEvent

public void dropEvent(java.lang.String identifier)
               throws java.lang.Exception
Drop a dangling event.

Parameters:
identifier - the id returned by startEvent
Throws:
java.lang.Exception

addInternalEvent

public void addInternalEvent(java.lang.String process,
                             java.lang.String text)
                      throws java.lang.Exception
Add an internal event to the given process.

Parameters:
process - the name of the process to add the event to
text - the text of the internal event
Throws:
java.lang.Exception

addInternalEventStyle

@ToDo(severity=TRIVIAL,
      value="Long texts on the last processes cause problems with the bounds calculation")
public void addInternalEventStyle(java.lang.String process,
                                       java.lang.String text,
                                       java.lang.String style)
                           throws java.lang.Exception
Add an internal event to the given process.

Parameters:
process - the name of the process to add the event to
text - the text of the internal event
style - a style id returned by createStyle
Throws:
java.lang.Exception

addLine

public void addLine(java.lang.String text)
Parameters:
text -