|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jagatoo.input.devices.InputDevice
org.jagatoo.input.devices.Mouse
public abstract class Mouse
This is the base-class for all Mouse implementations.
Applications should always use instances as Mouse, but never cast them to
the concrete implementation.
Instances can only be created/retrieved through an InputDeviceFactory.
| Constructor Summary | |
|---|---|
protected |
Mouse(MouseFactory sourceFactory,
InputSourceWindow sourceWindow,
EventQueue eventQueue,
java.lang.String name,
int numButtons,
boolean hasWheel)
|
| Method Summary | |
|---|---|
protected void |
addButtonsState(int buttonState)
Adds bits to the button-state's bitmask. |
protected void |
addButtonsState(MouseButton button)
Adds bits to the button-state's bitmask. |
void |
addMouseListener(MouseListener l)
Adds a MouseListener to the list of instances being notifed on
mouse events. |
void |
addMouseStopListener(MouseStopListener l)
Adds a MouseStopListener to this Mouse to be notified
when the mouse has stopped being moved (for a while). |
abstract void |
centerMouse()
Centers the mouse cursor on the source-window. |
void |
destroy()
Destroys the InputDevice. |
protected abstract void |
destroyImpl()
Destroys the Mouse. |
void |
fireMouseEvent(MouseEvent e,
boolean consumeEvent)
This method simply forwards to the concrete fire* methods. |
void |
fireOnMouseButtonClicked(MouseButtonClickedEvent e,
boolean consumeEvent)
Fires a MouseButtonClickedEvent and pushes it back to the pool,
if consumeEvent is true. |
void |
fireOnMouseButtonPressed(MouseButtonPressedEvent e,
boolean consumeEvent)
Fires a MouseButtonPressedEvent and pushes it back to the pool,
if consumeEvent is true. |
void |
fireOnMouseButtonReleased(MouseButtonReleasedEvent e,
boolean consumeEvent)
Fires a MouseButtonReleasedEvent and pushes it back to the pool,
if consumeEvent is true. |
void |
fireOnMouseMoved(MouseMovedEvent e,
boolean consumeEvent)
Fires a MouseMovedEvent and pushes it back to the pool,
if consumeEvent is true. |
void |
fireOnMouseWheelMoved(MouseWheelEvent e,
boolean consumeEvent)
Fires a MouseWheelEvent and pushes it back to the pool,
if consumeEvent is true. |
MouseButton |
getButton(int index)
|
int |
getButtonsCount()
|
int |
getButtonsState()
|
InputState |
getButtonState(MouseButton button)
|
int |
getCurrentX()
|
int |
getCurrentY()
|
MouseFactory |
getSourceFactory()
|
int |
getState(DeviceComponent component)
This method returns an abstract input-state for the given DeviceComponent. |
MouseWheel |
getWheel()
|
MouseAxis |
getXAxis()
|
MouseAxis |
getYAxis()
|
protected void |
handleClickedEvents(long when,
long threshold)
Checks, if there are pending clicked-events and compares their when-times with the current when and threshold and fires the events, if necessary. |
boolean |
hasListener()
|
boolean |
hasMouseListener()
|
boolean |
isAbsolute()
|
boolean |
isButtonPressed(MouseButton button)
|
protected void |
notifyMouseStopManager(long nanoTime)
|
protected MouseButtonPressedEvent |
prepareMouseButtonPressedEvent(MouseButton button,
long when)
Prepares a MouseButtonPressedEvent for being fired. |
protected MouseButtonReleasedEvent |
prepareMouseButtonReleasedEvent(MouseButton button,
long when)
Prepares a MouseButtonReleasedEvent for being fired. |
protected MouseMovedEvent |
prepareMouseMovedEvent(int x,
int y,
int dx,
int dy,
long when)
Prepares a MouseMovedEvent for being fired. |
protected MouseWheelEvent |
prepareMouseWheelMovedEvent(int wheelDelta,
boolean isPageMove,
long when)
Prepares a MouseWheelEvent for being fired. |
protected void |
removeButtonsState(int buttonState)
Removes bits from the button-state's bitmask. |
protected void |
removeButtonsState(MouseButton button)
Removes bits from the button-state's bitmask. |
void |
removeMouseListener(MouseListener l)
Removes a MouseListener from the list of notified instances. |
void |
removeMouseStopListener(MouseStopListener l)
Removes a MouseStopListener from the list of notified instances. |
void |
setAbsolute(boolean absolute)
Makes this Mouse an absolute mouse (only delta positions become valid) or relative. |
protected abstract void |
setAbsoluteImpl(boolean absolute)
Makes this Mouse an absolute mouse (only delta positions become valid) or relative. |
protected void |
setButtonsState(int buttonState)
Sets the new button-state. |
protected void |
setPosition(int x,
int y)
This method stores the positional values and may do some additional implementation dependent stuff. |
protected void |
storePosition(int x,
int y)
This method simply stores the positional values. |
java.lang.String |
toString()
|
void |
update(InputSystem is,
EventQueue eventQueue,
long nanoTime)
Processes pending events from the system and directly fires them (notifes the listeners). |
protected abstract void |
updateMouse(InputSystem is,
EventQueue eventQueue,
long nanoTime)
Processes pending events from the system and directly fires them (notifes the listeners). |
| Methods inherited from class org.jagatoo.input.devices.InputDevice |
|---|
addInputStateListener, collectEvents, consumePendingEvents, equals, fireStateEventsAndDoActions, getEventQueue, getName, getSourceWindow, hasInputStateListener, isEnabled, onDeviceRegistered, onDeviceUnregistered, removeInputStateListener, setEnabled |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Mouse(MouseFactory sourceFactory,
InputSourceWindow sourceWindow,
EventQueue eventQueue,
java.lang.String name,
int numButtons,
boolean hasWheel)
throws InputSystemException
InputSystemException| Method Detail |
|---|
public final MouseFactory getSourceFactory()
MouseFactory, that created this instance.protected final void notifyMouseStopManager(long nanoTime)
public final MouseAxis getXAxis()
public final MouseAxis getYAxis()
protected void setPosition(int x,
int y)
throws InputSystemException
x - y -
InputSystemException
public abstract void centerMouse()
throws InputSystemException
InputSystemException
protected void storePosition(int x,
int y)
x - y - public final int getCurrentX()
public final int getCurrentY()
public final int getButtonsCount()
ControllerButtons mounted to this Controller.public final MouseButton getButton(int index)
ControllerButtons mounted to this Controller.protected void setButtonsState(int buttonState)
buttonState - protected void addButtonsState(int buttonState)
buttonState - protected void addButtonsState(MouseButton button)
button - protected void removeButtonsState(int buttonState)
buttonState - protected void removeButtonsState(MouseButton button)
button - public final int getButtonsState()
public final MouseWheel getWheel()
public final boolean isButtonPressed(MouseButton button)
button -
MouseButton is pressed on this Mouse.public final InputState getButtonState(MouseButton button)
button -
public int getState(DeviceComponent component)
throws InputSystemRuntimeException
getState in class InputDeviceInputSystemRuntimeExceptionpublic void addMouseStopListener(MouseStopListener l)
MouseStopListener to this Mouse to be notified
when the mouse has stopped being moved (for a while).
l - public void removeMouseStopListener(MouseStopListener l)
MouseStopListener from the list of notified instances.
l - public final boolean hasMouseListener()
MouseStopListener is currently registered.public final boolean hasListener()
InputDevice.hasInputStateListener() or hasMouseListener() return true.public void addMouseListener(MouseListener l)
MouseListener to the list of instances being notifed on
mouse events.
l - public void removeMouseListener(MouseListener l)
MouseListener from the list of notified instances.
l -
protected final MouseButtonPressedEvent prepareMouseButtonPressedEvent(MouseButton button,
long when)
MouseButtonPressedEvent for being fired.
button - when -
null, if no events are currently accepted.
public final void fireOnMouseButtonPressed(MouseButtonPressedEvent e,
boolean consumeEvent)
MouseButtonPressedEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
protected final MouseButtonReleasedEvent prepareMouseButtonReleasedEvent(MouseButton button,
long when)
MouseButtonReleasedEvent for being fired.
button - when -
null, if no events are currently accepted.
public final void fireOnMouseButtonReleased(MouseButtonReleasedEvent e,
boolean consumeEvent)
MouseButtonReleasedEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
public final void fireOnMouseButtonClicked(MouseButtonClickedEvent e,
boolean consumeEvent)
MouseButtonClickedEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
protected final void handleClickedEvents(long when,
long threshold)
when - threshold -
protected final MouseMovedEvent prepareMouseMovedEvent(int x,
int y,
int dx,
int dy,
long when)
MouseMovedEvent for being fired.MouseStopManager, so
that it can track, when the mouse has stopped.
button - when -
null, if no events are currently accepted.
public final void fireOnMouseMoved(MouseMovedEvent e,
boolean consumeEvent)
MouseMovedEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
protected final MouseWheelEvent prepareMouseWheelMovedEvent(int wheelDelta,
boolean isPageMove,
long when)
MouseWheelEvent for being fired.
button - when -
null, if no events are currently accepted.
public final void fireOnMouseWheelMoved(MouseWheelEvent e,
boolean consumeEvent)
MouseWheelEvent and pushes it back to the pool,
if consumeEvent is true.
e - consumeEvent -
public final void fireMouseEvent(MouseEvent e,
boolean consumeEvent)
e - consumeEvent -
protected abstract void setAbsoluteImpl(boolean absolute)
throws InputSystemException
setAbsolute(boolean),
but only if the value has changed.
absolute -
InputSystemException
public final void setAbsolute(boolean absolute)
throws InputSystemException
absolute -
InputSystemExceptionpublic final boolean isAbsolute()
protected abstract void updateMouse(InputSystem is,
EventQueue eventQueue,
long nanoTime)
throws InputSystemException
InputDevice.collectEvents(InputSystem, EventQueue, long)
method placed events into it.
is - eventQueue - nanoTime -
InputSystemException
public void update(InputSystem is,
EventQueue eventQueue,
long nanoTime)
throws InputSystemException
InputDevice.collectEvents(InputSystem, EventQueue, long)
method placed events into it.
update in class InputDeviceInputSystemExceptionpublic java.lang.String toString()
toString in class java.lang.Object
protected abstract void destroyImpl()
throws InputSystemException
InputSystemException
public final void destroy()
throws InputSystemException
destroy in class InputDeviceInputSystemException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||