Add an inspector for a factory
Source file: BeanInspectorExample
When you use a geometry factory to generate a geometry for the scene graph
you may wish to change parameters of that factory and see the effect of this
change. The de.jtem.beans.InspectorPanel
(the so called beans inspector from
the jTEM project beans, whose jar file is deliverd
with jReality) does that automatically for classes that adhere to the JavaBeans convention as the geometry factories do.
Let us extend the tutorial
"Use a parametric surface factory" with an inspector for the parametric surface factory. The following code should be added before the method JRViewer.startup()
is called.
To generate the inspector gui add the following two lines.
InspectorPanel inspector = new InspectorPanel(); inspector.setObject(psf, "update");
The second argument in the second line tells the inspector what the update method is. This method is called whenever the usere changes a property.
Finally the gui needs to be wrapped into a shrink panel.
ViewShrinkPanelPlugin plugin = new ViewShrinkPanelPlugin() { public PluginInfo getPluginInfo() { return new PluginInfo("Domain"); } }; plugin.getShrinkPanel().add(inspector); v.registerPlugin(plugin);
|