templates.diagram.actions
Class DiagramUndoableEdits.CreateConnectorEdit

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by templates.diagram.actions.AbstractDiagramUndoableEdit
          extended by templates.diagram.actions.DiagramUndoableEdits.CreateConnectorEdit
All Implemented Interfaces:
java.io.Serializable, javax.swing.undo.UndoableEdit
Enclosing class:
DiagramUndoableEdits

public static class DiagramUndoableEdits.CreateConnectorEdit
extends AbstractDiagramUndoableEdit

Edit which does and undoes the creation of a Connector in a TemplateDiagram.

Author:
Lenko Grigorov
See Also:
Serialized Form

Field Summary
protected  Connector connector
          Holds the new Connector once it is created.
protected  TemplateDiagram diagram
          The TemplateDiagram where the Connector should be created.
protected  Entity left
          The first Entity to be linked.
protected  Entity right
          The second Entity to be linked.
 
Fields inherited from class templates.diagram.actions.AbstractDiagramUndoableEdit
usePluralDescription
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
DiagramUndoableEdits.CreateConnectorEdit(TemplateDiagram diagram, Entity left, Entity right)
          Constructs an edit with the given parameters.
 
Method Summary
 boolean canRedo()
           
 boolean canUndo()
           
 Connector getConnector()
          Retrieves the Connector created by the edit.
 java.lang.String getPresentationName()
          Returns the name that should be displayed besides the Undo/Redo menu items, so the user knows which action will be undone/redone.
 void redo()
          Has to be called once after the instantiation of the edit, in order to enact it.
 void undo()
           
 
Methods inherited from class templates.diagram.actions.AbstractDiagramUndoableEdit
setLastOfMultiple
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
addEdit, die, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

diagram

protected TemplateDiagram diagram
The TemplateDiagram where the Connector should be created.


left

protected Entity left
The first Entity to be linked.

A connector is symmetric. "Left" and "right" are used only to enable addressing the two linked entities separately.


right

protected Entity right
The second Entity to be linked.

A connector is symmetric. "Left" and "right" are used only to enable addressing the two linked entities separately.


connector

protected Connector connector
Holds the new Connector once it is created.

Constructor Detail

DiagramUndoableEdits.CreateConnectorEdit

public DiagramUndoableEdits.CreateConnectorEdit(TemplateDiagram diagram,
                                                Entity left,
                                                Entity right)
Constructs an edit with the given parameters.

A connector is symmetric. "Left" and "right" are used only to enable addressing the two linked entities separately.

Parameters:
diagram - the TemplateDiagram where the Connector should be created
left - the first Entity to be linked
right - the second Entity to be linked
Method Detail

getConnector

public Connector getConnector()
Retrieves the Connector created by the edit.

Returns:
the Connector created by the edit

redo

public void redo()
          throws javax.swing.undo.CannotRedoException
Has to be called once after the instantiation of the edit, in order to enact it.

Specified by:
redo in interface javax.swing.undo.UndoableEdit
Overrides:
redo in class javax.swing.undo.AbstractUndoableEdit
Throws:
javax.swing.undo.CannotRedoException

undo

public void undo()
          throws javax.swing.undo.CannotUndoException
Specified by:
undo in interface javax.swing.undo.UndoableEdit
Overrides:
undo in class javax.swing.undo.AbstractUndoableEdit
Throws:
javax.swing.undo.CannotUndoException

canUndo

public boolean canUndo()
Specified by:
canUndo in interface javax.swing.undo.UndoableEdit
Overrides:
canUndo in class javax.swing.undo.AbstractUndoableEdit

canRedo

public boolean canRedo()
Specified by:
canRedo in interface javax.swing.undo.UndoableEdit
Overrides:
canRedo in class javax.swing.undo.AbstractUndoableEdit

getPresentationName

public java.lang.String getPresentationName()
Returns the name that should be displayed besides the Undo/Redo menu items, so the user knows which action will be undone/redone.

Specified by:
getPresentationName in interface javax.swing.undo.UndoableEdit
Overrides:
getPresentationName in class javax.swing.undo.AbstractUndoableEdit