Xj3D 2.0 VRML/X3D Code API

org.xj3d.ui.swt.widgets
Class CursorManager

java.lang.Object
  extended by org.xj3d.ui.swt.widgets.CursorManager
All Implemented Interfaces:
java.lang.Runnable, NavigationStateListener, SensorStatusListener, CursorManager

public class CursorManager
extends java.lang.Object
implements CursorManager, SensorStatusListener, NavigationStateListener, java.lang.Runnable

Manages cursor icon changes based on state listeners.

Cursor definitions are loaded from a Properties object. The properties object is located in the following sequence:

  1. Supplied Properties object if not null
  2. Properties loaded from a properties file if it exists
  3. A default empty Properties object<\li>
Cursors whose values are not defined in the effective Properties object are given predefined values. The predefined values not used in the event of error loading user supplied values.

Version:
$Revision: 1.4 $
Author:
Rex Melton

Field Summary
 
Fields inherited from interface org.web3d.browser.SensorStatusListener
TYPE_ANCHOR, TYPE_DRAG_SENSOR, TYPE_TOUCH_SENSOR
 
Fields inherited from interface org.web3d.browser.NavigationStateListener
EXAMINE_STATE, FLY_STATE, NO_STATE, PAN_STATE, TILT_STATE, WALK_STATE
 
Constructor Summary
CursorManager(org.eclipse.swt.widgets.Canvas canvas, ErrorReporter reporter)
          Create a new instance of the cursor manager using the default set of images.
CursorManager(org.eclipse.swt.widgets.Canvas canvas, java.util.Properties skinProperties, ErrorReporter reporter)
          Create a new instance of the cursor manager with a customised set of images.
 
Method Summary
 void deviceActivated(int type)
          Invoked when a tracker activates the sensor.
 void deviceNotOver(int type)
          Invoked when a tracker leaves contact with a sensor.
 void deviceOver(int type, java.lang.String desc)
          Invoked when a sensor/anchor is in contact with a tracker capable of picking.
 void dispose()
          Called when the application is shutting down to explicitly dispose of the referenced cursor objects
 CursorFilter getCursorFilter()
          Get the cursor cursor filter.
 void linkActivated(java.lang.String[] url)
          Invoked when a tracker follows a link.
 void navigationListChanged(java.lang.String[] modes, int numModes)
          Notification that the list of valid navigation modes has changed.
 void navigationStateChanged(int idx)
          Notification that the navigation state has changed to the new state.
 void resetCanvas(org.eclipse.swt.widgets.Canvas canvas)
          Called when the surface is being reset to set the new canvas object
 void run()
          Called on the display thread to set the cursor to the canvas.
 void setCursor(java.lang.String url, int x, int y)
          Set the cursor to the currently specified image.
 void setCursorFilter(CursorFilter cf)
          Set the cursor cursor filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CursorManager

public CursorManager(org.eclipse.swt.widgets.Canvas canvas,
                     ErrorReporter reporter)
              throws java.lang.IllegalArgumentException
Create a new instance of the cursor manager using the default set of images.

Parameters:
canvas - - The canvas to manage cursors for
reporter - - The reporter instance to use or null
Throws:
java.lang.IllegalArgumentException - The canvas reference is null

CursorManager

public CursorManager(org.eclipse.swt.widgets.Canvas canvas,
                     java.util.Properties skinProperties,
                     ErrorReporter reporter)
              throws java.lang.IllegalArgumentException
Create a new instance of the cursor manager with a customised set of images.

Parameters:
canvas - - The canvas to manage cursors for
skinProperties - - The properties object specifying cursor image names
reporter - - The reporter instance to use or null
Throws:
java.lang.IllegalArgumentException - The canvas reference is null
Method Detail

setCursorFilter

public void setCursorFilter(CursorFilter cf)
Set the cursor cursor filter. NULL will disable filtering

Specified by:
setCursorFilter in interface CursorManager
Parameters:
cf - The filter

getCursorFilter

public CursorFilter getCursorFilter()
Get the cursor cursor filter. NULL means no filtering.

Specified by:
getCursorFilter in interface CursorManager
Returns:
The filter

setCursor

public void setCursor(java.lang.String url,
                      int x,
                      int y)
Set the cursor to the currently specified image. Normal changes can still occur. Monitor the cursorFilter for changes.

Specified by:
setCursor in interface CursorManager
Parameters:
url - The image to use
x - The center x coordinate
y - The center y coordinate

deviceOver

public void deviceOver(int type,
                       java.lang.String desc)
Invoked when a sensor/anchor is in contact with a tracker capable of picking.

Specified by:
deviceOver in interface SensorStatusListener
Parameters:
type - The sensor type
desc - The sensor's description string

deviceNotOver

public void deviceNotOver(int type)
Invoked when a tracker leaves contact with a sensor.

Specified by:
deviceNotOver in interface SensorStatusListener
Parameters:
type - The sensor type

deviceActivated

public void deviceActivated(int type)
Invoked when a tracker activates the sensor. Anchors will not receive this event, they get a linkActivated call.

Specified by:
deviceActivated in interface SensorStatusListener
Parameters:
type - The sensor type

linkActivated

public void linkActivated(java.lang.String[] url)
Invoked when a tracker follows a link.

Specified by:
linkActivated in interface SensorStatusListener
Parameters:
url - The url to load.

navigationStateChanged

public void navigationStateChanged(int idx)
Notification that the navigation state has changed to the new state.

Specified by:
navigationStateChanged in interface NavigationStateListener
Parameters:
idx - The new state expressed as an index into the current navModes list.

navigationListChanged

public void navigationListChanged(java.lang.String[] modes,
                                  int numModes)
Notification that the list of valid navigation modes has changed.

Specified by:
navigationListChanged in interface NavigationStateListener
Parameters:
modes - The new modes
numModes - The number of modes in the list

run

public void run()
Called on the display thread to set the cursor to the canvas.

Specified by:
run in interface java.lang.Runnable

resetCanvas

public void resetCanvas(org.eclipse.swt.widgets.Canvas canvas)
Called when the surface is being reset to set the new canvas object

Parameters:
canvas - - The new canvas object

dispose

public void dispose()
Called when the application is shutting down to explicitly dispose of the referenced cursor objects


Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium