org.jhotdraw.util
Class UndoableAdapter

java.lang.Object
  extended by org.jhotdraw.util.UndoableAdapter
All Implemented Interfaces:
Undoable
Direct Known Subclasses:
AlignCommand.UndoActivity, BorderTool.UndoActivity, ChangeAttributeCommand.UndoActivity, ChangeConnectionHandle.UndoActivity, ConnectionTool.UndoActivity, CutCommand.UndoActivity, DeleteCommand.UndoActivity, DragTracker.UndoActivity, FontSizeHandle.UndoActivity, GroupCommand.UndoActivity, InsertImageCommand.UndoActivity, JHDDragSourceListener.RemoveUndoActivity, JHDDropTargetListener.AddUndoActivity, PasteCommand.UndoActivity, PolyLineHandle.UndoActivity, SelectAllCommand.UndoActivity, SendToBackCommand.UndoActivity, TextAreaTool.UndoActivity, TextTool.UndoActivity, UngroupCommand.UndoActivity

public class UndoableAdapter
extends java.lang.Object
implements Undoable

Most basic implementation for an Undoable activity. Subclasses should override methods to provide specialized behaviour when necessary.

Version:
<$CURRENT_VERSION$>
Author:
Wolfram Kaiser

Constructor Summary
UndoableAdapter(DrawingView newDrawingView)
           
 
Method Summary
 FigureEnumeration getAffectedFigures()
           
 int getAffectedFiguresCount()
           
 FigureEnumeration getAffectedFiguresReversed()
           
 DrawingView getDrawingView()
           
 boolean isRedoable()
           
 boolean isUndoable()
           
 boolean redo()
          Redo the activity
 void release()
          Releases all resources related to an undoable activity
 void setAffectedFigures(FigureEnumeration newAffectedFigures)
           
 void setRedoable(boolean newIsRedoable)
           
 void setUndoable(boolean newIsUndoable)
           
 boolean undo()
          Undo the activity
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UndoableAdapter

public UndoableAdapter(DrawingView newDrawingView)
Method Detail

undo

public boolean undo()
Undo the activity

Specified by:
undo in interface Undoable
Returns:
true if the activity could be undone, false otherwise

redo

public boolean redo()
Redo the activity

Specified by:
redo in interface Undoable
Returns:
true if the activity could be redone, false otherwise

isUndoable

public boolean isUndoable()
Specified by:
isUndoable in interface Undoable

setUndoable

public void setUndoable(boolean newIsUndoable)
Specified by:
setUndoable in interface Undoable

isRedoable

public boolean isRedoable()
Specified by:
isRedoable in interface Undoable

setRedoable

public void setRedoable(boolean newIsRedoable)
Specified by:
setRedoable in interface Undoable

setAffectedFigures

public void setAffectedFigures(FigureEnumeration newAffectedFigures)
Specified by:
setAffectedFigures in interface Undoable

getAffectedFigures

public FigureEnumeration getAffectedFigures()
Specified by:
getAffectedFigures in interface Undoable

getAffectedFiguresReversed

public FigureEnumeration getAffectedFiguresReversed()

getAffectedFiguresCount

public int getAffectedFiguresCount()
Specified by:
getAffectedFiguresCount in interface Undoable

release

public void release()
Releases all resources related to an undoable activity

Specified by:
release in interface Undoable

getDrawingView

public DrawingView getDrawingView()
Specified by:
getDrawingView in interface Undoable