JHotDraw 6.0b1

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.


Constructor Summary
UndoableAdapter(DrawingView newDrawingView)
           
 
Method Summary
protected  void duplicateAffectedFigures()
          Create new set of affected figures for redo operation because deleting figures in an undo operation makes them unusable Especially contained figures have been removed from their observing container like CompositeFigure or DecoratorFigure.
 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
protected  void rememberFigures(FigureEnumeration toBeRemembered)
           
 void setAffectedFigures(FigureEnumeration newAffectedFigures)
           
protected  void setDrawingView(DrawingView newDrawingView)
           
 void setRedoable(boolean newIsRedoable)
           
 void setUndoable(boolean newIsUndoable)
           
 boolean undo()
          Undo the activity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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

rememberFigures

protected void rememberFigures(FigureEnumeration toBeRemembered)

release

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

Specified by:
release in interface Undoable

duplicateAffectedFigures

protected void duplicateAffectedFigures()
Create new set of affected figures for redo operation because deleting figures in an undo operation makes them unusable Especially contained figures have been removed from their observing container like CompositeFigure or DecoratorFigure. Duplicating these figures re-establishes the dependencies.


getDrawingView

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

setDrawingView

protected void setDrawingView(DrawingView newDrawingView)

JHotDraw 6.0b1