javapoint.undo
Class UndoableGraphicObjectAfterResize

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javapoint.undo.UndoableGraphicObjectAfterResize
All Implemented Interfaces:
java.io.Serializable, javax.swing.undo.UndoableEdit

public class UndoableGraphicObjectAfterResize
extends javax.swing.undo.AbstractUndoableEdit

This class defines undo/redo command for the grafic object after resizing.
The object of this class will be put into undo/redo stack after the graphic object has been resized.

See Also:
Serialized Form

Field Summary
protected  GraphicObject element
           
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
UndoableGraphicObjectAfterResize(GraphicObject element, java.awt.Rectangle oldBounds, java.awt.Polygon oldPolygon, Line oldLine)
           
 
Method Summary
 boolean canRedo()
           
 boolean canUndo()
           
 java.lang.String getPresentationName()
           
 void redo()
          Performs redo operation
Opposite to undo operation => set graphic object to new bounds.
 void undo()
          Performs undo operation
Since it is done just after the graphic object has been resized, undo-operation just returns it to old bounds.
 
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

element

protected GraphicObject element
Constructor Detail

UndoableGraphicObjectAfterResize

public UndoableGraphicObjectAfterResize(GraphicObject element,
                                        java.awt.Rectangle oldBounds,
                                        java.awt.Polygon oldPolygon,
                                        Line oldLine)
Parameters:
element - represents graphic object with updated bounds.
oldBounds - represents old bounds of graphic object before resizing.
Method Detail

undo

public void undo()
          throws javax.swing.undo.CannotUndoException
Performs undo operation
Since it is done just after the graphic object has been resized, undo-operation just returns it to old bounds.

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

redo

public void redo()
          throws javax.swing.undo.CannotRedoException
Performs redo operation
Opposite to undo operation => set graphic object to new bounds.

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

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()
Specified by:
getPresentationName in interface javax.swing.undo.UndoableEdit
Overrides:
getPresentationName in class javax.swing.undo.AbstractUndoableEdit