org.jagatoo.input.impl.swt
Class SWTMouse

java.lang.Object
  extended by org.jagatoo.input.devices.InputDevice
      extended by org.jagatoo.input.devices.Mouse
          extended by org.jagatoo.input.impl.swt.SWTMouse
All Implemented Interfaces:
Enableable

public class SWTMouse
extends Mouse

SWT implementation of the Mouse class.


Constructor Summary
protected SWTMouse(MouseFactory factory, InputSourceWindow sourceWindow, EventQueue eventQueue)
           
 
Method Summary
 void centerMouse()
          Centers the mouse cursor on the source-window.
 void collectEvents(InputSystem is, EventQueue eventQueue, long nanoTime)
          Processes pending events from the system and places them into the EventQueue.
 void consumePendingEvents(InputSystem is, EventQueue eventQueue, long nanoTime)
          Processes pending events from the system and simply wastes them.
 void destroyImpl()
          Destroys the Mouse.
protected  void setAbsoluteImpl(boolean absolute)
          Makes this Mouse an absolute mouse (only delta positions become valid) or relative.
 void setPosition(int x, int y)
          This method stores the positional values and may do some additional implementation dependent stuff.
 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.Mouse
addButtonsState, addButtonsState, addMouseListener, addMouseStopListener, destroy, fireMouseEvent, fireOnMouseButtonClicked, fireOnMouseButtonPressed, fireOnMouseButtonReleased, fireOnMouseMoved, fireOnMouseWheelMoved, getButton, getButtonsCount, getButtonsState, getButtonState, getCurrentX, getCurrentY, getSourceFactory, getState, getWheel, getXAxis, getYAxis, handleClickedEvents, hasListener, hasMouseListener, isAbsolute, isButtonPressed, notifyMouseStopManager, prepareMouseButtonPressedEvent, prepareMouseButtonReleasedEvent, prepareMouseMovedEvent, prepareMouseWheelMovedEvent, removeButtonsState, removeButtonsState, removeMouseListener, removeMouseStopListener, setAbsolute, setButtonsState, storePosition, toString, update
 
Methods inherited from class org.jagatoo.input.devices.InputDevice
addInputStateListener, 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

SWTMouse

protected SWTMouse(MouseFactory factory,
                   InputSourceWindow sourceWindow,
                   EventQueue eventQueue)
            throws InputSystemException
Throws:
InputSystemException
Method Detail

setPosition

public void setPosition(int x,
                        int y)
                 throws InputSystemException
This method stores the positional values and may do some additional implementation dependent stuff.

Overrides:
setPosition in class Mouse
Throws:
InputSystemException

centerMouse

public void centerMouse()
                 throws InputSystemException
Centers the mouse cursor on the source-window.

Specified by:
centerMouse in class Mouse
Throws:
InputSystemException

consumePendingEvents

public void consumePendingEvents(InputSystem is,
                                 EventQueue eventQueue,
                                 long nanoTime)
                          throws InputSystemException
Processes pending events from the system and simply wastes them.
This method is invoked by the InputSystem when a new InputDevice is registered and instead of the InputDevice.update(InputSystem, EventQueue, long) method, if the device is disabled or its InputSourceWindow doesn't currently receive input events.

Specified by:
consumePendingEvents in class InputDevice
Throws:
InputSystemException

collectEvents

public void collectEvents(InputSystem is,
                          EventQueue eventQueue,
                          long nanoTime)
                   throws InputSystemException
Processes pending events from the system and places them into the EventQueue.
The events are not fired (listeners are not notified). They are fired when the InputDevice.update(InputSystem, EventQueue, long) method is invoked.

Specified by:
collectEvents in class InputDevice
Throws:
InputSystemException

updateMouse

public void updateMouse(InputSystem is,
                        EventQueue eventQueue,
                        long nanoTime)
                 throws InputSystemException
Processes pending events from the system and directly fires them (notifes the listeners).
This method also flushes the EventQueue, if the previously called InputDevice.collectEvents(InputSystem, EventQueue, long) method placed events into it.

Specified by:
updateMouse in class Mouse
Throws:
InputSystemException

setAbsoluteImpl

protected void setAbsoluteImpl(boolean absolute)
                        throws InputSystemException
Makes this Mouse an absolute mouse (only delta positions become valid) or relative. This method is implicitly called by Mouse.setAbsolute(boolean), but only if the value has changed.

Specified by:
setAbsoluteImpl in class Mouse
Throws:
InputSystemException

destroyImpl

public void destroyImpl()
                 throws InputSystemException
Destroys the Mouse.

Specified by:
destroyImpl in class Mouse
Throws:
InputSystemException