org.pietschy.command.demo.undo
Class SimpleUndoToggle

java.lang.Object
  extended by org.pietschy.command.Command
      extended by org.pietschy.command.ActionCommand
          extended by org.pietschy.command.ToggleCommand
              extended by org.pietschy.command.undo.UndoableToggleCommand
                  extended by org.pietschy.command.demo.undo.SimpleUndoToggle
All Implemented Interfaces:
ActionCommandExecutor, UndoableEventSource

public class SimpleUndoToggle
extends UndoableToggleCommand

Created by IntelliJ IDEA. User: andrewp Date: 11/04/2004 Time: 14:34:50 To change this template use Options | File Templates.


Field Summary
 
Fields inherited from class org.pietschy.command.ActionCommand
HINT_ACTION_EVENT, HINT_INVOKER, HINT_INVOKER_WINDOW, HINT_MODIFIERS
 
Fields inherited from class org.pietschy.command.Command
internalLog, listenerList, pcs
 
Constructor Summary
SimpleUndoToggle(java.lang.String commandId, javax.swing.JTextPane textPane)
           
 
Method Summary
protected  javax.swing.undo.UndoableEdit performEdit(boolean selected)
          Subclasses must override to perform the actual edit.
 
Methods inherited from class org.pietschy.command.undo.UndoableToggleCommand
addUndoableEditListener, getUndoableEditListeners, handleSelection, postEdit, removeUndoableEditListener
 
Methods inherited from class org.pietschy.command.ToggleCommand
addNotify, applySelection, attemptSelection, configureButtonStates, createButton, createCheckBox, createCheckBox, createCheckBox, createCheckBox, createMenuItem, handleExecute, isSelected, removeNotify, requestDefautIn, setSelected
 
Methods inherited from class org.pietschy.command.ActionCommand
addCommandListener, addInterceptor, areEqual, attach, detach, execute, execute, getActionAdapter, getActionAdapter, getActionCommand, getActionEvent, getHint, getHint, getHints, getInvoker, getInvokerWindow, getModifiers, installShortCut, installShortCut, postExecute, preExecute, putHint, putHints, removeCommandListener, removeInterceptor, setActionCommand, uninstallShortCut, uninstallShortCut
 
Methods inherited from class org.pietschy.command.Command
addFace, addHoverListener, addNewFace, addPropertyChangeListener, addPropertyChangeListener, buttonIterator, configureButtonAppearance, configureButtonAppearances, configureButtonAppearances, createButton, createButton, createButton, createMenuItem, createMenuItem, createMenuItem, export, faceExists, fireHoverEnded, fireHoverStarted, getAccelerator, getAlternativeFaceNames, getButtonFactory, getButtonIn, getCommandManager, getDefaultFace, getDefaultFace, getDescription, getFace, getFace, getIcon, getId, getLongDescription, getMenuFactory, getMnemonic, getMnemonicIndex, getProperty, getProperty, getPropertyNames, getSelectedIcon, getText, getTextPosition, getToolbarFactory, initCommandManager, installFace, isAnonymous, isAttachedTo, isEnabled, isVisible, putProperty, removeHoverListener, removePropertyChangeListener, removePropertyChangeListener, requestFocusIn, setAccelerator, setButtonFactory, setDescription, setEnabled, setIcon, setLongDescription, setMenuFactory, setMnemonic, setMnemonicIndex, setSelectedIcon, setText, setTextPosition, setToolbarFactory, setVisible, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pietschy.command.ActionCommandExecutor
addPropertyChangeListener, addPropertyChangeListener, isEnabled, removePropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

SimpleUndoToggle

public SimpleUndoToggle(java.lang.String commandId,
                        javax.swing.JTextPane textPane)
Parameters:
commandId -
Method Detail

performEdit

protected javax.swing.undo.UndoableEdit performEdit(boolean selected)
Description copied from class: UndoableToggleCommand
Subclasses must override to perform the actual edit. This method behaves similar to ToggleCommand.handleSelection(boolean) in that it can throw a ToggleVetoException to cancel the edit.

Please note that the edit object should call ToggleCommand.applySelection(boolean) to update the state of this command without causing a new UndoableEdit to be created. For example

 class MyToggle.ToggleUndoableEdit extends UndoableEdit
 {
    public void undo()
    {
       // undo any command specific stuff...
       ...
       // and reset our state without causeing any side effects..
       applySelection(oldState);
    }
 }
 

Specified by:
performEdit in class UndoableToggleCommand
Parameters:
selected - the new selected state of the command.
Returns:
an UndoableEdit object that can undo and redo the commands action.
See Also:
ToggleCommand.applySelection(boolean)