Override the name of CSS title for localisation in framework
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Override the name of CSS title for localisation in framework
Hello,
We use oxygen-18.1.0.0.jar, and we need to override the name of CSS title for localisation.
I success to manage localisation for other actions and toolbars in the framework thanks to "translation.xml" file.
But I don't find how to do for cssFile title.
Can you explain me how to do that, please ?
Thanks.
Regards,
Isabelle
We use oxygen-18.1.0.0.jar, and we need to override the name of CSS title for localisation.
I success to manage localisation for other actions and toolbars in the framework thanks to "translation.xml" file.
But I don't find how to do for cssFile title.
Can you explain me how to do that, please ?
Thanks.
Regards,
Isabelle
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Override the name of CSS title for localisation in framework
Hi Isabelle,
Right now (even in Oxygen 19.1 which is the current version) we do not have support to translate the titles of the CSS layers using the i18n editor variable which works for actions.
As a workaround you could probably try to navigate the Author toolbar Swing component, try to find the menu items for the CSS styles drop down and change their name.
Or you could try to create your own CSS layers drop down button. It would invoke custom actions which would change certain pseudo class properties on the root element, triggering various CSS selectors to be applied.
Regards,
Radu
Right now (even in Oxygen 19.1 which is the current version) we do not have support to translate the titles of the CSS layers using the i18n editor variable which works for actions.
As a workaround you could probably try to navigate the Author toolbar Swing component, try to find the menu items for the CSS styles drop down and change their name.
Or you could try to create your own CSS layers drop down button. It would invoke custom actions which would change certain pseudo class properties on the root element, triggering various CSS selectors to be applied.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Override the name of CSS title for localisation in framework
Hi Radu,
Thanks for your answer.
I tried to build the css toolbar using the "createCSSAlternativesToolbar()" method like this :
I want to take the "title" field from the framework and use it to build the name of the JComponent, but I don't find how te get this field.
In the "jc" variable, this info is in the field "db".
Is it possible for me to access to this field, in order to get the field "title" ?
Regards,
Isabelle
Thanks for your answer.
I tried to build the css toolbar using the "createCSSAlternativesToolbar()" method like this :
Code: Select all
JToolBar cssAlternativesToolBar = currentPage.createCSSAlternativesToolbar();
for (int i = 0; i < cssAlternativesToolBar.getComponentCount(); i++) {
final JComponent jc = (JComponent) cssAlternativesToolBar.getComponent(i);
jc.setPreferredSize(new Dimension(55, 20));
jc.setMinimumSize(new Dimension(70, 20));
if(/* CSS title is not null */) {
jc.setName(CommonResourceBundle.getInstance().getString(/* CSS title */));
}
this.add(jc);
}
In the "jc" variable, this info is in the field "db".
Is it possible for me to access to this field, in order to get the field "title" ?
Regards,
Isabelle
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Override the name of CSS title for localisation in framework
Hi Isabelle,
I found an automated test in which I accessed those CSS layers, it looks something like this:
so those components in the drop down menu are actually Swing JCheckBoxMenuItem and you can set and get the text set on them.
Regards,
Radu
I found an automated test in which I accessed those CSS layers, it looks something like this:
Code: Select all
JToolBar tbs = authPage.createCSSAlternativesToolbar();
assertEquals(1, tbs.getComponentCount());
JMenu cssMBP = (JMenu) tbs.getComponent(0);
JPopupMenu popupMenu = cssMBP.getPopupMenu();
assertEquals(7, popupMenu.getComponentCount());
assertEquals("Default", ((JCheckBoxMenuItem)popupMenu.getComponent(0)).getText());
assertEquals("+ Show colspec", ((JCheckBoxMenuItem)popupMenu.getComponent(2)).getText());
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Override the name of CSS title for localisation in framework
Hi Radu,
It doesn't change my situation.
Even if I use JComponent, or JMenu or JPopupMenu , the name is null.
The string I put as title in the framework :
doesn't appear as the name of the component.
In fact I found this information in
How can I access to this "db" ArryaList ?
Regards,
Isabelle
It doesn't change my situation.
Even if I use JComponent, or JMenu or JPopupMenu , the name is null.
The string I put as title in the framework :
Code: Select all
<cssFile>
<field name="href">
<String>${framework}/redacteur.less</String>
</field>
<field name="title">
<String>css.file.redactor</String>
</field>
<field name="alternate">
<Boolean>false</Boolean>
</field>
</cssFile>
In fact I found this information in
Code: Select all
popupMenu.invoker.db.0.title = "css.file.redactor"
Regards,
Isabelle
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Override the name of CSS title for localisation in framework
Hi Isabelle,
You should not use "getName", you should use "getText" like in: ((JCheckBoxMenuItem)popupMenu.getComponent(i)).getText().
If this does not work for you please paste the current code you are working with.
About your remark:
Regards,
Radu
You should not use "getName", you should use "getText" like in: ((JCheckBoxMenuItem)popupMenu.getComponent(i)).getText().
If this does not work for you please paste the current code you are working with.
About your remark:
I do not understand in what context. What is that "popupMenu.invoker.db.0.title" key? How did you find it?How can I access to this "db" ArryaList ?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Override the name of CSS title for localisation in framework
Hi Radu,
Thanks for your help, this is the solution I looked for.
Regarding your last question, I find "popupMenu.invoker.db.0.title" this way.
In debug mode I inspect the popupMenu element with debugger tool.
I find "invoker" field.
And when I inspect this field I find an arrayList with the name "db".
And in the first element of this arrayList, I found an object with the element "title" I looked for.
Regards,
Isabelle
Thanks for your help, this is the solution I looked for.
Regarding your last question, I find "popupMenu.invoker.db.0.title" this way.
In debug mode I inspect the popupMenu element with debugger tool.
I find "invoker" field.
And when I inspect this field I find an arrayList with the name "db".
And in the first element of this arrayList, I found an object with the element "title" I looked for.
Regards,
Isabelle
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Override the name of CSS title for localisation in framework
Hi Isabelle,
Oh, OK, I understand now, you were looking in the Java debugger.
By the way, we also added this API in Oxygen 17.0:
and that CSS customizer API can be even used to add extra CSS layers or to override the call "customizeAvailableCSSGroups" and try to change the titles in the default CSS Groups.
Regards,
Radu
Oh, OK, I understand now, you were looking in the Java debugger.
By the way, we also added this API in Oxygen 17.0:
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().addAuthorCSSAlternativesCustomizer(cssAlternativesCustomizer);
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service