Xj3D 2.0 VRML/X3D Code API

org.xj3d.ui.swt.device
Class SWTDeviceFactory

java.lang.Object
  extended by org.xj3d.core.eventmodel.DeviceFactory
      extended by org.xj3d.ui.swt.device.SWTDeviceFactory

public class SWTDeviceFactory
extends DeviceFactory

A concrete implementation of DeviceFactory that is specific to the SWT UI toolkit. Devices created through this factory are initialized with the appropriate SWT event listeners.

Version:
$Revision: 1.4 $
Author:
Rex Melton

Field Summary
 
Fields inherited from class org.xj3d.core.eventmodel.DeviceFactory
canvas, errorReporter, rendererID, surface, toolkitID
 
Constructor Summary
SWTDeviceFactory(java.lang.Object canvas, java.lang.String rendererID, java.lang.Object surface, ErrorReporter reporter)
          Constructor.
 
Method Summary
 DeviceManager[] getDeviceManagers()
          Return the array of DeviceManagers that are available per the constructor parameters.
 KeySensorDevice getKeySensorDevice()
          Return the KeySensorDevice associated with the rendering surface initialized with the SWT key event listener.
 
Methods inherited from class org.xj3d.core.eventmodel.DeviceFactory
createDevices, setErrorReporter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWTDeviceFactory

public SWTDeviceFactory(java.lang.Object canvas,
                        java.lang.String rendererID,
                        java.lang.Object surface,
                        ErrorReporter reporter)
Constructor.

Note that the canvas argument requires an instance of org.eclipse.swt.widgets.Control. Control is the lowest level swt class that implements the device listeners utilized in this class. Specifically:

Parameters:
canvas - - The Object representing the ui toolkit specific graphical component. Must be an instance of org.eclipse.swt.widgets.Control.
rendererID - - Identifier String of the renderer type.
surface - - The Object representing the renderer specific drawing surface.
reporter - - The instance to use or null. A value of null will clear the currently set reporter and causes the factory to use the DefaultErrorReporter.
Throws:
java.lang.IllegalArgumentException - if the canvas Object is not an instance of org.eclipse.swt.widgets.Control.
Method Detail

getDeviceManagers

public DeviceManager[] getDeviceManagers()
Return the array of DeviceManagers that are available per the constructor parameters. The InputDevices instantiated will be initialized with SWT UI toolkit event listeners.

Specified by:
getDeviceManagers in class DeviceFactory
Returns:
the array of DeviceManagers. If no DeviceManagers are available, an empty (size 0) array is returned.

getKeySensorDevice

public KeySensorDevice getKeySensorDevice()
Return the KeySensorDevice associated with the rendering surface initialized with the SWT key event listener.

Specified by:
getKeySensorDevice in class DeviceFactory
Returns:
the KeySensorDevice

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium