FreeHEP API
Version current

org.freehep.swing.undo
Class AnimatedCompoundEdit

java.lang.Object
  extended byjavax.swing.undo.AbstractUndoableEdit
      extended byjavax.swing.undo.CompoundEdit
          extended byorg.freehep.swing.undo.AnimatedCompoundEdit
All Implemented Interfaces:
DoableEdit, LinkableEdit, Serializable, UndoableEdit

public class AnimatedCompoundEdit
extends CompoundEdit
implements DoableEdit, LinkableEdit

Version:
$Id: AnimatedCompoundEdit.java,v 1.5 2005/03/11 05:28:42 duns Exp $
Author:
Mark Donszelmann
See Also:
Serialized Form
Source Code:
AnimatedCompoundEdit.java

Field Summary
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
AnimatedCompoundEdit()
          Create an AnimatedCompoundEdit that still needs to be "(re)done".
AnimatedCompoundEdit(boolean done)
           
AnimatedCompoundEdit(String name)
           
AnimatedCompoundEdit(String name, boolean done)
          Create an AnimatedCompoundEdit that can be in either "done" or "undone" state.
 
Method Summary
 boolean addEdit(LinkableEdit edit)
          If this edit is inProgress, accepts anEdit and returns true.
 boolean addEdit(UndoableEdit edit)
          Returns false since only LinkableEdits can be added.
 boolean canRedo()
          Returns false if isInProgress.
 boolean canUndo()
          Returns false if isInProgress.
 void die()
          Sends die to each subedit, in the reverse of the order that they were added.
 void end()
          Sets inProgress to false.
 LinkableEdit getFirstEdit()
           
 LinkableEdit getLastEdit()
           
 String getName()
          Returns name (if set).
 LinkableEdit getNextEdit()
          Returns the next edit.
 LinkableEdit getParent()
          Returns the parent.
 String getPresentationName()
          Returns getPresentationName from the last LinkableEdit added.
 LinkableEdit getPreviousEdit()
          Returns the previous edit.
 String getRedoPresentationName()
          Returns getRedoPresentationName from the last LinkableEdit added.
 String getUndoPresentationName()
          Returns getUndoPresentationName from the last LinkableEdit added.
 boolean isInProgress()
          Returns true if this edit is in progress--that is, it has not received end.
 boolean isSignificant()
          Returns true if any of the LinkableEdits in edits do.
protected  UndoableEdit lastEdit()
          Returns the last LinkableEdit, or null.
 void redo()
          Sends redo to all contained LinkableEdits in the order in which they were added.
 void setNextEdit(LinkableEdit edit)
          Connects to the next edit.
 void setParent(LinkableEdit parent)
          Sets the parent, can only be called once.
 void setPreviousEdit(LinkableEdit edit)
          Connext to the previous edit.
 String toString()
          Returns a string that displays and identifies this object's properties.
 void undo()
          Sends undo to all contained LinkableEdits in the reverse of the order in which they were added.
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.undo.UndoableEdit
replaceEdit
 

Constructor Detail

AnimatedCompoundEdit

public AnimatedCompoundEdit()
Create an AnimatedCompoundEdit that still needs to be "(re)done".


AnimatedCompoundEdit

public AnimatedCompoundEdit(String name)

AnimatedCompoundEdit

public AnimatedCompoundEdit(boolean done)

AnimatedCompoundEdit

public AnimatedCompoundEdit(String name,
                            boolean done)
Create an AnimatedCompoundEdit that can be in either "done" or "undone" state.

Method Detail

getParent

public LinkableEdit getParent()
Description copied from interface: LinkableEdit
Returns the parent.

Specified by:
getParent in interface LinkableEdit

setParent

public void setParent(LinkableEdit parent)
Description copied from interface: LinkableEdit
Sets the parent, can only be called once.

Specified by:
setParent in interface LinkableEdit

getFirstEdit

public LinkableEdit getFirstEdit()

getLastEdit

public LinkableEdit getLastEdit()

getNextEdit

public LinkableEdit getNextEdit()
Description copied from interface: LinkableEdit
Returns the next edit.

Specified by:
getNextEdit in interface LinkableEdit

setNextEdit

public void setNextEdit(LinkableEdit edit)
Description copied from interface: LinkableEdit
Connects to the next edit.

Specified by:
setNextEdit in interface LinkableEdit

getPreviousEdit

public LinkableEdit getPreviousEdit()
Description copied from interface: LinkableEdit
Returns the previous edit.

Specified by:
getPreviousEdit in interface LinkableEdit

setPreviousEdit

public void setPreviousEdit(LinkableEdit edit)
Description copied from interface: LinkableEdit
Connext to the previous edit.

Specified by:
setPreviousEdit in interface LinkableEdit

undo

public void undo()
          throws CannotUndoException
Sends undo to all contained LinkableEdits in the reverse of the order in which they were added.

Specified by:
undo in interface UndoableEdit
Throws:
CannotUndoException

redo

public void redo()
          throws CannotRedoException
Sends redo to all contained LinkableEdits in the order in which they were added.

Specified by:
redo in interface UndoableEdit
Throws:
CannotRedoException

lastEdit

protected UndoableEdit lastEdit()
Returns the last LinkableEdit, or null.


die

public void die()
Sends die to each subedit, in the reverse of the order that they were added.

Specified by:
die in interface UndoableEdit

addEdit

public boolean addEdit(UndoableEdit edit)
Returns false since only LinkableEdits can be added.

Specified by:
addEdit in interface UndoableEdit

addEdit

public boolean addEdit(LinkableEdit edit)
If this edit is inProgress, accepts anEdit and returns true.

The last edit added to this CompoundEdit is given a chance to addEdit(anEdit). If it refuses (returns false), anEdit is given a chance to replaceEdit the last edit. If anEdit returns false here, it is added to edits.

Parameters:
edit - the edit to be added
Returns:
true if the edit is inProgress; otherwise returns false

end

public void end()
Sets inProgress to false.

See Also:
canUndo(), canRedo()

canUndo

public boolean canUndo()
Returns false if isInProgress.

Specified by:
canUndo in interface UndoableEdit
See Also:
isInProgress()

canRedo

public boolean canRedo()
Returns false if isInProgress.

Specified by:
canRedo in interface UndoableEdit
See Also:
isInProgress()

isInProgress

public boolean isInProgress()
Returns true if this edit is in progress--that is, it has not received end. This generally means that edits are still being added to it.

See Also:
end()

isSignificant

public boolean isSignificant()
Returns true if any of the LinkableEdits in edits do. Returns false if they all return false.

Specified by:
isSignificant in interface UndoableEdit

getName

public String getName()
Returns name (if set).


getPresentationName

public String getPresentationName()
Returns getPresentationName from the last LinkableEdit added. If this edit is empty, calls super.

Specified by:
getPresentationName in interface UndoableEdit

getUndoPresentationName

public String getUndoPresentationName()
Returns getUndoPresentationName from the last LinkableEdit added. If edit is empty, calls super.

Specified by:
getUndoPresentationName in interface UndoableEdit

getRedoPresentationName

public String getRedoPresentationName()
Returns getRedoPresentationName from the last LinkableEdit added. If edit is empty, calls super.

Specified by:
getRedoPresentationName in interface UndoableEdit

toString

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

Returns:
a String representation of this object

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.