import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
implements DropTargetListener, ClipboardOwner, IProgressIndicator,
jalview.api.StructureSelectionManagerProvider
{
- private static final String CITATION = "<br><br>Development managed by The Barton Group, University of Dundee, Scotland, UK.<br>"
- + "<br><br>For help, see the FAQ at <a href=\"http://www.jalview.org/faq\">www.jalview.org/faq</a> and/or join the jalview-discuss@jalview.org mailing list"
- + "<br><br>If you use Jalview, please cite:"
- + "<br>Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
- + "<br>Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
- + "<br>Bioinformatics doi: 10.1093/bioinformatics/btp033";
+ private static final String CITATION;
+ static
+ {
+ URL bg_logo_url = ChannelProperties.getImageURL(
+ "bg_logo." + String.valueOf(SplashScreen.logoSize));
+ URL uod_logo_url = ChannelProperties.getImageURL(
+ "uod_banner." + String.valueOf(SplashScreen.logoSize));
+ boolean logo = (bg_logo_url != null || uod_logo_url != null);
+ StringBuilder sb = new StringBuilder();
+ sb.append(
+ "<br><br>Development managed by The Barton Group, University of Dundee, Scotland, UK.");
+ if (logo)
+ {
+ sb.append("<br>");
+ }
+ sb.append(bg_logo_url == null ? ""
+ : "<img alt=\"Barton Group logo\" src=\""
+ + bg_logo_url.toString() + "\">");
+ sb.append(uod_logo_url == null ? ""
+ : " <img alt=\"University of Dundee shield\" src=\""
+ + uod_logo_url.toString() + "\">");
+ sb.append(
+ "<br><br>For help, see the FAQ at <a href=\"https://www.jalview.org/faq\">www.jalview.org/faq</a> and/or join the jalview-discuss@jalview.org mailing list");
+ sb.append("<br><br>If you use Jalview, please cite:"
+ + "<br>Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
+ + "<br>Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
+ + "<br>Bioinformatics doi: 10.1093/bioinformatics/btp033");
+ CITATION = sb.toString();
+ }
private static final String DEFAULT_AUTHORS = "The Jalview Authors (See AUTHORS file for current list)";
doConfigureStructurePrefs();
setTitle(ChannelProperties.getProperty("app_name") + " "
+ Cache.getProperty("VERSION"));
- /*
- if (!Platform.isAMac())
- {
- // this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- }
- else
+
+ /**
+ * Set taskbar "grouped windows" name for linux desktops (works in GNOME and KDE).
+ * This uses sun.awt.X11.XToolkit.awtAppClassName which is not officially documented or
+ * guaranteed to exist, so we access it via reflection.
+ * There appear to be unfathomable criteria about what this string can contain, and it if doesn't
+ * meet those criteria then "java" (KDE) or "jalview-bin-Jalview" (GNOME) is used.
+ * "Jalview", "Jalview Develop" and "Jalview Test" seem okay, but "Jalview non-release" does not.
+ * The reflection access may generate a warning:
+ * WARNING: An illegal reflective access operation has occurred
+ * WARNING: Illegal reflective access by jalview.gui.Desktop () to field sun.awt.X11.XToolkit.awtAppClassName
+ * which I don't think can be avoided.
+ */
+ if (Platform.isLinux())
{
- this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
+ try
+ {
+ Toolkit xToolkit = Toolkit.getDefaultToolkit();
+ Field[] declaredFields = xToolkit.getClass().getDeclaredFields();
+ Field awtAppClassNameField = null;
+
+ if (Arrays.stream(declaredFields).anyMatch(f -> f.getName().equals("awtAppClassName")))
+ {
+ awtAppClassNameField = xToolkit.getClass()
+ .getDeclaredField("awtAppClassName");
+ }
+
+ String title = ChannelProperties.getProperty("app_name");
+ if (awtAppClassNameField != null)
+ {
+ awtAppClassNameField.setAccessible(true);
+ awtAppClassNameField.set(xToolkit, title);
+ }
+ else
+ {
+ Cache.log.debug("XToolkit: awtAppClassName not found");
+ }
+ } catch (Exception e)
+ {
+ Cache.debug("Error setting awtAppClassName");
+ Cache.trace(Cache.getStackTraceString(e));
+ }
}
- */
+ /**
+ * APQHandlers sets handlers for About, Preferences and Quit actions peculiar to macOS's application menu.
+ * APQHandlers will check to see if a handler is supported before setting it.
+ */
try
{
APQHandlers.setAPQHandlers(this);
} catch (Throwable t)
{
- System.out.println("Error setting APQHandlers: " + t.toString());
- // t.printStackTrace();
+ Cache.warn("Error setting APQHandlers: " + t.toString());
+ Cache.trace(Cache.getStackTraceString(t));
}
+ setIconImages(ChannelProperties.getIconList());
addWindowListener(new WindowAdapter()
{
showMemusage.setSelected(selmemusage);
desktop.setBackground(Color.white);
+ this.setIconImages(ChannelProperties.getIconList());
+
getContentPane().setLayout(new BorderLayout());
// alternate config - have scrollbars - see notes in JAL-153
// JScrollPane sp = new JScrollPane();
} catch (java.lang.ClassCastException cex)
{
Cache.log.warn(
- "Squashed a possible GUI implementation error. If you can recreate this, please look at http://issues.jalview.org/browse/JAL-869",
+ "Squashed a possible GUI implementation error. If you can recreate this, please look at https://issues.jalview.org/browse/JAL-869",
cex);
}
}
panel.add(label);
/*
- * the URL to fetch is
+ * the URL to fetch is input in
* Java: an editable combobox with history
* JS: (pending JAL-3038) a plain text field
*/
JComponent history;
- String urlBase = "http://www.";
+ String urlBase = "https://www.";
if (Platform.isJS())
{
history = new JTextField(urlBase, 35);
@SuppressWarnings("unchecked")
String url = (history instanceof JTextField
? ((JTextField) history).getText()
- : ((JComboBox<String>) history).getSelectedItem()
- .toString());
+ : ((JComboBox<String>) history).getEditor().getItem()
+ .toString().trim());
if (url.toLowerCase().endsWith(".jar"))
{
public String getAboutMessage()
{
StringBuilder message = new StringBuilder(1024);
- message.append("<h1><strong>Version: ")
+ message.append("<div style=\"font-family: sans-serif;\">")
+ .append("<h1><strong>Version: ")
.append(Cache.getProperty("VERSION")).append("</strong></h1>")
.append("<strong>Built: <em>")
.append(Cache.getDefault("BUILD_DATE", "unknown"))
.append(Cache.getDefault("LATEST_VERSION", "..Checking.."))
.append(" is available for download from ")
.append(Cache.getDefault("www.jalview.org",
- "http://www.jalview.org"))
+ "https://www.jalview.org"))
.append(" !!");
if (red)
{
message.append(Cache.getDefault("AUTHORFNAMES", DEFAULT_AUTHORS));
message.append(CITATION);
+ message.append("</div>");
+
return message.toString();
}
{
if (Platform.isJS())
{
- BrowserLauncher.openURL("http://www.jalview.org/help.html");
+ BrowserLauncher.openURL("https://www.jalview.org/help.html");
}
else
/**