Class ThincCMsgEventKey

java.lang.Object
  extended by ThincMsg
      extended by ThincCMsg
          extended by ThincCMsgEvent
              extended by ThincCMsgEventKey
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener

public final class ThincCMsgEventKey
extends ThincCMsgEvent
implements java.awt.event.KeyListener

ThincCMsgEventKey handles the key pressed and released event from canvas. it simply implements KeyListener interfaces provided from java, and it is added as a KeyListener on ThincClientCanvas.

Author:
Young Jin Yoon

Field Summary
private  int key
           
static int KEY_DOWN
           
static int KEY_UP
           
static int MESSAGE_SIZE
           
static int MESSAGE_TYPE
           
private  byte status
           
private static int VK_BACK_SLASH
           
private static int VK_BACK_TICK
           
private static int VK_COLON
           
private static int VK_COMMA
           
private static int VK_LBRACKET
           
private static int VK_MINUS
           
private static int VK_PERIOD
           
private static int VK_PLUS
           
private static int VK_RBRACKET
           
private static int VK_SEMICOLON
           
private static int VK_SINGLE_QUOTE
           
private static int VK_SLASH
           
private static int XK_Alt_L
           
private static int XK_Back_slash
           
private static int XK_Back_Tick
           
private static int XK_BackSpace
           
private static int XK_Cancel
           
private static int XK_Caps_Lock
           
private static int XK_Clear
           
private static int XK_Colon
           
private static int XK_Comma
           
private static int XK_Control_L
           
private static int XK_Delete
           
private static int XK_Down
           
private static int XK_End
           
private static int XK_Escape
           
private static int XK_F1
           
private static int XK_F10
           
private static int XK_F11
           
private static int XK_F12
           
private static int XK_F13
           
private static int XK_F14
           
private static int XK_F15
           
private static int XK_F16
           
private static int XK_F17
           
private static int XK_F18
           
private static int XK_F19
           
private static int XK_F2
           
private static int XK_F20
           
private static int XK_F21
           
private static int XK_F22
           
private static int XK_F23
           
private static int XK_F24
           
private static int XK_F3
           
private static int XK_F4
           
private static int XK_F5
           
private static int XK_F6
           
private static int XK_F7
           
private static int XK_F8
           
private static int XK_F9
           
private static int XK_Find
           
private static int XK_Help
           
private static int XK_Home
           
private static int XK_Insert
           
private static int XK_KP_0
           
private static int XK_KP_1
           
private static int XK_KP_2
           
private static int XK_KP_3
           
private static int XK_KP_4
           
private static int XK_KP_5
           
private static int XK_KP_6
           
private static int XK_KP_7
           
private static int XK_KP_8
           
private static int XK_KP_9
           
private static int XK_LBracket
           
private static int XK_Left
           
private static int XK_Meta_L
           
private static int XK_Minus
           
private static int XK_Mode_switch
           
private static int XK_Num_Lock
           
private static int XK_Page_Down
           
private static int XK_Page_Up
           
private static int XK_Pause
           
private static int XK_Period
           
private static int XK_Plus
           
private static int XK_Print
           
private static int XK_RBracket
           
private static int XK_Redo
           
private static int XK_Return
           
private static int XK_Right
           
private static int XK_Scroll_Lock
           
private static int XK_Semi_Colon
           
private static int XK_Shift_L
           
private static int XK_Shift_Lock
           
private static int XK_Single_Quote
           
private static int XK_Slash
           
private static int XK_Tab
           
private static int XK_Undo
           
private static int XK_Up
           
private static int XKEY_SIZE
           
 
Fields inherited from class ThincMsg
canvas, handler
 
Constructor Summary
ThincCMsgEventKey(ThincMsgHandler h, ThincClientCanvas c)
          creates ThincCMsgEventKey object.
 
Method Summary
private  int getKeyCode(java.awt.event.KeyEvent e)
          getKeyCode() translate KeyCode for java to KeyCode for X11.
 byte getMsgType()
          getMsgType() returns a type of the message.
 void keyPressed(java.awt.event.KeyEvent arg0)
          keyPressed() sets the key using getKeyCode method and status as KEY_DOWN.
 void keyReleased(java.awt.event.KeyEvent arg0)
          keyReleased() sets the key using getKeyCode method and status as KEY_UP.
 void keyTyped(java.awt.event.KeyEvent arg0)
           
 short messageSize()
          messageSize() returns the total messageSize to send.
 void process()
          process() is general processing method for each thinc messages.
 void putMessage(java.nio.ByteBuffer b)
          putMessage() simply puts key code and pressed / released information
 
Methods inherited from class ThincCMsg
getFlag, headerSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESSAGE_TYPE

public static final int MESSAGE_TYPE
See Also:
Constant Field Values

