org.argouml.notation.providers.uml
Class TransitionNotationUml

java.lang.Object
  extended by org.argouml.notation.NotationProvider
      extended by org.argouml.notation.providers.TransitionNotation
          extended by org.argouml.notation.providers.uml.TransitionNotationUml

public class TransitionNotationUml
extends TransitionNotation

UML Notation for the text shown next to a Transition.


Constructor Summary
TransitionNotationUml(java.lang.Object transition)
          The constructor.
 
Method Summary
 java.lang.String generateParameter(java.lang.Object parameter)
          Generates the representation of a parameter on the display (diagram).
 java.lang.String getParsingHelp()
           
 void initialiseListener(java.beans.PropertyChangeListener listener, java.lang.Object modelElement)
          Initialise the appropriate model change listeners for the given modelelement to the given listener.
 void parse(java.lang.Object modelElement, java.lang.String text)
          Parses the given text, and adapts the modelElement and maybe related elements accordingly.
protected  java.lang.Object parseTransition(java.lang.Object trans, java.lang.String s)
          Parse a transition description line of the form:
 java.lang.String toString(java.lang.Object modelElement, NotationSettings settings)
          Generate a string representation for the given model element.
 
Methods inherited from class org.argouml.notation.NotationProvider
addElementListener, addElementListener, addElementListener, cleanListener, formatNameList, formatNameList, removeAllElementListeners, removeElementListener, updateListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransitionNotationUml

public TransitionNotationUml(java.lang.Object transition)
The constructor.

Parameters:
transition - the transition represented by this notation
Method Detail

parse

public void parse(java.lang.Object modelElement,
                  java.lang.String text)
Description copied from class: NotationProvider
Parses the given text, and adapts the modelElement and maybe related elements accordingly.

Specified by:
parse in class NotationProvider
Parameters:
modelElement - the modelelement to adapt
text - the string given by the user to be parsed to adapt the model

parseTransition

protected java.lang.Object parseTransition(java.lang.Object trans,
                                           java.lang.String s)
                                    throws java.text.ParseException
Parse a transition description line of the form:
    "event-signature [guard-condition] / action-expression".
 
If the last character of this line is a ";", then it is ignored.

The "event-signature" may be one of the 4 formats:

Remark: The UML standard does not make a distinction between the syntax of a CallEvent and SignalEvent: both may have parameters between (). For simplicity and user-friendliness, we chose for this distinction. If a user wants parameters for a SignalEvent, then he may add them in the properties panels, but not on the diagram.

An alternative solution would be to create a CallEvent by default, and when editing an existing event, do not change the type.

TODO: This function fails when the event-signature contains a "[" or a "/".

Parameters:
trans - the transition object to which this string applies
s - the string to be parsed
Returns:
the transition object
Throws:
java.text.ParseException - when no matching [] are found

getParsingHelp

public java.lang.String getParsingHelp()
Specified by:
getParsingHelp in class NotationProvider
Returns:
a i18 key that represents a help string giving an explanation to the user of the syntax

toString

public java.lang.String toString(java.lang.Object modelElement,
                                 NotationSettings settings)
Description copied from class: NotationProvider
Generate a string representation for the given model element.

Specified by:
toString in class NotationProvider
Parameters:
modelElement - the base UML element
settings - settings that control rendering of the text
Returns:
the string written in the correct notation

generateParameter

public java.lang.String generateParameter(java.lang.Object parameter)
Generates the representation of a parameter on the display (diagram). The string to be returned will have the following syntax:

kind name : type-expression = default-value

Parameters:
parameter - the parameter
Returns:
the generated text

initialiseListener

public void initialiseListener(java.beans.PropertyChangeListener listener,
                               java.lang.Object modelElement)
Description copied from class: NotationProvider
Initialise the appropriate model change listeners for the given modelelement to the given listener. Overrule this when you need more than listening to all events from the base modelelement.

Overrides:
initialiseListener in class NotationProvider
Parameters:
listener - the given listener
modelElement - the modelelement that we provide notation for


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook