Page 1 of 1

Cannot save documents opened in Oxygen author component

Posted: Wed Jan 30, 2013 6:36 pm
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?

Re: Cannot save documents opened in Oxygen author component

Posted: Thu Jan 31, 2013 11:23 am
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

Re: Cannot save documents opened in Oxygen author component

Posted: Fri Feb 01, 2013 12:55 am
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?

Re: Cannot save documents opened in Oxygen author component

Posted: Fri Feb 01, 2013 9:49 am
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

Re: Cannot save documents opened in Oxygen author component

Posted: Tue Feb 05, 2013 7:46 pm
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