Class SWTKeyLookup

  • All Implemented Interfaces:
    IKeyLookup

    public final class SWTKeyLookup
    extends Object
    implements IKeyLookup

    A look-up table for the formal grammar for keys, and the integer values they represent. This look-up table is hard-coded to use SWT representations. By replacing this class (and SWTKeySupport), you can remove the dependency on SWT.

    Since:
    3.1
    See Also:
    KeyLookupFactory
    • Method Detail

      • formalKeyLookup

        public final int formalKeyLookup​(String name)
        Description copied from interface: IKeyLookup
        Looks up a single natural key by its formal name, and returns the integer representation for this natural key
        Specified by:
        formalKeyLookup in interface IKeyLookup
        Parameters:
        name - The formal name of the natural key to look-up; must not be null.
        Returns:
        The integer representation of this key. If the natural key cannot be found, then this method returns 0.
      • formalKeyLookupInteger

        public final Integer formalKeyLookupInteger​(String name)
        Description copied from interface: IKeyLookup
        Looks up a single natural key by its formal name, and returns the integer representation for this natural key
        Specified by:
        formalKeyLookupInteger in interface IKeyLookup
        Parameters:
        name - The formal name of the natural key to look-up; must not be null.
        Returns:
        The integer representation of this key. If the natural key cannot be found, then this method returns 0.
      • formalModifierLookup

        public final int formalModifierLookup​(String name)
        Description copied from interface: IKeyLookup
        Looks up a single modifier key by its formal name, and returns the integer representation for this modifier key
        Specified by:
        formalModifierLookup in interface IKeyLookup
        Parameters:
        name - The formal name of the modifier key to look-up; must not be null.
        Returns:
        The integer representation of this key. If the modifier key cannot be found, then this method returns 0.
      • formalNameLookup

        public final String formalNameLookup​(int key)
        Description copied from interface: IKeyLookup
        Looks up a key value, and returns the formal string representation for that key
        Specified by:
        formalNameLookup in interface IKeyLookup
        Parameters:
        key - The key to look-up.
        Returns:
        The formal string representation of this key. If this key cannot be found, then it is simply the character corresponding to that integer value.
      • getAlt

        public final int getAlt()
        Description copied from interface: IKeyLookup
        Returns the integer representation of the ALT key.
        Specified by:
        getAlt in interface IKeyLookup
        Returns:
        The ALT key
      • getCommand

        public final int getCommand()
        Description copied from interface: IKeyLookup
        Returns the integer representation of the COMMAND key.
        Specified by:
        getCommand in interface IKeyLookup
        Returns:
        The COMMAND key
      • getCtrl

        public final int getCtrl()
        Description copied from interface: IKeyLookup
        Returns the integer representation of the CTRL key.
        Specified by:
        getCtrl in interface IKeyLookup
        Returns:
        The CTRL key
      • getShift

        public final int getShift()
        Description copied from interface: IKeyLookup
        Returns the integer representation of the SHIFT key.
        Specified by:
        getShift in interface IKeyLookup
        Returns:
        The SHIFT key
      • isModifierKey

        public final boolean isModifierKey​(int key)
        Description copied from interface: IKeyLookup
        Returns whether the given key is a modifier key.
        Specified by:
        isModifierKey in interface IKeyLookup
        Parameters:
        key - The integer value of the key to check.
        Returns:
        true if the key is one of the modifier keys; false otherwise.