public abstract class Device extends Composite
It contains all of the input/output parts of the real device (screens, buttons, ...). The packaging of the device is represented by a background image.
A device is created by the front panel framework during the parsing step. As soon as all device's widgets are created
and finalized, the device is started. A this moment the widgets and user code can call the method
getDevice()
(and FrontPanel.getDevice()
): it will return the unique device. Before starting
step, a call to these functions throws a runtime exception.
Widget.WidgetAttribute, Widget.WidgetDescription
DEFAULT_LABEL
Constructor and Description |
---|
Device(java.lang.String name,
Image skin)
Creates a new device with its name (label) and background.
|
Modifier and Type | Method and Description |
---|---|
static Device |
getDevice()
Gets the unique device instance.
|
EventQueue |
getEventQueue()
Gets the input events queue.
|
java.lang.String |
getName()
Gets the name of the device.
|
<T> T |
getWidget(java.lang.Class<T> clazz)
Gets the first width which implement the given class.
|
<T> T |
getWidget(java.lang.Class<T> clazz,
java.lang.String label)
Gets the first width which implement the given class and whose label is equals to given label.
|
java.util.List<Widget> |
getWidgets()
Gets a list of device's widgets.
|
<T> java.util.List<T> |
getWidgets(java.lang.Class<T> clazz)
Gets a list of device's widgets which implement the given class.
|
finalizeConfiguration, getAbsoluteX, getAbsoluteY, getCurrentSkin, getFilter, getHeight, getLabel, getParent, getSkin, getWidth, getX, getY, isOver, repaint, repaint, setCurrentSkin, setFilter, setHeight, setLabel, setOverlay, setSkin, setWidth, setX, setY, showYourself, start
public Device(java.lang.String name, Image skin)
name
- the name to show as title.skin
- the device background image.public static Device getDevice()
Equivalent to FrontPanel.getFrontPanel().getDevice()
.
public java.lang.String getName()
Equivalent to getLabel()
.
public java.util.List<Widget> getWidgets()
public <T> java.util.List<T> getWidgets(java.lang.Class<T> clazz)
clazz
- the widget class to retrieve.public <T> T getWidget(java.lang.Class<T> clazz)
clazz
- the widget class to retrieve.public <T> T getWidget(java.lang.Class<T> clazz, java.lang.String label)
clazz
- the widget class to retrieve.label
- the label to looking for or null to return only the first widget which implements the given class.public EventQueue getEventQueue()