fr.lri.swingstates.canvas
Class CStateMachine.EventOnTag

java.lang.Object
  extended by fr.lri.swingstates.sm.Transition
      extended by fr.lri.swingstates.sm.transitions.Event
          extended by fr.lri.swingstates.sm.transitions.EventOnPosition
              extended by fr.lri.swingstates.canvas.CStateMachine.EventOnShape
                  extended by fr.lri.swingstates.canvas.CStateMachine.EventOnTag
Direct Known Subclasses:
CStateMachine.MouseOnTag
Enclosing class:
CStateMachine

public abstract class CStateMachine.EventOnTag
extends CStateMachine.EventOnShape

A transition triggered on a tagged shape. OnTag transitions allow developpers to retrieve the shape and the tag where this transition has been fired:

  class ColorTag extends CNamedTag {
                Color color;
                public ColorTag(String tagName, Color c) {
                        super(n);
                }
  }
  ...
  CShape ellipse1 = canvas.newEllipse(100, 100, 20, 30);
  CShape ellipse2 = canvas.newEllipse(200, 200, 20, 30);
  CShape rectangle = canvas.newRectangle(300, 300, 20, 30);
  ColorTag red = new ColorTag("red", Color.RED);
  red.addTo(ellipse1).addTo(rectangle);
  ColorTag green = new ColorTag("green", Color.GREEN);
  green.addTo(ellipse2);
 

Author:
Caroline Appert

Constructor Summary
CStateMachine.EventOnTag(java.lang.Class tagClass, java.lang.Class eventClass)
          Builds a transition with any modifier on a tagged shape that loops on the current state.
CStateMachine.EventOnTag(java.lang.Class tgClass, java.lang.Class eventClass, java.lang.String outState)
          Builds a transition with any modifier on a tagged shape.
CStateMachine.EventOnTag(java.lang.Class tagClass, java.lang.String keyEvent)
          Builds a transition with any modifier on a tagged shape that loops on the current state.
CStateMachine.EventOnTag(java.lang.Class tagClass, java.lang.String keyEvent, java.lang.String outState)
          Builds a transition with any modifier on a tagged shape.
CStateMachine.EventOnTag(CTag tag, java.lang.Class eventClass)
          Builds a transition with any modifier on a tagged shape that loops on the current state.
CStateMachine.EventOnTag(CTag tag, java.lang.Class eventClass, java.lang.String outState)
          Builds a transition with any modifier on a tagged shape.
CStateMachine.EventOnTag(CTag tag, java.lang.String keyEvent)
          Builds a transition with any modifier on a tagged shape that loops on the current state.
CStateMachine.EventOnTag(CTag tag, java.lang.String keyEvent, java.lang.String outState)
          Builds a transition with any modifier on a tagged shape.
CStateMachine.EventOnTag(java.lang.String tagName, java.lang.Class eventClass)
          Builds a transition with any modifier on a tagged shape that loops on the current state.
CStateMachine.EventOnTag(java.lang.String tagName, java.lang.Class eventClass, java.lang.String outState)
          Builds a transition with any modifier on a tagged shape.
CStateMachine.EventOnTag(java.lang.String tagName, java.lang.String keyEvent)
          Builds a transition with any modifier on a tagged shape that loops on the current state.
CStateMachine.EventOnTag(java.lang.String tagName, java.lang.String keyEvent, java.lang.String outState)
          Builds a transition with any modifier on a tagged shape.
 
Method Summary
 CTag getTag()
          Returns the tag instance hold by the CShape on which the mouse event firing this transition has occurred.
 java.lang.String getTagName()
          Returns the name of the tag hold by the CShape on which the mouse event firing this transition has occurred.
 boolean matches(java.util.EventObject eventObject)
          Tests if an event can trigger that transition.
 java.lang.String toString()
          
 
Methods inherited from class fr.lri.swingstates.canvas.CStateMachine.EventOnShape
getPoint, getShape
 
Methods inherited from class fr.lri.swingstates.sm.Transition
action, getEvent, getInputState, getOutputState, guard, oldToString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(CTag tag,
                                java.lang.String keyEvent)
Builds a transition with any modifier on a tagged shape that loops on the current state.

Parameters:
tag - The tag
keyEvent - The string describing the events for which this transition must be triggered

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(java.lang.Class tagClass,
                                java.lang.String keyEvent)
Builds a transition with any modifier on a tagged shape that loops on the current state.

Parameters:
tagClass - The class of the tag
keyEvent - The string describing the events for which this transition must be triggered

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(java.lang.String tagName,
                                java.lang.String keyEvent)
Builds a transition with any modifier on a tagged shape that loops on the current state.

Parameters:
tagName - The name of the tag
keyEvent - The string describing the events for which this transition must be triggered

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(CTag tag,
                                java.lang.Class eventClass)
Builds a transition with any modifier on a tagged shape that loops on the current state.

Parameters:
tag - The tag
eventClass - The class of events

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(java.lang.Class tagClass,
                                java.lang.Class eventClass)
Builds a transition with any modifier on a tagged shape that loops on the current state.

Parameters:
tagClass - The class of the tag
eventClass - The class of events

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(java.lang.String tagName,
                                java.lang.Class eventClass)
Builds a transition with any modifier on a tagged shape that loops on the current state.

Parameters:
tagName - The name of the tag
eventClass - The class of events

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(java.lang.String tagName,
                                java.lang.String keyEvent,
                                java.lang.String outState)
Builds a transition with any modifier on a tagged shape.

Parameters:
tagName - The name of the tag
keyEvent - The string describing the events for which this transition must be triggered
outState - The name of the output state

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(java.lang.Class tagClass,
                                java.lang.String keyEvent,
                                java.lang.String outState)
Builds a transition with any modifier on a tagged shape.

Parameters:
tagClass - The class of the tag
keyEvent - The string describing the events for which this transition must be triggered
outState - The name of the output state

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(CTag tag,
                                java.lang.String keyEvent,
                                java.lang.String outState)
Builds a transition with any modifier on a tagged shape.

Parameters:
tag - The tag
keyEvent - The string describing the events for which this transition must be triggered
outState - The name of the output state

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(java.lang.String tagName,
                                java.lang.Class eventClass,
                                java.lang.String outState)
Builds a transition with any modifier on a tagged shape.

Parameters:
tagName - The name of the tag
eventClass - The class of events
outState - The name of the output state

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(java.lang.Class tgClass,
                                java.lang.Class eventClass,
                                java.lang.String outState)
Builds a transition with any modifier on a tagged shape.

Parameters:
tgClass - The class of the tag
eventClass - The class of events
outState - The name of the output state

CStateMachine.EventOnTag

public CStateMachine.EventOnTag(CTag tag,
                                java.lang.Class eventClass,
                                java.lang.String outState)
Builds a transition with any modifier on a tagged shape.

Parameters:
tag - The tag
eventClass - The class of events for which that triggers this transition.
outState - The name of the output state
Method Detail

getTagName

public java.lang.String getTagName()
Returns the name of the tag hold by the CShape on which the mouse event firing this transition has occurred.

Returns:
name of the tag.

getTag

public CTag getTag()
Returns the tag instance hold by the CShape on which the mouse event firing this transition has occurred.

Returns:
the tag instance.

toString

public java.lang.String toString()

Overrides:
toString in class CStateMachine.EventOnShape

matches

public boolean matches(java.util.EventObject eventObject)
Tests if an event can trigger that transition.

Overrides:
matches in class CStateMachine.EventOnShape
Parameters:
eventObject - The event to test
Returns:
True if the eventObject can trigger this transition.