Interface Commandable
-
- All Known Subinterfaces:
StrangeEonsEditor
- All Known Implementing Classes:
AbstractGameComponentEditor,AbstractStrangeEonsEditor,AbstractSupportEditor,CardLayoutEditor,CodeEditor,DeckEditor,DIYEditor,MarkerEditor,PropertyBundleEditor,StrangeEonsAppWindow
public interface CommandableThis interface is implemented by classes that can be consulted about the commands they are able to perform. Commands that are aware of this interface can ask a commandable of interest (typically the current editor) if it wants to handle the command. If the commandable does want to handle the command, then the command will delegate command processing to the commandable.- Since:
- 3.0
- Author:
- Chris Jennings
- See Also:
DelegatedCommand
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanPerformCommand(AbstractCommand command)Returnstrueif the commandable wishes to handle the given command.booleanisCommandApplicable(AbstractCommand command)Returnstrueif thecommandcan be performed by this commandable in its current state.voidperformCommand(AbstractCommand command)Performs the command.
-
-
-
Method Detail
-
canPerformCommand
boolean canPerformCommand(AbstractCommand command)
Returnstrueif the commandable wishes to handle the given command. This method defines the set of commands that the commandable responds to. The commandable might not be able to act on the command at the current moment. For example, a commandable that responds to "Cut" could return true fromhandlesCommand, but false fromisCommandApplicable(ca.cgjennings.apps.arkham.commands.AbstractCommand)if there is currently no selection to cut.- Parameters:
command- the command to be performed- Returns:
trueif this commandable wishes to handle the command (even if it cannot execute the command currently)
-
isCommandApplicable
boolean isCommandApplicable(AbstractCommand command)
Returnstrueif thecommandcan be performed by this commandable in its current state. IfcanPerformCommand(ca.cgjennings.apps.arkham.commands.AbstractCommand)would return false for this command, then this must also return false.- Parameters:
command- the command to be performed- Returns:
trueif this commandable can currently perform the command
-
performCommand
void performCommand(AbstractCommand command)
Performs the command. IfisCommandApplicable(ca.cgjennings.apps.arkham.commands.AbstractCommand)would returnfalsefor this command, then this should do nothing.- Parameters:
command- the command to perform
-
-