kaapo.projectmanager.command
Class AddConnectionEdit
java.lang.Object
javax.swing.undo.AbstractUndoableEdit
kaapo.projectmanager.command.AbstractUndoableEdit
kaapo.projectmanager.command.AddConnectionEdit
- All Implemented Interfaces:
- Serializable, UndoableEdit
public class AddConnectionEdit
- extends AbstractUndoableEdit
An Edit that adds a Connection to a visible
Diagram.
- Author:
- hprajani, hkovaska
- See Also:
- Serialized Form
AddConnectionEdit
public AddConnectionEdit(Class componentType,
Point2D startPoint,
Point2D endPoint,
DiagramComponentWrapper startComponent,
DiagramComponentWrapper endComponent)
- constructs an edit that adds a connection with defined start- and endcomponents
and the points user has clicked on when choosing them.
- Parameters:
componentType - type of the connectionstartPoint - first clicked pointendPoint - second clicked pointstartComponent - component the connection comes outendComponent - component the connection plugs into
AddConnectionEdit
public AddConnectionEdit(Class componentType,
Point2D point)
- constructs an edit that adds a connection with default form and no connected
components.
- Parameters:
componentType - type of the connectionpoint - where the connection is created to
undo
public void undo()
- Undos the Edit.
- Specified by:
undo in interface UndoableEdit- Overrides:
undo in class AbstractUndoableEdit
- See Also:
UndoableEdit.undo()
redo
public void redo()
- Redos the edit.
- Specified by:
redo in interface UndoableEdit- Overrides:
redo in class AbstractUndoableEdit
- See Also:
UndoableEdit.redo()
execute
public void execute(ProjectManager pm)
throws EditFailedException
- Creates a new
Connection and adds it to both the
Project and to the visible Diagram.
- Specified by:
execute in class AbstractUndoableEdit
- Parameters:
pm - the enviroment where the Edit is executed in.
- Throws:
EditFailedException - thrown when instantiating the connection fails- See Also:
AbstractUndoableEdit.execute(ProjectManager)
canUndo
public boolean canUndo()
- Specified by:
canUndo in interface UndoableEdit- Overrides:
canUndo in class AbstractUndoableEdit
- See Also:
UndoableEdit.canUndo()
canRedo
public boolean canRedo()
- Specified by:
canRedo in interface UndoableEdit- Overrides:
canRedo in class AbstractUndoableEdit
- See Also:
UndoableEdit.canRedo()