How do I extend the schema to expose properties on Swing components?
How do you dynamically disable a menu item by changing an Applet parameter?
I think I saw somewhere in the applet documentation that you can now make menu
items invisible. However the schema doesn't seem to support 'visibility' as an
attribute to menuItem. I would like to say something like:
<param name="config.treemap.uiElements.menu.menuItem['clickThru']@visible"
value="false" />
To keep the schema file size reasonable, only properties with a strong likelihood
of being used are exposed in the schema. However, you can add any property yourself
by modifying the schema file.
If you want to add visible to the list of attributes,
define a sub-element called visible that has two attributes, class and
propertyClasses, which both get set to "boolean". Then add "visible" to the
comma-separated list in the attributes property.
For instance, if you are using the Swing schema, modify it so it looks like:
<menuItem class="${this@class.source()|
'com.labescape.treemap.swingui.SwingMenuItem'}"
attributes="name,text,action,visible"
elements="font,border,textFormat"
propertyMethod="add"
propertyClasses="java.awt.Component">
<visible class="boolean" propertyClasses="boolean" />
...
</menuItem>
Then you'll be able to set the visible property just as you've described. You can do
this same procedure with any property of a Java object that isn't already exposed in the
configuration.
|