|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.action.injection.InjectedCommand
public abstract class InjectedCommand
An abstract Command
which relieves its subclasses from the chore of dealing with the
extraction and validation of arguments from the context. This happens by the way of argument
injection. Setters annotated with Argument
are automatically injected with
the necessary arguments prior to command execution.
Constructor Summary | |
---|---|
InjectedCommand()
|
Method Summary | |
---|---|
protected boolean |
canExecute()
Subclasses may override this method to perform argument validation beyond the validation that happens automatically during the injection phase. |
boolean |
canExecute(Collection<Object> args)
Permission checking for a command works as follows: |
protected abstract void |
execute()
This method is called in order to execute the command. |
void |
execute(Collection<Object> args)
Execute the command. |
protected String |
getKey()
|
boolean |
isAvailable()
Returns an indicator whether the command is available and therefore integrable. |
protected boolean |
isSelected()
Returns the selected state of this command. |
boolean |
isSelected(Collection<Object> args)
Returns the selected state of this command. |
void |
setKey(String key)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InjectedCommand()
Method Detail |
---|
public final boolean canExecute(Collection<Object> args)
Command
1. Check user privileges if the command is executable.
2. Ask if the command is executable with the given objects.
canExecute
in interface Command
args
- arguments for the command
true
- executable with these arguments,false
- impossible to execute this command with these argumentsprotected boolean canExecute()
Argument
annotations and the
arguments have been injected.
true
if the command can/may be executed in the current context,
false
otherwise.public final void execute(Collection<Object> args)
Command
execute
in interface Command
args
- arguments for the command (contains all items for all actions inside of the
context!)protected abstract void execute()
canExecute()
has returned
true
.
public final boolean isSelected(Collection<Object> args)
Command
isSelected
in interface Command
args
- arguments for the command
true
- selected with these arguments,false
- not selected with these argumentsCommand.isSelected(java.util.Collection)
protected boolean isSelected()
public boolean isAvailable()
Command
isAvailable
in interface Command
true
- available false
- not availableCommand.isAvailable()
public void setKey(String key)
protected String getKey()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |