Oxygen Author Component refresh problems

Having trouble installing Oxygen? Got a bug to report? Post it all here.
alexandr.golovach
Posts: 19
Joined: Tue Mar 11, 2014 11:56 am

Oxygen Author Component refresh problems

Post 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
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: Oxygen Author Component refresh problems

Post 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
alexandr.golovach
Posts: 19
Joined: Tue Mar 11, 2014 11:56 am

Re: Oxygen Author Component refresh problems

Post by alexandr.golovach »

Thank you, Alex, very much!

Your suggestions are working great.

Best, Alexandr.
Post Reply