JHotDraw 7.5.1

org.jhotdraw.beans
Class PropertyChangeEdit

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by org.jhotdraw.beans.PropertyChangeEdit
All Implemented Interfaces:
java.io.Serializable, javax.swing.undo.UndoableEdit

public class PropertyChangeEdit
extends javax.swing.undo.AbstractUndoableEdit

An UndoableEdit event which can undo a change of a JavaBeans property.

Version:
$Id: PropertyChangeEdit.java 647 2010-01-24 22:52:59Z rawcoder $
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
PropertyChangeEdit(java.lang.Object source, java.lang.String propertyName, boolean oldValue, boolean newValue)
          Creates a new PropertyChangeEdit.
PropertyChangeEdit(java.lang.Object source, java.lang.String propertyName, char oldValue, char newValue)
          Creates a new PropertyChangeEdit.
PropertyChangeEdit(java.lang.Object source, java.lang.String propertyName, java.lang.Class<T> type, T oldValue, T newValue)
          Creates a new PropertyChangeEdit.
PropertyChangeEdit(java.lang.Object source, java.lang.String propertyName, double oldValue, double newValue)
          Creates a new PropertyChangeEdit.
PropertyChangeEdit(java.lang.Object source, java.lang.String propertyName, float oldValue, float newValue)
          Creates a new PropertyChangeEdit.
PropertyChangeEdit(java.lang.Object source, java.lang.String propertyName, int oldValue, int newValue)
          Creates a new PropertyChangeEdit.
PropertyChangeEdit(java.lang.Object source, java.lang.String propertyName, long oldValue, long newValue)
          Creates a new PropertyChangeEdit.
PropertyChangeEdit(java.lang.Object source, java.lang.String propertyName, java.lang.String oldValue, java.lang.String newValue)
          Creates a new PropertyChangeEdit.
 
Method Summary
 boolean addEdit(javax.swing.undo.UndoableEdit anEdit)
          Adds the specified edit to this one, if it is a PropertyChangeEdit from the same owner and the same property.
 java.lang.String getPresentationName()
          Returns the presentation name of the undoable edit.
protected  java.lang.reflect.Method getSetter()
          Returns the setter for the property.
 void redo()
          Redoes the change.
 void setPresentationName(java.lang.String presentationName)
          Sets the presentation name of the undoable edit.
 java.lang.String toString()
          Returns a string representation of this object useful for debugging.
 void undo()
          Undoes the change.
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
canRedo, canUndo, die, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyChangeEdit

public PropertyChangeEdit(java.lang.Object source,
                          java.lang.String propertyName,
                          java.lang.Class<T> type,
                          T oldValue,
                          T newValue)
Creates a new PropertyChangeEdit.


PropertyChangeEdit

public PropertyChangeEdit(java.lang.Object source,
                          java.lang.String propertyName,
                          boolean oldValue,
                          boolean newValue)
Creates a new PropertyChangeEdit.


PropertyChangeEdit

public PropertyChangeEdit(java.lang.Object source,
                          java.lang.String propertyName,
                          int oldValue,
                          int newValue)
Creates a new PropertyChangeEdit.


PropertyChangeEdit

public PropertyChangeEdit(java.lang.Object source,
                          java.lang.String propertyName,
                          long oldValue,
                          long newValue)
Creates a new PropertyChangeEdit.


PropertyChangeEdit

public PropertyChangeEdit(java.lang.Object source,
                          java.lang.String propertyName,
                          float oldValue,
                          float newValue)
Creates a new PropertyChangeEdit.


PropertyChangeEdit

public PropertyChangeEdit(java.lang.Object source,
                          java.lang.String propertyName,
                          double oldValue,
                          double newValue)
Creates a new PropertyChangeEdit.


PropertyChangeEdit

public PropertyChangeEdit(java.lang.Object source,
                          java.lang.String propertyName,
                          char oldValue,
                          char newValue)
Creates a new PropertyChangeEdit.


PropertyChangeEdit

public PropertyChangeEdit(java.lang.Object source,
                          java.lang.String propertyName,
                          java.lang.String oldValue,
                          java.lang.String newValue)
Creates a new PropertyChangeEdit.

Method Detail

getSetter

protected java.lang.reflect.Method getSetter()
Returns the setter for the property.

Returns:
the setter method.

undo

public void undo()
          throws javax.swing.undo.CannotRedoException
Undoes the change.

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

redo

public void redo()
          throws javax.swing.undo.CannotRedoException
Redoes the change.

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

getPresentationName

public java.lang.String getPresentationName()
Returns the presentation name of the undoable edit. This is the same as the property name, unless you have set a different presentation name.

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

setPresentationName

public void setPresentationName(java.lang.String presentationName)
Sets the presentation name of the undoable edit.


addEdit

public boolean addEdit(javax.swing.undo.UndoableEdit anEdit)
Adds the specified edit to this one, if it is a PropertyChangeEdit from the same owner and the same property.

Specified by:
addEdit in interface javax.swing.undo.UndoableEdit
Overrides:
addEdit in class javax.swing.undo.AbstractUndoableEdit
Parameters:
anEdit - Edit to be added.
Returns:
True if added.

toString

public java.lang.String toString()
Returns a string representation of this object useful for debugging.

Overrides:
toString in class javax.swing.undo.AbstractUndoableEdit

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.