Page 1 of 1

Oxygen Author Applet. Xref insertion

Posted: Wed Jan 04, 2012 3:22 pm
by maxim.kovalev
How in Oxygen Author Applet I can check up insertion possibility xref in a current node?

Whether after an insertion xref probably to change behavior at pushing the link?

Re: Oxygen Author Applet. Xref insertion

Posted: Wed Jan 04, 2012 3:39 pm
by Radu
Hi,

So you have two questions:
How in Oxygen Author Applet I can check up insertion possibility xref in a current node?
You could use code like this:

Code: Select all

      AuthorSchemaManager schemaManager = authorAccess.getDocumentController().getAuthorSchemaManager();
WhatElementsCanGoHereContext wecgh = schemaManager.createWhatElementsCanGoHereContext(authorAccess.getEditorAccess().getCaretOffset());
List<CIElement> possibleChildrenElements = schemaManager.getChildrenElements(wecgh);
A CIElement contains information about the possible name and namespace (+ other info) of an element which would be allowed in the context.
Whether after an insertion xref probably to change behavior at pushing the link?
In the ro.sync.ecss.samples.AuthorComponentSample there is some code like:

Code: Select all

//Open a clicked link in the same component
factory.setOpenURLHandler.....
This callback received when a user clicks a link sets as a behavior opening the URL in the same component but you can take a different approach for the received URL, possibly create another AuthorComponentProvider from the factory and use a JTabbedPane to handle multiple components in the same applet.

If this does not answer your questions maybe you should provide more details about your user case.

Regards,
Radu

Re: Oxygen Author Applet. Xref insertion

Posted: Wed Jan 04, 2012 4:41 pm
by maxim.kovalev
About the second question. It is necessary that the special window (selector) opened at pushing on xref links where I can specify other object to change the link. The window is ready already, it is necessary to call only it on xref link pushing. How it to make?

Re: Oxygen Author Applet. Xref insertion

Posted: Thu Jan 05, 2012 9:34 am
by maxim.kovalev
I'm understand already. Thanks

Re: Oxygen Author Applet. Xref insertion

Posted: Fri Jan 06, 2012 12:35 pm
by maxim.kovalev

Code: Select all

		// Open a clicked link in the same component
factory.setOpenURLHandler(new OpenURLHandler() {
public void handleOpenURL (URL arg0) throws IOException {
href contains "../Reference/reference_Some_section.dita".

arg0 contains (FF8)
"file:/C:/Program%20Files%20(x86)/Reference/reference_Some_section.dita".
arg0 contains (IE8) "file:/C:/Documents%20and%20Settings/ga/Reference/reference_Some_section.dita"

Oxygen changed href when puts in URL. Need href. Needed to keep its value. It's possible?

Re: Oxygen Author Applet. Xref insertion

Posted: Fri Jan 06, 2012 1:08 pm
by Radu
Hello Maxim,

Oxygen makes an absolute URL from the relative location by looking at the URL of the current edited resource.
The URL of the current edited resource is usually set on this API method:

ro.sync.ecss.extensions.api.component.AuthorComponentProvider.load(URL, Reader)

So you need to set a relevant URL for the current resource which is edited in the Author Component, this will also help you identify the target of the link.

Regards,
Radu