Pros and cons of using Beans interface for PropertyEditors
pros of using beans interfaces
- allows a visual tool to build a world from components at build time (not
sure how useful this is)
- Provides a set of standard interfaces helps divide the program into managable
components.
- Gives a framework for a plug-in architecture
cons of using beans interfaces
- Beans properties are changed by instantiation of a complete new instance
of the property. This is a problem if the property could be a large array
of vertices for example. This means a lot of unnecessary allocation and garbage
collection.
- A lot of the properties consist of two or three numbers (examples sfPoint3D)
this could be edited as text (0,0.5,0.7) which is difficult to edit.
Approach used in mjbWorld

The program is a compromise to try to get the advantages of using beans, without
the disadvantages explained above.
The beans interfaces are implemented so that an external program can manipulate
the bean:
Also, for setting the properties internally within the program, the interfaces
are used slightly differently.
The diagrams below show both of these cases:
Editing properties which are not in Selected node (globalBean)

Editing array properties
There are some special issues when editing array properties (mfxxx properties).
First, since these proerties may be very large, we dont want the editor to
send back a duplicate of the whole array, just because one of its elements has
changed. Therefore we edit the reference value directly. The problem with this
approach is that we cannot undo the edit.
A second issue is that coordinateBean (and NormalBean, texCoordinateBean, ColorBean)
hold there values in mfvec3f, but when the scene is live they hold the values
in the scene graph.
Another issue is that we sometimes need to add or remove rows to from the table.
Thefefore, because of these issues arrayEditor is used for editing all arrays,
it edits the properties via the tableModel and di_tableUpdate interfaces.

setup property display
When a different node is selected then we have to display its properties in the
property window. When the node is selected its controlPanel method is called.
This displays the top two lines in the properties window and then the nodeDialog
is called on each parameter to display its value.


Changing values of properties

How External Visual editing tools would edit properties

How mjbWorld edits its own properties

Setting of multiple values (arrays) can be slightly more complicated:
How mjbWorld edits multiple values (editing mfxxx parameters
or arrays)


properties in this program
mjbWorld properties |
VRML properties |
Java3d properties |
comments |
sfbool |
SFBool |
|
|
sfcolor |
SFColor |
|
|
mfcolor |
MFColor |
|
|
sfdouble |
SFFloat |
|
|
mfdouble |
MFFloat |
|
|
sfimage |
SFImage |
|
|
sfint32 |
SFInt32 |
|
|
mfint32 |
MFInt32 |
|
|
sfrotation |
SFRotation |
|
|
mfrotation |
MFRotation |
|
|
sfstring |
SFString |
|
|
mfstring |
MFString |
|
|
sftime |
SFTime |
|
|
mftime |
MFTime |
|
|
sfvec2f |
SFVec2f |
|
|
mfvec2f |
MFVec2f |
|
|
sfvec3f |
SFVec3f |
|
|
mfvec3f |
MFVec3f |
|
|
sftransform |
|
|
|
mftransform |
|
|
|
editors for the properties in this program
- baseEditor.java <-- this is the base class for editors that is extended
by all the following
- sflongEditor.java
- arrayEditor.java <-- this edits all array properties (mfxxx)
- sfcolorEditor.java
- sfPoint2fEditor.java
- sfrotationEditor.java
- sfPoint3dEditor.java
- sfstringEditor.java
- sfimageEditor.java
- sfboolEditor.java
- Matrix4dEditor.java
- mfvec3fEditor.java
- sfvec3fEditor.java
- BoundsEditor.java
- colCanvas.java
- ColorEditor.java
- ColorRenderer.java
- di_tableupdate.java
- d_button.java
- d_checkbox.java
- d_editTable.java
This site may have errors. Don't use for critical systems.