UserEventRepository

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.dvb.event
Class UserEventRepository

    java.lang.Object
      org.dvb.event.RepositoryDescriptor
          org.dvb.event.UserEventRepository

All Implemented Interfaces:
  ResourceProxy

Direct Known Subclasses:
  OverallRepository

    public class UserEventRepository

extends RepositoryDescriptor

The application will use this class to define the events that it wants to receive. Events that are able to be put in the repository are defined in the UserEvent class.

Where a repository includes a `KEY_PRESSED` type event without the `KEY_RELEASED` type event for the same key code or vice versa then exclusive reservations shall be made for both event types but only the one requested shall be received by the listener. Where a repository includes a `KEY_TYPED` event without the corresponding `KEY_PRESSED` and `KEY_RELEASED` events (excluding `KEY_PRESSED` or `KEY_RELEASED` events for modifiers), when an exclusive reservation is requested, it shall also be made for those corresponding `KEY_PRESSED` and `KEY_RELEASED` events but only the requested event shall be received by the listener.

Repositories do not keep a count of the number of times a particular user event is added or removed. Repeatedly adding an event to a repository has no effect. Removing an event removes it regardless of the number of times it has been added. For example, org.dvb.event.UserEventRepository.addUserEvent(UserEvent event) does nothing in case that the event is already in the repository. Events are considered to be already in the repository if an event with the same triplet of family, type and code is already in the repository.

If an application loses exclusive access to a repository, it shall lose access to all events defined in that repository. Repositories are resolved when they are passed into the methods of EventManager. Adding or removing events from the repository after those method calls does not affect the subscription to those events.

Unless stated otherwise, all constants used in the specification of this class are defined in `java.awt.event.KeyEvent` and its parent classes and not in this class.

See Also:
  `UserEvent`

Constructor Summary
`UserEventRepository(String name)` The method to construct a new UserEventRepository.

Method Summary
`void` | `addAllArrowKeys()` Adds the key codes for the arrow keys (VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN).
`void` | `addAllColourKeys()` Adds the key codes for the colour keys (VK_COLORED_KEY_0, VK_COLORED_KEY_1, VK_COLORED_KEY_2, VK_COLORED_KEY_3).
`void` | `addAllNumericKeys()` Adds the key codes for the numeric keys (VK_0, VK_1, VK_2, VK_3, VK_4, VK_5, VK_6, VK_7, VK_8, VK_9).
`void` | `addKey(int keycode)` Adds the specified keycode to the repository.
`void` | `addUserEvent(UserEvent event)` Adds the given user event to the repository.
`String` | `getName()` Returns the name of the current repository as passed to the constructor.
`UserEvent[]` | `getUserEvent()` Returns the list of the user events that are in the repository.
`void` | `removeAllArrowKeys()` Removes the key codes for the arrow keys (VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN).
`void` | `removeAllColourKeys()` Removes the key codes for the colour keys (VK_COLORED_KEY_0, VK_COLORED_KEY_1, VK_COLORED_KEY_2, VK_COLORED_KEY_3).
`void` | `removeAllNumericKeys()` Remove the key codes for the numeric keys (VK_0, VK_1, VK_2, VK_3, VK_4, VK_5, VK_6, VK_7, VK_8, VK_9).
`void` | `removeKey(int keycode)` The method to remove a key from the repository.
`void` | `removeUserEvent(UserEvent event)` Remove a user event from the repository.

Methods inherited from class org.dvb.event.RepositoryDescriptor
`getClient`

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

Constructor Detail

### UserEventRepository

    public UserEventRepository(String name)

  The method to construct a new UserEventRepository.

  Parameters:
    `name` - the name of the repository.

Method Detail

### addUserEvent

    public void addUserEvent(UserEvent event)

  Adds the given user event to the repository. The values of the modifiers (if any) in the `UserEvent` shall be ignored by the MHP terminal. The value of the source used to construct the specified `UserEvent` shall be ignored by the MHP terminal when the `UserEventRepository` is used to specify events which an application wants to receive.

  Parameters:
    `event` - the user event to be added in the repository.

### getUserEvent

    public UserEvent[] getUserEvent()

  Returns the list of the user events that are in the repository.

  Returns:
    an array which contains the user events that are in the repository.

### removeUserEvent

    public void removeUserEvent(UserEvent event)

  Remove a user event from the repository. Removing a user event which is not in the repository shall have no effect.

  Parameters:
    `event` - the event to be removed from the repository.

### addKey

    public void addKey(int keycode)

  Adds the specified keycode to the repository. Keycodes added in this way shall be listed in the list of user events returned by the `getUserEvent` method. If a key is already in the repository, this method has no effect. After calling this method, the keycode shall be present for both the `KEY_PRESSED` and `KEY_RELEASED` modes.

  Parameters:
    `keycode` - the key code.

### removeKey

    public void removeKey(int keycode)

  The method to remove a key from the repository. Removing a key which is not in the repository has no effect. After calling this method, the keycode shall not be present for both the `KEY_PRESSED` and `KEY_RELEASED` modes.

  Parameters:
    `keycode` - the key code.

### addAllNumericKeys

    public void addAllNumericKeys()

  Adds the key codes for the numeric keys (VK_0, VK_1, VK_2, VK_3, VK_4, VK_5, VK_6, VK_7, VK_8, VK_9). Any key codes already in the repository will not be added again. After calling this method, the keycodes shall be present for both the `KEY_PRESSED` and `KEY_RELEASED` modes.

### addAllColourKeys

    public void addAllColourKeys()

  Adds the key codes for the colour keys (VK_COLORED_KEY_0, VK_COLORED_KEY_1, VK_COLORED_KEY_2, VK_COLORED_KEY_3). Any key codes already in the repository will not be added again. After calling this method, the keycodes shall be present for both the `KEY_PRESSED` and `KEY_RELEASED` modes.

### addAllArrowKeys

    public void addAllArrowKeys()

  Adds the key codes for the arrow keys (VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN). Any key codes already in the repository will not be added again. After calling this method, the keycodes shall be present for both the `KEY_PRESSED` and `KEY_RELEASED` modes.

### removeAllNumericKeys

    public void removeAllNumericKeys()

  Remove the key codes for the numeric keys (VK_0, VK_1, VK_2, VK_3, VK_4, VK_5, VK_6, VK_7, VK_8, VK_9). Key codes from this set which are not present in the repository will be ignored. After calling this method, the keycodes shall not be present for both the `KEY_PRESSED` and `KEY_RELEASED` modes.

### removeAllColourKeys

    public void removeAllColourKeys()

  Removes the key codes for the colour keys (VK_COLORED_KEY_0, VK_COLORED_KEY_1, VK_COLORED_KEY_2, VK_COLORED_KEY_3). Key codes from this set which are not present in the repository will be ignored. After calling this method, the keycodes shall not be present for both the `KEY_PRESSED` and `KEY_RELEASED` modes.

### removeAllArrowKeys

    public void removeAllArrowKeys()

  Removes the key codes for the arrow keys (VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN). Key codes from this set which are not present in the repository will be ignored. After calling this method, the keycodes shall not be present for both the `KEY_PRESSED` and `KEY_RELEASED` modes.

### getName

    public String getName()

  Returns the name of the current repository as passed to the constructor.

  Overrides:
    `getName` in class `RepositoryDescriptor`
  Returns:
    a String with the name of the repository.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD