Mercurial > hg > release > icedtea-web-1.2
changeset 59:c267c4e2b844
Patch to permanantly fix frame pop-out issue for applets
Also fixes inability to enter text in applet fields in certain cases
author | Deepak Bhole <dbhole@redhat.com> |
---|---|
date | Mon, 29 Nov 2010 10:19:17 -0500 |
parents | 99f8df2ec04b |
children | b1409d2cbd86 |
files | ChangeLog plugin/icedteanp/java/sun/applet/PluginAppletViewer.java |
diffstat | 2 files changed, 32 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Nov 29 15:56:06 2010 +0100 +++ b/ChangeLog Mon Nov 29 10:19:17 2010 -0500 @@ -1,3 +1,14 @@ +2010-11-29 Deepak Bhole <dbhole@redhat.com> + + * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java + (createPanel): Call the new framePanel() method with the proper handle. + (framePanel): New method, renamed from reFrame. Changed to now do one-time + framing of panel into the plugin. + (handleMessage): Don't re-frame the panel. Panel is now framed only once. + (destroyApplet): Dispose the frame right away, and try to remove the panel + if possible. If not, handleMessage() will do it when the panel is + ready/removable. + 2010-11-25 Andrew John Hughes <ahughes@redhat.com> * Makefile.am:
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Mon Nov 29 15:56:06 2010 +0100 +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Mon Nov 29 10:19:17 2010 -0500 @@ -138,7 +138,7 @@ }); // create the frame. - PluginAppletViewer.reFrame(null, identifier, System.out, 0, panel); + PluginAppletViewer.framePanel(identifier, System.out, handle, panel); panel.init(); @@ -368,42 +368,25 @@ public PluginAppletViewer() { } - public static void reFrame(PluginAppletViewer oldFrame, - int identifier, PrintStream statusMsgStream, - long handle, AppletViewerPanel panel) { + public static void framePanel(int identifier, PrintStream statusMsgStream, + long handle, AppletViewerPanel panel) { - PluginDebug.debug("Reframing " + panel); + PluginDebug.debug("Framing " + panel); // SecurityManager MUST be set, and only privileged code may call reFrame() System.getSecurityManager().checkPermission(new AllPermission()); - // Same handle => nothing to do - if (oldFrame != null && handle == oldFrame.handle) - return; - - PluginAppletViewer newFrame = new PluginAppletViewer(handle, identifier, statusMsgStream, panel); + PluginAppletViewer appletFrame = new PluginAppletViewer(handle, identifier, statusMsgStream, panel); - if (oldFrame != null) { - applets.remove(oldFrame.identifier); - oldFrame.removeWindowListener(oldFrame.windowEventListener); - panel.removeAppletListener(oldFrame.appletEventListener); + appletFrame.add("Center", panel); + appletFrame.pack(); - // Add first, remove later - newFrame.add("Center", panel); - oldFrame.remove(panel); - oldFrame.dispose(); - } else { - newFrame.add("Center", panel); - } + appletFrame.appletEventListener = new AppletEventListener(appletFrame, appletFrame); + panel.addAppletListener(appletFrame.appletEventListener); - newFrame.pack(); + applets.put(identifier, appletFrame); - newFrame.appletEventListener = new AppletEventListener(newFrame, newFrame); - panel.addAppletListener(newFrame.appletEventListener); - - applets.put(identifier, newFrame); - - PluginDebug.debug(panel + " reframed"); + PluginDebug.debug(panel + " framed"); } /** @@ -581,20 +564,11 @@ waitForAppletInit((NetxPanel) applets.get(identifier).panel); // Should we proceed with reframing? - if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) { + if (updateStatus(identifier, PAV_INIT_STATUS.REFRAME_COMPLETE).equals(PAV_INIT_STATUS.INACTIVE)) { destroyApplet(identifier); return; } - // Proceed with re-framing - reFrame(oldFrame, identifier, System.out, handle, oldFrame.panel); - - // There is a slight chance that destroy can happen - // between the above and below line - if (updateStatus(identifier, PAV_INIT_STATUS.REFRAME_COMPLETE).equals(PAV_INIT_STATUS.INACTIVE)) { - destroyApplet(identifier); - } - } else if (message.startsWith("destroy")) { // Set it inactive, and try to do cleanup is applicable @@ -691,16 +665,19 @@ return; } - // If already disposed, return - if (applets.get(identifier).panel.applet == null) { - // Try to still dispose the panel itself -- no harm done with double dispose + PluginDebug.debug("Attempting to destroy frame " + identifier); + + // Try to dispose the panel right away + if (applets.containsKey(identifier)) applets.get(identifier).dispose(); - PluginDebug.debug(identifier + " inactive. Returning."); + // If panel is already disposed, return + if (applets.get(identifier).panel.applet == null) { + PluginDebug.debug(identifier + " panel inactive. Returning."); return; } - PluginDebug.debug("Attempting to destroy " + identifier); + PluginDebug.debug("Attempting to destroy panel " + identifier); final int fIdentifier = identifier; SwingUtilities.invokeLater(new Runnable() { @@ -1674,7 +1651,7 @@ public void run() { ThreadGroup tg = ((JNLPClassLoader) p.applet.getClass().getClassLoader()).getApplication().getThreadGroup(); - + appletShutdown(p); appletPanels.removeElement(p); dispose();