set word wrap and font size api?
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 269
- Joined: Sat Jul 10, 2010 4:03 pm
set word wrap and font size api?
Using the SDK text mode editor.
Some of our users like to change the font size in the editor when starting, I would like to save off the last font change and restore that change when they next start the editor.
Some of our users like word wrap on by default, some like it off by default. Is there an API to turn it on or off?
thanks,
Scott
Some of our users like to change the font size in the editor when starting, I would like to save off the last font change and restore that change when they next start the editor.
Some of our users like word wrap on by default, some like it off by default. Is there an API to turn it on or off?
thanks,
Scott
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: set word wrap and font size api?
Hi Scott,
Something like this should work for newly opened XML documents:
The settings should also be persisted automatically.
But we do not have a simplified preferences dialog for the component so you would have to implement a dialog to allow the end user to choose the font and to set the line wrap choice.
Regards,
Radu
Something like this should work for newly opened XML documents:
Code: Select all
/**
* The font for the text controls. A property with a string value of the form "name,style,size".
* For example: "MS Gothic,0,15" where "0" style means plain font, "1" means bold font and "2" means italic font.
*/
AuthorComponentFactory.getInstance().setObjectProperty("font.for.text", "MS Gothic,0,15");
//Line wrap
AuthorComponentFactory.getInstance().setObjectProperty("editor.line.wrap", Boolean.TRUE);
But we do not have a simplified preferences dialog for the component so you would have to implement a dialog to allow the end user to choose the font and to set the line wrap choice.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 269
- Joined: Sat Jul 10, 2010 4:03 pm
Re: set word wrap and font size api?
Is there a corresponding get()? for the current font and line wrap setting?
I looked for
AuthorComponentFactory.getInstance().getObjectProperty("editor.line.wrap"); but don't see it?
thanks,
Scott
I looked for
AuthorComponentFactory.getInstance().getObjectProperty("editor.line.wrap"); but don't see it?
thanks,
Scott
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: set word wrap and font size api?
Hi Scott,
The AuthorComponent was originally intended as being heavily customized but without exposing settings to the end user.
We do have this API which should work also in the AuthorComponent:
PluginWorkspaceProvider.getPluginWorkspace().getGlobalObjectProperty("font.for.text")
but this will not work:
PluginWorkspaceProvider.getPluginWorkspace().getGlobalObjectProperty("editor.line.wrap")
because for each key that the API wants to read we need to pre-approve it by adding it to a list of approved keys.
Maybe you could set and get the user-related settings separately using PluginWorkspaceProvider.getPluginWorkspace().getOptionsStorage(), have some defaults for them and always impose the local settings using "setObjectProperty" after initializing the AuthorComponentFactory.
Regards,
Radu
The AuthorComponent was originally intended as being heavily customized but without exposing settings to the end user.
We do have this API which should work also in the AuthorComponent:
PluginWorkspaceProvider.getPluginWorkspace().getGlobalObjectProperty("font.for.text")
but this will not work:
PluginWorkspaceProvider.getPluginWorkspace().getGlobalObjectProperty("editor.line.wrap")
because for each key that the API wants to read we need to pre-approve it by adding it to a list of approved keys.
Maybe you could set and get the user-related settings separately using PluginWorkspaceProvider.getPluginWorkspace().getOptionsStorage(), have some defaults for them and always impose the local settings using "setObjectProperty" after initializing the AuthorComponentFactory.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 269
- Joined: Sat Jul 10, 2010 4:03 pm
Re: set word wrap and font size api?
Radu,
The word wrap is working great and I can persist the settings across editors and across sessions.
The font size not so good.
I tried
Object globalObjectProperty = PluginWorkspaceProvider.getPluginWorkspace().getGlobalObjectProperty("font.for.text");
which returns null until I do
AuthorComponentFactory.getInstance().setObjectProperty("font.for.text", "MS Gothic,0,15");
Then getGlobalObjectProperty returns the font that I set with setObjectProperty.
The problem with that is
1.) I need the default font for the text editor. How do I get or set that that.
2.) When I call AuthorComponentFactory.getInstance().setObjectProperty("font.for.text", "MS Gothic,0,20"); it sets the property but the text size in the editor doesn;t change as It does when I use the Font_size/Decrease_font action or the reduce action? Is there no way to call that increase size or decrease size action function?
thanks,
Scott
The word wrap is working great and I can persist the settings across editors and across sessions.
The font size not so good.
I tried
Object globalObjectProperty = PluginWorkspaceProvider.getPluginWorkspace().getGlobalObjectProperty("font.for.text");
which returns null until I do
AuthorComponentFactory.getInstance().setObjectProperty("font.for.text", "MS Gothic,0,15");
Then getGlobalObjectProperty returns the font that I set with setObjectProperty.
The problem with that is
1.) I need the default font for the text editor. How do I get or set that that.
2.) When I call AuthorComponentFactory.getInstance().setObjectProperty("font.for.text", "MS Gothic,0,20"); it sets the property but the text size in the editor doesn;t change as It does when I use the Font_size/Decrease_font action or the reduce action? Is there no way to call that increase size or decrease size action function?
thanks,
Scott
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: set word wrap and font size api?
Hi Scott,
Sorry, my bad. The key you need to set and read is this one: "editor.font". The "font.for.text" is for text fields and other text-based controls.
This will fix (1). For (2) the setting does not get automatically propagated to the opened editor. I will look into this on my side. You probably need to advice the end user to re-start the application.
Regards,
Radu
Sorry, my bad. The key you need to set and read is this one: "editor.font". The "font.for.text" is for text fields and other text-based controls.
This will fix (1). For (2) the setting does not get automatically propagated to the opened editor. I will look into this on my side. You probably need to advice the end user to re-start the application.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: set word wrap and font size api?
Hi,
We released Oxygen 22 and its corresponding SDK. The (2) API usage should now work without restarting the component.
Regards,
Radu
We released Oxygen 22 and its corresponding SDK. The (2) API usage should now work without restarting the component.
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