Xj3D 2.0 VRML/X3D Code API

org.xj3d.ui.awt.widgets
Class CursorManager

java.lang.Object
  extended by org.xj3d.ui.awt.widgets.CursorManager
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener, NavigationStateListener, SensorStatusListener, CursorManager

public class CursorManager
extends java.lang.Object
implements CursorManager, SensorStatusListener, NavigationStateListener, java.awt.event.KeyListener

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.8 $
Author:
Alan Hudson

Field Summary
 boolean altModifier
          Alt key modifier
 boolean ctrlModifier
          Ctrl key modifier
 boolean shiftModifier
          Shift key modifier
 
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(java.awt.Component canvas, ErrorReporter reporter)
          Create a new instance of the cursor manager using the default set of images.
CursorManager(java.awt.Component 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.
 CursorFilter getCursorFilter()
          Get the cursor cursor filter.
 void keyPressed(java.awt.event.KeyEvent evt)
          Process a key press event.
 void keyReleased(java.awt.event.KeyEvent evt)
          Process a key release event.
 void keyTyped(java.awt.event.KeyEvent evt)
          Process a key click event.
 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 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
 

Field Detail

shiftModifier

public boolean shiftModifier
Shift key modifier


altModifier

public boolean altModifier
Alt key modifier


ctrlModifier

public boolean ctrlModifier
Ctrl key modifier

Constructor Detail

CursorManager

public CursorManager(java.awt.Component 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(java.awt.Component 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 - 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. Null returns the cursor to its current state
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

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Process a key press event.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
evt - The event that caused this method to be called

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Process a key release event.

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
evt - The event that caused this method to be called

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Process a key click event.

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
evt - The event that caused this method to be called

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium