The list of actions available for applet
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 269
- Joined: Sat Jul 10, 2010 4:03 pm
The list of actions available for applet
in the main applet function that configures the toolbar is the following code
Where is this "list of actions" mentioned on the last line?
Another question:
If I add a "save" action, I imagine I need to add a js function to send the contents to my server. Is there an example of how hook that action to a js function?
thanks,
Scott
Code: Select all
if (EditorPageConstants.PAGE_AUTHOR.equals(editorComponent
.getWSEditorAccess().getCurrentPageID())) {
WSAuthorComponentEditorPage authorPage = (WSAuthorComponentEditorPage) editorComponent
.getWSEditorAccess().getCurrentPage();
Map<String, Object> authorCommonActions = authorPage
.getActionsProvider().getAuthorCommonActions();
// You can look in the list of actions to see what's available.
Another question:
If I add a "save" action, I imagine I need to add a js function to send the contents to my server. Is there an example of how hook that action to a js function?
thanks,
Scott
-
- Posts: 9423
- Joined: Fri Jul 09, 2004 5:18 pm
Re: The list of actions available for applet
Hi Scott,
So:
1) Have a "Save" action in the HTML page surrounding the applet (so it would not be on the applet toolbar). The action would call a method from the applet side to obtain its XML content and then possibly use an AJAX request to send the content to a server.
The applet sample already comes with a Javascript file which shows how you can call methods from the Java applet instantiated in the page:
2) The Save action could be on the applet's internal toolbar.
The Author Component is usually loaded from an URL ro.sync.ecss.extensions.api.component.ComponentProvider.load(URL, Reader).
If that URL points to a webdav enabled server, when you call ro.sync.ecss.extensions.api.component.ComponentProvider.getWSEditorAccess().save() the component will try to use the PUT HTTP method to save the content back to the URL from where the content was opened.
Or again you can obtain the edited XML content using ro.sync.ecss.extensions.api.component.ComponentProvider.getWSEditorAccess().createContentReader() and save it to a server either by calling some Java code or by calling some Javascript code from the web page where the applet is embedded. As an example of calling Javascript code from Java is found in the class AuthorComponentSampleApplet.java which at some point does:
Regards,
Radu
So:
That remark meant that you can use System.out.println("Common actions: " + authorCommonActions); and then look in the Java console to see what action keys are available for usage.Where is this "list of actions" mentioned on the last line?
You have about two choices:If I add a "save" action, I imagine I need to add a js function to send the contents to my server. Is there an example of how hook that action to a js function?
1) Have a "Save" action in the HTML page surrounding the applet (so it would not be on the applet toolbar). The action would call a method from the applet side to obtain its XML content and then possibly use an AJAX request to send the content to a server.
The applet sample already comes with a Javascript file which shows how you can call methods from the Java applet instantiated in the page:
Code: Select all
/**
* Sets the content to be edited.
*
* @param url The base system ID of the content. Used to resolve referred resources.
* @param content The serialized XML
*/
function setDocumentContent(url, content) {
var sample = document.getElementById('authorComponentApplet').getAuthorComponentSample();
if(sample != null){
// May be null if not licensed.
try {
sample.setDocumentContent(url, content);
}
catch (e) {
alert("setDocumentContent " + e);
}
}
}
The Author Component is usually loaded from an URL ro.sync.ecss.extensions.api.component.ComponentProvider.load(URL, Reader).
If that URL points to a webdav enabled server, when you call ro.sync.ecss.extensions.api.component.ComponentProvider.getWSEditorAccess().save() the component will try to use the PUT HTTP method to save the content back to the URL from where the content was opened.
Or again you can obtain the edited XML content using ro.sync.ecss.extensions.api.component.ComponentProvider.getWSEditorAccess().createContentReader() and save it to a server either by calling some Java code or by calling some Javascript code from the web page where the applet is embedded. As an example of calling Javascript code from Java is found in the class AuthorComponentSampleApplet.java which at some point does:
Code: Select all
getAppletContext().showDocument(new URL("javascript:onLoad()"));
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