This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing.undo
class AbstractUndoableEdit

java.lang.Object extended by javax.swing.undo.AbstractUndoableEdit
All Implemented Interfaces:
Serializable, UndoableEdit
Direct Known Subclasses:
AbstractDocument.ElementEdit, CompoundEdit, DefaultStyledDocument.AttributeUndoableEdit, StateEdit

public class AbstractUndoableEdit
extends Object
implements UndoableEdit, Serializable

An abstract implementation of UndoableEdit, implementing simple responses to all boolean methods in that interface.


Field Summary
protected static String RedoName
          String returned by getRedoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used.
protected static String UndoName
          String returned by getUndoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used.
 
Constructor Summary

          Creates an AbstractUndoableEdit which defaults hasBeenDone and alive to true.
 
Method Summary
 boolean

          This default implementation returns false.
 boolean

          Returns true if this edit is alive and hasBeenDone is false.
 boolean

          Returns true if this edit is alive and hasBeenDone is true.
 void
die()

          Sets alive to false.
 String

          This default implementation returns "".
 String

          Retreives the value from the defaults table with key AbstractUndoableEdit.redoText and returns that value followed by a space, followed by getPresentationName.
 String

          Retreives the value from the defaults table with key AbstractUndoableEdit.undoText and returns that value followed by a space, followed by getPresentationName.
 boolean

          This default implementation returns true.
 void

          Throws CannotRedoException if canRedo returns false.
 boolean

          This default implementation returns false.
 String

          Returns a string that displays and identifies this object's properties.
 void

          Throws CannotUndoException if canUndo returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RedoName

protected static final String RedoName
String returned by getRedoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used. This value is now localized and comes from the defaults table with key AbstractUndoableEdit.redoText.

UndoName

protected static final String UndoName
String returned by getUndoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used. This value is now localized and comes from the defaults table with key AbstractUndoableEdit.undoText.
Constructor Detail

AbstractUndoableEdit

public AbstractUndoableEdit()
Creates an AbstractUndoableEdit which defaults hasBeenDone and alive to true.

Method Detail

addEdit

public boolean addEdit(UndoableEdit anEdit)
This default implementation returns false.

Parameters:
anEdit - the edit to be added
Returns:
false

canRedo

public boolean canRedo()
Returns true if this edit is alive and hasBeenDone is false.

Returns:
true if this edit is alive and hasBeenDone is false

canUndo

public boolean canUndo()
Returns true if this edit is alive and hasBeenDone is true.

Returns:
true if this edit is alive and hasBeenDone is true

die

public void die()
Sets alive to false. Note that this is a one way operation; dead edits cannot be resurrected. Sending undo or redo to a dead edit results in an exception being thrown.

Typically an edit is killed when it is consolidated by another edit's addEdit or replaceEdit method, or when it is dequeued from an UndoManager.


getPresentationName

public String getPresentationName()
This default implementation returns "". Used by getUndoPresentationName and getRedoPresentationName to construct the strings they return. Subclasses should override to return an appropriate description of the operation this edit represents.

Returns:
the empty string ""

getRedoPresentationName

public String getRedoPresentationName()
Retreives the value from the defaults table with key AbstractUndoableEdit.redoText and returns that value followed by a space, followed by getPresentationName. If getPresentationName returns "", then the defaults value is returned alone.

Returns:
the value from the defaults table with key AbstractUndoableEdit.redoText, followed by a space, followed by getPresentationName unless getPresentationName is "" in which case, the defaults value is returned alone.

getUndoPresentationName

public String getUndoPresentationName()
Retreives the value from the defaults table with key AbstractUndoableEdit.undoText and returns that value followed by a space, followed by getPresentationName. If getPresentationName returns "", then the defaults value is returned alone.

Returns:
the value from the defaults table with key AbstractUndoableEdit.undoText, followed by a space, followed by getPresentationName unless getPresentationName is "" in which case, the defaults value is returned alone.

isSignificant

public boolean isSignificant()
This default implementation returns true.

Returns:
true

redo

public void redo()
          throws CannotRedoException
Throws CannotRedoException if canRedo returns false. Sets hasBeenDone to true. Subclasses should override to redo the operation represented by this edit. Override should begin with a call to super.

Throws:
CannotRedoException - if canRedo returns false

replaceEdit

public boolean replaceEdit(UndoableEdit anEdit)
This default implementation returns false.

Parameters:
anEdit - the edit to replace
Returns:
false

toString

public String toString()
Returns a string that displays and identifies this object's properties.

Overrides:
toString in class Object
Returns:
a String representation of this object

undo

public void undo()
          throws CannotUndoException
Throws CannotUndoException if canUndo returns false. Sets hasBeenDone to false. Subclasses should override to undo the operation represented by this edit. Override should begin with a call to super.

Throws:
CannotUndoException - if canUndo returns false


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.