Cannot save documents opened in Oxygen author component

Oxygen general issues.
CheryBen
Posts: 24
Joined: Tue Jun 05, 2012 10:34 am

Cannot save documents opened in Oxygen author component

Post by CheryBen »

Hi again,

I have some troubles using oxygen author component (AuthorComponentProvider), i can't save documents using keyboard action CTRL+S.
I have implemented a custom action (with CTRL+S mnemonic) accessible in a toolbar to save the content of my document, this works fine only if the cursor is outside my document content.

Otherway, if the cursor is inside my document content (ie : in oxygen component), this seems the action is handled by something else (i think this is something from oxygen), and this throws me the error : "Cannot save the file. protocol doesn't support output"

I load my document using this code coming from demo :

Code: Select all

private void setDocument(final String xmlSystemId, final Reader xmlContent)
throws AuthorComponentException {
final Exception[] ex = new Exception[1];
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
// Installs a document modification listener.
try {
authorComponent
.load((xmlSystemId != null && xmlSystemId.trim()
.length() > 0) ? new URL(xmlSystemId)
: null, xmlContent);
} catch (Exception e) {
ex[0] = e;
}
return null;
}
});
if (ex[0] != null) {
throw new AuthorComponentException(ex[0]);
}
}
When i open a document, the arguments values are :
xmlSystemId = file:/C:/authorNeo/DM-Sample/A350/DMC-BRAKE-AAA-DA1-00-00-00AA-041A-A_001-00_EN-US.XML
xmlContent = null


Is there anything i'm doing wrong?
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Cannot save documents opened in Oxygen author component

Post by Radu »

Hi Benoit,

Here's the problem:

The action map of the Author swing component contains a binding for the component's own "save" operation. When the focus is in the component, that action is called instead of yours.
We'll remove in the next version of the component the binding of the save action from the component code. In the meantime, you can remove the action from the action map using the code:

Code: Select all

JPanel panel = (JPanel) authorComponentProvider.getEditorComponent();
panel.getActionMap().remove("File__File_Save");
Actually the default "save" would work quite nicely but Oxygen saves to a resource by opening an URL connection like

Code: Select all

new URL("file://path/.../to.xml").openConnection().getOutputStream()....
and the default SUN implementation for the "file" URL protocol does not allow saving to it. In a standalone version of Oxygen the SUN "file" protocol handler is overwritten by ours and it works there but for the component we do not overwrite any installed URL stream handlers.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
CheryBen
Posts: 24
Joined: Tue Jun 05, 2012 10:34 am

Re: Cannot save documents opened in Oxygen author component

Post by CheryBen »

Thanks for this nice reply.

Do you have any idea when the next component version will be released? at the same time of Oxygen standalone version 14.2?
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Cannot save documents opened in Oxygen author component

Post by Radu »

Hi Benoit,

Yes it will. We plan to release 14.2 in February (in a couple of weeks).
The most important component improvement in 14.2 will be that it will be possible to edit XML content with the component in multiple pages (Text/Grid/Author). Of course the API will allow the developer to decide the pages that should be used for this.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
CheryBen
Posts: 24
Joined: Tue Jun 05, 2012 10:34 am

Re: Cannot save documents opened in Oxygen author component

Post by CheryBen »

I've just seen your reply, this is a really good news! really awesome!

We had this requirement in our roadmap, i hope it will be quite easy for us to integrate this nice improvement.

Thanks for your good support,
Benoît
Post Reply