com.realtime.crossfire.jxclient.gui.keybindings
Class KeyBindingState

java.lang.Object
  extended by com.realtime.crossfire.jxclient.gui.keybindings.KeyBindingState

public class KeyBindingState
extends java.lang.Object

Manages the state for the key binding dialog.


Field Summary
private  CommandList commands
          The commands to bind, or null to unbind.
private  KeyBindings keyBindings
          The KeyBindings to modify.
private  KeyBindings keyBindings2
          The KeyBindings to modify.
private  char keyChar
          The key character.
private  int keyCode
          The key code.
private  int modifiers
          The modifiers.
private  int state
          The dialog state: 0=waiting for initial key press, 1=waiting for key release.
private  int type
          The type of key binding: -1=invalid, 0=key code (keyCode and modifiers are valid), 1=key char (keyChar is valid).
 
Constructor Summary
KeyBindingState(KeyBindings keyBindings, KeyBindings keyBindings2, CommandList commands)
          Creates a new instance.
 
Method Summary
 void keyPressed(int keyCode, int modifiers)
          Records a binding by key code.
 boolean keyReleased()
          Records a key released event.
 void keyTyped(char keyChar)
          Records a binding by key character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commands

@Nullable
private final CommandList commands
The commands to bind, or null to unbind.


keyBindings

@Nullable
private final KeyBindings keyBindings
The KeyBindings to modify.


keyBindings2

@Nullable
private final KeyBindings keyBindings2
The KeyBindings to modify.


keyChar

private char keyChar
The key character. Only valid if type == 1.


keyCode

private int keyCode
The key code. Only valid if type == 0.


modifiers

private int modifiers
The modifiers. Only valid if type == 0.


state

private int state
The dialog state: 0=waiting for initial key press, 1=waiting for key release.


type

private int type
The type of key binding: -1=invalid, 0=key code (keyCode and modifiers are valid), 1=key char (keyChar is valid).

Constructor Detail

KeyBindingState

public KeyBindingState(@Nullable
                       KeyBindings keyBindings,
                       @Nullable
                       KeyBindings keyBindings2,
                       @Nullable
                       CommandList commands)
Creates a new instance.

Parameters:
keyBindings - the KeyBindings to modify; may be null when removing bindings
keyBindings2 - the KeyBindings to modify; only used when removing bindings; may be null when removing bindings
commands - the commands to bind, or null to unbind
Method Detail

keyPressed

public void keyPressed(int keyCode,
                       int modifiers)
Records a binding by key code.

Parameters:
keyCode - the key code that was pressed
modifiers - the bindings that are active

keyReleased

public boolean keyReleased()
Records a key released event.

Returns:
true if the dialog has finished, or false if the dialog is still active

keyTyped

public void keyTyped(char keyChar)
Records a binding by key character.

Parameters:
keyChar - the key character that was typed