org.dvb.event
Class UserEvent

java.lang.Object
  extended byjava.util.EventObject
      extended byorg.dvb.event.UserEvent
All Implemented Interfaces:
java.io.Serializable

public class UserEvent
extends java.util.EventObject

Represents a user event. A user event is defined by a family, a type and either a code or a character. Unless stated otherwise, all constants used in the specification of this class are defined in java.awt.event.KeyEvent and its parent classes.

See Also:
Serialized Form

Field Summary
static int UEF_KEY_EVENT
          the family for events that are coming from the remote control or from the keyboard.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
UserEvent(java.lang.Object source, int family, char keyChar, long when)
          Constructor for a new UserEvent object representing a key being typed.
UserEvent(java.lang.Object source, int family, int type, int code, int modifiers, long when)
          Constructor for a new UserEvent object representing a key being pressed.
 
Method Summary
 int getCode()
          Returns the event code.
 int getFamily()
          Returns the event family.
 char getKeyChar()
          Returns the character associated with the key in this event.
 int getModifiers()
          Returns the modifiers flag for this event.
 int getType()
          Returns the event type.
 long getWhen()
          Returns the timestamp of when this event occurred.
 boolean isAltDown()
          Returns whether or not the Alt modifier is down on this event.
 boolean isControlDown()
          Returns whether or not the Control modifier is down on this event.
 boolean isMetaDown()
          Returns whether or not the Meta modifier is down on this event.
 boolean isShiftDown()
          Returns whether or not the Shift modifier is down on this event.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UEF_KEY_EVENT

public static final int UEF_KEY_EVENT
the family for events that are coming from the remote control or from the keyboard.

See Also:
Constant Field Values
Constructor Detail

UserEvent

public UserEvent(java.lang.Object source,
                 int family,
                 int type,
                 int code,
                 int modifiers,
                 long when)
Constructor for a new UserEvent object representing a key being pressed.

Parameters:
source - the EventManager which is the source of the event
family - the event family.
type - the event type. Either one of KEY_PRESSED or KEY_RELEASED.
code - the event code. One of the constants whose name begins in "VK_" defined in java.awt.event.KeyEvent or org.havi.ui.event.HRcEvent.
modifiers - the modifiers active when the key was pressed. These have the same semantics as modifiers in java.awt.event.KeyEvent.
when - a long integer that specifies the time the event occurred

UserEvent

public UserEvent(java.lang.Object source,
                 int family,
                 char keyChar,
                 long when)
Constructor for a new UserEvent object representing a key being typed. This is the combination of a key being pressed and then being released. The type of UserEvents created with this constructor shall be KEY_TYPED. Key combinations which do not result in characters, such as keys like the red key on a remote control, shall not generate KEY_TYPED events. KEY_TYPED events shall have no modifiers and hence shall not report any modifiers as being down.

Parameters:
source - the EventManager which is the source of the event
family - the event family.
keyChar - the character typed
when - a long integer that specifies the time the event occurred
Since:
MHP 1.0.1
Method Detail

getFamily

public int getFamily()
Returns the event family. Could be UEF_KEY_EVENT.

Returns:
an int representing the event family.

getType

public int getType()
Returns the event type. Could be KEY_PRESSED, KEY_RELEASED or KEY_TYPED.

Returns:
an int representing the event type.

getCode

public int getCode()
Returns the event code. For KEY_TYPED events, the code is VK_UNDEFINED.

Returns:
an int representing the event code.

getKeyChar

public char getKeyChar()
Returns the character associated with the key in this event. If no valid Unicode character exists for this key event, keyChar is CHAR_UNDEFINED.

Returns:
a character
Since:
MHP 1.0.1

getModifiers

public int getModifiers()
Returns the modifiers flag for this event. This method shall return 0 for UserEvents constructed using a constructor which does not include an input parameter specifying the modifiers.

Returns:
the modifiers flag for this event
Since:
MHP 1.0.1

isShiftDown

public boolean isShiftDown()
Returns whether or not the Shift modifier is down on this event. This method shall return false for UserEvents constructed using a constructor which does not include an input parameter specifying the modifiers.

Returns:
whether the Shift modifier is down on this event
Since:
MHP 1.0.1

isControlDown

public boolean isControlDown()
Returns whether or not the Control modifier is down on this event. This method shall return false for UserEvents constructed using a constructor which does not include an input parameter specifying the modifiers.

Returns:
whether the Control modifier is down on this event
Since:
MHP 1.0.1

isMetaDown

public boolean isMetaDown()
Returns whether or not the Meta modifier is down on this event. This method shall return false for UserEvents constructed using a constructor which does not include an input parameter specifying the modifiers.

Returns:
whether the Meta modifier is down on this event
Since:
MHP 1.0.1

isAltDown

public boolean isAltDown()
Returns whether or not the Alt modifier is down on this event. This method shall return false for UserEvents constructed using a constructor which does not include an input parameter specifying the modifiers.

Returns:
whether the Alt modifier is down on this event
Since:
MHP 1.0.1

getWhen

public long getWhen()
Returns the timestamp of when this event occurred.

Returns:
a long
Since:
MHP 1.0.2