JAL-3322 New progress bar. Added option to report appbase in launcher window. Added...
authorBen Soares <bsoares@dundee.ac.uk>
Thu, 20 Jun 2019 16:00:18 +0000 (17:00 +0100)
committerBen Soares <bsoares@dundee.ac.uk>
Thu, 20 Jun 2019 16:00:18 +0000 (17:00 +0100)
19 files changed:
build.gradle
getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar
getdown/lib/getdown-launcher.jar
getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java
getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java
getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java
getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/StatusPanel.java
gradle.properties
resources/images/file.png [changed mode: 0755->0644]
resources/images/jalview_logo_background_getdown-progress-TEST2.png [changed mode: 0755->0644]
resources/images/jalview_logo_background_getdown-progress.png
resources/images/jalview_logo_background_getdown-progress3.png [new file with mode: 0644]
resources/images/jalview_logo_background_getdown-progress4.png [new file with mode: 0644]
resources/images/jalview_logo_background_getdown_instant-640x480.png [new file with mode: 0644]
resources/images/jalview_logo_background_getdown_instant-640x480.xcf [new file with mode: 0644]
resources/images/jalview_logos.icns [changed mode: 0755->0644]
resources/images/link.gif [changed mode: 0755->0644]
resources/images/logo_big_v2.gif [changed mode: 0755->0644]
resources/images/logo_v2.gif [changed mode: 0755->0644]

