org.malai.instrument.library
Class UndoRedoManager

java.lang.Object
  extended by org.malai.instrument.Instrument
      extended by org.malai.instrument.WidgetInstrument
          extended by org.malai.instrument.library.UndoRedoManager
All Implemented Interfaces:
ActionHandler, Preferenciable, Modifiable, Reinitialisable, UndoHandler

public class UndoRedoManager
extends WidgetInstrument

This instrument allows to undo and redo saved actions.

This file is part of libMalai.
Copyright (c) 2009-2012 Arnaud BLOUIN

libMalan is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

libMalan is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Since:
0.1
Version:
0.2
Author:
Arnaud BLOUIN

Field Summary
protected  MButton redoB
          The button used to redo actions.
protected  MButton undoB
          The button used to undo actions.
 
Fields inherited from class org.malai.instrument.WidgetInstrument
composer
 
Fields inherited from class org.malai.instrument.Instrument
activated, eventables, links, modified
 
Constructor Summary
UndoRedoManager(UIComposer<?> composer)
          Creates the instrument.
 
Method Summary
 MButton getRedoB()
           
 MButton getUndoB()
           
protected  void initialiseLinks()
          Initialises the links of the instrument.
protected  void initialiseWidgets()
          Initialises the widgets of the instrument.
 void onUndoableAdded(Undoable undoable)
          Actions to do when an undoable object is added to the undo register.
 void onUndoableRedo(Undoable undoable)
          Actions to do when an undoable object is redone.
 void onUndoableUndo(Undoable undoable)
          Actions to do when an undoable object is undone.
 void setActivated(boolean activated)
          Activates or deactivates the instrument.
 void updateWidgets()
          Updates the widgets of the instrument.
 
Methods inherited from class org.malai.instrument.WidgetInstrument
getComposer, setActivated
 
Methods inherited from class org.malai.instrument.Instrument
addEventable, addLink, clearEvents, getLinks, getSizeLinks, hasLinks, interimFeedback, isActivated, isModified, load, onActionAborted, onActionAdded, onActionCancelled, onActionDone, onActionExecuted, reinit, removeLink, save, setModified
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

undoB

protected MButton undoB
The button used to undo actions.


redoB

protected MButton redoB
The button used to redo actions.

Constructor Detail

UndoRedoManager

public UndoRedoManager(UIComposer<?> composer)
Creates the instrument.

Parameters:
composer - The composer that compose the widgets provided by this instrument.
Since:
0.1
Method Detail

initialiseWidgets

protected void initialiseWidgets()
Description copied from class: WidgetInstrument
Initialises the widgets of the instrument.

Specified by:
initialiseWidgets in class WidgetInstrument

initialiseLinks

protected void initialiseLinks()
Description copied from class: Instrument
Initialises the links of the instrument.

Specified by:
initialiseLinks in class Instrument

getUndoB

public MButton getUndoB()
Returns:
The button used to undo actions.
Since:
0.1

getRedoB

public MButton getRedoB()
Returns:
The button used to redo actions.
Since:
0.1

updateWidgets

public void updateWidgets()
Updates the widgets of the instrument.

Since:
0.2

setActivated

public void setActivated(boolean activated)
Description copied from class: Instrument
Activates or deactivates the instrument.

Overrides:
setActivated in class Instrument
Parameters:
activated - True = activation.

onUndoableAdded

public void onUndoableAdded(Undoable undoable)
Description copied from interface: UndoHandler
Actions to do when an undoable object is added to the undo register.

Specified by:
onUndoableAdded in interface UndoHandler
Overrides:
onUndoableAdded in class Instrument
Parameters:
undoable - The undoable object added to the undo register.

onUndoableUndo

public void onUndoableUndo(Undoable undoable)
Description copied from interface: UndoHandler
Actions to do when an undoable object is undone.

Specified by:
onUndoableUndo in interface UndoHandler
Overrides:
onUndoableUndo in class Instrument
Parameters:
undoable - The undone object.

onUndoableRedo

public void onUndoableRedo(Undoable undoable)
Description copied from interface: UndoHandler
Actions to do when an undoable object is redone.

Specified by:
onUndoableRedo in interface UndoHandler
Overrides:
onUndoableRedo in class Instrument
Parameters:
undoable - The redone object.