A custom attribute editor extends the Attributes tool. There are two kinds of such extensions:
An extension which returns the list of all possible values for a given attribute. Example:
<attributeEditor attribute="f:remove" elementMatches="f:filter" xmlns:f="urn:namespace:filter"> <list> <item>red</item> <item>green</item> <item>blue</item> </list> </attributeEditor>
Note that implementing this first kind of attribute editor may be done without any Java™ programming, by the means of the list
child element of an attributeEditor
configuration element. This is the case of the above example. More information in Section 1, “attributeEditor” in XMLmind XML Editor - Configuration and Deployment.
An extension which creates a modal dialog box allowing to edit the value of a given attribute. This dialog box is passed the initial attribute value (or the empty string if the attribute has not yet been specified). The dialog box is then expected to return a possibly modified value for this attribute. XHTML example described in this tutorial:
<attributeEditor attribute="bgcolor" elementMatches="html:table|html:tr|html:th|html:td|html:body" xmlns:html="http://www.w3.org/1999/xhtml"> <class>HexColorChooser</class> </attributeEditor>
The Attributes tool invokes such extension as follows:
The Value field which supports auto-completion will display the items of the list.
When you click the Value field. The dialog box displayed in this case comes from the attributeEditor
configuration element.
A custom attribute editor is declared in an XXE configuration file by the means of the attributeEditor
configuration element in XMLmind XML Editor - Configuration and Deployment. See above examples.
In the case of an attribute editor of the first kind, implement interface SetAttribute.ChoicesFactory
or SetAttribute.RefChoicesFactory
. In the case of an attribute editor of the second kind, implement interface SetAttribute.EditorFactory
.