Back to index

wims  3.65+svn20090927
Public Member Functions | Package Functions | Package Attributes
rene.gui.KeyboardController Class Reference
Inheritance diagram for rene.gui.KeyboardController:
Inheritance graph
[legend]
Collaboration diagram for rene.gui.KeyboardController:
Collaboration graph
[legend]

List of all members.

Public Member Functions

synchronized void keyPressed (KeyEvent e)
void keyTyped (KeyEvent e)
void keyReleased (KeyEvent e)
void keyboardCommand (KeyEvent e, String command)
void keyboardEscape (KeyEvent e, char c)
void keyboardChar (KeyEvent e, char c)
void listenTo (Component c)
void setPrimary (KeyboardInterface i)
void setSecondary (KeyboardInterface i)

Package Functions

boolean old (KeyEvent e)
 Test for old keys.

Package Attributes

boolean Escape = false
 Macro and programs key pressed.
boolean IgnoreTyped = false
 Note, if the next entry should be ignored or not.
int CommandType = 0
 The type of the recent command key (1..5)
Component C = null
 The component, which we are listening to.
KeyboardInterface Primary = null
 The primary and secondary KeyboardInterface.
KeyboardInterface Secondary = null
boolean scaled = false
long scale

Detailed Description

Definition at line 7 of file KeyboardController.java.


Member Function Documentation

void rene.gui.KeyboardController.keyboardChar ( KeyEvent  e,
char  c 
) [inline]

Definition at line 94 of file KeyboardController.java.

       {      //System.out.println(""+c);
              if (Primary==null || !Primary.keyboardChar(e,c))
                     if (Secondary!=null) Secondary.keyboardChar(e,c);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.KeyboardController.keyboardCommand ( KeyEvent  e,
String  command 
) [inline]

Definition at line 82 of file KeyboardController.java.

       {      // System.out.println(command);
              if (Primary==null || !Primary.keyboardCommand(e,command))
                     if (Secondary!=null) Secondary.keyboardCommand(e,command);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.KeyboardController.keyboardEscape ( KeyEvent  e,
char  c 
) [inline]

Definition at line 88 of file KeyboardController.java.

       {      //System.out.println("escape "+c);
              if (Primary==null || !Primary.keyboardEscape(e,c))
                     if (Secondary!=null) Secondary.keyboardEscape(e,c);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized void rene.gui.KeyboardController.keyPressed ( KeyEvent  e) [inline]

Definition at line 20 of file KeyboardController.java.

       {      if (e.getKeyCode()==KeyEvent.VK_SHIFT) return;
              if (e.getKeyCode()==KeyEvent.VK_CONTROL) return;
              if (e.getKeyCode()==KeyEvent.VK_ALT) return;
              if (old(e)) return;
              String s=Keyboard.findKey(e,CommandType);
              // System.out.println(Escape+" "+CommandType+" "+s);
              IgnoreTyped=false;
              if (s.startsWith("command."))
              {      if (s.equals("command.escape"))
                     {      Escape=!Escape;
                     }
                     else try
                     {      CommandType=Integer.parseInt(s.substring(8));
                            Escape=false;
                     }
                     catch (Exception ex) { CommandType=0; }
                     IgnoreTyped=true;
              }
              else if (s.startsWith("charkey."))
              {      keyboardCommand(e,s);
                     IgnoreTyped=true;
                     Escape=false;
                     CommandType=0;
              }
              else if (Escape)
              {      char c=e.getKeyChar();
                     IgnoreTyped=true;
                     keyboardEscape(e,c);
                     Escape=false;
              }
              else if (!s.equals(""))
              {      keyboardCommand(e,s);
                     IgnoreTyped=false;
                     Escape=false;
                     CommandType=0;
              }
              else if (!e.isActionKey())
              {      if (!Global.getParameter("keyboard.compose",true))
                     {      keyboardChar(e,e.getKeyChar());
                            Escape=false;
                            CommandType=0;
                     }
                     else
                     {      Escape=false;
                            CommandType=0;
                     }
              }
       }

Here is the call graph for this function:

void rene.gui.KeyboardController.keyReleased ( KeyEvent  e) [inline]

Definition at line 80 of file KeyboardController.java.

{}
void rene.gui.KeyboardController.keyTyped ( KeyEvent  e) [inline]

Definition at line 70 of file KeyboardController.java.

       {      if (!Global.getParameter("keyboard.compose",true)) return;
              // System.out.println("key typed "+IgnoreTyped+" "+e);
              if (IgnoreTyped) return;
              IgnoreTyped=false;
              keyboardChar(e,e.getKeyChar());
              Escape=false;
              CommandType=0;
       }      

Here is the call graph for this function:

void rene.gui.KeyboardController.listenTo ( Component  c) [inline]

Definition at line 118 of file KeyboardController.java.

       {      if (C!=null) C.removeKeyListener(this);
              C=c;
              if (C!=null) C.addKeyListener(this);
       }
boolean rene.gui.KeyboardController.old ( KeyEvent  e) [inline, package]

Test for old keys.

This algorithm uses the difference between event time and system time. However, one needs to scale this first, since in Linux both timers do not agree.

Definition at line 108 of file KeyboardController.java.

       {      if (!scaled)
              {      scaled=true; scale=System.currentTimeMillis()-e.getWhen();
                     return false;
              }
              long delay=System.currentTimeMillis()-e.getWhen()-scale;
              if (delay>10000) return false; // function does not work!
              return (delay>200);
       }

Here is the caller graph for this function:

Definition at line 124 of file KeyboardController.java.

       {      Primary=i;
       }

Definition at line 128 of file KeyboardController.java.

       {      Secondary=i;
       }

Member Data Documentation

Component rene.gui.KeyboardController.C = null [package]

The component, which we are listening to.

Definition at line 16 of file KeyboardController.java.

The type of the recent command key (1..5)

Definition at line 14 of file KeyboardController.java.

Macro and programs key pressed.

Definition at line 10 of file KeyboardController.java.

Note, if the next entry should be ignored or not.

Definition at line 12 of file KeyboardController.java.

The primary and secondary KeyboardInterface.

Definition at line 18 of file KeyboardController.java.

Definition at line 101 of file KeyboardController.java.

Definition at line 100 of file KeyboardController.java.

Definition at line 18 of file KeyboardController.java.


The documentation for this class was generated from the following file: