Multiple CustomAttributeValueEditor

Post here questions and problems related to oXygen frameworks/document types.
cedporter
Posts: 18
Joined: Thu Mar 16, 2017 8:44 pm

Multiple CustomAttributeValueEditor

Post by cedporter »

I have implemented a CustomAttributeValueEditor for one attribute, and following the example in the SDF project sample, I am able to use it in our framework. Maybe I am misunderstanding the use case of this class, but I don't immediately see how to add additional CustomAttributeValueEditors for other attributes in the extension bundle. The overridden method (createCustomAttributeValueEditor) appears to only accept one. Is there a way to have several CustomAttributeValueEditors in a single extension bundle?
Radu
Posts: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: Multiple CustomAttributeValueEditor

Post by Radu »

Hi,

Whenever an attribute value is edited, the method "ro.sync.ecss.extensions.api.ExtensionsBundle.createCustomAttributeValueEditor(boolean)" should be called and you can provide your own CustomAttributeValueEditor implementation on it as you probably already do.
Then the method "CustomAttributeValueEditor.shouldHandleAttribute(EditedAttribute, CustomAttributeValueEditingContext)" is called in your CustomAttributeValueEditor implementation providing you with an "ro.sync.ecss.extensions.api.EditedAttribute" interface from which you can obtain the name and current value of the edited attribute. So depending on the details in the received "EditedAttribute" interface you decide if the attribute name is interesting for you or not. Then you receive the callback "CustomAttributeValueEditor.getAttributeValue(EditedAttribute, Object)" again with the "EditedAttribute" interface allowing you to edit the attribute in any number of ways depending on its name.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
cedporter
Posts: 18
Joined: Thu Mar 16, 2017 8:44 pm

Re: Multiple CustomAttributeValueEditor

Post by cedporter »

Thanks, I realized this was the approach I should use over the weekend. Will do so.
Post Reply