Page 1 of 1

Issue Updating Attribute in Oxygen UI Interface

Posted: Fri Aug 22, 2025 3:17 pm
by aujunior
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:

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");
  }
The main class that call the other:

Code: Select all

public class ReferenceRenderer extends WebappFormControlRenderer
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
image.png
image.png

Re: Issue Updating Attribute in Oxygen UI Interface

Posted: Mon Aug 25, 2025 5:11 pm
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.