org.openpermis.editor.policy.command
Class CommandManager

java.lang.Object
  extended by org.openpermis.editor.policy.command.CommandManager
All Implemented Interfaces:
CommandDispatcher

public class CommandManager
extends Object
implements CommandDispatcher

Basic implementation of a command dispatcher.

Since:
0.1.0

Constructor Summary
CommandManager(org.openpermis.policy.bean.PolicyBean policy)
          Creates a new command dispatcher for the specified policy.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Registers the specified property change listener.
 void execute(Command command)
          Executes the specified command and pushes it on the undo stack.
 String getRedoName()
          Returns the name of the first command on the redo stack.
 String getUndoName()
          Returns the name of the first command on the undo stack.
 boolean isRedoAvailable()
          Check if there is at least one command to undo.
 boolean isUndoAvailable()
          Check if there is at least one command to undo.
 boolean redo()
          Executes the last command that was undone again.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes the specified property change listener.
protected  void sureFirePropertyChange(String property, boolean oldValue, boolean newValue)
          Support for reporting bound property changes for Object properties.
 boolean undo()
          Performs an undo of the last command executed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandManager

public CommandManager(org.openpermis.policy.bean.PolicyBean policy)
Creates a new command dispatcher for the specified policy.

Parameters:
policy - the policy the dispatcher operates on.
Since:
0.1.0
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Registers the specified property change listener.

Parameters:
listener - the listener to register.
Since:
0.1.0

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes the specified property change listener.

Parameters:
listener - the listener to remove.
Since:
0.1.0

sureFirePropertyChange

protected void sureFirePropertyChange(String property,
                                      boolean oldValue,
                                      boolean newValue)
Support for reporting bound property changes for Object properties.

Use this method to inform registered property change listeners of a change in a bound property.

This method will not throw any exceptions.

Parameters:
property - the property whose value has changed.
oldValue - the previous value of the property.
newValue - the new value of the property.
Since:
0.1.0

isUndoAvailable

public boolean isUndoAvailable()
Check if there is at least one command to undo.

Returns:
true if there is a command to undo.
Since:
0.1.0

getUndoName

public String getUndoName()
Returns the name of the first command on the undo stack.

Returns:
the name or null if there is none.
Since:
0.1.0

undo

public boolean undo()
Performs an undo of the last command executed.

Returns:
true if a command was executed successfully.
Since:
0.1.0

isRedoAvailable

public boolean isRedoAvailable()
Check if there is at least one command to undo.

Returns:
true if there is a command to undo.
Since:
0.1.0

getRedoName

public String getRedoName()
Returns the name of the first command on the redo stack.

Returns:
the name or null if there is none.
Since:
0.1.0

redo

public boolean redo()
Executes the last command that was undone again.

Returns:
true if a command was executed successfully.
Since:
0.1.0

execute

public void execute(Command command)
Description copied from interface: CommandDispatcher
Executes the specified command and pushes it on the undo stack.

Flushes the contents of the redo stack.

Specified by:
execute in interface CommandDispatcher
Parameters:
command - the command to process.
Since:
0.1.0


PERMIS Role Based Access Control 0.4.0 (Build 15)
2009/05/20 08:15:11
Copyright (c) 2002-2007 Ergon Informatik AG