Back to index

wims  3.65+svn20090927
Public Member Functions | Package Attributes
rene.gui.KeyboardItem Class Reference

A keyboard item. More...

Inheritance diagram for rene.gui.KeyboardItem:
Inheritance graph
[legend]
Collaboration diagram for rene.gui.KeyboardItem:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 KeyboardItem (KeyboardItem item)
 Copy constructor, for use in editing (clone).
 KeyboardItem (String charkey, String menustring, String actionname, boolean shift, boolean control, boolean alt, int commandtype)
 KeyboardItem (String menu, String key)
String getMenuString ()
String getActionName ()
String getCharKey ()
boolean isShift ()
boolean isControl ()
boolean isAlt ()
int getCommandType ()
String getStrippedMenuString ()
 Get a menu string, which is stripped from stars.
String shortcut ()
 Compute a visible shortcut to append after the menu items (like "(Ctr O)".
String getName ()
 Get the name of this KeyboardItem element.
int compare (SortObject o)
 Method of SortObject, necessary to sort the keys by name.
String keyDescription ()
 Return a key description for this item (to save as parameter).

Package Attributes

boolean Shift
boolean Control
boolean Alt
String CharKey
String MenuString
String ActionName
int CommandType = 0

Detailed Description

A keyboard item.

Can be constructed from a menu string (like editor.file.open) and a key string (like control.o). Can test a key event, if it fits.

Definition at line 14 of file KeyboardItem.java.


Constructor & Destructor Documentation

Copy constructor, for use in editing (clone).

Definition at line 24 of file KeyboardItem.java.

       {      Shift=item.Shift; Control=item.Control; Alt=item.Alt;
              CharKey=item.CharKey; MenuString=item.MenuString;
              ActionName=item.ActionName; CommandType=item.CommandType;
       }
rene.gui.KeyboardItem.KeyboardItem ( String  charkey,
String  menustring,
String  actionname,
boolean  shift,
boolean  control,
boolean  alt,
int  commandtype 
) [inline]
Parameters:
charkeyThe keyboard descriptive character (like "page down")
menustringThe menu item (may have some *s added)
actionnameThe description of the menu item.
shift,control,altModifier flags.
commandtypeThe command key, that is needed (0 is none).

Definition at line 37 of file KeyboardItem.java.

       {      Shift=shift; Control=control; Alt=alt;
              CharKey=charkey.toLowerCase();
              MenuString=menustring; ActionName=actionname;
              CommandType=commandtype;
       }
rene.gui.KeyboardItem.KeyboardItem ( String  menu,
String  key 
) [inline]
Parameters:
menuThe menu string.
keyThe key descripion a la "esc1.shift.control.e"

Definition at line 49 of file KeyboardItem.java.

       {      MenuString=menu;
              Shift=Control=Alt=false;
              CommandType=0;
              CharKey="";
              StringTokenizer t=new StringTokenizer(key,".");
              while (t.hasMoreTokens())
              {      String token=(String)t.nextToken();
                     if (t.hasMoreTokens())
                     {      if (token.equals("control")) Control=true;
                            else if (token.equals("shift")) Shift=true;
                            else if (token.equals("alt")) Alt=true;
                            else if (token.startsWith("esc"))
                                   // esc should be followed by a number
                            {      try
                                   {      CommandType=Integer.parseInt(token.substring(3));
                                   }
                                   catch (Exception e) {}
                            }
                            else return;
                     }
                     else
                     {      if (key.equals("")) return;
                            CharKey=token.toLowerCase();
                     }
              }
              ActionName=Global.name(getStrippedMenuString());
       }

Here is the call graph for this function:


Member Function Documentation

Method of SortObject, necessary to sort the keys by name.

Implements rene.util.sort.SortObject.

Definition at line 120 of file KeyboardItem.java.

       {      return getName().compareTo(((KeyboardItem)o).getName());
       }

Here is the call graph for this function:

Definition at line 79 of file KeyboardItem.java.

{ return ActionName; }

Here is the caller graph for this function:

String rene.gui.KeyboardItem.getCharKey ( ) [inline]

Definition at line 80 of file KeyboardItem.java.

{ return CharKey; }

Here is the caller graph for this function:

Definition at line 84 of file KeyboardItem.java.

{ return CommandType; }

Here is the caller graph for this function:

Definition at line 78 of file KeyboardItem.java.

{ return MenuString; }

Here is the caller graph for this function:

String rene.gui.KeyboardItem.getName ( ) [inline]

Get the name of this KeyboardItem element.

Implements rene.dialogs.ItemEditorElement.

Definition at line 113 of file KeyboardItem.java.

       {      return MenuString;
       }

Here is the caller graph for this function:

Get a menu string, which is stripped from stars.

Definition at line 89 of file KeyboardItem.java.

       {      String s=MenuString;
              while (s.endsWith("*")) s=s.substring(0,s.length()-1);
              return s;
       }

Here is the caller graph for this function:

Definition at line 83 of file KeyboardItem.java.

{ return Alt; }

Here is the caller graph for this function:

Definition at line 82 of file KeyboardItem.java.

{ return Control; }

Here is the caller graph for this function:

Definition at line 81 of file KeyboardItem.java.

{ return Shift; }

Here is the caller graph for this function:

Return a key description for this item (to save as parameter).

This should be the same as the key parameter in the constructor.

Definition at line 128 of file KeyboardItem.java.

       {      String s=CharKey.toLowerCase();
              if (s.equals("none") || s.equals("default")) return s;
              if (Alt) s="alt."+s;
              if (Control) s="control."+s;
              if (Shift) s="shift."+s;
              if (CommandType>0) s="esc"+CommandType+"."+s;
              return s;
       }

Here is the caller graph for this function:

String rene.gui.KeyboardItem.shortcut ( ) [inline]

Compute a visible shortcut to append after the menu items (like "(Ctr O)".

The modifiers depend on the language.

Definition at line 99 of file KeyboardItem.java.

       {      if (CharKey.equals("none")) return "";
              String s=CharKey.toUpperCase();
              if (Alt) s=Global.name("shortcut.alt")+" "+s;
              if (Control) s=Global.name("shortcut.control")+" "+s;
              if (Shift) s=Global.name("shortcut.shift")+" "+s;
              if (CommandType>0)
                     s=Keyboard.commandShortcut(CommandType)+" "+s;
              return s;
       }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 18 of file KeyboardItem.java.

Definition at line 16 of file KeyboardItem.java.

Definition at line 17 of file KeyboardItem.java.

Definition at line 19 of file KeyboardItem.java.

Definition at line 16 of file KeyboardItem.java.

Definition at line 18 of file KeyboardItem.java.

Definition at line 16 of file KeyboardItem.java.


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