org.jagatoo.commands
Class InputActionCommand

java.lang.Object
  extended by org.jagatoo.commands.CommandBase
      extended by org.jagatoo.commands.NoParamCommandBase
          extended by org.jagatoo.commands.InputActionCommand
All Implemented Interfaces:
Command, NoParamCommand, InputAction, InvokableInputAction, LabeledInputAction, LabeledInvokableInputAction

public abstract class InputActionCommand
extends NoParamCommandBase
implements LabeledInvokableInputAction

This is a Command, that can be bound to a key.


Field Summary
 
Fields inherited from class org.jagatoo.commands.CommandBase
paramsArray
 
Constructor Summary
  InputActionCommand(java.lang.String commandKey, int ordinal, java.lang.String text)
          Creates a new key-bound Command.
protected InputActionCommand(java.lang.String commandKey, int ordinal, java.lang.String text, int numParams)
          Creates a new key-bound Command.
  InputActionCommand(java.lang.String commandKey, java.lang.String text)
          Creates a new key-bound Command.
 
Method Summary
 java.lang.String invokeAction(InputDevice device, DeviceComponent comp, int delta, int state, long nanoTime)
          This method is invoked when the bound InputDevice changed its state.
 int ordinal()
          
 
Methods inherited from class org.jagatoo.commands.NoParamCommandBase
execute, getParameterTypes
 
Methods inherited from class org.jagatoo.commands.CommandBase
createParametersArray, equals, execute, execute, execute, getKey, getLocalizedText, getNumParameters, getText, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jagatoo.input.actions.LabeledInputAction
getLocalizedText, getText
 
Methods inherited from interface org.jagatoo.commands.NoParamCommand
execute
 
Methods inherited from interface org.jagatoo.commands.Command
createParametersArray, execute, execute, execute, getKey, getLocalizedText, getNumParameters, getText
 

Constructor Detail

InputActionCommand

protected InputActionCommand(java.lang.String commandKey,
                             int ordinal,
                             java.lang.String text,
                             int numParams)
Creates a new key-bound Command.

Parameters:
commandKey - this is NOT the Keyboard-key, but the command's key (name).
ordinal - this KeyCommandInterface's ordinal. The next auto-ordinal will be resettet to (ordinal + 1), if this is >= 0.
text - the Text, that is displayed in a configuration dialog
numParams -

InputActionCommand

public InputActionCommand(java.lang.String commandKey,
                          int ordinal,
                          java.lang.String text)
Creates a new key-bound Command.

Parameters:
commandKey - this is NOT the Keyboard-key, but the command's key (name).
ordinal - this KeyCommandInterface's ordinal. The next auto-ordinal will be resettet to (ordinal + 1), if this is >= 0.
text - the Text, that is displayed in a configuration dialog

InputActionCommand

public InputActionCommand(java.lang.String commandKey,
                          java.lang.String text)
Creates a new key-bound Command.

Parameters:
commandKey - this is NOT the Keyboard-key, but the command's key (name).
text - the Text, that is displayed in a configuration dialog
Method Detail

ordinal

public final int ordinal()

Specified by:
ordinal in interface InputAction
Returns:
This InputAction's ordinal number, which must be zero-based for all actions of a set.

invokeAction

public java.lang.String invokeAction(InputDevice device,
                                     DeviceComponent comp,
                                     int delta,
                                     int state,
                                     long nanoTime)
                              throws InputSystemException
This method is invoked when the bound InputDevice changed its state.

Specified by:
invokeAction in interface InvokableInputAction
Parameters:
device - the bound device
comp - the bound device component
delta - the delta of the previous and current state
state - the current state
Returns:
a success message (implementation dependent)
Throws:
InputSystemException