return o == null ? "" : o.toString()
}
-def overrideProperties(def propsFileName) {
+def overrideProperties(String propsFileName, boolean output = false) {
if (propsFileName == null) {
return
}
def propsFile = file(propsFileName)
if (propsFile != null && propsFile.exists()) {
+ println("Using properties from file '${propsFileName}'")
try {
def p = new Properties()
def localPropsFIS = new FileInputStream(propsFile)
if (project.hasProperty(key)) {
oldval = project.findProperty(key)
project.setProperty(key, val)
- println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'")
+ if (output) {
+ println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'")
+ }
} else {
ext.setProperty(key, val)
- println("Setting ext property '${key}' with ${file(propsFile).getName()}s value '${val}'")
+ if (output) {
+ println("Setting ext property '${key}' with ${file(propsFile).getName()}s value '${val}'")
+ }
}
- //true
}
} catch (Exception e) {
println("Exception reading local.properties")
// Import channel_properties
channelDir = string("${jalviewDir}/${channel_properties_dir}/${propertiesChannelName}")
channelGradleProperties = string("${channelDir}/channel_gradle.properties")
- overrideProperties(channelGradleProperties)
+ overrideProperties(channelGradleProperties, false)
// local build environment properties
// can be "projectDir/local.properties"
- overrideProperties("${projectDir}/local.properties")
+ overrideProperties("${projectDir}/local.properties", true)
// or "../projectDir_local.properties"
- overrideProperties(projectDir.getParent() + "/" + projectDir.getName() + "_local.properties")
+ overrideProperties(projectDir.getParent() + "/" + projectDir.getName() + "_local.properties", true)
////
// Import releaseProps from the RELEASE file
import java.awt.Image;
import java.awt.Taskbar;
+import jalview.util.ChannelProperties;
+
public class JalviewTaskbar
{
public JalviewTaskbar()
protected static void setTaskbar(Jalview jalview)
{
-
+
if (Taskbar.isTaskbarSupported())
{
Taskbar tb = Taskbar.getTaskbar();
if (tb.isSupported(Taskbar.Feature.ICON_IMAGE))
{
- try
+ Image image = ChannelProperties.getImage("logo.512");
+ if (image != null)
{
- java.net.URL url = jalview.getClass()
- .getResource("/images/JalviewLogo_Huge.png");
- if (url != null)
- {
- Image image = java.awt.Toolkit.getDefaultToolkit()
- .createImage(url);
- tb.setIconImage(image);
- }
- } catch (Exception e)
+ tb.setIconImage(image);
+ }
+ else
{
System.out.println("Unable to setIconImage()");
}
}
}
-
}
import java.util.ArrayList;
import java.util.List;
+import jalview.util.ChannelProperties;
+
/**
* A Launcher class for Jalview. This class is used to launch Jalview from the
* shadowJar when Getdown is not used or available. It attempts to take all the
{
private final static String startClass = "jalview.bin.Jalview";
- private final static String dockIconPath = "JalviewLogo_Huge.png";
+ private final static String dockIconPath = ChannelProperties
+ .getProperty("logo.512");
/**
* main method for jalview.bin.Launcher. This restarts the same JRE's JVM with
*/
package jalview.gui;
-import jalview.util.Platform;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
-import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.net.URL;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
+import jalview.util.ChannelProperties;
+import jalview.util.Platform;
+
/**
* DOCUMENT ME!
*
try
{
- URL url = getClass().getResource("/images/Jalview_Logo.png");
- URL urllogo = getClass()
- .getResource("/images/Jalview_Logo_small.png");
-
- if (!Platform.isJS() && url != null)
+ if (!Platform.isJS())
{
- image = Toolkit.getDefaultToolkit().createImage(url);
- Image logo = Toolkit.getDefaultToolkit().createImage(urllogo);
+ image = ChannelProperties.getImage("banner");
+ Image logo = ChannelProperties.getImage("logo.48");
MediaTracker mt = new MediaTracker(this);
- mt.addImage(image, 0);
- mt.addImage(logo, 1);
+ if (image != null)
+ {
+ mt.addImage(image, 0);
+ }
+ if (logo != null)
+ {
+ mt.addImage(logo, 1);
+ }
do
{
try
* SwingJS doesn't have HTMLEditorKit, required for a JTextPane
* to display formatted html, so we use a simple alternative
*/
- String text = "<html><br><br><img src=\"swingjs/j2s/images/Jalview_Logo.png\"/><br>"
+ String text = "<html><br><br><img src=\"swingjs/j2s/images/jalview_logo-48.png\"/><br>"
+ newtext + "</html>";
JLabel ta = new JLabel(text);
ta.setOpaque(true);
{
}
- if (transientDialog
- && ((System.currentTimeMillis() / 1000) - startTime) > SHOW_FOR_SECS)
+ if (transientDialog && ((System.currentTimeMillis() / 1000)
+ - startTime) > SHOW_FOR_SECS)
{
visible = false;
}
--- /dev/null
+package jalview.util;
+
+import java.awt.Image;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.swing.ImageIcon;
+
+import jalview.bin.Cache;
+
+public class ChannelProperties
+{
+
+ private static final String CHANNEL_PROPERTIES_FILENAME = "/channel_properties";
+
+ private Properties channelProps = new Properties();
+
+ private Map<String, Image> imageMap = new HashMap<String, Image>();
+
+ private static ChannelProperties instance;
+
+ private boolean initDone = false;
+
+ private boolean init()
+ {
+ if (initDone)
+ {
+ return initDone;
+ }
+ // load channel_properties
+ URL channelPropsURL = getClass()
+ .getResource(CHANNEL_PROPERTIES_FILENAME);
+ if (channelPropsURL == null)
+ {
+ // fallback
+ System.err.println(
+ "Failed to find '" + CHANNEL_PROPERTIES_FILENAME + "' file");
+ return false;
+ }
+ else
+ {
+ try
+ {
+ InputStream channelPropsIS = channelPropsURL.openStream();
+ channelProps.load(channelPropsIS);
+ channelPropsIS.close();
+ } catch (IOException e)
+ {
+ Cache.log.warn(e.getMessage());
+ return false;
+ }
+ }
+ initDone = true;
+ return initDone;
+ }
+
+ private ChannelProperties()
+ {
+ init();
+ }
+
+ public static ChannelProperties getChannelProperties()
+ {
+ if (instance == null)
+ {
+ instance = new ChannelProperties();
+ }
+ return instance;
+ }
+
+ public static String getProperty(String key)
+ {
+ return getProperty(key, null);
+ }
+
+ private static Properties channelProps()
+ {
+ return getChannelProperties().channelProps;
+ }
+
+ private static Map<String, Image> imageMap()
+ {
+ return getChannelProperties().imageMap;
+ }
+
+ public static String getProperty(String key, String defaultVal)
+ {
+ if (channelProps() != null)
+ {
+ if (channelProps().containsKey(key))
+ {
+ String val = channelProps().getProperty(key, "NOTFOUND");
+ return channelProps().getProperty(key, defaultVal);
+ }
+ else
+ {
+ System.err.println("Failed to get channel property '" + key + "'");
+ }
+ }
+ return null;
+ }
+
+ public static Image getImage(String key)
+ {
+ Image img = null;
+ if (imageMap().containsKey(key))
+ {
+ img = imageMap().get(key);
+ }
+ // Catch a previously untried or failed load
+ if (img == null)
+ {
+ String path = getProperty(key);
+ if (path == null)
+ {
+ return null;
+ }
+ URL imageURL = getChannelProperties().getClass().getResource(path);
+ img = new ImageIcon(imageURL).getImage();
+ if (img == null)
+ {
+ System.err.println(
+ "Failed to load channel image " + key + "=" + path);
+ }
+ else
+ {
+ imageMap().put(key, img);
+ }
+ }
+ return img;
+ }
+}
\ No newline at end of file
-channel.app_name=Jalview
-channel.banner=images/jalview_banner.png
-channel.logo.512=images/jalview_logo-512.png
-channel.logo.256=images/jalview_logo-256.png
-channel.logo.128=images/jalview_logo-128.png
-channel.logo.64=images/jalview_logo-64.png
-channel.logo.48=images/jalview_logo-48.png
-channel.logo.32=images/jalview_logo-32.png
-channel.logo.16=images/jalview_logo-16.png
-channel.rotatable_logo.48=images/rotatable_jalview_logo-48.png
-channel.default_appbase=https://www.jalview.org/getdown/develop/11
+app_name=Jalview Develop
+banner=/images/jalview_develop_banner.png
+logo.16=/images/jalview_develop_logo-16.png
+logo.32=/images/jalview_develop_logo-32.png
+logo.48=/images/jalview_develop_logo-48.png
+logo.64=/images/jalview_develop_logo-64.png
+logo.128=/images/jalview_develop_logo-128.png
+logo.256=/images/jalview_develop_logo-256.png
+logo.512=/images/jalview_develop_logo-512.png
+rotatable_logo.48=/images/rotatable_jalview_develop_logo-48.png
+default_appbase=https://www.jalview.org/getdown/develop/11
getdown_txt_allow_offline = true
getdown_txt_max_concurrent_downloads = 10
getdown_txt_ui.install_error = https://www.jalview.org/faq/getdownerror
+getdown_txt_ui.hide_decorations = true
install4j_images_dir = utils/channels/release/images
install4j_mac_icons_file = jalview_logo.icns
install4j_windows_icons_file = jalview_logo.ico
-channel.app_name=Jalview
-channel.banner=images/jalview_banner.png
-channel.logo.512=images/jalview_logo-512.png
-channel.logo.256=images/jalview_logo-256.png
-channel.logo.128=images/jalview_logo-128.png
-channel.logo.64=images/jalview_logo-64.png
-channel.logo.48=images/jalview_logo-48.png
-channel.logo.32=images/jalview_logo-32.png
-channel.logo.16=images/jalview_logo-16.png
-channel.rotatable_logo.48=images/rotatable_jalview_logo-48.png
-channel.default_appbase=https://www.jalview.org/getdown/release/1.8
+app_name=Jalview
+banner=/images/jalview_banner.png
+logo.16=/images/jalview_logo-16.png
+logo.32=/images/jalview_logo-32.png
+logo.48=/images/jalview_logo-48.png
+logo.64=/images/jalview_logo-64.png
+logo.128=/images/jalview_logo-128.png
+logo.256=/images/jalview_logo-256.png
+logo.512=/images/jalview_logo-512.png
+rotatable_logo.48=/images/rotatable_jalview_logo-48.png
+default_appbase=https://www.jalview.org/getdown/release/1.8