diff -r a86af88a8ecd Makefile.am --- a/Makefile.am Mon Aug 13 15:52:03 2012 +0200 +++ b/Makefile.am Mon Aug 13 16:52:21 2012 +0200 @@ -174,6 +174,7 @@ edit_launcher_script = sed \ -e 's|[@]LAUNCHER_BOOTCLASSPATH[@]|$(LAUNCHER_BOOTCLASSPATH)|g' \ -e 's|[@]JAVAWS_BIN_LOCATION[@]|$(bindir)/$(javaws)|g' \ + -e 's|[@]JAVAWS_SPLASH_LOCATION[@]|$(datadir)/$(PACKAGE_NAME)/javaws_splash.png|g' \ -e 's|[@]ITWEB_SETTINGS_BIN_LOCATION[@]|$(bindir)/$(itweb_settings)|g' \ -e 's|[@]JAVA[@]|$(JAVA)|g' \ -e 's|[@]JRE[@]|$(SYSTEM_JRE_DIR)|g' @@ -204,6 +205,7 @@ ${INSTALL_DATA} $(abs_top_builddir)/liveconnect/lib/classes.jar $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/plugin.jar endif ${INSTALL_DATA} $(NETX_DIR)/lib/classes.jar $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/netx.jar + ${INSTALL_DATA} $(NETX_SRCDIR)/javaws_splash.png $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/javaws_splash.png ${INSTALL_PROGRAM} launcher.build/$(javaws) $(DESTDIR)$(bindir) ${INSTALL_DATA} extra-lib/about.jar $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/about.jar ${INSTALL_PROGRAM} launcher.build/$(itweb_settings) $(DESTDIR)$(bindir) diff -r a86af88a8ecd NEWS --- a/NEWS Mon Aug 13 15:52:03 2012 +0200 +++ b/NEWS Mon Aug 13 16:52:21 2012 +0200 @@ -19,6 +19,7 @@ - PR955: regression: SweetHome3D fails to run New in release 1.3 (2012-XX-XX): +* Splash screen for javaws and plugin * NetX - PR898: signed applications with big jnlp-file doesn't start (webstart affect like "frozen") - PR811: javaws is not handling urls with spaces (and other characters needing encoding) correctly diff -r a86af88a8ecd launcher/javaws.in --- a/launcher/javaws.in Mon Aug 13 15:52:03 2012 +0200 +++ b/launcher/javaws.in Mon Aug 13 16:52:21 2012 +0200 @@ -5,6 +5,7 @@ LAUNCHER_FLAGS=-Xms8m CLASSNAME=net.sourceforge.jnlp.runtime.Boot BINARY_LOCATION=@JAVAWS_BIN_LOCATION@ +SPLASH_LOCATION=@JAVAWS_SPLASH_LOCATION@ PROGRAM_NAME=javaws CP=@JRE@/lib/rt.jar @@ -15,6 +16,10 @@ i=0 j=0 +SPLASH="false" +if [ "x$ICEDTEA_WEB_SPLASH" = "x" ] ; then +SPLASH="true" +fi; while [ "$#" -gt "0" ]; do case "$1" in -J*) @@ -24,6 +29,9 @@ *) ARGS[$j]="$1" j=$((j+1)) + if [ "$1" = "-headless" ] ; then + SPLASH="false" + fi ;; esac shift @@ -32,6 +40,10 @@ k=0 COMMAND[k]="${JAVA}" k=$((k+1)) +if [ "$SPLASH" = "true" ] ; then +COMMAND[k]="-splash:${SPLASH_LOCATION}" +k=$((k+1)) +fi; COMMAND[k]="${LAUNCHER_BOOTCLASSPATH}" k=$((k+1)) COMMAND[k]="${LAUNCHER_FLAGS}" diff -r a86af88a8ecd netx/net/sourceforge/jnlp/GuiLaunchHandler.java --- a/netx/net/sourceforge/jnlp/GuiLaunchHandler.java Mon Aug 13 15:52:03 2012 +0200 +++ b/netx/net/sourceforge/jnlp/GuiLaunchHandler.java Mon Aug 13 16:52:21 2012 +0200 @@ -1,5 +1,5 @@ /* GuiLaunchHandler.java - Copyright (C) 2011 Red Hat, Inc. + Copyright (C) 2012 Red Hat, Inc. This file is part of IcedTea. @@ -54,7 +54,7 @@ */ public class GuiLaunchHandler extends AbstractLaunchHandler { - private JNLPSplashScreen splashScreen = null; + private volatile JNLPSplashScreen splashScreen = null; private final Object mutex = new Object(); private UpdatePolicy policy = UpdatePolicy.ALWAYS; @@ -80,10 +80,13 @@ } private void closeSplashScreen() { - synchronized(mutex) { + synchronized (mutex) { if (splashScreen != null) { if (splashScreen.isSplashScreenValid()) { splashScreen.setVisible(false); + if (splashScreen.isCustomSplashscreen()) { + splashScreen.stopAnimation(); + } } splashScreen.dispose(); } @@ -102,40 +105,56 @@ @Override public void launchInitialized(final JNLPFile file) { - + int preferredWidth = 500; int preferredHeight = 400; final URL splashImageURL = file.getInformation().getIconLocation( IconDesc.SPLASH, preferredWidth, preferredHeight); + final ResourceTracker resourceTracker = new ResourceTracker(true); if (splashImageURL != null) { - final ResourceTracker resourceTracker = new ResourceTracker(true); resourceTracker.addResource(splashImageURL, file.getFileVersion(), null, policy); - synchronized(mutex) { - try { - SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - splashScreen = new JNLPSplashScreen(resourceTracker, file); - } - }); - } catch (InterruptedException ie) { - // Wait till splash screen is created - while (splashScreen == null); - } catch (InvocationTargetException ite) { - ite.printStackTrace(); - } + } + synchronized (mutex) { + try { + SwingUtilities.invokeAndWait(new Runnable() { - splashScreen.setSplashImageURL(splashImageURL); + @Override + public void run() { + splashScreen = new JNLPSplashScreen(resourceTracker, file); + } + }); + } catch (InterruptedException ie) { + // Wait till splash screen is created + while (splashScreen == null); + } catch (InvocationTargetException ite) { + ite.printStackTrace(); } + try { + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + splashScreen.setSplashImageURL(splashImageURL); + } + }); + } catch (InterruptedException ie) { + // Wait till splash screen is created + while (splashScreen == null); + } catch (InvocationTargetException ite) { + ite.printStackTrace(); + } + + } - + SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { - if (splashImageURL != null) { - synchronized(mutex) { + if (splashScreen != null) { + synchronized (mutex) { if (splashScreen.isSplashScreenValid()) { splashScreen.setVisible(true); } diff -r a86af88a8ecd netx/net/sourceforge/jnlp/JNLPSplashScreen.java --- a/netx/net/sourceforge/jnlp/JNLPSplashScreen.java Mon Aug 13 15:52:03 2012 +0200 +++ b/netx/net/sourceforge/jnlp/JNLPSplashScreen.java Mon Aug 13 16:52:21 2012 +0200 @@ -78,61 +78,82 @@ // JNLP file. this.resourceTracker = resourceTracker; - - this.file=file; + this.file=file; } public void setSplashImageURL(URL url) { - splashImageUrl = url; - splashImage = null; - try { - splashImage = ImageIO.read(resourceTracker - .getCacheFile(splashImageUrl)); - if (splashImage == null) { + if (url != null) { + splashImageUrl = url; + splashImage = null; + try { + splashImage = ImageIO.read(resourceTracker.getCacheFile(splashImageUrl)); + if (splashImage == null) { + if (JNLPRuntime.isDebug()) { + System.err.println("Error loading splash image: " + url); + } + + } + } catch (IOException e) { if (JNLPRuntime.isDebug()) { System.err.println("Error loading splash image: " + url); } - return; + splashImage = null; + + } catch (IllegalArgumentException argumentException) { + if (JNLPRuntime.isDebug()) { + System.err.println("Error loading splash image: " + url); + } + splashImage = null; + } - } catch (IOException e) { - if (JNLPRuntime.isDebug()) { - System.err.println("Error loading splash image: " + url); - } - splashImage = null; - return; - } catch (IllegalArgumentException argumentException) { - if (JNLPRuntime.isDebug()) { - System.err.println("Error loading splash image: " + url); - } - splashImage = null; - return; } + if (splashImage == null) { + this.setLayout(new BorderLayout()); + SplashPanel splash = SplashUtils.getSplashScreen(DEF_WIDTH, DEF_HEIGHT); + if (splash != null) { + splash.startAnimation(); + splash.setInformationElement(InformationElement.createFromJNLP(file)); + this.add(splash.getSplashComponent()); + this.componetSplash = splash; + } + } correctSize(); } public boolean isSplashScreenValid() { - return (splashImage != null); + return (splashImage != null) || (componetSplash != null); + } private void correctSize() { + int minimumWidth = DEF_WIDTH; + int minimumHeight = DEF_HEIGHT; + if (splashImage != null) { + Insets insets = getInsets(); + minimumWidth = splashImage.getWidth(null) + insets.left + + insets.right; + minimumHeight = splashImage.getHeight(null) + insets.top + + insets.bottom; + } + setMinimumSize(new Dimension(0, 0)); + setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); + setSize(new Dimension(minimumWidth, minimumHeight)); + setPreferredSize(new Dimension(minimumWidth, minimumHeight)); - Insets insets = getInsets(); - int minimumWidth = splashImage.getWidth(null) + insets.left - + insets.right; - int minimumHeight = splashImage.getHeight(null) + insets.top - + insets.bottom; - setMinimumSize(new Dimension(minimumWidth, minimumHeight)); - - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - setLocation((screenSize.width - minimumWidth) / 2, - (screenSize.height - minimumHeight) / 2); + // Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + // setLocation((screenSize.width - minimumWidth) / 2, + // (screenSize.height - minimumHeight) / 2); + //Above works always, but center only to middle of all monitors + //below works on 1.4 and higher, and center to middle of primary monmtor + setLocationRelativeTo(null); } @Override public void paint(Graphics g) { if (splashImage == null) { + super.paint(g); return; } @@ -141,4 +162,12 @@ g2.drawImage(splashImage, getInsets().left, getInsets().top, null); } + + boolean isCustomSplashscreen() { + return (componetSplash!=null); + } + + void stopAnimation() { + if (isCustomSplashscreen()) componetSplash.stopAnimation(); + } } diff -r a86af88a8ecd netx/net/sourceforge/jnlp/Launcher.java --- a/netx/net/sourceforge/jnlp/Launcher.java Mon Aug 13 15:52:03 2012 +0200 +++ b/netx/net/sourceforge/jnlp/Launcher.java Mon Aug 13 16:52:21 2012 +0200 @@ -20,6 +20,7 @@ import java.applet.Applet; import java.awt.Container; +import java.awt.SplashScreen; import java.io.File; import java.lang.reflect.Method; import java.net.InetAddress; @@ -42,6 +43,8 @@ import javax.swing.SwingUtilities; import javax.swing.text.html.parser.ParserDelegator; +import net.sourceforge.jnlp.runtime.AppletEnvironment; +import net.sourceforge.jnlp.splashscreen.SplashUtils; import sun.awt.SunToolkit; @@ -540,6 +543,12 @@ } if (JNLPRuntime.getForksAllowed() && file.needsNewVM()) { + if (!JNLPRuntime.isHeadless()){ + SplashScreen sp = SplashScreen.getSplashScreen(); + if (sp!=null) { + sp.close(); + } + } List netxArguments = new LinkedList(); netxArguments.add("-Xnofork"); netxArguments.addAll(JNLPRuntime.getInitialArguments()); @@ -649,18 +658,22 @@ * @param enableCodeBase whether to add the codebase URL to the classloader */ protected ApplicationInstance launchApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException { - if (!file.isApplet()) + if (!file.isApplet()) { throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplet"), R("LNotAppletInfo"))); + } + AppletInstance applet = null; try { - AppletInstance applet = createApplet(file, enableCodeBase, cont); + applet = createApplet(file, enableCodeBase, cont); applet.initialize(); applet.getAppletEnvironment().startApplet(); // this should be a direct call to applet instance return applet; } catch (LaunchException lex) { + SplashUtils.showErrorCaught(lex, applet); throw launchError(lex); } catch (Exception ex) { + SplashUtils.showErrorCaught(ex, applet); throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo"))); } } @@ -669,16 +682,19 @@ * Gets an ApplicationInstance, but does not launch the applet. */ protected ApplicationInstance getApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException { - if (!file.isApplet()) + if (!file.isApplet()) { throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplet"), R("LNotAppletInfo"))); - + } + AppletInstance applet = null; try { - AppletInstance applet = createApplet(file, enableCodeBase, cont); + applet = createApplet(file, enableCodeBase, cont); applet.initialize(); return applet; } catch (LaunchException lex) { + SplashUtils.showErrorCaught(lex, applet); throw launchError(lex); } catch (Exception ex) { + SplashUtils.showErrorCaught(ex, applet); throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo"))); } } @@ -696,22 +712,30 @@ * * @param enableCodeBase whether to add the code base URL to the classloader */ - protected AppletInstance createApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException { + protected synchronized AppletInstance createApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException { + // appletInstance is needed by ServiceManager when looking up + // services. This could potentially be done in applet constructor + // so initialize appletInstance before creating applet. + AppletInstance appletInstance = null; + ThreadGroup group = Thread.currentThread().getThreadGroup(); try { JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy); if (enableCodeBase) { loader.enableCodeBase(); } else if (file.getResources().getJARs().length == 0) { - throw new ClassNotFoundException("Can't do a codebase look up and there are no jars. Failing sooner rather than later"); + Exception ex = new ClassNotFoundException("Can't do a codebase look up and there are no jars. Failing sooner rather than later"); + try { + SplashUtils.showError(ex, new AppletEnvironment(file, new AppletInstance(file, group, new ClassLoader() { + }, null))); + } catch (Exception exx) { + if (JNLPRuntime.isDebug()) { + exx.printStackTrace(); + } + } + throw ex; } - ThreadGroup group = Thread.currentThread().getThreadGroup(); - - // appletInstance is needed by ServiceManager when looking up - // services. This could potentially be done in applet constructor - // so initialize appletInstance before creating applet. - AppletInstance appletInstance; if (cont == null) appletInstance = new AppletInstance(file, group, loader, null); else @@ -732,6 +756,7 @@ return appletInstance; } catch (Exception ex) { + SplashUtils.showErrorCaught(ex, appletInstance); throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCInit"), R("LInitApplet"), R("LInitAppletInfo"))); } } @@ -842,7 +867,7 @@ new ParserDelegator(); } - /** + /** * This runnable is used to call the appropriate launch method * for the application, applet, or installer in its thread group. */ diff -r a86af88a8ecd netx/net/sourceforge/jnlp/NetxPanel.java --- a/netx/net/sourceforge/jnlp/NetxPanel.java Mon Aug 13 15:52:03 2012 +0200 +++ b/netx/net/sourceforge/jnlp/NetxPanel.java Mon Aug 13 16:52:21 2012 +0200 @@ -1,5 +1,5 @@ /* - * Copyright 2007 Red Hat, Inc. + * Copyright 2012 Red Hat, Inc. * This file is part of IcedTea, http://icedtea.classpath.org * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -22,7 +22,6 @@ package net.sourceforge.jnlp; -import net.sourceforge.jnlp.AppletLog; import net.sourceforge.jnlp.runtime.AppletInstance; import net.sourceforge.jnlp.runtime.JNLPRuntime; @@ -32,6 +31,8 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import net.sourceforge.jnlp.splashscreen.SplashController; +import net.sourceforge.jnlp.splashscreen.SplashPanel; import sun.applet.AppletViewerPanel; import sun.awt.SunToolkit; @@ -42,10 +43,11 @@ * * @author Francis Kung */ -public class NetxPanel extends AppletViewerPanel { +public class NetxPanel extends AppletViewerPanel implements SplashController { private PluginBridge bridge = null; private boolean exitOnFailure = true; private AppletInstance appInst = null; + private SplashController appletViewerFrame; private boolean appletAlive; private final String uKey; @@ -232,4 +234,32 @@ SunToolkit.createNewAppContext(); } } + + + + + public void setAppletViewerFrame(SplashController framePanel) { + appletViewerFrame=framePanel; + } + + @Override + public void removeSplash() { + appletViewerFrame.removeSplash(); + } + + @Override + public void replaceSplash(SplashPanel r) { + appletViewerFrame.replaceSplash(r); + } + + @Override + public int getSplashWidth() { + return appletViewerFrame.getSplashWidth(); + } + + @Override + public int getSplashHeigth() { + return appletViewerFrame.getSplashHeigth(); + } + } diff -r a86af88a8ecd plugin/icedteanp/java/sun/applet/PluginAppletViewer.java --- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Mon Aug 13 15:52:03 2012 +0200 +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Mon Aug 13 16:52:21 2012 +0200 @@ -76,6 +76,7 @@ import java.awt.event.WindowListener; import java.awt.print.PageFormat; import java.awt.print.Printable; +import java.awt.Component; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; @@ -93,10 +94,8 @@ import java.security.PrivilegedExceptionAction; import java.util.Enumeration; import java.util.HashMap; -import java.util.Hashtable; import java.util.Iterator; import java.util.Map; -import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -115,6 +114,11 @@ import sun.misc.Ref; import com.sun.jndi.toolkit.url.UrlUtil; +import java.util.Hashtable; +import java.util.Vector; +import net.sourceforge.jnlp.splashscreen.SplashController; +import net.sourceforge.jnlp.splashscreen.SplashPanel; +import net.sourceforge.jnlp.splashscreen.SplashUtils; /** * Lets us construct one using unix-style one shot behaviors @@ -145,7 +149,12 @@ @Override public void run() { panel.createNewAppContext(); // create the frame. - PluginAppletViewer.framePanel(identifier, handle, panel); + int width = Integer.parseInt(atts.get("width")); + int height = Integer.parseInt(atts.get("height")); + + PluginDebug.debug("X and Y are: " + width + " " + height); + panel.setAppletViewerFrame(PluginAppletViewer.framePanel(identifier,handle, width, height, panel)); + panel.init(); // Start the applet initEventQueue(panel); @@ -198,6 +207,8 @@ ie.printStackTrace(); } + panel.removeSplash(); + AppletSecurityContextManager.getSecurityContext(0).associateSrc(panel.getAppletClassLoader(), doc); AppletSecurityContextManager.getSecurityContext(0).associateInstance(identifier, panel.getAppletClassLoader()); @@ -271,7 +282,7 @@ // FIXME: declare JSProxy implementation @SuppressWarnings("serial") public class PluginAppletViewer extends XEmbeddedFrame - implements AppletContext, Printable { + implements AppletContext, Printable, SplashController { /** * Enumerates the current status of an applet @@ -323,26 +334,32 @@ private Image bufFrameImg; private Graphics bufFrameImgGraphics; + + private SplashPanel splashPanel; + /** * Null constructor to allow instantiation via newInstance() */ public PluginAppletViewer() { } - public static void framePanel(int identifier, long handle, NetxPanel panel) { + public static synchronized PluginAppletViewer framePanel(int identifier,long handle, int width, int height, NetxPanel panel) { PluginDebug.debug("Framing ", panel); - - // SecurityManager MUST be set, and only privileged code may call reFrame() + + // SecurityManager MUST be set, and only privileged code may call framePanel() System.getSecurityManager().checkPermission(new AllPermission()); PluginAppletViewer appletFrame = new PluginAppletViewer(handle, identifier, panel); - - appletFrame.add("Center", panel); - appletFrame.pack(); - + appletFrame.appletEventListener = new AppletEventListener(appletFrame, appletFrame); panel.addAppletListener(appletFrame.appletEventListener); + // Clear bindings, if any + if (applets.containsKey(identifier)) { + PluginAppletViewer oldFrame = applets.get(identifier); + oldFrame.remove(panel); + panel.removeAppletListener(oldFrame.appletEventListener); + } appletsLock.lock(); applets.put(identifier, appletFrame); @@ -350,6 +367,7 @@ appletsLock.unlock(); PluginDebug.debug(panel, " framed"); + return appletFrame; } /** @@ -383,9 +401,107 @@ }; addWindowListener(windowEventListener); + final AppletPanel fPanel = panel; + try { + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + add("Center", fPanel); + fPanel.setVisible(false); + + splashPanel = SplashUtils.getSplashScreen(fPanel.getWidth(), fPanel.getHeight()); + if (splashPanel != null) { + splashPanel.startAnimation(); + PluginDebug.debug("Added splash " + splashPanel); + add("Center", splashPanel.getSplashComponent()); + } + pack(); + } + }); + } catch (Exception e) { + e.printStackTrace(); // Not much we can do other and print + } } + public void replaceSplash(final SplashPanel newSplash) { + // Loading done. Remove splash screen. + if (splashPanel == null) { + return; + } + if (newSplash == null) { + removeSplash(); + return; + } + splashPanel.stopAnimation(); + try { + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + splashPanel.getSplashComponent().setVisible(false); + splashPanel.stopAnimation(); + remove(splashPanel.getSplashComponent()); + newSplash.setPercentage(splashPanel.getPercentage()); + newSplash.setSplashWidth(splashPanel.getSplashWidth()); + newSplash.setSplashHeight(splashPanel.getSplashHeight()); + newSplash.adjustForSize(); + splashPanel = newSplash; + add("Center", splashPanel.getSplashComponent()); + pack(); + } + }); + } catch (Exception e) { + e.printStackTrace(); // Not much we can do other and print + } + } + + @Override + public void removeSplash() { + + // Loading done. Remove splash screen. + if (splashPanel == null) { + return; + } + splashPanel.stopAnimation(); + try { + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + splashPanel.getSplashComponent().setVisible(false); + splashPanel.stopAnimation(); + remove(splashPanel.getSplashComponent()); + splashPanel = null; + // Re-add the applet + remove(panel); + add(panel); + panel.setVisible(true); + pack(); + } + }); + } catch (Exception e) { + e.printStackTrace(); // Not much we can do other and print + } + } + + @Override + public int getSplashWidth() { + if (splashPanel != null) { + return splashPanel.getSplashWidth(); + } else { + return -1; + } + } + + @Override + public int getSplashHeigth() { + if (splashPanel != null) { + return splashPanel.getSplashHeight(); + } else { + return -1; + } + } + + private static class AppletEventListener implements AppletListener { final Frame frame; final PluginAppletViewer appletViewer; @@ -401,7 +517,6 @@ panelLock.lock(); panelLive.signalAll(); panelLock.unlock(); - switch (evt.getID()) { case AppletPanel.APPLET_RESIZE: { if (src != null) { @@ -436,6 +551,23 @@ break; } + case AppletPanel.APPLET_START: { + String s="Error1 detected"; + PluginDebug.debug(s); + if (src.status != AppletPanel.APPLET_INIT && src.status != AppletPanel.APPLET_STOP) { + SplashPanel sp=SplashUtils.getErrorSplashScreen(appletViewer.panel.getWidth(), appletViewer.panel.getHeight(), new Exception(s)); + appletViewer.replaceSplash(sp); + } + + break; + } + case AppletPanel.APPLET_ERROR: { + String s="Error2 detected"; + PluginDebug.debug(s); + SplashPanel sp=SplashUtils.getErrorSplashScreen(appletViewer.panel.getWidth(), appletViewer.panel.getHeight(), new Exception(s)); + appletViewer.replaceSplash(sp); + break; + } } } } @@ -517,6 +649,8 @@ waitForAppletInit(applets.get(identifier).panel); // Should we proceed with reframing? + PluginDebug.debug("Init complete"); + if (updateStatus(identifier, PAV_INIT_STATUS.REFRAME_COMPLETE).equals(PAV_INIT_STATUS.INACTIVE)) { destroyApplet(identifier); return; @@ -656,6 +790,8 @@ */ public static void waitForAppletInit(NetxPanel panel) { + System.err.println("Waiting for applet init"); + // Wait till initialization finishes long maxTimeToSleep = APPLET_TIMEOUT; @@ -2103,7 +2239,7 @@ * the parent class's update() just does a couple of checks (both of * which are accounted for) and then calls paint anyway. */ - public void update(Graphics g) { + public void paint(Graphics g) { // If the image or the graphics don't exist, create new ones if (bufFrameImg == null || bufFrameImgGraphics == null) { @@ -2112,11 +2248,18 @@ } // Paint off-screen - paint(bufFrameImgGraphics); + for (Component c: this.getComponents()) { + c.update(bufFrameImgGraphics); + } // Draw the painted image g.drawImage(bufFrameImg, 0, 0, this); } + + public void update(Graphics g) { + paint(g); + } + /** * Waits on a given condition queue until timeout.