Error during refresh of an AuthorNode

Post here questions and problems related to oXygen frameworks/document types.
odaata
Posts: 26
Location: Utrecht, Netherlands

Error during refresh of an AuthorNode

Tue Mar 11, 2014 8:44 pm

I've implemented my own StylesFilter to insert combo box with values from another file. I'm watching the other file for changes and refreshing the lists accordingly. In order to let Oxygen know that the list values have changed, I call the refresh(AuthorNode node) function on WSAuthorEditorPage. Here's the code I'm calling:

Code: Select all

WSAuthorEditorPage page = getAuthorPage();
AuthorElement element = getAuthorElement();

if (page != null && element != null) {
    page.refresh(element);
}


However, sometimes this call to refresh produces the error given below. It looks like something is missing from the author node being refreshed. Any ideas on how I can avoid this error?

Code: Select all

18:34:32,525 105133 ERROR [ pool-1-thread-1 ] ro.sync.ecss.css.u - This should never happen, the pseudo styles must ALWAYS be in the cache
java.lang.Exception
   at ro.sync.ecss.css.u.wd(Unknown Source)
   at ro.sync.ecss.css.u.q(Unknown Source)
   at ro.sync.ecss.css.u.l(Unknown Source)
   at ro.sync.ecss.g.u.xl(Unknown Source)
   at ro.sync.ecss.g.b.tt(Unknown Source)
   at ro.sync.ecss.g.b.<init>(Unknown Source)
   at ro.sync.ecss.g.q.xt(Unknown Source)
   at ro.sync.ecss.g.q.<init>(Unknown Source)
   at ro.sync.ecss.g.e.fp(Unknown Source)
   at ro.sync.ecss.g.e.kp(Unknown Source)
   at ro.sync.ecss.g.e.kp(Unknown Source)
   at ro.sync.ecss.g.e.kp(Unknown Source)
   at ro.sync.ecss.g.e.kp(Unknown Source)
   at ro.sync.ecss.g.e.kp(Unknown Source)
   at ro.sync.ecss.g.e.kp(Unknown Source)
   at ro.sync.ecss.g.e.km(Unknown Source)
   at ro.sync.ecss.g.nb.km(Unknown Source)
   at ro.sync.ecss.component.n.rsl(Unknown Source)
   at ro.sync.ecss.component.n.ysl(Unknown Source)
   at ro.sync.ecss.component.n.jkn(Unknown Source)
   at ro.sync.exml.workspace.b.e.b.b.c.refresh(Unknown Source)
   at ro.sync.ecss.extensions.g.refresh(Unknown Source)
   at eu.emergingstandards.lists.styled.EMSTAbstractStyledList.refresh(EMSTAbstractStyledList.java:111)
   at eu.emergingstandards.contextual_info.EMSTContextualInfo.notifyListeners(EMSTContextualInfo.java:266)
   at eu.emergingstandards.contextual_info.EMSTContextualInfo$2.handleEvent(EMSTContextualInfo.java:171)
   at eu.emergingstandards.contextual_info.EMSTContextualInfo$2.fileChanged(EMSTContextualInfo.java:166)
   at org.apache.commons.vfs2.events.ChangedEvent.notify(ChangedEvent.java:36)
   at org.apache.commons.vfs2.provider.AbstractFileSystem.fireEvent(AbstractFileSystem.java:600)
   at org.apache.commons.vfs2.provider.AbstractFileSystem.fireFileChanged(AbstractFileSystem.java:560)
   at eu.emergingstandards.monitor.EMSTFileMonitor.check(EMSTFileMonitor.java:188)
   at eu.emergingstandards.monitor.EMSTFileMonitor$EMSTMonitorService.run(EMSTFileMonitor.java:44)
   at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
   at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
alex_jitianu
Posts: 654

Re: Error during refresh of an AuthorNode

Wed Mar 12, 2014 11:24 am

Hello,

There are two possible causes that come to mind:
1. The page.refresh(element) call should be called on the AWT thread because it updates the layout. Something like this:

Code: Select all

SwingUtilities.invokeLater(new Runnable() {
  @Override
  public void run() {
    page.refresh(element);
  }
});

2. Make sure the element you are refreshing is not a :before or :after pseudo-element. If that's the case, refresh the real element:

Code: Select all

AuthorElement element = getAuthorElement();
if (element.getType() == AuthorNode.NODE_TYPE_PSEUDO_ELEMENT) {
  element = element.getParentElement();
}


Best regards,
Alex
odaata
Posts: 26
Location: Utrecht, Netherlands

Re: Error during refresh of an AuthorNode

Thu Mar 13, 2014 1:12 am

Thank you! That seems to have taken care of the problem. You should somehow mark those functions that require being run on the AWT thread in the documentation. I didn't realize I needed to run it that way.

Which brings up my next question :-) Is there a better way to refresh the nodes after the underlying data in their CSS form control has changed? For example, I've noticed that even without calling the refresh() function, the nodes are refreshed after a mouseover - is this an automatic refresh that happens (i.e. I might not have to refresh the nodes at all, just the list)...

Thanks again for your help!
alex_jitianu
Posts: 654

Re: Error during refresh of an AuthorNode

Thu Mar 13, 2014 11:53 am

Hi,

I've already added a note on the refresh() method that it needs to be fired on AWT and I'll also take a look to see if I identify other omissions.

Calling refresh() is the correct way to handle these situations. When you move the mouse over that element you may have some :hover rules that activate and automatically refresh that node. So the idea is that while other events might happen that will automatically refresh the node, you should not rely on them and explicitly invoke a refresh().

Best regards,
Alex

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 1 guest