javapoint.undo
Class UndoableGraphicObjectAfterChangeProperties

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

public class UndoableGraphicObjectAfterChangeProperties
extends javax.swing.undo.AbstractUndoableEdit

This class defines undo/redo command for the grafic object after changing properties (color, stroke, ...).
The object of this class will be put into undo/redo stack after the graphic object has changed its properties.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
UndoableGraphicObjectAfterChangeProperties(GraphicObject element, java.awt.Color oldFillColor, int oldFillAlpha, java.awt.Color oldLineColor, int oldLineWidth, GraphicObject.LineStyle oldLineStyle)
           
 
Method Summary
 boolean canRedo()
           
 boolean canUndo()
           
 java.lang.String getPresentationName()
           
 void redo()
          Performs redo opeation
Opposite to undo operation => set new properties to graphic object.
 void undo()
          Performs undo opeation
Since it is done just after the graphic object changed properties, undo-operation just sets old properties.
 
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
 

Constructor Detail

UndoableGraphicObjectAfterChangeProperties

public UndoableGraphicObjectAfterChangeProperties(GraphicObject element,
                                                  java.awt.Color oldFillColor,
                                                  int oldFillAlpha,
                                                  java.awt.Color oldLineColor,
                                                  int oldLineWidth,
                                                  GraphicObject.LineStyle oldLineStyle)
Parameters:
element - represents graphic object with updated properties.
oldFillColor -
oldFillAlpha -
oldLineColor -
oldLineWidth -
oldLineStyle -
Method Detail

undo

public final void undo()
                throws javax.swing.undo.CannotUndoException
Performs undo opeation
Since it is done just after the graphic object changed properties, undo-operation just sets old properties.

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

redo

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

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

canUndo

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

canRedo

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

getPresentationName

public final java.lang.String getPresentationName()
Specified by:
getPresentationName in interface javax.swing.undo.UndoableEdit
Overrides:
getPresentationName in class javax.swing.undo.AbstractUndoableEdit