Class InjectedCommand
java.lang.Object
com.levigo.jadice.web.client.util.command.InjectedCommand
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
AbstractContextCommand,AnnotationPropertyEditor,FullscreenCommand,HorizontalAlignmentEditor.AlignmentCommand,InjectedWidgetCommand,LocaleCommand
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. Fields and/or setters annotated with @ link Argument} are automatically injected with
the necessary arguments prior to command execution.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanSubclasses may override this method to perform argument validation beyond the validation that happens automatically during the injection phase.final booleancanExecute(Collection<Object> args) Permission checking for a command works as follows:protected voidprotected abstract voidexecute()This method is called in order to execute the command.final voidexecute(Collection<Object> args) Execute the command.protected StringgetKey()protected booleanReturns the selected state of this command.final booleanisSelected(Collection<Object> args) Returns the selected state of this command.voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.levigo.jadice.web.client.util.command.Command
getID, isAvailable, isAvailable
-
Constructor Details
-
InjectedCommand
public InjectedCommand()
-
-
Method Details
-
canExecute
Description copied from interface:CommandPermission checking for a command works as follows:1. Check user privileges if the command is executable.
2. Ask if the command is executable with the given objects.- Specified by:
canExecutein interfaceCommand- Parameters:
args- arguments for the command- Returns:
true- executable with these arguments,
false- impossible to execute this command with these arguments
-
clearInjections
protected void clearInjections() -
canExecute
protected boolean canExecute()Subclasses may override this method to perform argument validation beyond the validation that happens automatically during the injection phase. This method is called after the context has been found to match the requirements specified via the @ link Argument} annotations and the arguments have been injected.- Returns:
trueif the command can/may be executed in the current context,falseotherwise.
-
execute
Description copied from interface:CommandExecute the command. -
execute
protected abstract void execute()This method is called in order to execute the command. It is only called, after the arguments have been validated and injected and only ifcanExecute()has returnedtrue. -
isSelected
Description copied from interface:CommandReturns the selected state of this command. This is typically used only for commands with a meaningful selection state.- Specified by:
isSelectedin interfaceCommand- Parameters:
args- arguments for the command- Returns:
true- selected with these arguments,
false- not selected with these arguments
-
isSelected
protected boolean isSelected()Returns the selected state of this command. This is typically used only for commands with a meaningful selection state.- Returns:
- the selected state
-
setKey
-
getKey
-