Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| SWIXML 1.5 (#149)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.swixml.converters
Class KeyStrokeConverter

    java.lang.Object
      org.swixml.converters.KeyStrokeConverter

All Implemented Interfaces:
  Converter

    public class KeyStrokeConverter

extends Object
implements Converter

A Converter that turns a Strings in the form of a filename into an KeyStroke objects.

       Valild syntax includes:

       accelerator="F7"
       accelerator="control N"
       accelerator="alt A"

Version:
  $Revision: 1.1 $
Author:
  Wolf Paulus, Eric Lafargue
See Also:
  `KeyStroke.getKeyStroke(java.lang.String)`, `ConverterLibrary`

Field Summary
`static Class` | `TEMPLATE` converter's return type

Constructor Summary
`KeyStrokeConverter()`

Method Summary
`static Object` | `conv(Class type, Attribute attr, Localizer localizer)` Converts a String into an KeyStroke.
`Object` | `convert(Class type, Attribute attr, Localizer localizer)` Converts a String into an KeyStroke through a Resource lookup
`Class` | `convertsTo()` A `Converters` conversTo method informs about the Class type the converter is returning when its `convert` method is called

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TEMPLATE

    public static final Class TEMPLATE

  converter's return type

Constructor Detail

### KeyStrokeConverter

    public KeyStrokeConverter()

Method Detail

### convert

    public Object convert(Class type,
                          Attribute attr,
                          Localizer localizer)

  Converts a String into an KeyStroke through a Resource lookup

  Specified by:
    `convert` in interface `Converter`
  Parameters:
    `type` - `Class` not used
    `attr` - `Attribute` attribute provides the value to be converted
    `localizer` - `Localizer` allow the use of resource lookups
  Returns:
    `Object` - a `KeyStroke`

### conv

    public static Object conv(Class type,
                              Attribute attr,
                              Localizer localizer)

  Converts a String into an KeyStroke. Parses a string and returns a `KeyStroke`. The string must have the following syntax:

          <modifiers>* (<typedID> | <pressedReleasedID>)

          modifiers := shift | control | ctrl | meta | alt | button1 | button2 | button3
          typedID := typed <typedKey>
          typedKey := string of length 1 giving Unicode character.
          pressedReleasedID := (pressed | released) key
          key := KeyEvent key code name, i.e. the name following "VK_".

  If typed, pressed or released is not specified, pressed is assumed. Here are some examples:

           "INSERT" => getKeyStroke(KeyEvent.VK_INSERT, 0);
           "control DELETE" => getKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK);
           "alt shift X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK);
           "alt shift released X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);
           "typed a" => getKeyStroke('a');

  In order to maintain backward-compatibility, specifying a null String, or a String which is formatted incorrectly, returns null.

  Parameters:
    `type` - `Class` not used
    `attr` - `Attribute` attribute provides the value to be converted
    `localizer` - `Localizer` allow the use of resource lookups
  Returns:
    `Object` - a `KeyStroke` object for that String, or null if the specified String is null, or is formatted incorrectly

### convertsTo

    public Class convertsTo()

  A `Converters` conversTo method informs about the Class type the converter is returning when its `convert` method is called

  Specified by:
    `convertsTo` in interface `Converter`
  Returns:
    `Class` - the Class the converter is returning when its convert method is called

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| SWIXML 1.5 (#149)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 - 2007 - Wolf Paulus - wolfpaulus.com. All rights reserved.