Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.newdawn.slick.command
Class InputProvider

    java.lang.Object
      org.newdawn.slick.command.InputProvider

    public class InputProvider

extends java.lang.Object

The central provider that maps real device input into abstract commands defined by the developer. Registering a control against an command with this class will cause the provider to produce an event for the command when the input is pressed and released.

Author:
  joverton

Constructor Summary
`InputProvider(Input input)` Create a new input proider which will provide abstract input descriptions based on the input from the supplied context.

Method Summary
`void` | `addListener(InputProviderListener listener)` Add a listener to the provider.
`void` | `bindCommand(Control control, Command command)` Bind an command to a control.
`void` | `clearCommand(Command command)` Clear all the controls that have been configured for a given command
`protected void` | `firePressed(Command command)` Fire notification to any interested listeners that a control has been pressed indication an particular command
`protected void` | `fireReleased(Command command)` Fire notification to any interested listeners that a control has been released indication an particular command should be stopped
`java.util.List` | `getControlsFor(Command command)` Get a list of the registered controls (@see Control) that can cause a particular command to be invoked
`java.util.List` | `getUniqueCommands()` Get the list of commands that have been registered with the provider, i.e.
`boolean` | `isActive()` Check if this provider should be sending events
`boolean` | `isCommandControlDown(Command command)` Check if the last control event we recieved related to the given command indicated that a control was down
`boolean` | `isCommandControlPressed(Command command)` Check if one of the controls related to the command specified has been pressed since we last called this method
`void` | `removeListener(InputProviderListener listener)` Remove a listener from this provider.
`void` | `setActive(boolean active)` Indicate whether this provider should be sending events
`void` | `unbindCommand(Control control)` Unbinds the command associated with this control

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### InputProvider

    public InputProvider(Input input)

  Create a new input proider which will provide abstract input descriptions based on the input from the supplied context.

  Parameters:
    `input` - The input from which this provider will receive events

Method Detail

### getUniqueCommands

    public java.util.List getUniqueCommands()

  Get the list of commands that have been registered with the provider, i.e. the commands that can be issued to the listeners

  Returns:
    The list of commands (@see Command) that can be issued from this provider

### getControlsFor

    public java.util.List getControlsFor(Command command)

  Get a list of the registered controls (@see Control) that can cause a particular command to be invoked

  Parameters:
    `command` - The command to be invoked
  Returns:
    The list of controls that can cause the command (@see Control)

### setActive

    public void setActive(boolean active)

  Indicate whether this provider should be sending events

  Parameters:
    `active` - True if this provider should be sending events

### isActive

    public boolean isActive()

  Check if this provider should be sending events

  Returns:
    True if this provider should be sending events

### addListener

    public void addListener(InputProviderListener listener)

  Add a listener to the provider. This listener will be notified of commands detected from the input.

  Parameters:
    `listener` - The listener to be added

### removeListener

    public void removeListener(InputProviderListener listener)

  Remove a listener from this provider. The listener will no longer be provided with notification of commands performe.

  Parameters:
    `listener` - The listener to be removed

### bindCommand

    public void bindCommand(Control control,
                            Command command)

  Bind an command to a control.

  Parameters:
    `command` - The command to bind to
    `control` - The control that is pressed/released to represent the command

### clearCommand

    public void clearCommand(Command command)

  Clear all the controls that have been configured for a given command

  Parameters:
    `command` - The command whose controls should be unbound

### unbindCommand

    public void unbindCommand(Control control)

  Unbinds the command associated with this control

  Parameters:
    `control` - The control to remove

### isCommandControlDown

    public boolean isCommandControlDown(Command command)

  Check if the last control event we recieved related to the given command indicated that a control was down

  Parameters:
    `command` - The command to check
  Returns:
    True if the last event indicated a button down

### isCommandControlPressed

    public boolean isCommandControlPressed(Command command)

  Check if one of the controls related to the command specified has been pressed since we last called this method

  Parameters:
    `command` - The command to check
  Returns:
    True if one of the controls has been pressed

### firePressed

    protected void firePressed(Command command)

  Fire notification to any interested listeners that a control has been pressed indication an particular command

  Parameters:
    `command` - The command that has been pressed

### fireReleased

    protected void fireReleased(Command command)

  Fire notification to any interested listeners that a control has been released indication an particular command should be stopped

  Parameters:
    `command` - The command that has been pressed

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 New Dawn Software. All Rights Reserved.