Issue Updating Attribute in Oxygen UI Interface

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
aujunior
Posts: 48
Joined: Thu Feb 16, 2023 11:00 pm

Issue Updating Attribute in Oxygen UI Interface

Post 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