Issue Updating Attribute in Oxygen UI Interface
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 48
- Joined: Thu Feb 16, 2023 11:00 pm
Issue Updating Attribute in Oxygen UI Interface
Good morning,
We have created a class that extends WebappFormControlRenderer to update the content of an element called <externalPubCode>. The update of the internal text content worked perfectly, and the system responded as expected.
However, we encountered an issue when trying to update the "pubCodingScheme" attribute. Although the attribute was successfully modified in the XML document via the Java API, the change was not reflected in the Oxygen UI interface — the attribute remained unchanged from the user's perspective.
We attempted to refresh the node, but it did not work. We tried two different coding approaches, both of which correctly updated the XML document, but neither managed to update the UI interface.
Below is a summary of the two approaches we used:
The main class that call the other:
Could you please advise us on the correct way to update this attribute so that the change is properly reflected in the UI?
Thank you in advance for your support.
Best regards,
Audye Scola Junior
We have created a class that extends WebappFormControlRenderer to update the content of an element called <externalPubCode>. The update of the internal text content worked perfectly, and the system responded as expected.
However, we encountered an issue when trying to update the "pubCodingScheme" attribute. Although the attribute was successfully modified in the XML document via the Java API, the change was not reflected in the Oxygen UI interface — the attribute remained unchanged from the user's perspective.
We attempted to refresh the node, but it did not work. We tried two different coding approaches, both of which correctly updated the XML document, but neither managed to update the UI interface.
Below is a summary of the two approaches we used:
Code: Select all
public static void setElementAttributeV1(AuthorAccess authorAccess, AuthorElement element, String attribute, String value) {
AuthorDocumentController docControl = authorAccess.getDocumentController();
ArgsMap args = new ArgsMap();
try {
args.put("elementLocation", docControl.getXPathExpression(element.getStartOffset() + 1));
args.put("name", attribute);
args.put("value", value);
new ChangeAttributeOperation().doOperation(authorAccess, args);
logger.error("setElementAttributeV1 OK");
} catch (BadLocationException | AuthorOperationException e) {
logger.error("Error on setElementAttribute.", e);
}
}
public static void setElementAttributeV2(AuthorAccess authorAccess, AuthorElement element, String attribute, String value) {
AuthorDocumentController docControl = authorAccess.getDocumentController();
docControl.setAttribute(attribute, new AttrValue(value), element);
authorAccess.getEditorAccess().refresh(element);
logger.error("setElementAttributeV2 OK");
}
Code: Select all
public class ReferenceRenderer extends WebappFormControlRenderer
Thank you in advance for your support.
Best regards,
Audye Scola Junior
image.png
image.png
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 177
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Issue Updating Attribute in Oxygen UI Interface
Post by Bogdan Dumitru »
Hello Audye,
You say that you update an attribute and the update is visible in the editor but not in "Oxygen UI interface", but from what I can see in the screenshot you attached, the side-view where the attribute isn't updated is a custom side-view, not a built-in Oxygen side-view.
At a first glance, you need to add a listener to intercept when document changes, and then update your view. See the sync.api.AuthorEditingSupport.EventType.MODEL_CHANGE event.
You also mentioned WebappFormControlRenderer, but this API is usually used when you want to replace an element with a custom control, for example an Image Map Editor or MathML Editor.
If the above doesn't help you solve your problem, please give us more details about how the side-view was implemented. What APIs did you used in order to render it.
You say that you update an attribute and the update is visible in the editor but not in "Oxygen UI interface", but from what I can see in the screenshot you attached, the side-view where the attribute isn't updated is a custom side-view, not a built-in Oxygen side-view.
At a first glance, you need to add a listener to intercept when document changes, and then update your view. See the sync.api.AuthorEditingSupport.EventType.MODEL_CHANGE event.
You also mentioned WebappFormControlRenderer, but this API is usually used when you want to replace an element with a custom control, for example an Image Map Editor or MathML Editor.
If the above doesn't help you solve your problem, please give us more details about how the side-view was implemented. What APIs did you used in order to render it.
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service