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(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.
|
String |
getName()
Gets the name of the device.
|
<T> T |
getWidget(Class<T> clazz)
Gets the first width which implement the given class.
|
<T> T |
getWidget(Class<T> clazz,
String label)
Gets the first width which implement the given class and whose label is equals to given label.
|
List<Widget> |
getWidgets()
Gets a list of device's widgets.
|
<T> List<T> |
getWidgets(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 static Device getDevice()
Equivalent to FrontPanel.getFrontPanel().getDevice()
.
public EventQueue getEventQueue()
public String getName()
Equivalent to getLabel()
.
public <T> T getWidget(Class<T> clazz)
clazz
- the widget class to retrieve.public <T> T getWidget(Class<T> clazz, 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 List<Widget> getWidgets()