Oxygen Author Applet. Xref insertion

Having trouble installing Oxygen? Got a bug to report? Post it all here.
maxim.kovalev
Posts: 35
Joined: Fri Nov 11, 2011 10:34 am

Oxygen Author Applet. Xref insertion

Post 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?
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Oxygen Author Applet. Xref insertion

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
maxim.kovalev
Posts: 35
Joined: Fri Nov 11, 2011 10:34 am

Re: Oxygen Author Applet. Xref insertion

Post 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?
maxim.kovalev
Posts: 35
Joined: Fri Nov 11, 2011 10:34 am

Re: Oxygen Author Applet. Xref insertion

Post by maxim.kovalev »

I'm understand already. Thanks
maxim.kovalev
Posts: 35
Joined: Fri Nov 11, 2011 10:34 am

Re: Oxygen Author Applet. Xref insertion

Post 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?
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Oxygen Author Applet. Xref insertion

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply