[snow-cvs] r65 - trunk/src/java/snow

Alessio Stalla astalla at common-lisp.net
Wed Feb 24 20:46:21 UTC 2010


Author: astalla
Date: Wed Feb 24 15:46:21 2010
New Revision: 65

Log:
Added Splash screen when snow.Snow is launched without parameters.


Added:
   trunk/src/java/snow/SplashScreen.java
Modified:
   trunk/src/java/snow/Snow.java

Modified: trunk/src/java/snow/Snow.java
==============================================================================
--- trunk/src/java/snow/Snow.java	(original)
+++ trunk/src/java/snow/Snow.java	Wed Feb 24 15:46:21 2010
@@ -179,6 +179,22 @@
 	return path;
     }
 
+    public static synchronized ScriptEngine init(SplashScreen splashScreen)
+	throws ScriptException {
+	if(!init) {
+	    splashScreen.setState("Low-level initialization...", 0);
+	    initAux();
+	    splashScreen.setState("Loading data binding subsystem...", 30);
+	    lispEngine.eval("(asdf:oos 'asdf:load-op :cells)");
+	    splashScreen.setState("Loading Snow...", 60);
+	    lispEngine.eval("(asdf:oos 'asdf:load-op :snow)");
+	    init = true;
+	    return lispEngine;
+	} else {
+	    throw new RuntimeException("Already initialized");
+	}
+    }
+
     public static synchronized ScriptEngine init() throws ScriptException {
 	if(!init) {
 	    initAux();
@@ -318,7 +334,13 @@
 			}
 		    });
 	    if(args.length == 0) { //Launch GUI REPL
+		SplashScreen s = new SplashScreen();
+		s.setVisible(true);
+		init(s);
+		s.setState("Loading GUI REPL...", 90);
 		getCompiledSnowlet(Snow.class.getResource("/snow/start.lisp")).eval();
+		s.setState("Done.", 100);
+		s.dispose();
 	    } else if("--showcase".equals(args[0])) {
 		getInterpretedSnowlet(Snow.class.getResource("/snow/showcase/showcase.lisp")).eval();
 		getInvocable().invokeFunction("snow-showcase::showcase", true);

Added: trunk/src/java/snow/SplashScreen.java
==============================================================================
--- (empty file)
+++ trunk/src/java/snow/SplashScreen.java	Wed Feb 24 15:46:21 2010
@@ -0,0 +1,66 @@
+/*
+ * SplashScreen.java
+ *
+ * Copyright (C) 2010 Alessio Stalla
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * As a special exception, the copyright holders of this library give you
+ * permission to link this library with independent modules to produce an
+ * executable, regardless of the license terms of these independent
+ * modules, and to copy and distribute the resulting executable under
+ * terms of your choice, provided that you also meet, for each linked
+ * independent module, the terms and conditions of the license of that
+ * module.  An independent module is a module which is not derived from
+ * or based on this library.  If you modify this library, you may extend
+ * this exception to your version of the library, but you are not
+ * obligated to do so.  If you do not wish to do so, delete this
+ * exception statement from your version.
+ */
+
+package snow;
+
+import java.awt.*;
+import javax.swing.*;
+
+public class SplashScreen extends JWindow {
+
+    private JLabel message = new JLabel();
+    private JProgressBar progressBar = new JProgressBar();
+
+    public SplashScreen() {
+	setSize(400, 300);
+	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+        setLocation(screenSize.width/2 - 200, screenSize.height/2 - 150);
+	setLayout(new BorderLayout());
+	progressBar.setMinimum(0);
+	progressBar.setMaximum(100);
+	progressBar.setValue(0);
+	progressBar.setIndeterminate(false);
+	JLabel snow = new JLabel("Snow 0.3-dev", JLabel.CENTER);
+	snow.setFont(snow.getFont().deriveFont(36.0f));
+	add(snow);
+	JPanel south = new JPanel(new BorderLayout());
+	south.add(progressBar, BorderLayout.CENTER);
+	south.add(message, BorderLayout.SOUTH);
+	add(south, BorderLayout.SOUTH);
+    }
+
+    public void setState(String message, int percentComplete) {
+	this.message.setText(message);
+	progressBar.setValue(percentComplete);
+    }
+
+}
\ No newline at end of file




More information about the snow-cvs mailing list