kaapo.projectmanager.command
Class ChangeDiagramNameEdit

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by kaapo.projectmanager.command.AbstractUndoableEdit
          extended by kaapo.projectmanager.command.ChangeDiagramNameEdit
All Implemented Interfaces:
Serializable, UndoableEdit

public class ChangeDiagramNameEdit
extends AbstractUndoableEdit

This UndoableEdit is used to change either a visible Diagram's or another Diagram's name.

Author:
paltamaa
See Also:
Serialized Form

Field Summary
 
Fields inherited from class kaapo.projectmanager.command.AbstractUndoableEdit
pm, visibleDiagram
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
ChangeDiagramNameEdit(Diagram diagram, String name)
          Constructs an edit that renames diagram.
ChangeDiagramNameEdit(String name)
          Constructs an edit that renames visible diagram.
 
Method Summary
 boolean canRedo()
           
 boolean canUndo()
           
 void execute(ProjectManager pm)
          Stores the original name and sets the new one
 void redo()
           
 void undo()
           
 
Methods inherited from class kaapo.projectmanager.command.AbstractUndoableEdit
changeCorrectVisibleDiagram
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
addEdit, die, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChangeDiagramNameEdit

public ChangeDiagramNameEdit(String name)
Constructs an edit that renames visible diagram.

Parameters:
name - new name

ChangeDiagramNameEdit

public ChangeDiagramNameEdit(Diagram diagram,
                             String name)
Constructs an edit that renames diagram.

Parameters:
diagram - diagram to rename
name - new name
Method Detail

execute

public void execute(ProjectManager pm)
             throws EditFailedException
Stores the original name and sets the new one

Specified by:
execute in class AbstractUndoableEdit
Parameters:
pm - the enviroment where the Edit is executed in.
Throws:
EditFailedException - if the edit fails for some reason
See Also:
AbstractUndoableEdit.execute(ProjectManager)

redo

public void redo()
          throws CannotRedoException
Specified by:
redo in interface UndoableEdit
Overrides:
redo in class AbstractUndoableEdit
Throws:
CannotRedoException
See Also:
AbstractUndoableEdit.redo()

undo

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

canRedo

public boolean canRedo()
Specified by:
canRedo in interface UndoableEdit
Overrides:
canRedo in class AbstractUndoableEdit
See Also:
AbstractUndoableEdit.canRedo()

canUndo

public boolean canUndo()
Specified by:
canUndo in interface UndoableEdit
Overrides:
canUndo in class AbstractUndoableEdit
See Also:
AbstractUndoableEdit.canUndo()