Display not refreshing when undoing attribute updates

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Display not refreshing when undoing attribute updates

Post by sijomon » Mon Feb 22, 2010 6:06 pm

Hi,

I think I have found a bug in the 10.3 version, and just wanted to check it was on your radar (or possibly even fixed already), and also would like some advise about a work around given I am restricted to 10.3.

If you display an attribute value in author mode using the CSS property "content: attr(<some attribute name>);" and then update that attribute value via the API using AuthorDocumentController.setAttribute() and then undo the update action, the display doesn't refresh to show the old value of the attribute. If you manually force a refresh (say by changing the style sheet) the old value then displays correctly.

Can you suggest a way in which I can force a display refresh (with authorAccess.getEditorAccess().refresh(); maybe?) when the user triggers an undo event?

Thanks,

Simon.

Radu
Posts: 6433
Joined: Fri Jul 09, 2004 5:18 pm

Re: Display not refreshing when undoing attribute updates

Post by Radu » Mon Feb 22, 2010 6:28 pm

Hi Simon,

Does this issue also happen when you change the attribute using the "Attributes" view and then undo?

I seem to remember there was such a problem but I cannot reproduce it, even in Oxygen 10.3. Can you give me a small XML+CSS sample?

As a workaround I think you can get the AuthorDocumentController, add a document listener:

Code: Select all


  void addAuthorListener(AuthorListener listener);
and overwrite the:

Code: Select all


void attributeChanged(AttributeChangedEvent e);
Then in the overwritten method call from the AuthorEditorAccess the refresh method:

Code: Select all


void refresh(AuthorNode authorNode);
The changed node can be found out from the AttributeChangedEvent.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Radu
Posts: 6433
Joined: Fri Jul 09, 2004 5:18 pm

Re: Display not refreshing when undoing attribute updates

Post by Radu » Mon Feb 22, 2010 6:33 pm

We fixed an issue like this when the attribute had a namespace or when it was matched from the CSS like *|attrName.
Does this resemble your case?
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Re: Display not refreshing when undoing attribute updates

Post by sijomon » Mon Feb 22, 2010 7:15 pm

Yes the issue occurs if you edit the attribute via the attributes editor.

A sample XML document that reproduces this error is:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="sample.css"?>
<report>
<paragraph-group>
<paragraph id="87b7f1f3-582f-4547-9c09-ac54fe3c2e0d" para-number="20">
<para>Some paragraph text</para>
</paragraph>
</paragraph-group>
</report>
and the CSS file is:

Code: Select all

report{
font-family:sans-serif;
border-style: solid;
border-width: 2px;
border-color: black;
margin: 10px;
padding: 10px;
display:block;
margin-bottom: 2px;
}

[para-number]:before{
display:block;
content: attr(para-number);
font-weight:bold;
font-size:larger;
}
If you change the attribute value via the in-built attribute editor the value does not change either when you edit it, or when you undo an edit. To force the display to change, either re-associate the XML with the CSS or make a content change (add and then remove a space will do) in text mode and then flip back to author mode. I was aware of the problem of the value not updating when edited via the in-built editor and have created a new attribute editor operation which forces a refresh. I was not previously aware of the undo problem.

Thanks for the recomended work around, I will implement this.

Simon.

Radu
Posts: 6433
Joined: Fri Jul 09, 2004 5:18 pm

Re: Display not refreshing when undoing attribute updates

Post by Radu » Tue Feb 23, 2010 10:53 am

Hi Simon,

Actually this was fixed in the Oxygen 11.0 release because of a previous post you had:
http://www.oxygenxml.com/forum/topic4228.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Radu
Posts: 6433
Joined: Fri Jul 09, 2004 5:18 pm

Re: Display not refreshing when undoing attribute updates

Post by Radu » Tue Feb 23, 2010 10:55 am

I think the only workaround which will work on your part is to call refresh on the changed element's parent when the attribute changes.
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Re: Display not refreshing when undoing attribute updates

Post by sijomon » Tue Feb 23, 2010 12:09 pm

I had a feeling this undo issue would be related to the update issue you referenced (http://www.oxygenxml.com/forum/topic4228.html).

Thanks for the info.

Post Reply