|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.lri.swingstates.sm.Transition
fr.lri.swingstates.sm.transitions.Event
fr.lri.swingstates.sm.transitions.EventOnPosition
fr.lri.swingstates.canvas.CStateMachine.EventOnShape
fr.lri.swingstates.canvas.CStateMachine.EventOnTag
public abstract class CStateMachine.EventOnTag
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);
// The transition is triggered when an event occurs on ellipse1 or on rectangle.
Transition t = new EventOnTag (red, BUTTON1) {
public void action() {
...
// scale ellipse1 and rectangle
getTag().scaleBy(1.5);
// set the transparencyFill of the shape on which this transition has been triggered (ellipse1 OR rectangle)
getShape().setTransparency(0.5f);
}
}
// The transition is triggered when an event occurs on ellipse1, ellipse2 or on rectangle (any shape tagged by an instance of ColorTag).
Transition t = new EventOnTag (ColorTag.class, BUTTON1) {
public void action() {
...
getShape().setFillPaint(((ColorTag)getTag()).color));
...
}
}
// The transition is triggered when an event occurs on ellipse2 (the only shape tagged by the instance of ColorTag having the name "green").
Transition t = new EventOnTag ("green", BUTTON1) {
public void action() {
...
System.out.println("This shape is tagged by the color "+((ColorTag)getTag()).color);
...
}
}
| 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 |
|---|
public CStateMachine.EventOnTag(CTag tag,
java.lang.String keyEvent)
tag - The tagkeyEvent - The string describing the events for which this transition
must be triggered
public CStateMachine.EventOnTag(java.lang.Class tagClass,
java.lang.String keyEvent)
tagClass - The class of the tagkeyEvent - The string describing the events for which this transition
must be triggered
public CStateMachine.EventOnTag(java.lang.String tagName,
java.lang.String keyEvent)
tagName - The name of the tagkeyEvent - The string describing the events for which this transition
must be triggered
public CStateMachine.EventOnTag(CTag tag,
java.lang.Class eventClass)
tag - The tageventClass - The class of events
public CStateMachine.EventOnTag(java.lang.Class tagClass,
java.lang.Class eventClass)
tagClass - The class of the tageventClass - The class of events
public CStateMachine.EventOnTag(java.lang.String tagName,
java.lang.Class eventClass)
tagName - The name of the tageventClass - The class of events
public CStateMachine.EventOnTag(java.lang.String tagName,
java.lang.String keyEvent,
java.lang.String outState)
tagName - The name of the tagkeyEvent - The string describing the events for which this transition
must be triggeredoutState - The name of the output state
public CStateMachine.EventOnTag(java.lang.Class tagClass,
java.lang.String keyEvent,
java.lang.String outState)
tagClass - The class of the tagkeyEvent - The string describing the events for which this transition
must be triggeredoutState - The name of the output state
public CStateMachine.EventOnTag(CTag tag,
java.lang.String keyEvent,
java.lang.String outState)
tag - The tagkeyEvent - The string describing the events for which this transition
must be triggeredoutState - The name of the output state
public CStateMachine.EventOnTag(java.lang.String tagName,
java.lang.Class eventClass,
java.lang.String outState)
tagName - The name of the tageventClass - The class of eventsoutState - The name of the output state
public CStateMachine.EventOnTag(java.lang.Class tgClass,
java.lang.Class eventClass,
java.lang.String outState)
tgClass - The class of the tageventClass - The class of eventsoutState - The name of the output state
public CStateMachine.EventOnTag(CTag tag,
java.lang.Class eventClass,
java.lang.String outState)
tag - The tageventClass - The class of events for which that triggers this
transition.outState - The name of the output state| Method Detail |
|---|
public java.lang.String getTagName()
public CTag getTag()
public java.lang.String toString()
toString in class CStateMachine.EventOnShapepublic boolean matches(java.util.EventObject eventObject)
matches in class CStateMachine.EventOnShapeeventObject - The event to test
eventObject
can trigger this transition.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||