Page 1 of 1

internal xlink:href not working in Author component 17.0.2

Posted: Thu Jul 02, 2015 7:12 pm
by Johann
Hi,

Since Oxygen 17.0.2, in my Author Component, elements having attribute xlink:href and pointing to an internal Reference do not do anything on click.
With the same framework and the same XML, in Oxygen 17, the click goes to the pointed element.

Only internal references (xlink:href="#foo") seem not to be working. External references (xlink:href="http://foo.html") still work in AuthorComponent.

Do you have any idea about this behavior ?

Thanks in advance,

Johann

Re: internal xlink:href not working in Author component 17.0

Posted: Fri Jul 03, 2015 9:13 am
by Radu
Hi Johann,

I managed to reproduce the problem. It is a bug on our side, we'll work to fix it and try to come up in a couple of days with a 17.0.3 Maven SDK.

Regards,
Radu

Re: internal xlink:href not working in Author component 17.0

Posted: Fri Jul 03, 2015 10:31 am
by Johann
Thanks for your reactivity !

Johann

Re: internal xlink:href not working in Author component 17.0

Posted: Tue Jul 07, 2015 8:05 am
by Radu
Hi Johann,

We uploaded the Author Component 17.0.3 in the Maven repository so you could give that a try.

Regards,
Radu

Re: internal xlink:href not working in Author component 17.0.2

Posted: Wed Oct 28, 2015 1:41 pm
by Johann
Hi Radu,

Finally, I could upgrade my Oxygen component to 17.1.0.
Actually, it works well on a single tab (editor), I can click on an internal link and it scrolls and highlights to the pointed target.

"But", when i open multiple tabs with different documents containing internal links, I have this behaviour only on the last opened document.
For the other tabs, when I click on an internal link, I got this error :

Code: Select all


ro.sync.ecss.extensions.api.component.AuthorComponentException: Multiple component provider instances cannot be created over the same URL.
Another component provider has already been created for this URL.
Please dispose a component provider which is not necessary anymote using AuthorComponentFactory.disposeEditorComponentProvider().
at ro.sync.ecss.extensions.api.component.AuthorComponentProvider.load(Unknown Source)
at ro.sync.ecss.extensions.api.component.AuthorComponentProvider.showLocation(Unknown Source)
at com._4dconcept.docAdvance.authorNeo.authorComponent.document.OxygenComponent$1.handleOpenURL(OxygenComponent.java:51)
at ro.sync.ecss.extensions.api.component.BaseComponentEditorManager.open(Unknown Source)
at ro.sync.exml.e.h.c(Unknown Source)
at ro.sync.exml.e.h.d(Unknown Source)
at ro.sync.exml.editor.xmleditor.pageauthor.q.open(Unknown Source)
at ro.sync.exml.editor.b.c.w$1.zyb(Unknown Source)
at ro.sync.ui.application.jb.run(Unknown Source)
It seems the method "showLocation" tries to reopen a component provider whereas this one is already created (because it is an internal link).

Can you help me with this error ?

Thanks in advance.

Johann

Re: internal xlink:href not working in Author component 17.0.2

Posted: Wed Oct 28, 2015 3:51 pm
by Radu
Hi Johann,

About this remark:
It seems the method "showLocation" tries to reopen a component provider whereas this one is already created (because it is an internal link).
Yes, so the "showLocation" method tries to see if the URL is the same of the opened URL (case in which it just uses the anchor to show the location in the already opened content) or if it somehow reaches the conclusion it is another URL, it will try to open the content of that target URL in the component and then use the anchor to navigate to the target element.

I'm not quite sure what's going on.
You should try to make sure that you are not calling the "AuthorComponentFactory.init()" method more than once, when the application starts.
Ideally you could give me some sample code about how you are creating the components, if you are disposing them using "AuthorComponentFactory.disposeEditorComponentProvider(EditorComponentProvider)" when they are closed.
Also can you log (using System.err for example) what the precise URL which you are calling the showLocation() method looks like and what the precise URL which you loaded in the component AuthorComponentProvider.load(URL, Reader) looks like?

Regards,
Radu

Re: internal xlink:href not working in Author component 17.0.2

Posted: Wed Oct 28, 2015 5:27 pm
by Johann
Hi Radu,

I did several tests to help solving this issue.
You should try to make sure that you are not calling the "AuthorComponentFactory.init()" method more than once, when the application starts.
First, I tested it and the init method is just called once.

Then I performed this scenario (I close no document so the method disposeEditorComponentProvider is never called) :

(opening first document doc1.XML)
authorComponentProvider.load with url : file:/C:/oxygenComponent/doc1.XML

(clicking internal link in doc1.XML => it works !)
authorComponentProvider.showLocation with url : file:/C:/oxygenComponent/doc1.XML#seq-0001

(opening second document doc2.XML)
authorComponentProvider.load with url : file:/C:/oxygenComponent/doc2.XML

(clicking internal link in doc2.XML => it works !)
authorComponentProvider.showLocation with url : file:/C:/oxygenComponent/doc2.XML#sup-0002

