JAL-3594 Images for splash screen
[jalview.git] / src / jalview / util / ChannelProperties.java
index 2194c4d..c33198b 100644 (file)
@@ -26,6 +26,8 @@ public class ChannelProperties
 
   private static Map<String, Image> imageMap = new HashMap<String, Image>();
 
+  private static Map<String, URL> urlMap = new HashMap<String, URL>();
+
   private static final ArrayList<Image> iconList;
 
   static
@@ -45,8 +47,12 @@ public class ChannelProperties
     defaultProps.put("logo.512", "/default_images/jalview_logo-512.png");
     defaultProps.put("rotatable_logo.48",
             "/default_images/rotatable_jalview_logo-38.png");
-    defaultProps.put("bg_logo.62", "/default_images/barton_group-62.png");
-    defaultProps.put("uod_banner", "/default_images/UoD_banner.png");
+    defaultProps.put("bg_logo.28", "/default_images/barton_group-28.png");
+    defaultProps.put("bg_logo.30", "/default_images/barton_group-30.png");
+    defaultProps.put("bg_logo.32", "/default_images/barton_group-32.png");
+    defaultProps.put("uod_banner.28", "/default_images/UoD_banner-28.png");
+    defaultProps.put("uod_banner.30", "/default_images/UoD_banner-30.png");
+    defaultProps.put("uod_banner.32", "/default_images/UoD_banner-32.png");
     defaultProps.put("default_appbase",
             "https://www.jalview.org/getdown/release/1.8");
 
@@ -122,6 +128,11 @@ public class ChannelProperties
     return imageMap;
   }
 
+  private static Map<String, URL> urlMap()
+  {
+    return urlMap;
+  }
+
   /*
    * getProperty(key) will get property value from channel_properties for key.
    * If no property for key is found, it will fall back to using the defaultProps defined for this class.
@@ -217,12 +228,30 @@ public class ChannelProperties
       else
       {
         imageMap().put(key, img);
+        urlMap.put(key, imageURL);
       }
     }
     return img;
   }
 
   /*
+   * Public method to get the URL object pointing to a cached image.
+   */
+  public static URL getImageURL(String key)
+  {
+    if (getImage(key) != null)
+    {
+      if (urlMap().containsKey(key))
+      {
+        return urlMap().getOrDefault(key, null);
+      }
+      System.err.println(
+              "Do not use getImageURL(key) before using getImage(key...)");
+    }
+    return null;
+  }
+
+  /*
    * Get a List of Icon images of different sizes.
    */
   public static ArrayList<Image> getIconList()