Common uses the Java Object class as its homogeneous data class. This enables ANY native OR derived Java object to be passed as data between two Common nodes. The actual data type/format is negotiated between Common nodes at runtime by calls to the getDOC (Get Data Object Class) function.
A DAS application typically creates two or more instances of classes that implement the Common interface, then calls one Common node's setNotify function passing a reference to a second Common node. The second node is sent any subsequent state changes via calls to the registered node's setState function.
When one Common node is registered with another, initial state is automatically obtained and set by calling the host node's getState function. Any common node can thus be registered and unregistered throughout the life of a DAS application and state will automatically remain consistant.
// The "src" field is a reference to the calling Common class
// It enables optimization and it eliminates self-references
public void setState( Common src, Object obj ); // Set Data
public Object getState( ); // Get Data
public String getDOC( ); // Get Data Object Class
public void setNotify( Common com ); // Set notify node
public void unsetNotify( Common com ); // Unset notify node
The first Common node to be registered with a given instance of a Notify node is querried for its Data Object Class (DOC) by calling the registrant node's getDOC function. Any subsequent Common node registration attempts will fail unless each matches the initially registered DOC.
// All Common functions, plus...
public Notify() // Constructor
// Set a Master node for "getState" calls
public void setMaster( Common com );
public Common getMaster( );
// State Locking (needed for collaborative environments)
public int setLock( Common src, int lockState );
public int getLock( Common src );
Calls to the sfcolor_eai.setState function cause the registered field of the named VRML node to be modified. Calls to the sfcolor_eai.getState function retreives the value from the registered VRML field.
// All Common methods, plus...
public sfcolor_eai( Applet appl, String nName, String fName )
public void setValue( float r, float g, float b )
public float [] getValue( )
Not Implemented yet...
This automation node has no GUI. It simply generates random SFColor values at a fixed interval in time.
This example shows an SFColor Scrollbar widget and an SFColor
ColorSwatch widget. The two widgets have been connected directly
to one and other.
Click the image to run the applet in a new browser window.
This example shows an SFColor Scrollbar widget, an SFColor
ColorSwatch widget, an SFColor TextField widget, an SFColor
Palette widget, and a non-GUI Notify node.
Click the image to run the applet in a new browser window.
This example shows an SFColor Scrollbar widget, an SFColor
ColorSwatch widget, an SFColor TextField widget, an SFColor
Palette widget, a non-GUI Notify node, and finally
an SFColor automation node.
Click the image to run the applet in a new browser window.
Shape {
appearance Appearance {
material DEF MAT Material {
diffuseColor 0.8 0.8 0.8
}
}
geometry Box {}
}
This example shows an SFColor Scrollbar widget, an SFColor
ColorSwatch widget, an SFColor TextField widget, and finally
a non-GUI SFColor Gateway node.
Click the image to run the applet in a new browser window.