(switching to first tab doc1.XML and clicking internal link in doc1.XML => ERROR !)
authorComponentProvider.showLocation with url : file:/C:/oxygenComponent/doc1.XML#seq-0001
ro.sync.ecss.extensions.api.component.AuthorComponentException: Multiple component provider instances cannot be created over the same URL.
Another component provider has already been created for this URL.
Please dispose a component provider which is not necessary anymote using AuthorComponentFactory.disposeEditorComponentProvider().
at ro.sync.ecss.extensions.api.component.AuthorComponentProvider.load(Unknown Source)
at ro.sync.ecss.extensions.api.component.AuthorComponentProvider.showLocation(Unknown Source)
at com._4dconcept.docAdvance.authorNeo.authorComponent.document.OxygenComponent$1.handleOpenURL(OxygenComponent.java:52)
at ro.sync.ecss.extensions.api.component.BaseComponentEditorManager.open(Unknown Source)
at ro.sync.exml.e.h.c(Unknown Source)
at ro.sync.exml.e.h.d(Unknown Source)
at ro.sync.exml.editor.xmleditor.pageauthor.q.open(Unknown Source)
at ro.sync.exml.editor.b.c.w$1.zyb(Unknown Source)
at ro.sync.ui.application.jb.run(Unknown Source)

(switching to second tab doc2.XML and clicking internal link in doc2.XML => it works !)
authorComponentProvider.showLocation with url : file:/C:/oxygenComponent/doc2.XML#spa-0001

I did not see anything wrong during my tests :/

Johann

Re: internal xlink:href not working in Author component 17.0.2

Posted: Wed Oct 28, 2015 5:42 pm
by Radu
Hi Johann,

And you are creating a separate authorComponentProvider instance for each tab, right?
If so, I will try to build a small sample multi tabbed-pane interface to the author component and reproduce this on my side.

Regards,
Radu

Re: internal xlink:href not working in Author component 17.0.2

Posted: Wed Oct 28, 2015 5:47 pm
by Radu
One more thing I remembered, how does your OpenURLHandler implementation set on the factory factory.setOpenURLHandler look like?
The default sample one we provide only calls the current editor component provider (because the sample test application we provide is not multi tabbed pane).
If your application is multi tabbed pane when the OpenURLHandler gets called you should first try to locate the editorComponent which has already opened that URL and delegate the showLocation method to it. If there is no such editorComponent created in any of the tabs, you can create a new tab with a new editorComponent in it and delegate the showLocation method to it.

Regards,
Radu

Re: internal xlink:href not working in Author component 17.0.2

Posted: Wed Oct 28, 2015 5:49 pm
by Johann
And you are creating a separate authorComponentProvider instance for each tab, right?
Yes, I use this code for each tab creation :

Code: Select all

        // Getting the component factory
AuthorComponentFactory factory = AuthorComponentFactory.getInstance();

// Create the AuthorComponent
String[] editors = {EditorPageConstants.PAGE_AUTHOR, EditorPageConstants.PAGE_TEXT};
authorComponentProvider = (AuthorComponentProvider) factory.createEditorComponentProvider(editors, EditorPageConstants.PAGE_TEXT);
Johann

Re: internal xlink:href not working in Author component 17.0.2

Posted: Wed Oct 28, 2015 5:54 pm
by Johann
One more thing I remembered, how does your OpenURLHandler implementation set on the factory factory.setOpenURLHandler look like?
Here is the full code called when a new tab is created :

Code: Select all

        // Getting the component factory
AuthorComponentFactory factory = AuthorComponentFactory.getInstance();

// Create the AuthorComponent
String[] editors = {EditorPageConstants.PAGE_AUTHOR, EditorPageConstants.PAGE_TEXT};
authorComponentProvider = (AuthorComponentProvider) factory.createEditorComponentProvider(editors, EditorPageConstants.PAGE_TEXT);

Component editorSwingComponent = authorComponentProvider.getEditorComponent();
changeButtonText(editorSwingComponent);

// Open a clicked link in the same component
factory.setOpenURLHandler(new OpenURLHandler() {
public void handleOpenURL(URL url) throws IOException {
try {
authorComponentProvider.showLocation(url, null);
} catch (AuthorComponentException e) {
throw new IOException(e.getMessage());
}
}
});

Re: internal xlink:href not working in Author component 17.0.2

Posted: Thu Oct 29, 2015 9:39 am
by Radu
Hi Johann,

That's the problem. The method "factory.setOpenURLHandler" is static, you can set a single open URL handler which handles the open events in your entire custom application.
So you should set the open url handler only once. And for each tab you open you should keep a global mapping between the tab's URL and it's authorComponentProvider.
Then when you receive the "handleOpenURL" event you should try to see in that mapping if there is already an authorComponentProvider created in one of the opened tabs for that URL and delegate the showLocation call to it. If there is no component opened for the URL you can add a new tab with that component and delegate the showLocation call to it.

Regards,
Radu

Re: internal xlink:href not working in Author component 17.0.2

Posted: Thu Oct 29, 2015 6:40 pm
by Johann
Hi Radu,

Ok ! I understand what was wrong in my code... So, as you suggested, I've created a map associating an URL with its authorComponentProvider and in the handleOpenURL method, I get back the right authorComponentProvider and call showlocation. Everything works well now !

Thanks for your help Radu !

Johann