MESSAGE_SIZE

public static final int MESSAGE_SIZE
See Also:
Constant Field Values

KEY_DOWN

public static final int KEY_DOWN
See Also:
Constant Field Values

KEY_UP

public static final int KEY_UP
See Also:
Constant Field Values

key

private int key

status

private byte status

XK_BackSpace

private static final int XK_BackSpace
See Also:
Constant Field Values

XK_Tab

private static final int XK_Tab
See Also:
Constant Field Values

XK_Clear

private static final int XK_Clear
See Also:
Constant Field Values

XK_Return

private static final int XK_Return
See Also:
Constant Field Values

XK_Pause

private static final int XK_Pause
See Also:
Constant Field Values

XK_Scroll_Lock

private static final int XK_Scroll_Lock
See Also:
Constant Field Values

XK_Escape

private static final int XK_Escape
See Also:
Constant Field Values

XK_Delete

private static final int XK_Delete
See Also:
Constant Field Values

XK_Home

private static final int XK_Home
See Also:
Constant Field Values

XK_Left

private static final int XK_Left
See Also:
Constant Field Values

XK_Up

private static final int XK_Up
See Also:
Constant Field Values

XK_Right

private static final int XK_Right
See Also:
Constant Field Values

XK_Down

private static final int XK_Down
See Also:
Constant Field Values

XK_Page_Up

private static final int XK_Page_Up
See Also:
Constant Field Values

XK_Page_Down

private static final int XK_Page_Down
See Also:
Constant Field Values

XK_End

private static final int XK_End
See Also:
Constant Field Values

XK_Print

private static final int XK_Print
See Also:
Constant Field Values

XK_Insert

private static final int XK_Insert
See Also:
Constant Field Values

XK_Undo

private static final int XK_Undo
See Also:
Constant Field Values

XK_Redo

private static final int XK_Redo
See Also:
Constant Field Values

XK_Find

private static final int XK_Find
See Also:
Constant Field Values

XK_Cancel

private static final int XK_Cancel
See Also:
Constant Field Values

XK_Help

private static final int XK_Help
See Also:
Constant Field Values

XK_Mode_switch

private static final int XK_Mode_switch
See Also:
Constant Field Values

XK_Num_Lock

private static final int XK_Num_Lock
See Also:
Constant Field Values

XK_KP_0

private static final int XK_KP_0
See Also:
Constant Field Values

XK_KP_1

private static final int XK_KP_1
See Also:
Constant Field Values

XK_KP_2

private static final int XK_KP_2
See Also:
Constant Field Values

XK_KP_3

private static final int XK_KP_3
See Also:
Constant Field Values

XK_KP_4

private static final int XK_KP_4
See Also:
Constant Field Values

XK_KP_5

private static final int XK_KP_5
See Also:
Constant Field Values

XK_KP_6

private static final int XK_KP_6
See Also:
Constant Field Values

XK_KP_7

private static final int XK_KP_7
See Also:
Constant Field Values

XK_KP_8

private static final int XK_KP_8
See Also:
Constant Field Values

XK_KP_9

private static final int XK_KP_9
See Also:
Constant Field Values

XK_F1

private static final int XK_F1
See Also:
Constant Field Values

XK_F2

private static final int XK_F2
See Also:
Constant Field Values

XK_F3

private static final int XK_F3
See Also:
Constant Field Values

XK_F4

private static final int XK_F4
See Also:
Constant Field Values

XK_F5

private static final int XK_F5
See Also:
Constant Field Values

XK_F6

private static final int XK_F6
See Also:
Constant Field Values

XK_F7

private static final int XK_F7
See Also:
Constant Field Values

XK_F8

private static final int XK_F8
See Also:
Constant Field Values

XK_F9

private static final int XK_F9
See Also:
Constant Field Values

XK_F10

private static final int XK_F10
See Also:
Constant Field Values

XK_F11

private static final int XK_F11
See Also:
Constant Field Values

XK_F12

private static final int XK_F12
See Also:
Constant Field Values

XK_F13

private static final int XK_F13
See Also:
Constant Field Values

XK_F14

private static final int XK_F14
See Also:
Constant Field Values

XK_F15

private static final int XK_F15
See Also:
Constant Field Values

XK_F16

private static final int XK_F16
See Also:
Constant Field Values

XK_F17

private static final int XK_F17
See Also:
Constant Field Values

XK_F18

private static final int XK_F18
See Also:
Constant Field Values

XK_F19

private static final int XK_F19
See Also:
Constant Field Values

XK_F20

private static final int XK_F20
See Also:
Constant Field Values

XK_F21

private static final int XK_F21
See Also:
Constant Field Values

XK_F22

private static final int XK_F22
See Also:
Constant Field Values

XK_F23

