Change the CSS filepath of a framework at runtime

Oxygen general issues.
SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Change the CSS filepath of a framework at runtime

Post by SSC »

Hello,

We are using the Eclipse version 14.1 of Oxygen.

I have added the http://www.pi-mod.de/ framework to the Document Type Association and defined certain rules for it.

Unfortunately some of our customers have individually customized the CSS and Schema files, so that the XML document, its Schema and CSS is downloaded together from the customers server and then should be used by the XML editor.
So we cannot exactly define, which CSS and Schema should be chosen beforehand.
The CSS and Schema files have the same location like the XML document itself.
It seems that the correct Schema file is detected automatically by the Oxygen Author(Maybe because it is located in the same folder). But the CSS only works, if I define the right path in the Document Type Association.

Do you have an API to change the CSS URI at runtime, when a certain xml document is opened?

Best regards,

Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Change the CSS filepath of a framework at runtime

Post by Radu »

Hi Simon,

I do not quite understand.

So in some XML files is the CSS referenced like this?

Code: Select all

<?xml-stylesheet type="text/css" href="personal.css"?>
When the user opens the XML, is the relatively referenced CSS also available as a resource?
But the CSS only works, if I define the right path in the Document Type Association.
In the case it does not work, when switching the XML to the Author page is there any problem reported?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Re: Change the CSS filepath of a framework at runtime

Post by SSC »

Hello Radu,

the approach with the PI <?xml-stylesheet type="text/css" href="personal.css"?> works.
I was just wonderung, if I could change some properties of a certain Framework programmatically at runtime.

So we define the CSS via PI and DTD via Doctype.
Though we have to define certain actions for inserting tables and other framework specific elements inside the frameworks preferences.
For tables I just copied the docbook.jar, because it contains methods for inserting cals Tables.

Could you explain how I can create my own actions, which can be used for the PI-Mod framework?
Do you have a certain Interface, which I have to implement in order to provide actions for the menu, toolbar and context menu for the framework?

Best regards,

Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Change the CSS filepath of a framework at runtime

Post by Radu »

Hi Simon,
I was just wonderung, if I could change some properties of a certain Framework programmatically at runtime.
No, sorry. As long as the XML references the custom XML Schema, it should not be a problem for it to reference the custom CSS as well, right?
For tables I just copied the docbook.jar, because it contains methods for inserting cals Tables.
Right, Docbook tables adhere to the CALS table standard so if you use the same standard the existing implementations should work.
If you want to make modifications, our Author SDK contains the entire Java code for the Docbook extensions:

http://www.oxygenxml.com/oxygen_sdk.htm ... horing_SDK
Could you explain how I can create my own actions, which can be used for the PI-Mod framework?
Do you have a certain Interface, which I have to implement in order to provide actions for the menu, toolbar and context menu for the framework?
Our Author Developer guide covers this:

http://www.oxygenxml.com/doc/ug-oxygen/ ... intro.html

Basically when editing a custom framework there is an Author tab which contains an Actions tab.
You create actions which can have more than one XPath contexts in which certain operations can be invoked. Out of the box we provide a list of built-in operations like ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation which can be used to insert a small XML fragment in a certain place.
But you can also implement a custom operation (extend the interface ro.sync.ecss.extensions.api.AuthorOperation). The JAR library with the implementation will need to be added to the Classpath list when editing the document type.

Then these actions can be added to the toolbar, main or contextual menus.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Re: Change the CSS filepath of a framework at runtime

Post by SSC »

Hello Radu,
It should not be a problem for it to reference the custom CSS as well, right?
Right :wink:

Thanks for the hint with the SDK Sources.
The ro.sync.ecss.extensions.api.AuthorOperation was actually what I needed.
I did implement some PI-Mod custom actions and it works fine.

Because it is not so easy to include our bundles into the oxygen extensions I decided to use your localisation mechanism using a translation.xml in the i18n folder, which is referenced as classpath in the framework file.
With the ro.sync.ecss.extensions.api.AuthorResourceBundle.getMessage I get the text from the translation.xml file, but only the en_US ones and not the german de_DE ones, even though I have set the -nl de arguments.

Is there any additional language configuration required?

Best regards,

Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Change the CSS filepath of a framework at runtime

Post by Radu »

Hi Simon,

Are the tooltips which appear over the Author toolbar custom operations in German?
Does any action from the Oxygen plugin appear translated in German.
Did you install the German language pack (or copy the plugin_de.properties properties file to the plugin installation folder) in the Oxygen plugin?
When started with a certain locale, Oxygen looks if the plugin_locale.properties is available and if so will also try to use the locale for the extension actions and other Oxygen actions which are not available in the plugin.xml.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Re: Change the CSS filepath of a framework at runtime

Post by SSC »

Hello Radu,

somehow the localisation fragment was not activated any more in my run configurations.
Now everything works fine.
Thanks a lot.

Best regards,

Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
Post Reply