public class Wheel extends WidgetWithListener implements MouseListener
Notes:
Wheel.WheelListener
to send the state events.Modifier and Type | Class and Description |
---|---|
static interface |
Wheel.WheelListener
Interface that handle wheel events.
|
static class |
Wheel.WheelListenerToCommandEvents
Default implementation of
Wheel.WheelListener . |
Widget.WidgetAttribute, Widget.WidgetDescription
MouseListener.MouseButton
DEFAULT_LABEL
Constructor and Description |
---|
Wheel() |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes the widget's associated resources (such as threads, images...).
|
void |
finalizeConfiguration()
Checks whether the widget configuration is valid or not and finalizes the widget configuration according all
attributes previously set.
|
void |
mouseDragged(int x,
int y)
Invoked when a mouse has been dragged on a widget.
|
void |
mousePressed(int x,
int y,
MouseListener.MouseButton button)
Invoked when a mouse has been pressed on a widget.
|
void |
mouseReleased(int x,
int y,
MouseListener.MouseButton button)
Invoked when a mouse has been released on a widget.
|
protected Object |
newDefaultListener()
Lets subclass creates a default listener.
|
void |
setListenerClass(String listenerClassName)
Defines the user class which has to implement
Wheel.WheelListener . |
void |
setMaxAngle(double maxAngle)
Sets the bigger angle the wheel can have.
|
void |
setPushedSkin(Image pushedSkin)
Sets the skin to show the wheel press event.
|
void |
setSteps(Image[] steps)
Sets the images which simulate the wheel rotation.
|
void |
start()
Starts the widget.
|
newListener, setListenerClass
getAbsoluteX, getAbsoluteY, getCurrentSkin, getFilter, getHeight, getLabel, getParent, getSkin, getWidth, getX, getY, isOver, repaint, repaint, setCurrentSkin, setFilter, setHeight, setLabel, setOverlay, setSkin, setWidth, setX, setY, showYourself
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
mouseEntered, mouseExited, mouseMoved, mouseWheelMoved
public void dispose()
Widget
Default behavior disposes the common images and subclasses should override this method to define their own behavior.
This method should only be called by front panel engine.
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 void mouseDragged(int x, int y)
MouseListener
mouseDragged
in interface MouseListener
x
- the mouse x coordinate relative to widget position.y
- the mouse y coordinate relative to widget position.public void mousePressed(int x, int y, MouseListener.MouseButton button)
MouseListener
mousePressed
in interface MouseListener
x
- the mouse x coordinate relative to widget position.y
- the mouse y coordinate relative to widget position.button
- the button that has been pressed.public void mouseReleased(int x, int y, MouseListener.MouseButton button)
MouseListener
mouseReleased
in interface MouseListener
x
- the mouse x coordinate relative to widget position.y
- the mouse y coordinate relative to widget position.button
- the button that has been released.protected Object newDefaultListener()
WidgetWithListener
newDefaultListener
in class WidgetWithListener
public void setListenerClass(String listenerClassName)
Wheel.WheelListener
.
This method should only be called by front panel parser.
listenerClassName
- user listener class name.public void setMaxAngle(double maxAngle)
This method should only be called by front panel parser.
maxAngle
- an angle in degree.public void setPushedSkin(Image pushedSkin)
This method should only be called by front panel parser.
pushedSkin
- the press skin.public void setSteps(Image[] steps)
This method should only be called by front panel parser.
steps
- array of images.public void start()
Widget
Widget.finalizeConfiguration()
).
Main implementation does nothing.
This method should only be called by front panel engine.