|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openpermis.editor.policy.command.CommandManager
public class CommandManager
Basic implementation of a command dispatcher.
Field Summary | |
---|---|
private PropertyChangeSupport |
changeSupport
Beans property change support. |
private static org.slf4j.Logger |
LOGGER
The logger object of this class. |
private org.openpermis.policy.bean.PolicyBean |
policy
The policy this command dispatcher operates on. |
private List<Command> |
redoStack
The stack holding reverted commands. |
private List<Command> |
undoStack
The stack holding executed commands. |
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 |
Field Detail |
---|
private static final org.slf4j.Logger LOGGER
private final org.openpermis.policy.bean.PolicyBean policy
private final List<Command> undoStack
private final List<Command> redoStack
private final PropertyChangeSupport changeSupport
Constructor Detail |
---|
public CommandManager(org.openpermis.policy.bean.PolicyBean policy)
policy
- the policy the dispatcher operates on.Method Detail |
---|
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- the listener to register.public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the listener to remove.protected void sureFirePropertyChange(String property, boolean oldValue, boolean newValue)
Use this method to inform registered property change listeners of a change in a bound property.
This method will not throw any exceptions.
property
- the property whose value has changed.oldValue
- the previous value of the property.newValue
- the new value of the property.public boolean isUndoAvailable()
true
if there is a command to undo.public String getUndoName()
null
if there is none.public boolean undo()
true
if a command was executed successfully.public boolean isRedoAvailable()
true
if there is a command to undo.public String getRedoName()
null
if there is none.public boolean redo()
true
if a command was executed successfully.public void execute(Command command)
CommandDispatcher
Flushes the contents of the redo stack.
execute
in interface CommandDispatcher
command
- the command to process.
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
PERMIS Role Based Access Control 0.4.0 (Build 15)
2009/05/20 08:15:22
Copyright (c) 2002-2007 Ergon Informatik AG