public class Pointer extends WidgetWithListener implements MouseListener
Notes:
Pointer.PointerListener
to send the pointer events,setTouch(boolean)
attribute is false, this widget manages a mouse. Until three buttons are
managed,setTouch(boolean)
attribute is true, this widget manages a touch panel. Only one button is
managed.Modifier and Type | Class and Description |
---|---|
static interface |
Pointer.PointerListener
Interface that handle pointer events.
|
static class |
Pointer.PointerListenerToPointerEvents
Default implementation of
Pointer.PointerListener . |
Widget.WidgetAttribute, Widget.WidgetDescription
MouseListener.MouseButton
DEFAULT_LABEL
Constructor and Description |
---|
Pointer() |
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.
|
protected Pointer.PointerListener |
getListener()
Gets the widget listener.
|
protected int |
getMoveFilteringDelay()
Gets the minimum delay (in milliseconds) the system has to respect to send a new move event to the application.
|
protected boolean |
isTouch()
Tells if pointer is a touch panel or a mouse.
|
void |
mouseDragged(int x,
int y)
Invoked when a mouse has been dragged on a widget.
|
void |
mouseEntered(int x,
int y)
Invoked when a mouse enters a widget.
|
void |
mouseExited(int x,
int y)
Invoked when a mouse exits a widget.
|
void |
mouseMoved(int x,
int y)
Invoked when a mouse has been moved 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 |
setAreaHeight(int height)
Sets the area height of the pointer area.
|
void |
setAreaWidth(int width)
Sets the area width of the pointer area.
|
void |
setListenerClass(String listenerClassName)
Defines the user class which has to implement
Pointer.PointerListener . |
void |
setTouch(boolean touch)
Configures touch or mouse mode.
|
void |
start()
Starts the widget.
|
newListener, setListenerClass
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
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
mouseWheelMoved
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
protected Pointer.PointerListener getListener()
protected int getMoveFilteringDelay()
protected boolean isTouch()
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 mouseEntered(int x, int y)
MouseListener
mouseEntered
in interface MouseListener
x
- the mouse x coordinate relative to widget position.y
- the mouse y coordinate relative to widget position.public void mouseExited(int x, int y)
MouseListener
mouseExited
in interface MouseListener
x
- the mouse x coordinate relative to widget position.y
- the mouse y coordinate relative to widget position.public void mouseMoved(int x, int y)
MouseListener
mouseMoved
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 setAreaHeight(int height)
finalizeConfiguration()
).
This method should only be called by front panel parser.
height
- the height to set.public void setAreaWidth(int width)
finalizeConfiguration()
).
This method should only be called by front panel parser.
width
- the width to set.public void setListenerClass(String listenerClassName)
Pointer.PointerListener
.
This method should only be called by front panel parser.
listenerClassName
- user listener class name.public void setTouch(boolean touch)
This method should only be called by front panel parser.
touch
- true to set touch mode.public void start()
Widget
Widget.finalizeConfiguration()
).
Main implementation does nothing.
This method should only be called by front panel engine.