java.lang.Object com.realtime.crossfire.jxclient.window.KeyHandler
public class KeyHandler
Handles keyboard input processing.
Field Summary | |
---|---|
private CommandQueue |
commandQueue
The CommandQueue to use. |
private java.io.Writer |
debugKeyboard
The Writer for logging keyboard debug output. |
private static int |
KEY_SHIFT_ALT
|
private static int |
KEY_SHIFT_ALT_GR
|
private static int |
KEY_SHIFT_CTRL
|
private static int |
KEY_SHIFT_SHIFT
|
private KeyBindings |
keyBindings
|
private KeybindingsManager |
keybindingsManager
The KeybindingsManager to use. |
private KeyHandlerListener |
keyHandlerListener
The KeyHandlerListener to notify. |
private boolean[] |
keyShift
|
private java.text.DateFormat |
simpleDateFormat
A formatter for timestamps. |
private JXCWindowRenderer |
windowRenderer
The JXCWindowRenderer to use. |
Constructor Summary | |
---|---|
KeyHandler(java.io.Writer debugKeyboard,
KeybindingsManager keybindingsManager,
CommandQueue commandQueue,
JXCWindowRenderer windowRenderer,
KeyHandlerListener keyHandlerListener)
Creates a new instance. |
Method Summary | |
---|---|
private void |
debugKeyboardWrite(java.lang.CharSequence message)
Writes a message to the keyboard debug. |
private void |
debugKeyboardWrite(java.lang.String type,
java.awt.event.KeyEvent e)
Writes a KeyEvent to the keyboard debug. |
private boolean |
getKeyShift(int keyId)
|
private void |
handleKeyPress(java.awt.event.KeyEvent e)
|
private void |
handleKeyRelease(java.awt.event.KeyEvent e)
|
private void |
handleKeyType(java.awt.event.KeyEvent e)
|
void |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
void |
reset()
|
void |
setKeyBindings(KeyBindings keyBindings)
|
private void |
setKeyShift(int keyId,
boolean state)
|
private void |
updateModifiers(java.awt.event.InputEvent keyEvent)
Update the saved modifier state from a key event. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private final CommandQueue commandQueue
CommandQueue
to use.
@Nullable private final java.io.Writer debugKeyboard
Writer
for logging keyboard debug output. Log nothing if
null
.
private static final int KEY_SHIFT_ALT
private static final int KEY_SHIFT_ALT_GR
private static final int KEY_SHIFT_CTRL
private static final int KEY_SHIFT_SHIFT
@Nullable private KeyBindings keyBindings
@NotNull private final KeybindingsManager keybindingsManager
KeybindingsManager
to use.
@NotNull private final KeyHandlerListener keyHandlerListener
KeyHandlerListener
to notify.
@NotNull private final boolean[] keyShift
@NotNull private final java.text.DateFormat simpleDateFormat
@NotNull private final JXCWindowRenderer windowRenderer
JXCWindowRenderer
to use.
Constructor Detail |
---|
public KeyHandler(@Nullable java.io.Writer debugKeyboard, @NotNull KeybindingsManager keybindingsManager, @NotNull CommandQueue commandQueue, @NotNull JXCWindowRenderer windowRenderer, @NotNull KeyHandlerListener keyHandlerListener)
debugKeyboard
- the writer for logging keyboard debug output; maykeybindingsManager
- the keybindings manager to usecommandQueue
- the command queue to usewindowRenderer
- the window renderer to usekeyHandlerListener
- the key handler listener to notifyMethod Detail |
---|
private void debugKeyboardWrite(@NotNull java.lang.CharSequence message)
message
- the message to writeprivate void debugKeyboardWrite(@NotNull java.lang.String type, @NotNull java.awt.event.KeyEvent e)
KeyEvent
to the keyboard debug.
type
- the event typee
- the key event to writeprivate boolean getKeyShift(int keyId)
private void handleKeyPress(@NotNull java.awt.event.KeyEvent e)
private void handleKeyRelease(@NotNull java.awt.event.KeyEvent e)
private void handleKeyType(@NotNull java.awt.event.KeyEvent e)
public void keyPressed(@NotNull java.awt.event.KeyEvent e)
public void keyReleased(@NotNull java.awt.event.KeyEvent e)
public void keyTyped(@NotNull java.awt.event.KeyEvent e)
public void reset()
public void setKeyBindings(@NotNull KeyBindings keyBindings)
private void setKeyShift(int keyId, boolean state)
private void updateModifiers(@NotNull java.awt.event.InputEvent keyEvent)
keyEvent
- The key event to process.