dsto.dfc.swing.undo
Class MonitoredEditGroup

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by dsto.dfc.swing.undo.MonitoredEditGroup
All Implemented Interfaces:
Serializable, UndoableEdit

public class MonitoredEditGroup
extends AbstractUndoableEdit

Groups a number of edits. Design driver is to allow edits executed as part of an InVision process to be grouped together, but could be used for many organisational purposes.

Version:
$Revision$
Author:
Peter J Smet, Derek Weber
See Also:
Serialized Form

Field Summary
static Icon ICON
           
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
MonitoredEditGroup()
          Constructor for bean serialisation.
MonitoredEditGroup(EditListModel list)
           
MonitoredEditGroup(EditListModel list, String name)
          Creates a MonitoredEditGroup with the name name with the UndoableEdits in list.
MonitoredEditGroup(String name)
           
 
Method Summary
 boolean addEdit(UndoableEdit edit)
          Add an edit to the group.
 void die()
          Indicates that this edit is no longer required and subsequently cannot be used.
 void end()
          Prevents the further additions of UndoableEdits to this MonitoredEditGroup.
 UndoableEdit getEdit(int index)
          Accesses the UndoableEdit at the indexth position.
 int getEditCount()
          Access method for the number of edits held in the MonitoredEditGroup at this time.
 List getEdits()
          Access method for the edit list.
 Icon getIcon()
           
 String getName()
          Access method for the name property.
 String getPresentationName()
           
 String getRedoPresentationName()
           
 String getUndoPresentationName()
           
 boolean isInProgress()
          Returns true if UndoableEdits can still be added to this MonitoredEditGroup and false otherwise.
 boolean isSignificant()
          Returns true if any of its component edits are significant.
protected  boolean mergedEditWithLastEdit(UndoableEdit edit)
          Attempts to merge edit with the last edit.
 void redo()
          Currently invokes UndoableEdit.redo() on each component UndoableEdit in order.
 void setName(String newName)
          Sets the value of the name property.
 void undo()
          Currently invokes UndoableEdit.undo() on each component UndoableEdit in reverse order.
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
canRedo, canUndo, replaceEdit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ICON

public static Icon ICON
Constructor Detail

MonitoredEditGroup

public MonitoredEditGroup()
Constructor for bean serialisation.


MonitoredEditGroup

public MonitoredEditGroup(String name)

MonitoredEditGroup

public MonitoredEditGroup(EditListModel list)

MonitoredEditGroup

public MonitoredEditGroup(EditListModel list,
                          String name)
Creates a MonitoredEditGroup with the name name with the UndoableEdits in list.

Method Detail

end

public void end()
Prevents the further additions of UndoableEdits to this MonitoredEditGroup.


isInProgress

public boolean isInProgress()
Returns true if UndoableEdits can still be added to this MonitoredEditGroup and false otherwise.


isSignificant

public boolean isSignificant()
Returns true if any of its component edits are significant.

Specified by:
isSignificant in interface UndoableEdit
Overrides:
isSignificant in class AbstractUndoableEdit

undo

public void undo()
Currently invokes UndoableEdit.undo() on each component UndoableEdit in reverse order.

Specified by:
undo in interface UndoableEdit
Overrides:
undo in class AbstractUndoableEdit

redo

public void redo()
Currently invokes UndoableEdit.redo() on each component UndoableEdit in order.

Specified by:
redo in interface UndoableEdit
Overrides:
redo in class AbstractUndoableEdit

mergedEditWithLastEdit

protected boolean mergedEditWithLastEdit(UndoableEdit edit)
Attempts to merge edit with the last edit.


addEdit

public boolean addEdit(UndoableEdit edit)
Add an edit to the group.

Specified by:
addEdit in interface UndoableEdit
Overrides:
addEdit in class AbstractUndoableEdit

die

public void die()
Indicates that this edit is no longer required and subsequently cannot be used.

Specified by:
die in interface UndoableEdit
Overrides:
die in class AbstractUndoableEdit

getName

public String getName()
Access method for the name property.

Returns:
The current value of the name property.

setName

public void setName(String newName)
Sets the value of the name property.

Parameters:
newName - The new value of the name property

getEdits

public List getEdits()
Access method for the edit list.

Returns:
The current value of the edits property

getEditCount

public int getEditCount()
Access method for the number of edits held in the MonitoredEditGroup at this time.

Returns:
The number of edits held.

getEdit

public UndoableEdit getEdit(int index)
                     throws IndexOutOfBoundsException
Accesses the UndoableEdit at the indexth position.

Throws:
IndexOutOfBoundsException - If the index is not within the valid range.

getPresentationName

public String getPresentationName()
Specified by:
getPresentationName in interface UndoableEdit
Overrides:
getPresentationName in class AbstractUndoableEdit

getUndoPresentationName

public String getUndoPresentationName()
Specified by:
getUndoPresentationName in interface UndoableEdit
Overrides:
getUndoPresentationName in class AbstractUndoableEdit

getRedoPresentationName

public String getRedoPresentationName()
Specified by:
getRedoPresentationName in interface UndoableEdit
Overrides:
getRedoPresentationName in class AbstractUndoableEdit

getIcon

public Icon getIcon()


Copyright © 2008 Commonwealth of Australia