VRJConfig UI API
v2.0


org.vrjuggler.vrjconfig.commoneditors.devicegraph
Class DefaultUnitPropertyHandler

java.lang.Object
  extended by org.vrjuggler.vrjconfig.commoneditors.devicegraph.AbstractDeviceUnitPropertyHandler
      extended by org.vrjuggler.vrjconfig.commoneditors.devicegraph.DefaultUnitPropertyHandler
All Implemented Interfaces:
DeviceUnitPropertyHandler

public class DefaultUnitPropertyHandler
extends AbstractDeviceUnitPropertyHandler

The baseline implementation of DeviceUnitPropertyHandler that can deal with the "standard" cases of config elements for input devices in Gadgeteer. There are three such standard cases:

  1. A fixed number of inherent input sources (units) of any combination of input types (such as a Trackd sensor, an Immersion Tech IBox, or a simulated positional device)
  2. A device that has a variable number of units of any combination of input types that is specified by the config element for the device (such as VRPN or a simulated digital device)
  3. A device that has a variable number of units of any combination of input types that are not specified by the config element but instead are auto-detected when the device driver communciates with the hardware (such as the Ascension Flock of Birds or the Direct Input game controller)
For special cases, a different implementation of DeviceUnitPropertyHandler would be needed.


Field Summary
 
Fields inherited from class org.vrjuggler.vrjconfig.commoneditors.devicegraph.AbstractDeviceUnitPropertyHandler
configContext, configElement, unitTypeMap, unitTypes
 
Constructor Summary
DefaultUnitPropertyHandler()
           
 
Method Summary
static void addArtificialUnits(Map unitTypeMap, Integer unitType, int numUnits)
          Adds the given number of units to the artificial unit property and stores the result in the given unit type map.
 void addUnit(Integer unitType)
          Adds a new unit of the given type to the device managed by this handler.
 void propertyValueAdded(ConfigElementEvent evt)
          Handles the addition of a new property value to our config element.
 void propertyValueChanged(ConfigElementEvent evt)
          Handles the change in a property value in our config element.
 void propertyValueOrderChanged(ConfigElementEvent evt)
          Invoked when the order of property values is changed in the config element being held by this handler.
 void propertyValueRemoved(ConfigElementEvent evt)
          Handles the removal of a new property value from our config element.
 void removeUnit(Integer unitType, int unitNumber)
          Removes the identified unit of the given type from the device managed by this handler.
 
Methods inherited from class org.vrjuggler.vrjconfig.commoneditors.devicegraph.AbstractDeviceUnitPropertyHandler
addDeviceUnitListener, fireDeviceUnitAdded, fireDeviceUnitRemoved, getUnitTypes, removeDeviceUnitListener, setConfig, setUnitTypeMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUnitPropertyHandler

public DefaultUnitPropertyHandler()
Method Detail

addArtificialUnits

public static void addArtificialUnits(Map unitTypeMap,
                                      Integer unitType,
                                      int numUnits)
Adds the given number of units to the artificial unit property and stores the result in the given unit type map. If there is already an artificial unit property for the given unit type in the map, then numUnits are added to the current set of units.

Parameters:
unitTypeMap - the unit type map providing a mapping from unit types (instances of java.lang.Integer) to the artificial unit property for that type
unitType - the type of the artificial unit property (one of the UnitConstants values)
numUnits - the number of units to add to the artificial unit property
See Also:
UnitConstants

propertyValueAdded

public void propertyValueAdded(ConfigElementEvent evt)
Handles the addition of a new property value to our config element. The changed property is comopared with internally stored information to determine how to handle the unit addition. If the device units are managed using a variable valued property, then a DeviceUnitEvent is fired to inform listeners of the additional unit.


propertyValueChanged

public void propertyValueChanged(ConfigElementEvent evt)
Handles the change in a property value in our config element. The changed property is comopared with internally stored information to determine how to interpret the chagne. If the device units are managed using the value of a property, then a DeviceUnitEvent is fired to inform listeners of the addition or removal of a unit, depending on how the change is interpreted.


propertyValueOrderChanged

public void propertyValueOrderChanged(ConfigElementEvent evt)
Description copied from interface: DeviceUnitPropertyHandler
Invoked when the order of property values is changed in the config element being held by this handler. Whether this results in a DeviceUnitEvent event being generated is dependent upon the specific implementation of this interface.


propertyValueRemoved

public void propertyValueRemoved(ConfigElementEvent evt)
Handles the removal of a new property value from our config element. The changed property is comopared with internally stored information to determine how to handle the unit removal. If the device units are managed using a variable valued property, then a DeviceUnitEvent is fired to inform listeners of the removed unit.


addUnit

public void addUnit(Integer unitType)
Adds a new unit of the given type to the device managed by this handler. Depending on how the units are managed, a DeviceUnitEvent is fired by this method or later by propertyValueAdded() or by propertyValueChanged().

Parameters:
unitType - the type (as defined in UnitConstants of the device unit to be added)
See Also:
UnitConstants

removeUnit

public void removeUnit(Integer unitType,
                       int unitNumber)
Removes the identified unit of the given type from the device managed by this handler. Depending on how the units are managed, a DeviceUnitEvent is fired by this method or later by propertyValueRemoved() or by propertyValueChanged().

Parameters:
unitType - the type (as defined in UnitConstants of the device unit to be added)
unitNumber - the index of the unit to remove
See Also:
UnitConstants

VRJConfig UI API
v2.0


Copyright © 1998–2005 Iowa State University. All rights reserved.