Extend the Author web applet code

Having trouble installing Oxygen? Got a bug to report? Post it all here.
itarato
Posts: 4
Joined: Mon Jun 24, 2013 5:26 pm

Extend the Author web applet code

Post by itarato »

Hi there,

I'm using the Author component applet in the browser to edit XML documents. I can check the status by calling:

Code: Select all


var applet = document.getElementById(id).getAuthorComponentSample();
applet.isModified();
And I can also get the content:

Code: Select all


var applet = document.getElementById(id).getAuthorComponentSample();
applet.getSerializedDocument();
However when I send the document back and save the isModified() call will show me true - so for it it's still changed. How can I tell the applet that I managed to save the code and only tell me that it's changed when there is a new change in it?

Regarding this - is there a documentation what applet functions are available? (Such as isModified() or getSerializedDocument())? I've checked the ro.sync.ecss.samples classes at the src folder, there I can see it defined. I tried to edit it and rebuild with ant but my new functions weren't available. Is there a way to add new functions that I can call from JS?

Thanks so much.
Peter
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Extend the Author web applet code

Post by Radu »

Hi Peter,

So you are calling the Java code from the ro.sync.ecss.samples.AuthorComponentSample class from the Javascript code, right?
You could add in the AuthorComponentSample sample Java class another method like:

Code: Select all

	/**
* Set the document's modified flag to a certain state.
*
* @param modified <code>true</code> to mark the document as modified, <code>false</code> to mark it as not dirty.
*/
public void setModified(boolean modified) {
editorComponent.getWSEditorAccess().setModified(modified);
}
Basically all public methods you add to the AuthorComponentSample class will be accessible via the Javascript.
And these public methods can call our API, the Javadoc for our API is present in the : javadoc/doc.zip ZIP file.

If adding a new method to the AuthorComponentSample class does not work, it's possible that the class is not re-compiled by the ANT build process. The original "build.xml" we bundle with the component has a target called "compile" which is called before the applet's libraries are constructed.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
itarato
Posts: 4
Joined: Mon Jun 24, 2013 5:26 pm

Re: Extend the Author web applet code

Post by itarato »

Hi Radu,

Thanks so much for your quick reply. I tried to add the functions - and I called 'ant' (not 'ant compile') and didn't see any change. I'll check which java file is used and do an 'ant compile' again.
One question - just out of curiosity. When I recompile it again, which jar file the updated java file goes into?

Thanks,
Peter
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Extend the Author web applet code

Post by Radu »

Hi Peter,

You can also look in the ANT build file for this information.
A folder called dist is created having the newly updated library lib\oxygen-author-component-sample.jar

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply