| java.lang.Object com.sun.j3d.utils.universe.ConfigContainer
ConfigContainer | public class ConfigContainer (Code) | | Loads a Java 3D configuration file and creates a container of named objects
that will effect the viewing configuration specified in the file. These
can include Viewers, ViewingPlatforms, ViewPlatformBehaviors, InputDevices,
Sensors, and other objects.
Clients can construct the view side of a scene graph by retrieving these
objects using the accessor methods provided by this class. This could
involve as little as just attaching ViewingPlatforms to a Locale, depending
upon how completely the viewing configuration is specified in the file.
The ConfiguredUniverse class is an example of a ConfigContainer client and
how it can be used.
ConfigContainer can be useful for clients other than ConfiguredUniverse.
InputDevice and ViewPlatformBehavior configuration is fully supported, so a
given Java 3D installation can provide configuration files to an
application that will allow it to fully utilize whatever site-specific
devices and behaviors are available. The configuration mechanism can be
extended for any target object through the use of the
NewObject and ObjectProperty configuration
commands.
See Also: ConfiguredUniverse See Also:
* The Java 3D Configuration File See Also:
* Example Configuration Files since: Java 3D 1.3.1 |
Constructor Summary | |
public | ConfigContainer(URL userConfig) Creates a new ConfigContainer and loads the configuration file at the
specified URL. | public | ConfigContainer(URL userConfig, ClassLoader classLoader) Creates a new ConfigContainer and loads the configuration file at the
specified URL. | public | ConfigContainer(URL userConfig, boolean setVisible, int transformCount) Creates a new ConfigContainer and loads the configuration file at the
specified URL. | public | ConfigContainer(URL userConfig, boolean setVisible, int transformCount, ClassLoader classLoader) Creates a new ConfigContainer and loads the configuration file at the
specified URL. | | ConfigContainer(URL userConfig, boolean setVisible, int transformCount, boolean attachBehaviors) Package-scoped constructor for ConfigContainer. | | ConfigContainer(URL userConfig, boolean setVisible, int transformCount, boolean attachBehaviors, ClassLoader classLoader) Package scoped constructor that adds the ability to set the ClassLoader
which will be used to load any app specific classes specified in the
configuration file. |
Method Summary | |
public void | clear() Release memory references used by this ConfigContainer. | Object | evaluateBuiltIn(ConfigCommand cmd) This method gets called from a ConfigObject to evaluate a retained
built-in command nested within a property command. | void | evaluateCommand(ArrayList elements, int lineNumber) This method gets called from the s-expression parser to process a
configuration command. | ConfigObject | findConfigObject(String baseName, String instanceName) Finds a config object matching the given base name and the instance
name. | Collection | findConfigObjects(String baseName) Find instances of config objects with the given base name. | Collection | findConfigObjects(String baseName, boolean filterAlias) Find instances of config objects with the given base name. | public static URL | getConfigURL() Returns the config file URL based on system properties. | public static URL | getConfigURL(String defaultURLString) Returns the config file URL based on system properties. | public Set | getGenericObjects() Returns a read-only Set of all generic configuration object
instances in the order they were defined in the configuration file.
Generic object instances are created with the following command:
(NewObject <instanceName> <className>)
className must be the fully-qualified name of a class that
provides a parameterless constructor.
The object is configured through the ObjectProperty command:
(ObjectProperty <instanceName> <propertyName>
<arg0> ... | public Set | getInputDevices() Returns a read-only Set of all configured InputDevice instances in the
order they were defined in the configuration file. | public Map | getNamedCanvases(String viewName) Returns a read-only Map containing the named Canvas3D instances used by
the specified Viewer. | public Map | getNamedGenericObjects() Returns a read-only Map that maps generic object names to
instances. | public Map | getNamedInputDevices() Returns a read-only Map that maps InputDevice names to instances.
Names may be aliases and if so will map to the original instances. | public Map | getNamedPhysicalBodies() Returns a read-only Map that maps PhysicalBody names to instances. | public Map | getNamedPhysicalEnvironments() Returns a read-only Map that maps PhysicalEnvironment names to
instances. | public Map | getNamedSensors() Returns a read-only Map that maps Sensor names to instances. | public Map | getNamedViewPlatformBehaviors() Returns a read-only Map that maps ViewPlatformBehavior names to
instances. | public Map | getNamedViewers() Returns a read-only Map that maps Viewer names to instances. | public Map | getNamedViewingPlatforms() Returns a read-only Map that maps ViewingPlatform names to instances.
Names may be aliases and if so will map to the original instances. | public Set | getPhysicalBodies() Returns a read-only Set of all configured PhysicalBody instances in the
order they were defined in the configuration file. | public Set | getPhysicalEnvironments() | public Set | getSensors() Returns a read-only Set of all configured Sensor instances in the order
they were defined in the configuration file. | public Set | getViewPlatformBehaviors() Returns a read-only Set of all configured ViewPlatformBehavior
instances in the order they were defined in the configuration file.
The behaviors are attached to any ViewingPlatforms that specified them;
that is, the setViewPlatformBehavior and
setViewingPlatform methods of ViewingPlatform and
ViewPlatformBehavior have been called if appropriate. | public int | getViewPlatformTransformCount() Returns the number of TransformGroups with which ViewingPlatforms
should be created. | public boolean | getViewerVisibility() Returns whether Viewers should be created with their AWT components
initially visible or invisible. | public Set | getViewers() Returns a read-only Set of all configured Viewer instances in the order
they were defined in the configuration file. | public Set | getViewingPlatforms() Returns a read-only Set of all configured ViewingPlatform instances in
the order they were defined in the configuration file. |
currentFileName | String currentFileName(Code) | | The name of the file this ConfigContainer is currently loading.
|
ConfigContainer | public ConfigContainer(URL userConfig)(Code) | | Creates a new ConfigContainer and loads the configuration file at the
specified URL. All ViewingPlatform instances are created with a single
TransformGroup and all Viewer components are initially invisible.
Parameters: userConfig - URL of the configuration file to load |
ConfigContainer | public ConfigContainer(URL userConfig, ClassLoader classLoader)(Code) | | Creates a new ConfigContainer and loads the configuration file at the
specified URL. All ViewingPlatform instances are created with a single
TransformGroup and all Viewer components are initially invisible.
Parameters: userConfig - URL of the configuration file to load Parameters: classLoader - the class loader to use to load classes specifiedin the config file. |
ConfigContainer | public ConfigContainer(URL userConfig, boolean setVisible, int transformCount)(Code) | | Creates a new ConfigContainer and loads the configuration file at the
specified URL. Any ViewingPlatform instantiated by the configuration
file will be created with the specified number of transforms. Viewer
components may be set initially visible or invisible with the
setVisible flag.
Parameters: userConfig - URL of the configuration file to load Parameters: setVisible - if true, setVisible(true) is called onall Viewers Parameters: transformCount - number of transforms to be included in anyViewingPlatform created; must be greater than 0 |
ConfigContainer | public ConfigContainer(URL userConfig, boolean setVisible, int transformCount, ClassLoader classLoader)(Code) | | Creates a new ConfigContainer and loads the configuration file at the
specified URL. Any ViewingPlatform instantiated by the configuration
file will be created with the specified number of transforms. Viewer
components may be set initially visible or invisible with the
setVisible flag.
Parameters: userConfig - URL of the configuration file to load Parameters: setVisible - if true, setVisible(true) is called onall Viewers Parameters: transformCount - number of transforms to be included in anyViewingPlatform created; must be greater than 0 Parameters: classLoader - the class loader to use to load classes specifiedin the config file. |
ConfigContainer | ConfigContainer(URL userConfig, boolean setVisible, int transformCount, boolean attachBehaviors)(Code) | | Package-scoped constructor for ConfigContainer. This provides an
additional flag, attachBehaviors , which indicates whether
or not ViewPlatformBehaviors should be attached to the ViewingPlatforms
specified for them.
Normally the flag should be true. However, when instantiated by
ConfiguredUniverse, this flag is set false so that ConfiguredUniverse
can set a reference to itself in the ViewingPlatform before attaching
the behavior. This provides backwards compatibility to behaviors that
access the ConfiguredUniverse instance from a call to
setViewingPlatform in order to look up the actual Sensor,
Viewer, Behavior, etc., instances associated with the names provided
them from the configuration file.
The preferred methods to retrieve instances of specific objects defined
in the configuration file are to either 1) get the ConfiguredUniverse
instance when the behavior's initialize method is called,
or to 2) define properties that accept object instances directly, and
then use the newer Device, Sensor, ViewPlatform, etc., built-in
commands in the configuration file. These built-ins will return an
object instance from a name.
Parameters: userConfig - URL of the configuration file to load Parameters: setVisible - if true, setVisible(true) is called onall Viewers Parameters: transformCount - number of transforms to be included in anyViewingPlatform created; must be greater than 0 Parameters: attachBehaviors - if true, attach ViewPlatformBehaviors to theappropriate ViewingPlatforms |
ConfigContainer | ConfigContainer(URL userConfig, boolean setVisible, int transformCount, boolean attachBehaviors, ClassLoader classLoader)(Code) | | Package scoped constructor that adds the ability to set the ClassLoader
which will be used to load any app specific classes specified in the
configuration file. By default SystemClassLoader is used.
|
clear | public void clear()(Code) | | Release memory references used by this ConfigContainer. All Sets and
Maps obtained from this ConfigContainer are cleared.
|
evaluateBuiltIn | Object evaluateBuiltIn(ConfigCommand cmd)(Code) | | This method gets called from a ConfigObject to evaluate a retained
built-in command nested within a property command. These are commands
that can't be evaluated until the entire config file is parsed.
Parameters: cmd - the built-in command object representing result of evaluation |
evaluateCommand | void evaluateCommand(ArrayList elements, int lineNumber)(Code) | | This method gets called from the s-expression parser to process a
configuration command.
Parameters: elements - tokenized list of sexp elements Parameters: lineNumber - command line number |
findConfigObject | ConfigObject findConfigObject(String baseName, String instanceName)(Code) | | Finds a config object matching the given base name and the instance
name. If an alias is found, then its original is returned. If the
object is not found, an IllegalArgumentException is thrown.
Parameters: basename - base name of the config object Parameters: instanceName - name associated with this config object instance the found ConfigObject |
findConfigObjects | Collection findConfigObjects(String baseName)(Code) | | Find instances of config objects with the given base name.
This is the same as findConfigObjects(baseName, true) .
Aliases are filtered out so that all returned instances are unique.
Parameters: baseName - base name of desired config object class ArrayList of config object instances of the desired baseclass, or null if instances of the base class don't exist |
findConfigObjects | Collection findConfigObjects(String baseName, boolean filterAlias)(Code) | | Find instances of config objects with the given base name.
Parameters: baseName - base name of desired config object class Parameters: filterAlias - if true, aliases are filtered out so that allreturned instances are unique ArrayList of config object instances of the desired baseclass, or null if instances of the base class don't exist |
getConfigURL | public static URL getConfigURL()(Code) | | Returns the config file URL based on system properties. The current
implementation of this method parses the j3d.configURL property as a
URL string. For example, the following command line would specify that
the config file is taken from the file "j3dconfig" in the current
directory:
java -Dj3d.configURL=file:j3dconfig ...
the URL of the config file; null is returned if no validURL is defined by the system properties |
getConfigURL | public static URL getConfigURL(String defaultURLString)(Code) | | Returns the config file URL based on system properties. The current
implementation of this method parses the j3d.configURL property as a
URL string. For example, the following command line would specify that
the config file is taken from the file "j3dconfig" in the current
directory:
java -Dj3d.configURL=file:j3dconfig ...
Parameters: defaultURLString - the default string used to constructthe URL if the appropriate system properties are not defined the URL of the config file; null is returned if novalid URL is defined either by the system properties or thedefault URL string |
getGenericObjects | public Set getGenericObjects()(Code) | | Returns a read-only Set of all generic configuration object
instances in the order they were defined in the configuration file.
Generic object instances are created with the following command:
(NewObject <instanceName> <className>)
className must be the fully-qualified name of a class that
provides a parameterless constructor.
The object is configured through the ObjectProperty command:
(ObjectProperty <instanceName> <propertyName>
<arg0> ... <argn>)
propertyName must be the name of a method provided by object
instanceName. It must take an array of Objects as its only
parameter; the array is populated with the values of arg0
through argn when the method is invoked to set the property.
These additional requirements for configurable objects can usually be
fulfilled by extending or wrapping available object classes.
read-only Set of all unique instances, or null |
getInputDevices | public Set getInputDevices()(Code) | | Returns a read-only Set of all configured InputDevice instances in the
order they were defined in the configuration file. All InputDevice
instances in the set are initialized and registered with any
PhysicalEnvironments that reference them.
InputDevice instances are created with the following command:
(NewDevice <instanceName> <className>
[Alias <alias name>])
className must be the fully-qualified name of a class that
implements the InputDevice interface. The implementation
must provide a parameterless constructor.
The InputDevice is configured through the DeviceProperty command:
(DeviceProperty <instanceName> <propertyName>
<arg0> ... <argn>)
propertyName must be the name of a input device method that
takes an array of Objects as its only parameter; the array is populated
with the values of arg0 through argn when the method is
invoked to set the property. These additional requirements for
configurable input devices can usually be fulfilled by extending or
wrapping available InputDevice implementations.
read-only Set of all unique instances, or null |
getNamedCanvases | public Map getNamedCanvases(String viewName)(Code) | | Returns a read-only Map containing the named Canvas3D instances used by
the specified Viewer. Names may be aliases and if so will map to the
original instances. The set of unique Canvas3D instances used by a
Viewer may be obtained by calling the Viewer's accessor methods
directly.
A named Canvas3D is created and added to a Viewer whenever any of the
following configuration commands are used:
(ViewProperty <view> Screen <screenName>)
(ViewProperty <view> Window <windowName>)
view is the name of a Viewer created with the NewView command.
The screenName and windowName parameters of the above
commands are the keys to use when looking up the associated Canvas3D
instances in the Map returned by this method. Note: the
NewScreen and NewWindow commands do not create Canvas3D
instances themselves; they are created only by the above configuration
commands.
Parameters: viewName - the name of the Viewer read-only Map containing the Viewer's named Canvas3D instances |
getNamedGenericObjects | public Map getNamedGenericObjects()(Code) | | Returns a read-only Map that maps generic object names to
instances. Names may be aliases and if so will map to the original
instances.
read-only Map from names to generic object instances, ornull if no instances See Also: ConfigContainer.getGenericObjects |
getNamedInputDevices | public Map getNamedInputDevices()(Code) | | Returns a read-only Map that maps InputDevice names to instances.
Names may be aliases and if so will map to the original instances. All
InputDevice instances in the map are initialized and registered with
any PhysicalEnvironments that reference them.
read-only Map from names to InputDevice instances, ornull if no instances See Also: ConfigContainer.getInputDevices |
getNamedPhysicalBodies | public Map getNamedPhysicalBodies()(Code) | | Returns a read-only Map that maps PhysicalBody names to instances.
Names may be aliases and if so will map to the original instances.
read-only Map from names to PhysicalBody instances, or null ifno instances |
getNamedPhysicalEnvironments | public Map getNamedPhysicalEnvironments()(Code) | | Returns a read-only Map that maps PhysicalEnvironment names to
instances. Names may be aliases and if so will map to the original
instances.
read-only Map from names to PhysicalEnvironment instances, ornull if no instances |
getNamedSensors | public Map getNamedSensors()(Code) | | Returns a read-only Map that maps Sensor names to instances. Names may
be aliases and if so will map to the original instances. The
associated InputDevices are all initialized and registered with any
PhysicalEnvironments that reference them.
With the sole exception of the Sensor assigned to the head tracker,
none of the Sensors defined in the configuration file are placed into
the Sensor array maintained by a PhysicalEnvironment.
read-only Map from names to Sensor instances, ornull if no instances |
getNamedViewPlatformBehaviors | public Map getNamedViewPlatformBehaviors()(Code) | | Returns a read-only Map that maps ViewPlatformBehavior names to
instances. Names may be aliases and if so will map to the original
instances.
The behaviors are attached to any ViewingPlatforms that specified them;
that is, the setViewPlatformBehavior and
setViewingPlatform methods of ViewingPlatform and
ViewPlatformBehavior have been called if appropriate. However, a
behavior's initialize method is not called until the
ViewingPlatform to which it is attached is made live.
read-only Map from names to ViewPlatformBehavior instances, ornull if no instances See Also: ConfigContainer.getViewPlatformBehaviors |
getNamedViewers | public Map getNamedViewers()(Code) | | Returns a read-only Map that maps Viewer names to instances.
Names may be aliases and if so will map to the original instances.
The Viewers will have incorporated any PhysicalEnvironment and
PhysicalBody objects specfied for them in the configuration file, and
will be attached to any ViewingPlatforms specified for them.
read-only Map from names to Viewer instances, ornull if no instances |
getNamedViewingPlatforms | public Map getNamedViewingPlatforms()(Code) | | Returns a read-only Map that maps ViewingPlatform names to instances.
Names may be aliases and if so will map to the original instances. The
ConfigContainer class itself does not attach the ViewingPlatform
instances to any scengraph components or universe Locales; they are not
"live" until made so by a separate client such as ConfiguredUniverse.
read-only Map from names to ViewingPlatform instances, ornull if no instances |
getPhysicalBodies | public Set getPhysicalBodies()(Code) | | Returns a read-only Set of all configured PhysicalBody instances in the
order they were defined in the configuration file.
PhysicalBody instances are created with the following command:
(NewPhysicalBody <instance name>
[Alias <alias name>])
The PhysicalBody is configured through the following command:
(PhysicalBodyProperty <instance name>
<property name> <property value>)
read-only Set of all unique instances, or null |
getPhysicalEnvironments | public Set getPhysicalEnvironments()(Code) | | Returns a read-only Set of all configured PhysicalEnvironment instances
in the order they were defined in the configuration file.
PhysicalEnvironment instances are created with the following command:
(NewPhysicalEnvironment <instance name>
[Alias <alias name>])
The PhysicalEnvironment is configured through the following command:
(PhysicalEnvironmentProperty <instance name>
<property name> <property value>)
read-only Set of all unique instances, or null |
getSensors | public Set getSensors()(Code) | | Returns a read-only Set of all configured Sensor instances in the order
they were defined in the configuration file. The associated
InputDevices are all initialized and registered with any
PhysicalEnvironments that reference them.
Sensor instances are named with the following command:
(NewSensor <instance name> <device name>
<sensor index> [Alias <alias name>])
device name is the instance name of a previously defined
InputDevice, and sensor index is the index of the Sensor to be
bound to instance name. The InputDevice implementation is
responsible for creating its own Sensor objects, so this command does
not create any new instances.
The Sensor is configured through the SensorProperty command:
(SensorProperty <instance name> <property name>
<property value>)
With the sole exception of the Sensor assigned to the head tracker,
none of the Sensors defined in the configuration file are placed into
the Sensor array maintained by a PhysicalEnvironment.
read-only Set of all unique instances, or null |
getViewPlatformBehaviors | public Set getViewPlatformBehaviors()(Code) | | Returns a read-only Set of all configured ViewPlatformBehavior
instances in the order they were defined in the configuration file.
The behaviors are attached to any ViewingPlatforms that specified them;
that is, the setViewPlatformBehavior and
setViewingPlatform methods of ViewingPlatform and
ViewPlatformBehavior have been called if appropriate. However, a
behavior's initialize method is not called until the
ViewingPlatform to which it is attached is made live.
ViewPlatformBehavior instances are created by the following command:
(NewViewPlatformBehavior <instanceName> <className>)
className must be the fully qualified name of a concrete class
that extends the abstract ViewPlatformBehavior class. The
implementation must provide a parameterless constructor.
The behavior is configured using ViewPlatformBehaviorProperty:
(ViewPlatformBehaviorProperty <instanceName>
<propertyName> <arg0> ... <argn>)
ViewPlatformBehavior subclasses inherit a number of pre-defined
properties that can be directly specified with the propertyName
string; see the configuration file documentation for details.
Concrete ViewPlatformBehavior instances can also define their own
unique properties. In those cases, propertyName must be the
name of a behavior method that takes an array of Objects as its only
parameter; the array is populated with the values of arg0
through argn when the method is invoked to set the property.
These additional requirements for configurable behaviors can usually be
fulfilled by extending or wrapping available ViewPlatformBehavior
subclasses.
read-only Set of all unique instances, or null |
getViewPlatformTransformCount | public int getViewPlatformTransformCount()(Code) | | Returns the number of TransformGroups with which ViewingPlatforms
should be created. This is useful for clients that wish to provide a
default ViewingPlatform if the configuration file doesn't specify one.
the number of TransformGroups |
getViewerVisibility | public boolean getViewerVisibility()(Code) | | Returns whether Viewers should be created with their AWT components
initially visible or invisible. This is useful for clients that wish
to provide a default Viewer if the configuration file doesn't specify
one.
true if Viewer components should be initially visible; falseotherwise |
getViewers | public Set getViewers()(Code) | | Returns a read-only Set of all configured Viewer instances in the order
they were defined in the configuration file. The Viewers will have
incorporated any PhysicalEnvironment and PhysicalBody objects specfied
for them in the configuration file, and will be attached to any
ViewingPlatforms specified for them.
Viewer instances are created with the following command:
(NewView <instance name> [Alias <alias name>])
The Viewer is configured through the following command:
(ViewProperty <instance name>
<property name> <property value>)
read-only Set of all unique instances, or null |
getViewingPlatforms | public Set getViewingPlatforms()(Code) | | Returns a read-only Set of all configured ViewingPlatform instances in
the order they were defined in the configuration file. The
ConfigContainer class itself does not attach the ViewingPlatform
instances to any scengraph components or universe Locales; they are not
"live" until made so by a separate client such as ConfiguredUniverse.
ViewingPlatform instances are created with the following command:
(NewViewPlatform <instance name>
[Alias <alias name>])
The ViewingPlatform is configured through the following command:
(ViewPlatformProperty <instance name> <property name>
<property value>)
read-only Set of all unique instances, or null |
|
|