org.jagatoo.input.devices
Class InputDeviceFactory

java.lang.Object
  extended by org.jagatoo.input.devices.InputDeviceFactory
All Implemented Interfaces:
ControllerFactory, KeyboardFactory, MouseFactory
Direct Known Subclasses:
AWTInputDeviceFactory, AWTJInputInputDeviceFactory, JInputInputDeviceFactory, LWJGLInputDeviceFactory, LWJGLJInputInputDeviceFactory, SWTInputDeviceFactory

public abstract class InputDeviceFactory
extends java.lang.Object
implements KeyboardFactory, MouseFactory, ControllerFactory

A DeviceFactory is a simple factory to access all input devices available on the system.


Constructor Summary
InputDeviceFactory(InputDeviceFactory masterFactory, boolean useStaticArrays, InputSourceWindow sourceWindow, EventQueue eventQueue)
           
 
Method Summary
 void destroy(InputSystem inputSystem)
          This method is called by the InputSystem when it gets destroyed.
protected abstract  void destroyImpl(InputSystem inputSystem)
           
protected  InputDeviceFactory findSourceFactory()
           
protected  void flushCache(boolean keyboards, boolean mouses, boolean controllers)
           
protected static void flushCache(InputDeviceFactory factory, boolean keyboards, boolean mouses, boolean controllers)
           
protected  Controller[] getCachedControllers()
           
protected  Keyboard[] getCachedKeyboards()
           
protected  Mouse[] getCachedMouses()
           
 Controller[] getControllers()
          
 Controller[] getControllers(boolean forceRefresh)
          
protected  EventQueue getEveneQueue()
           
 Keyboard[] getKeyboards()
          
 Keyboard[] getKeyboards(boolean forceRefresh)
          
protected  InputDeviceFactory getMasterFactory()
           
 Mouse[] getMouses()
          
 Mouse[] getMouses(boolean forceRefresh)
          
 InputSourceWindow getSourceWindow()
           
protected abstract  Controller[] initControllers()
           
protected static Controller[] initControllers(InputDeviceFactory factory)
           
protected abstract  Keyboard[] initKeyboards()
           
protected static Keyboard[] initKeyboards(InputDeviceFactory factory)
           
protected abstract  Mouse[] initMouses()
           
protected static Mouse[] initMouses(InputDeviceFactory factory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputDeviceFactory

public InputDeviceFactory(InputDeviceFactory masterFactory,
                          boolean useStaticArrays,
                          InputSourceWindow sourceWindow,
                          EventQueue eventQueue)
Method Detail

getSourceWindow

public final InputSourceWindow getSourceWindow()

getMasterFactory

protected final InputDeviceFactory getMasterFactory()
Returns:
the master InputDeviceFactory, if this is a sub-factory (part of a mixed one).

findSourceFactory

protected final InputDeviceFactory findSourceFactory()

getEveneQueue

protected EventQueue getEveneQueue()

getCachedKeyboards

protected final Keyboard[] getCachedKeyboards()

getCachedMouses

protected final Mouse[] getCachedMouses()

getCachedControllers

protected final Controller[] getCachedControllers()

flushCache

protected void flushCache(boolean keyboards,
                          boolean mouses,
                          boolean controllers)

flushCache

protected static final void flushCache(InputDeviceFactory factory,
                                       boolean keyboards,
                                       boolean mouses,
                                       boolean controllers)

initKeyboards

protected abstract Keyboard[] initKeyboards()
                                     throws InputSystemException
Returns:
an array of all the installed Keyboards in the system.
Throws:
InputSystemException

initKeyboards

protected static final Keyboard[] initKeyboards(InputDeviceFactory factory)
                                         throws InputSystemException
Parameters:
factory - the factory to call initKeyboards() on
Returns:
an array of all the installed Keyboards in the system.
Throws:
InputSystemException

getKeyboards

public Keyboard[] getKeyboards(boolean forceRefresh)
                        throws InputSystemException

Specified by:
getKeyboards in interface KeyboardFactory
Parameters:
forceRefresh - if true, the list of available devices is refreshed from the system.
Returns:
an array of all the installed Keyboards in the system.
Throws:
InputSystemException

getKeyboards

public final Keyboard[] getKeyboards()
                              throws InputSystemException

Specified by:
getKeyboards in interface KeyboardFactory
Returns:
an array of all the installed Keyboards in the system. (This method doesn't force a refresh!)
Throws:
InputSystemException

initMouses

protected abstract Mouse[] initMouses()
                               throws InputSystemException
Returns:
an array of all the installed Mouses in the system.
Throws:
InputSystemException

initMouses

protected static final Mouse[] initMouses(InputDeviceFactory factory)
                                   throws InputSystemException
Parameters:
factory - the factory to call initMouses() on
Returns:
an array of all the installed Mouses in the system.
Throws:
InputSystemException

getMouses

public Mouse[] getMouses(boolean forceRefresh)
                  throws InputSystemException

Specified by:
getMouses in interface MouseFactory
Parameters:
forceRefresh - if true, the list of available devices is refreshed from the system.
Returns:
an array of all the installed Mouses in the system.
Throws:
InputSystemException

getMouses

public final Mouse[] getMouses()
                        throws InputSystemException

Specified by:
getMouses in interface MouseFactory
Returns:
an array of all the installed Mouses in the system. (This method doesn't force a refresh!)
Throws:
InputSystemException

initControllers

protected abstract Controller[] initControllers()
                                         throws InputSystemException
Returns:
an array of all the installed Controllers in the system.
Throws:
InputSystemException

initControllers

protected static final Controller[] initControllers(InputDeviceFactory factory)
                                             throws InputSystemException
Parameters:
factory - the factory to call initControllers() on
Returns:
an array of all the installed Controllers in the system.
Throws:
InputSystemException

getControllers

public Controller[] getControllers(boolean forceRefresh)
                            throws InputSystemException

Specified by:
getControllers in interface ControllerFactory
Parameters:
forceRefresh - if true, the list of available devices is refreshed from the system.
Returns:
an array of all the installed Controllers in the system.
Throws:
InputSystemException

getControllers

public final Controller[] getControllers()
                                  throws InputSystemException

Specified by:
getControllers in interface ControllerFactory
Returns:
an array of all the installed Controllers in the system. (This method doesn't force a refresh!)
Throws:
InputSystemException

destroyImpl

protected abstract void destroyImpl(InputSystem inputSystem)
                             throws InputSystemException
Throws:
InputSystemException

destroy

public final void destroy(InputSystem inputSystem)
                   throws InputSystemException
This method is called by the InputSystem when it gets destroyed.

Specified by:
destroy in interface ControllerFactory
Specified by:
destroy in interface KeyboardFactory
Specified by:
destroy in interface MouseFactory
Parameters:
inputSystem -
Throws:
InputSystemException