index 84d5f73..21ecde6 100644 (file)
@@ -721,11 +721,20 @@ task getdownWebsite() {
   def getdownResourceDir = project.ext.getdownResourceDir
   def getdownAppDir = project.ext.getdownAppDir
   def getdownResourceFilenames = []
+  
+  copy {
+               from "$classes/$buildPropertiesFile"
+               rename(buildPropertiesFile, getdown_install_build_properties)
+               into project.ext.getdownWebsiteDir
+  }
+  getdownResourceFilenames += getdown_current_build_properties
+  
   doFirst {
     // go through properties looking for getdown_txt_...
     def props = project.properties.sort { it.key }
     props.put("getdown_txt_java_min_version", getdown_alt_java_min_version)
     props.put("getdown_txt_multi_java_location", getdown_alt_multi_java_location)
+       props.put("getdown_txt_resource", "$classes/$buildPropertiesFile")
 
     if (getdown_local == "true") {
       getdown_app_base = file(getdownWebsiteDir).toURI().toString()
@@ -741,7 +750,7 @@ task getdownWebsite() {
           }
         } else {
           // file values rationalised
-          if (val.indexOf('/') > -1) {
+          if (val.indexOf('/') > -1 || prop.startsWith("getdown_txt_resource")) {
             def r = null
             if (val.indexOf('/') == 0) {
               // absolute path
@@ -756,8 +765,10 @@ task getdownWebsite() {
               getdownResourceFilenames += r.getPath()
             }
           }
-          def line = prop.substring(12) + " = " + val + "\n"
-          getdownTextString += line
+                 if (! prop.startsWith("getdown_txt_resource")) {
+                         def line = prop.substring(12) + " = " + val + "\n"
+                         getdownTextString += line
+                 }
         }
       }
     }
@@ -812,9 +823,15 @@ task getdownWebsite() {
 
     def getdown_txt = file(project.ext.getdownWebsiteDir + "/getdown.txt")
     getdown_txt.write(getdownTextString)
+       
+       def launch_jvl = file(project.ext.getdownWebsiteDir + "/" + getdown_launch_jvl)
+       launch_jvl.write("appbase="+props.get("getdown_txt_appbase"))
 
     copy {
       from getdown_txt
+         from launch_jvl
+         from project.ext.getdownWebsiteDir+"/"+getdown_current_build_properties
+         from project.ext.getdownWebsiteDir+"/"+getdown_install_build_properties
       into project.ext.getdownFilesDir
     }
 
index 965e75d..022c067 100644 (file)
Binary files a/getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar and b/getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar differ
index dcede78..43d56f9 100644 (file)
Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ
index 0de5c8a..3497b21 100644 (file)
@@ -103,6 +103,9 @@ public class Application
         /** The paths (relative to the appdir) of images for the window icon. */
         public final List<String> iconImages;
 
+        /** The path (relative to the appdir) to a single background image to appear first. */
+        public final String instantBackgroundImage;
+
         /** The path (relative to the appdir) to a single background image. */
         public final String backgroundImage;
 
@@ -142,6 +145,12 @@ public class Application
         /** Whether progress text should be hidden or not. */
         public final boolean hideProgressText;
 
+        /** Whether the splash screen should retain focus. */
+        public final boolean keepOnTop;
+
+        /** Whether to display the appbase. */
+        public final boolean displayAppbase;
+
         /** The minimum number of seconds to display the GUI. This is to prevent the GUI from
           * flashing up on the screen and immediately disappearing, which can be confusing to the
           * user. */
@@ -155,12 +164,12 @@ public class Application
         @Override
         public String toString ()
         {
-            return "[name=" + name + ", bg=" + background + ", bg=" + backgroundImage +
+            return "[name=" + name + ", bg=" + background + ", bg=" + backgroundImage + ", instant_bg=" + instantBackgroundImage +
                 ", pi=" + progressImage + ", prect=" + progress + ", pt=" + progressText +
                 ", pb=" + progressBar + ", srect=" + status + ", st=" + statusText +
                 ", shadow=" + textShadow + ", err=" + installError + ", nrect=" + patchNotes +
                 ", notes=" + patchNotesUrl + ", stepPercentages=" + stepPercentages +
-                ", hideProgressText" + hideProgressText + ", minShow=" + minShowSeconds + "]";
+                ", hideProgressText=" + hideProgressText + ", keepOnTop=" + keepOnTop + ", minShow=" + minShowSeconds + "]";
         }
 
         public UpdateInterface (Config config)
@@ -169,6 +178,8 @@ public class Application
             this.progress = config.getRect("ui.progress", new Rectangle(5, 5, 300, 15));
             this.progressText = config.getColor("ui.progress_text", Color.BLACK);
             this.hideProgressText =  config.getBoolean("ui.hide_progress_text");
+            this.keepOnTop =  config.getBoolean("ui.keep_on_top");
+            this.displayAppbase =  config.getBoolean("ui.display_appbase");
             this.minShowSeconds = config.getInt("ui.min_show_seconds", 5);
             this.progressBar = config.getColor("ui.progress_bar", 0x6699CC);
             this.status = config.getRect("ui.status", new Rectangle(5, 25, 500, 100));
@@ -176,6 +187,7 @@ public class Application
             this.textShadow = config.getColor("ui.text_shadow", Color.CLEAR);
             this.hideDecorations = config.getBoolean("ui.hide_decorations");
             this.backgroundImage = config.getString("ui.background_image");
+            this.instantBackgroundImage = config.getString("ui.instant_background_image");
             // default to black or white bg color, depending on the brightness of the progressText
             int defaultBackground = (0.5f < Color.brightness(this.progressText)) ?
                 Color.BLACK : Color.WHITE;
@@ -1893,6 +1905,10 @@ public class Application
       return locatorConfig;
     }
     
+    public String getAppbase() {
+       return _appbase;
+    }
+    
     protected final EnvConfig _envc;
     protected File _config;
     protected Digest _digest;
index d82ed15..fc3cfbd 100644 (file)
@@ -231,6 +231,7 @@ public abstract class Getdown extends Thread
         Config config = _app.init(true);
         if (preloads) doPredownloads(_app.getResources());
         _ifc = new Application.UpdateInterface(config);
+        _status.setAppbase(_app.getAppbase());
     }
 
     /**
@@ -702,7 +703,7 @@ public abstract class Getdown extends Thread
                 } else {
                     proc = _app.createProcess(false);
                 }
-
+                
                 // close standard in to avoid choking standard out of the launched process
                 proc.getInputStream().close();
                 // close standard out, since we're not going to write to anything to it anyway
@@ -731,6 +732,9 @@ public abstract class Getdown extends Thread
                 }
             }
 
+            _container.setVisible(true);
+            _container.validate();
+
             // if we have a UI open and we haven't been around for at least 5 seconds (the default
             // for min_show_seconds), don't stick a fork in ourselves straight away but give our
             // lovely user a chance to see what we're doing
@@ -782,34 +786,41 @@ public abstract class Getdown extends Thread
                     try {
                       readConfig(false);
                       Graphics g = _container.getGraphics();
-                      String imageFile = _ifc.backgroundImage;
-                      BufferedImage bgImage = loadImage(_ifc.backgroundImage);
-                      int bwidth = bgImage.getWidth();
-                      int bheight = bgImage.getHeight();
-
-                      instantSplashPane = new JPanel() {
-                        @Override
-                        protected void paintComponent(Graphics g)
-                        {
-                          super.paintComponent(g);
-                          // attempt to draw a background image...
-                          if (bgImage != null) {
-                            g.drawImage(bgImage, 0, 0, this);
-                          }
-                        }
-                      };
-
-                      instantSplashPane.setSize(bwidth,bheight);
-                      instantSplashPane.setPreferredSize(new Dimension(bwidth,bheight));
-
-                      _layers.add(instantSplashPane, Integer.valueOf(0));
-                    
-                      _container.setPreferredSize(new Dimension(bwidth,bheight));
+                      BufferedImage iBgImage = loadImage(_ifc.instantBackgroundImage);
+                      boolean ibg = true;
+                      if (iBgImage == null) {
+                         iBgImage = loadImage(_ifc.backgroundImage);
+                         ibg = false;
+                      }
+                      if (iBgImage != null) {
+                                                 final BufferedImage bgImage = iBgImage;
+                                                 int bwidth = bgImage.getWidth();
+                                                 int bheight = bgImage.getHeight();
+                                                 
+                                                 log.info("Displaying instant background image", ibg?"instant_background_image":"background_image");
+
+                                                 instantSplashPane = new JPanel() {
+                                                       @Override
+                                                       protected void paintComponent(Graphics g)
+                                                       {
+                                                         super.paintComponent(g);
+                                                         // attempt to draw a background image...
+                                                         if (bgImage != null) {
+                                                               g.drawImage(bgImage, 0, 0, this);
+                                                         }
+                                                       }
+                                                 };
+
+                                                 instantSplashPane.setSize(bwidth,bheight);
+                                                 instantSplashPane.setPreferredSize(new Dimension(bwidth,bheight));
+
+                                                 _layers.add(instantSplashPane, Integer.valueOf(0));
+                                               
+                                                 _container.setPreferredSize(new Dimension(bwidth,bheight));
+                      }
                     } catch (Exception e) {
-                      log.warning("Failed to set instant background image", "bg", _ifc.backgroundImage);
+                      log.warning("Failed to set instant background image", "ibg", _ifc.instantBackgroundImage);
                     }
-
-                    
                     
                     _container.add(_layers, BorderLayout.CENTER);
                     _patchNotes = new JButton(new AbstractAction(_msgs.getString("m.patch_notes")) {
@@ -844,6 +855,7 @@ public abstract class Getdown extends Thread
         _status.init(_ifc, _background, getProgressImage());
         Dimension size = _status.getPreferredSize();
         _status.setSize(size);
+        //_status.updateStatusLabel();
         _layers.setPreferredSize(size);
 
         _patchNotes.setBounds(_ifc.patchNotes.x, _ifc.patchNotes.y,
index fd83de3..684de30 100644 (file)
@@ -92,7 +92,7 @@ public class GetdownApp
     }
     if (abort) System.exit(-1);
 
-    log.info("Starting ....");
+    log.info("Starting .....");
     try
     {
       jalview.bin.StartupNotificationListener.setListener();
@@ -132,6 +132,26 @@ public class GetdownApp
               handleWindowClose();
             }
           });
+          
+          // keep_on_top
+          try {
+                 readConfig(false);
+          } catch (Exception e) {
+                 log.warning("Error reading config for keep_on_top");
+          }
+          // move window to top, always on top
+          if (_ifc.keepOnTop) {
+                 log.info("Keep on top set to ", "keep_on_top", _ifc.keepOnTop);
+                         java.awt.EventQueue.invokeLater(new Runnable() {
+                                       @Override
+                                       public void run() {
+                                               _frame.toFront();
+                                               _frame.repaint();
+                                       }
+                               });
+                         _frame.setAlwaysOnTop(true);
+          }
+
           // handle close on ESC
           String cancelId = "Cancel"; // $NON-NLS-1$
           _frame.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
index 99f44ca..5526568 100644 (file)
@@ -271,7 +271,15 @@ public final class StatusPanel extends JComponent
                 status += " .";
             }
         }
-        _newlab = createLabel(status, new Color(_ifc.statusText, true));
+        
+       StringBuilder labelText = new StringBuilder();
+       if (_ifc.displayAppbase) {
+               labelText.append(" appbase: "+_appbase);
+               labelText.append("\n");
+       }
+       labelText.append(status); 
+        
+        _newlab = createLabel(labelText.toString(), new Color(_ifc.statusText, true));
         // set the width of the label to the width specified
         int width = _ifc.status.width;
         if (width == 0) {
@@ -370,6 +378,10 @@ public final class StatusPanel extends JComponent
             return key;
         }
     }
+    
+    public void setAppbase(String appbase) {
+       _appbase = appbase;
+    }
 
     protected Image _barimg;
     protected RotatingBackgrounds _bg;
@@ -393,4 +405,6 @@ public final class StatusPanel extends JComponent
     protected Throttle _rthrottle = new Throttle(1, 1000L);
 
     protected static final Font FONT = new Font("SansSerif", Font.BOLD, 12);
+    
+    public String _appbase;
 }
index b483978..9cf137b 100644 (file)
@@ -53,7 +53,9 @@ getdown_files_dir = getdown/files
 getdown_launcher = getdown/lib/getdown-launcher.jar
 getdown_launcher_new = getdown-launcher-new.jar
 getdown_core = getdown/lib/getdown-core-1.8.3-SNAPSHOT.jar
-getdown_base_txt = getdown/files/getdown.txt
+getdown_launch_jvl = channel_launch.jvl
+getdown_current_build_properties = build_properties
+getdown_install_build_properties = build_properties.install
 getdown_txt_title = Jalview
 getdown_channel_base = http://www.jalview.org/getdown/jalview
 getdown_channel_name = TEST
@@ -63,8 +65,11 @@ getdown_txt_multi_jvmarg = -Dgetdownappdir=%APPDIR%
 getdown_txt_strict_comments = true
 getdown_txt_title = Jalview
 getdown_txt_ui.name = Jalview
+getdown_txt_ui.keep_on_top = true
+getdown_txt_ui.display_appbase = true
 getdown_txt_ui.background = FFFFFF
 getdown_txt_ui.background_image = resources/images/jalview_logo_background_getdown-640x480.png
+getdown_txt_ui.instant_background_image = resources/images/jalview_logo_background_getdown_instant-640x480.png
 getdown_txt_ui.error_background = resources/images/jetset_jalview_splash.png
 getdown_txt_ui.progress_image = resources/images/jalview_logo_background_getdown-progress.png
 getdown_txt_ui.icon = resources/images/JalviewLogo_Huge.png
@@ -73,8 +78,8 @@ getdown_txt_ui.progress_bar = AAAAFF
 getdown_txt_ui.progress_text = 000000
 getdown_txt_ui.status = 20, 380, 600, 58
 getdown_txt_ui.status_text = 000066
-getdown_txt_ui.text_shadow = EEEEFF
-getdown_txt_ui.install_error = http://www.jalview.org/download/error
+#getdown_txt_ui.text_shadow = FFFFFF
+getdown_txt_ui.install_error = http://www.jalview.org/faq/getdownerror
 getdown_txt_ui.mac_dock_icon = resources/images/jalview_logos.ico
 getdown_alt_java8_min_version  = 01080000
 getdown_alt_java11_min_version = 11000000
old mode 100755 (executable)
new mode 100644 (file)
index fb87750..cb1475c 100644 (file)
Binary files a/resources/images/jalview_logo_background_getdown-progress.png and b/resources/images/jalview_logo_background_getdown-progress.png differ
diff --git a/resources/images/jalview_logo_background_getdown-progress3.png b/resources/images/jalview_logo_background_getdown-progress3.png
new file mode 100644 (file)
index 0000000..cb1475c
Binary files /dev/null and b/resources/images/jalview_logo_background_getdown-progress3.png differ
diff --git a/resources/images/jalview_logo_background_getdown-progress4.png b/resources/images/jalview_logo_background_getdown-progress4.png
new file mode 100644 (file)
index 0000000..bc7e125
Binary files /dev/null and b/resources/images/jalview_logo_background_getdown-progress4.png differ
diff --git a/resources/images/jalview_logo_background_getdown_instant-640x480.png b/resources/images/jalview_logo_background_getdown_instant-640x480.png
new file mode 100644 (file)
index 0000000..8f88dd0
Binary files /dev/null and b/resources/images/jalview_logo_background_getdown_instant-640x480.png differ
diff --git a/resources/images/jalview_logo_background_getdown_instant-640x480.xcf b/resources/images/jalview_logo_background_getdown_instant-640x480.xcf
new file mode 100644 (file)
index 0000000..3e6cc24
Binary files /dev/null and b/resources/images/jalview_logo_background_getdown_instant-640x480.xcf differ
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)