public abstract class MicroUILED extends Widget
A LED is a widget that represents a LED. Its intensity is variable.
Note the widget label must be an integer. It allows MicroUI implementation to retrieve a LED from an integer index.
The first LED index must be 0
and last LED index must be availableNumberOfLEDs - 1
, where
availableNumberOfLEDs
is retrieved using method
Device.getDevice().getWidgets(MicroUILED.class).size()
.
Widget.WidgetAttribute, Widget.WidgetDescription
Modifier and Type | Field and Description |
---|---|
static int |
MAX_INTENSITY
Maximal value of intensity according MicroUI specification.
|
static int |
MIN_INTENSITY
Minimal value of intensity according MicroUI specification.
|
DEFAULT_LABEL
Constructor and Description |
---|
MicroUILED()
Creates a widget LED compatible with MicroUI implementation.
|
Modifier and Type | Method and Description |
---|---|
void |
finalizeConfiguration()
Checks whether the widget configuration is valid or not and finalizes the widget configuration according all
attributes previously set.
|
int |
getID()
Gets the LED identifier (equals to its label).
|
abstract int |
getIntensity()
Gets the intensity of this led.
|
abstract void |
setIntensity(int intensity)
Sets the intensity of this led.
|
dispose, 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 final int MIN_INTENSITY
public static final int MAX_INTENSITY
public MicroUILED()
public void finalizeConfiguration()
Widget
The widget attributes are set by the front panel parser but the order is not defined. This method allows to perform some checks between several attributes (this method is called by the front panel parser after setting all attributes defined in front panel file).
The configuration validation depends on widget itself. Each subclass must verify its configuration after checking its parent configuration.
When framework calling this method, all device widgets are not created and finalized yet, and by extension the
device itself is not fully created too. So the implementation must not have to call some methods on other widgets
and the methods Device.getDevice()
or FrontPanel.getDevice()
. As soon as all widgets are created
and finalized, the simulation starts calling the method Widget.start()
on each widget. As this moment only, the
widget is able to use the other widgets and the device itself.
On configuration error, a RuntimeException
(or a subclass of RuntimeException
) must be thrown.
This method should only be called by front panel parser.
finalizeConfiguration
in class Widget
public int getID()
public abstract void setIntensity(int intensity)
intensity
- the intensity to set.public abstract int getIntensity()