private static final int XK_F23
See Also:
Constant Field Values

XK_F24

private static final int XK_F24
See Also:
Constant Field Values

XK_Shift_L

private static final int XK_Shift_L
See Also:
Constant Field Values

XK_Control_L

private static final int XK_Control_L
See Also:
Constant Field Values

XK_Caps_Lock

private static final int XK_Caps_Lock
See Also:
Constant Field Values

XK_Shift_Lock

private static final int XK_Shift_Lock
See Also:
Constant Field Values

XK_Meta_L

private static final int XK_Meta_L
See Also:
Constant Field Values

XK_Alt_L

private static final int XK_Alt_L
See Also:
Constant Field Values

XK_Semi_Colon

private static final int XK_Semi_Colon
See Also:
Constant Field Values

VK_SEMICOLON

private static final int VK_SEMICOLON
See Also:
Constant Field Values

XK_Colon

private static final int XK_Colon
See Also:
Constant Field Values

VK_COLON

private static final int VK_COLON
See Also:
Constant Field Values

XK_Single_Quote

private static final int XK_Single_Quote
See Also:
Constant Field Values

VK_SINGLE_QUOTE

private static final int VK_SINGLE_QUOTE
See Also:
Constant Field Values

XK_Back_Tick

private static final int XK_Back_Tick
See Also:
Constant Field Values

VK_BACK_TICK

private static final int VK_BACK_TICK
See Also:
Constant Field Values

XK_Back_slash

private static final int XK_Back_slash
See Also:
Constant Field Values

VK_BACK_SLASH

private static final int VK_BACK_SLASH
See Also:
Constant Field Values

XK_Period

private static final int XK_Period
See Also:
Constant Field Values

VK_PERIOD

private static final int VK_PERIOD
See Also:
Constant Field Values

XK_Slash

private static final int XK_Slash
See Also:
Constant Field Values

VK_SLASH

private static final int VK_SLASH
See Also:
Constant Field Values

XK_Comma

private static final int XK_Comma
See Also:
Constant Field Values

VK_COMMA

private static final int VK_COMMA
See Also:
Constant Field Values

XK_RBracket

private static final int XK_RBracket
See Also:
Constant Field Values

VK_RBRACKET

private static final int VK_RBRACKET
See Also:
Constant Field Values

XK_LBracket

private static final int XK_LBracket
See Also:
Constant Field Values

VK_LBRACKET

private static final int VK_LBRACKET
See Also:
Constant Field Values

XK_Plus

private static final int XK_Plus
See Also:
Constant Field Values

VK_PLUS

private static final int VK_PLUS
See Also:
Constant Field Values

XK_Minus

private static final int XK_Minus
See Also:
Constant Field Values

VK_MINUS

private static final int VK_MINUS
See Also:
Constant Field Values

XKEY_SIZE

private static final int XKEY_SIZE
See Also:
Constant Field Values
Constructor Detail

ThincCMsgEventKey

public ThincCMsgEventKey(ThincMsgHandler h,
                         ThincClientCanvas c)
creates ThincCMsgEventKey object.

Parameters:
h - ThincMsgHandler to handle the message
c - ThincClientCanvas to get the information
Method Detail

getMsgType

public byte getMsgType()
Description copied from class: ThincCMsg
getMsgType() returns a type of the message.

Specified by:
getMsgType in class ThincCMsg
Returns:
type of message

putMessage

public void putMessage(java.nio.ByteBuffer b)
putMessage() simply puts key code and pressed / released information

Specified by:
putMessage in class ThincCMsg
Parameters:
b - ByteBuffer object to send
See Also:
ThincCMsg.putMessage()

messageSize

public short messageSize()
Description copied from class: ThincCMsg
messageSize() returns the total messageSize to send.

Specified by:
messageSize in class ThincCMsg
Returns:
total messageSize refered from ThincMsgHandler class

process

public void process()
             throws ThincException
Description copied from class: ThincMsg
process() is general processing method for each thinc messages. Most of client messages, it simply invokes send() methods in ThincMsgHandler object to send the client messages. In server messages, it interacts with ThincClientCanvas in this method.

Specified by:
process in class ThincMsg
Throws:
ThincException

keyPressed

public void keyPressed(java.awt.event.KeyEvent arg0)
keyPressed() sets the key using getKeyCode method and status as KEY_DOWN. Then invokes process method.

Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent arg0)
keyReleased() sets the key using getKeyCode method and status as KEY_UP. Then invokes process method.

Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent arg0)
Specified by:
keyTyped in interface java.awt.event.KeyListener

getKeyCode

private int getKeyCode(java.awt.event.KeyEvent e)
getKeyCode() translate KeyCode for java to KeyCode for X11.

Parameters:
e - java key code
Returns:
x11 key code