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

java.lang.Object
  extended by com.realtime.crossfire.jxclient.gui.keybindings.KeyBinding
Direct Known Subclasses:
KeyCharKeyBinding, KeyCodeKeyBinding

public abstract class KeyBinding
extends java.lang.Object

Abstract base class for key bindings. A key binding consists of information about the bound key and an associated CommandList.


Field Summary
private  CommandList commands
          The associated CommandList.
private  boolean isDefault
          Whether the key binding is a "default" binding which should not be saved.
 
Constructor Summary
protected KeyBinding(CommandList commands, boolean isDefault)
          Creates a new instance.
 
Method Summary
abstract  boolean equals(java.lang.Object obj)
          
 CommandList getCommands()
          Returns the associated CommandList.
 java.lang.String getCommandString()
          Returns the commands as a string.
abstract  int hashCode()
          
 boolean isDefault()
          Returns whether the key binding is a "default" binding which should not be saved.
abstract  boolean matchesKeyChar(char keyChar)
          Check whether this key binding matches a key character.
abstract  boolean matchesKeyCode(int keyCode, int modifiers)
          Checks whether this key binding matches a key code/modifiers pair.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commands

@NotNull
private final CommandList commands
The associated CommandList.


isDefault

private final boolean isDefault
Whether the key binding is a "default" binding which should not be saved.

Constructor Detail

KeyBinding

protected KeyBinding(@NotNull
                     CommandList commands,
                     boolean isDefault)
Creates a new instance.

Parameters:
commands - the commands to execute
isDefault - whether the key binding is a "default" binding which should not be saved
Method Detail

equals

public abstract boolean equals(@Nullable
                               java.lang.Object obj)

Overrides:
equals in class java.lang.Object

getCommands

@NotNull
public CommandList getCommands()
Returns the associated CommandList.

Returns:
the associated command list

getCommandString

@NotNull
public java.lang.String getCommandString()
Returns the commands as a string.

Returns:
the commands as a string

hashCode

public abstract int hashCode()

Overrides:
hashCode in class java.lang.Object

isDefault

public boolean isDefault()
Returns whether the key binding is a "default" binding which should not be saved.

Returns:
true=do not save

matchesKeyChar

public abstract boolean matchesKeyChar(char keyChar)
Check whether this key binding matches a key character.

Parameters:
keyChar - the key character to check
Returns:
whether the key binding matches the parameters

matchesKeyCode

public abstract boolean matchesKeyCode(int keyCode,
                                       int modifiers)
Checks whether this key binding matches a key code/modifiers pair.

Parameters:
keyCode - the key code to check
modifiers - the modifiers to check
Returns:
whether the key binding matches the parameters