Revision: 1515
          http://svn.sourceforge.net/spring-rich-c/?rev=1515&view=rev
Author:   mathiasbr
Date:     2006-10-17 03:42:10 -0700 (Tue, 17 Oct 2006)

Log Message:
-----------
splash screen will only be displayed if a valid image path is provided

Modified Paths:
--------------
    
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/splash/AbstractSplashScreen.java
    
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/splash/SimpleSplashScreen.java

Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/splash/AbstractSplashScreen.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/splash/AbstractSplashScreen.java
   2006-10-16 20:25:41 UTC (rev 1514)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/splash/AbstractSplashScreen.java
   2006-10-17 10:42:10 UTC (rev 1515)
@@ -101,7 +101,7 @@
         this.messageSource = messageSource;
     }
 
-    public final void dispose() {
+    public void dispose() {
         
         if (frame != null) {
             frame.dispose();
@@ -120,7 +120,7 @@
      * on this instance and it is unable to find a message under the key
      * [EMAIL PROTECTED] #SPLASH_TITLE_KEY}. 
      */
-    public final void splash() {
+    public void splash() {
         frame = new JFrame();
         frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
         frame.setUndecorated(true);

Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/splash/SimpleSplashScreen.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/splash/SimpleSplashScreen.java
     2006-10-16 20:25:41 UTC (rev 1514)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/splash/SimpleSplashScreen.java
     2006-10-17 10:42:10 UTC (rev 1515)
@@ -43,6 +43,8 @@
 
     private String imageResourcePath;
 
+    private boolean imageLoaded = false;
+
     private static final Log logger = 
LogFactory.getLog(SimpleSplashScreen.class);
 
     /**
@@ -89,7 +91,14 @@
     public void setImageResourcePath(String path) {
         Assert.hasText(path, "The splash screen image resource path is 
required");
         this.imageResourcePath = path;
+        this.imageLoaded = false;
     }
+    
+    public void splash() {
+        if (getImage() != null) {
+            super.splash();
+        }
+    }
 
     /**
      * Load image from path.
@@ -107,7 +116,15 @@
         }
         return Toolkit.getDefaultToolkit().createImage(url);
     }
-
+    
+    protected Image getImage() {
+        if(!imageLoaded && imageResourcePath != null) {
+            image = loadImage(imageResourcePath);
+            imageLoaded = true;
+        }
+        return image;
+    }
+    
     /**
      * Simple Canvas that paints an image.
      */
@@ -156,13 +173,6 @@
      * Returns a component that displays an image in a canvas.
      */
     protected JComponent createSplashContentPane() {
-        if (image == null) {
-            image = loadImage(imageResourcePath);
-            if (image == null) {
-                return null;
-            }
-        }
-
-        return new ImageCanvas(image);
+        return new ImageCanvas(getImage());
     }
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
spring-rich-c-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs

Reply via email to