|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.gef.commands.Command edu.stanford.hci.dtools.statechart.model.commands.ConnectionReconnectCommand
public class ConnectionReconnectCommand
A command to reconnect a connection to a different start point or end point. The command can be undone or redone.
This command is designed to be used together with a GraphicalNodeEditPolicy. To use this command propertly, following steps are necessary:
for an
example of the above procedure.
,
GraphicalNodeEditPolicy
,
setNewSource(ShapeModel)
,
This software is distributed under the
BSD License.
This code is partially based on code that is copyright (c) 2004 Elias Volanakis. See License.txt
Constructor Summary | |
---|---|
ConnectionReconnectCommand(ConnectionModel conn)
Instantiate a command that can reconnect a ConnectionModel instance to a different source or target endpoint. |
Method Summary | |
---|---|
boolean |
canExecute()
|
void |
execute()
Reconnect the connection to newSource (if setNewSource(...) was invoked before) or newTarget (if setNewTarget(...) was invoked before). |
void |
setNewSource(ShapeModel connectionSource)
Set a new source endpoint for this connection. |
void |
setNewTarget(ShapeModel connectionTarget)
Set a new target endpoint for this connection When execute() is invoked, the target endpoint of the connection will be attached to the supplied ShapeModel instance. |
void |
undo()
Reconnect the connection to its original source and target endpoints. |
Methods inherited from class org.eclipse.gef.commands.Command |
---|
canUndo, chain, dispose, getDebugLabel, getLabel, redo, setDebugLabel, setLabel |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionReconnectCommand(ConnectionModel conn)
conn
- the connection instance to reconnect (non-null)
java.lang.IllegalArgumentException
- if conn is nullMethod Detail |
---|
public boolean canExecute()
canExecute
in class org.eclipse.gef.commands.Command
public void execute()
execute
in class org.eclipse.gef.commands.Command
public void setNewSource(ShapeModel connectionSource)
Note: Calling this method, deactivates reconnection of the target endpoint. A single instance of this command can only reconnect either the source or the target endpoint.
connectionSource
- a non-null ShapeModel instance, to be used as a new source endpoint
java.lang.IllegalArgumentException
- if connectionSource is nullpublic void setNewTarget(ShapeModel connectionTarget)
Note: Calling this method, deactivates reconnection of the source endpoint. A single instance of this command can only reconnect either the source or the target endpoint.
connectionTarget
- a non-null ShapeModel instance, to be used as a new target endpoint
java.lang.IllegalArgumentException
- if connectionTarget is nullpublic void undo()
undo
in class org.eclipse.gef.commands.Command
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |