mjbWorld - PropertyEditors


Pros and cons of using Beans interface for PropertyEditors

pros of using beans interfaces

  1. allows a visual tool to build a world from components at build time (not sure how useful this is)
  2. Provides a set of standard interfaces helps divide the program into managable components.
  3. Gives a framework for a plug-in architecture

cons of using beans interfaces

  1. 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.
  2. 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


metadata block
see also:

 

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

 

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2015 Martin John Baker - All rights reserved - privacy policy.