/hg/icedtea-web: Patch to permanantly fix frame pop-out issue fo...

dbhole at icedtea.classpath.org dbhole at icedtea.classpath.org
Mon Nov 29 07:20:59 PST 2010


changeset c267c4e2b844 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=c267c4e2b844
author: Deepak Bhole <dbhole at redhat.com>
date: Mon Nov 29 10:19:17 2010 -0500

	Patch to permanantly fix frame pop-out issue for applets Also fixes
	inability to enter text in applet fields in certain cases


diffstat:

2 files changed, 33 insertions(+), 45 deletions(-)
ChangeLog                                                |   11 ++
plugin/icedteanp/java/sun/applet/PluginAppletViewer.java |   67 ++++----------

diffs (138 lines):

diff -r 99f8df2ec04b -r c267c4e2b844 ChangeLog
--- 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-25  Andrew John Hughes  <ahughes
+2010-11-29  Deepak Bhole <dbhole at 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 at redhat.com>
 
 	* Makefile.am:
diff -r 99f8df2ec04b -r c267c4e2b844 plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
--- 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 @@ import com.sun.jndi.toolkit.url.UrlUtil;
          });
          
          // create the frame.
-         PluginAppletViewer.reFrame(null, identifier, System.out, 0, panel);
+         PluginAppletViewer.framePanel(identifier, System.out, handle, panel);
 
          panel.init();
 
@@ -368,42 +368,25 @@ import com.sun.jndi.toolkit.url.UrlUtil;
      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 appletFrame = new PluginAppletViewer(handle, identifier, statusMsgStream, panel);
+         
+         appletFrame.add("Center", panel);
+         appletFrame.pack();
 
-         PluginAppletViewer newFrame = new PluginAppletViewer(handle, identifier, statusMsgStream, panel);
-         
-         if (oldFrame != null) {
-             applets.remove(oldFrame.identifier);
-             oldFrame.removeWindowListener(oldFrame.windowEventListener);
-             panel.removeAppletListener(oldFrame.appletEventListener);
+         appletFrame.appletEventListener = new AppletEventListener(appletFrame, appletFrame);
+         panel.addAppletListener(appletFrame.appletEventListener);
 
-			 // Add first, remove later
-             newFrame.add("Center", panel);
-             oldFrame.remove(panel);
-             oldFrame.dispose();
-         } else {
-	         newFrame.add("Center", panel);
-         }
+         applets.put(identifier, appletFrame);
 
-         newFrame.pack();
-
-         newFrame.appletEventListener = new AppletEventListener(newFrame, newFrame);
-         panel.addAppletListener(newFrame.appletEventListener);
-
-         applets.put(identifier, newFrame);
-
-         PluginDebug.debug(panel + " reframed");
+         PluginDebug.debug(panel + " framed");
      }
 
      /**
@@ -581,18 +564,9 @@ import com.sun.jndi.toolkit.url.UrlUtil;
                  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")) {
@@ -691,16 +665,19 @@ import com.sun.jndi.toolkit.url.UrlUtil;
     		 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 @@ import com.sun.jndi.toolkit.url.UrlUtil;
              public void run()
              {
                  ThreadGroup tg = ((JNLPClassLoader) p.applet.getClass().getClassLoader()).getApplication().getThreadGroup();
-                
+
                  appletShutdown(p);
                  appletPanels.removeElement(p);
                  dispose();



More information about the distro-pkg-dev mailing list