org.vishia.gral.swt

## Class SwtKeyListener

- java.lang.Object
- - org.vishia.gral.swt.SwtKeyListener

- All Implemented Interfaces:
    java.util.EventListener, org.eclipse.swt.events.KeyListener, org.eclipse.swt.internal.SWTEventListener, GralKeySpecial_ifc
  Direct Known Subclasses:
    SwtButton.KeyListener, SwtTextBox.TextBoxKeyListener, SwtTextFieldWrapper.TextFieldKeyListener

      public class SwtKeyListener
      extends java.lang.Object
      implements GralKeySpecial_ifc, org.eclipse.swt.events.KeyListener

  A common key listener implementation for SWT. It is applied to all widgets. Derived forms exists for special SWT-widgets. This class is instanciated one time in the `SwtMng`. A Widget can be completed with this key listener. On all keys the `GralUserAction` given in the `GralWidget#getActionChange()` is called
  If the method returns false, the central key action given in `GralMng#getRegisteredUserAction(String)` for "keyAction" is tried to get and then invoked with cmd = "key" and the key code in params[0]. This central keyAction may be used for application centralized keys without association to the table itself.
  See Also:
    `GralKeyListener`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private GralKeyListener` | `keyAction`
    `static int` | `version` Version and history 2011-12-03 Hartmut created.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SwtKeyListener(GralKeyListener keyAction)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `keyPressed(org.eclipse.swt.events.KeyEvent keyEv)`
    `void` | `keyReleased(org.eclipse.swt.events.KeyEvent arg0)`
    `boolean` | `specialKeysOfWidgetType(int key, GralWidget_ifc widgg, java.lang.Object widgImpl)` This method can be overridden by specialized classes of this.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### version

          public static final int version

      Version and history
      - 2011-12-03 Hartmut created. Any widget may have the same key listener.
      See Also:
        Constant Field Values

    - #### keyAction

          private final GralKeyListener keyAction

  - ### Constructor Detail

    - #### SwtKeyListener

          public SwtKeyListener(GralKeyListener keyAction)

  - ### Method Detail

    - #### keyPressed

          public void keyPressed(org.eclipse.swt.events.KeyEvent keyEv)

      Specified by:
        `keyPressed` in interface `org.eclipse.swt.events.KeyListener`

    - #### keyReleased

          public void keyReleased(org.eclipse.swt.events.KeyEvent arg0)

      Specified by:
        `keyReleased` in interface `org.eclipse.swt.events.KeyListener`

    - #### specialKeysOfWidgetType

          public boolean specialKeysOfWidgetType(int key,
                                                 GralWidget_ifc widgg,
                                                 java.lang.Object widgImpl)

      Description copied from interface: `GralKeySpecial_ifc`
      This method can be overridden by specialized classes of this. This method is called firstly. Note if a special key should be handled in the `GralWidget#getActionChange()` then this special handling should be programmed in the derived class. If this method returns true, the key is not applied to the action and not applied to the common handling.
      Specified by:
        `specialKeysOfWidgetType` in interface `GralKeySpecial_ifc`
      Returns:
        true if the key is processed.