public class HEventRepresentation extends Object
The particular text, color, or symbol can be determined by calling
the getString, getColor or getSymbol methods respectively. All available events should return
a valid text representation from the getString method.
If supported the six colored key events
(VK_COLORED_KEY_0 thru VK_COLORED_KEY_5)
must also be represented by a color, i.e. the getColor method
must return a valid java.awt.Color object.
Key events may also be represented as a symbol - if the platform does not support a symbolic representation for a given event, then the application is responsible for rendering the symbol itself. The rendering of keys with a commonly known representation should follow the guidelines given here, as defined in the following table.
| Event | Implied symbol | Sample |
|---|---|---|
| VK_GO_TO_START | Two equilateral triangles, pointing at a line to the left | ![]() |
| VK_REWIND | Two equilateral triangles, pointing to the left | ![]() |
| VK_STOP | A square | ![]() |
| VK_PAUSE | Two vertical lines, side by side | ![]() |
| VK_PLAY | One equilateral triangle, pointing to the right | ![]() |
| VK_FAST_FWD | Two equilateral triangles, pointing to the right | ![]() |
| VK_GO_TO_END | Two equilateral triangles, pointing to a line at the right | ![]() |
| VK_TRACK_PREV | One equilateral triangle, pointing to a line at the left | ![]() |
| VK_TRACK_NEXT | One equilateral triangle, pointing to a line at the right | ![]() |
| VK_RECORD | A circle, normally red | ![]() |
| VK_EJECT_TOGGLE | A line under a wide triangle which points up | ![]() |
| VK_VOLUME_UP | A ramp, increasing to the right, near a plus sign | ![]() |
| VK_VOLUME_DOWN | A ramp, increasing to the right, near a minus sign | ![]() |
| VK_UP | An arrow pointing up | ![]() |
| VK_DOWN | An arrow pointing down | ![]() |
| VK_LEFT | An arrow pointing to the left | ![]() |
| VK_RIGHT | An arrow pointing to the right | ![]() |
| VK_POWER | A circle, broken at the top, with a vertical line in the break | ![]() |
| Parameter | Description | Default value | Set method | Get method |
|---|---|---|---|---|
| None. | ||||
| Description | Default value | Set method | Get method |
|---|---|---|---|
| None. | |||
| Modifier and Type | Field and Description |
|---|---|
static int |
ER_TYPE_COLOR
The event representation type for the current event is
supported as a color.
|
static int |
ER_TYPE_NOT_SUPPORTED
The event representation type for the current event is not
supported.
|
static int |
ER_TYPE_STRING
The event representation type for the current event is
supported as a string.
|
static int |
ER_TYPE_SYMBOL
The event representation type for the current event is
supported as a symbol.
|
| Modifier | Constructor and Description |
|---|---|
protected |
HEventRepresentation()
An interoperable application shall not subclass the
HEventRepresentation class.
|
| Modifier and Type | Method and Description |
|---|---|
Color |
getColor()
This returns the color representation (generally used for
colored soft keys) of the current event code.
|
String |
getString()
Returns the text representation of the current event code.
|
Image |
getSymbol()
This returns an image-based representation (generally used for
symbolic keys) of the current event code.
|
int |
getType()
This returns the type of representation(s) available for the
event code which this instance of
HEventRepresentation
represents. |
boolean |
isSupported()
This method returns true if the current event is supported by
the platform.
|
protected void |
setColor(Color aColor)
Sets the Color representation for this
HEventRepresentation. |
protected void |
setString(String aText)
Sets the string representation for this
HEventRepresentation. |
protected void |
setSymbol(Image aSymbol)
Sets the symbolic representation for this
HEventRepresentation. |
protected void |
setType(int aType)
Sets the type of representation(s) available for the event code
which this this instance of
HEventRepresentation
represents. |
public static final int ER_TYPE_NOT_SUPPORTED
The four ER_TYPE integers describe if an input mechanism is not supported, or is described by a string, color or symbol.
The values of the four ER_TYPE integers are required to be bitwise distinct, and the value of ER_TYPE_NOT_SUPPORTED should be 0.
public static final int ER_TYPE_STRING
ER_TYPE_NOT_SUPPORTED,
Constant Field Valuespublic static final int ER_TYPE_COLOR
ER_TYPE_NOT_SUPPORTED,
Constant Field Valuespublic static final int ER_TYPE_SYMBOL
ER_TYPE_NOT_SUPPORTED,
Constant Field Valuesprotected HEventRepresentation()
Creates an HEventRepresentation object. See the class description for
details of constructor parameters and default values.
This method is protected to allow the platform to override it in a different package scope.
public boolean isSupported()
protected void setType(int aType)
HEventRepresentation
represents. If no representation(s) are available then
aType should be set to
ER_TYPE_NOT_SUPPORTED. Otherwise the representation should be
set to the sum of one or more of the following: ER_TYPE_STRING,
ER_TYPE_COLOR, ER_TYPE_SYMBOL.
For example, if both string and color representations
are available then the system should call this method with the
parameter set to ER_TYPE_STRING + ER_TYPE_COLOR.
This method is protected to allow the platform to override it in subclasses of HEventRepresentation. It is not intended for use by the application and conformant applications shall not use this method.
aType - the type of representation(s) available for this eventpublic int getType()
HEventRepresentation
represents.
If the event code can be represented in multiple ways, then the returned type will be the sum of the supported types, e.g. an event generated by a key with a particular font representation of an "A" in yellow might return ER_TYPE_STRING + ER_TYPE_COLOR + ER_TYPE_SYMBOL. Where the string representation is "A", the color representation is "yellow" and the symbol representation might be a likeness of the "A glyph" from a particular font.
protected void setColor(Color aColor)
HEventRepresentation. Any previous value is overwritten.
This method is protected to allow the platform to override it in subclasses of HEventRepresentation. It is not intended for use by the application and conformant applications shall not use this method.
aColor - - the color to be associated with this event.public Color getColor()
protected void setString(String aText)
HEventRepresentation. Any previous value is overwritten.
This method is protected to allow the platform to override it in subclasses of HEventRepresentation. It is not intended for use by the application and conformant applications shall not use this method.
aText - - the text string to be associated with this event.public String getString()
protected void setSymbol(Image aSymbol)
HEventRepresentation. Any previous value is overwritten.
This method is protected to allow the platform to override it in subclasses of HEventRepresentation. It is not intended for use by the application and conformant applications shall not use this method.
aSymbol - - the symbol image to be associated with this event.public Image getSymbol()
Note that it is platform specific whether this method will return a valid Image, in particular it is a valid implementation option to always return null. Note that for non-null Images, the size and other Image characteristics are dependent on particular manufacturer implementation.
Copyright © 2012 code4tv.com. All Rights Reserved.