Page 1 of 1

Oxygen Author Component refresh problems

Posted: Tue May 06, 2014 6:36 pm
by alexandr.golovach
Hi, Oxygen guys!

I use Oxygen Author Component in our application.
When I edit document in Oxygen and I push F5 button for refresh current page in browser, I have this message : Image
Then I push "Yes" or "No" and I have different problems.
Image
Image

How can I hide this message(Save dialog)?

Regards,
Alexandr

Re: Oxygen Author Component refresh problems

Posted: Thu May 08, 2014 4:01 pm
by alex_jitianu
Hi Alexandr,

The reload action is bounded in the action map of the author page. First thing you must do is to remove it, something like this:

Code: Select all


JComponent jComponent = (JComponent)editorComponent.getEditorComponent();
removeReloadAction(jComponent);

private void removeReloadAction(JComponent jComponent) {
jComponent.getActionMap().remove("Author__Reload");

int componentCount = jComponent.getComponentCount();
for (int i = 0; i < componentCount; i++) {
Component child = jComponent.getComponent(i);
if (child instanceof JComponent) {
removeReloadAction((JComponent) child);
}
}
}
After removing I don't think F5 will be processed by the browser. You'll have to install an action yourself on the applet and maybe invoke Javascript to do the refresh. You can add an action like so:

Code: Select all

JComponent jComponent = (JComponent)editorComponent.getEditorComponent();
// Install a different reload action to delegate to the browser.
Action action = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("REFRESH");
}
};
jComponent.getActionMap().put("refresh-override", action);
jComponent.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0, false), "refresh-override");
Best regards,
Alex

Re: Oxygen Author Component refresh problems

Posted: Mon May 12, 2014 6:55 pm
by alexandr.golovach
Thank you, Alex, very much!

Your suggestions are working great.

Best, Alexandr.