JAL-3274 resource path correction, code tidying (constants etc)
[jalview.git] / src / jalview / gui / Desktop.java
index 6bb9b36..7682ee6 100644 (file)
@@ -134,6 +134,15 @@ public class Desktop extends jalview.jbgui.GDesktop
         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 DEFAULT_AUTHORS = "The Jalview Authors (See AUTHORS file for current list)";
+
   private static int DEFAULT_MIN_WIDTH = 300;
 
   private static int DEFAULT_MIN_HEIGHT = 250;
@@ -440,20 +449,8 @@ public class Desktop extends jalview.jbgui.GDesktop
      * @j2sIgnore
      */
     {
-
       jconsole = new Console(this, showjconsole);
-      // add essential build information
-      jconsole.setHeader("Jalview Version: "
-              + Cache.getProperty("VERSION") + "\n"
-              + "Jalview Installation: "
-              + Cache.getDefault("INSTALLATION", "unknown")
-              + "\n" + "Build Date: "
-              + Cache.getDefault("BUILD_DATE", "unknown") + "\n"
-              + "Java version: " + System.getProperty("java.version") + "\n"
-              + System.getProperty("os.arch") + " "
-              + System.getProperty("os.name") + " "
-              + System.getProperty("os.version"));
-
+      jconsole.setHeader(Cache.getVersionDetailsForConsole());
       showConsole(showjconsole);
 
       showNews.setVisible(false);
@@ -471,7 +468,7 @@ public class Desktop extends jalview.jbgui.GDesktop
         @Override
         public void run()
         {
-          new SplashScreen();
+          new SplashScreen(true);
         }
       });
 
@@ -1346,52 +1343,40 @@ public class Desktop extends jalview.jbgui.GDesktop
   @Override
   public void aboutMenuItem_actionPerformed(ActionEvent e)
   {
-    // StringBuffer message = getAboutMessage(false);
-    // JvOptionPane.showInternalMessageDialog(Desktop.desktop,
-    //
-    // message.toString(), "About Jalview", JvOptionPane.INFORMATION_MESSAGE);
     new Thread(new Runnable()
     {
       @Override
       public void run()
       {
-        new SplashScreen(true);
+        new SplashScreen(false);
       }
     }).start();
   }
 
-  public StringBuffer getAboutMessage(boolean shortv)
+  /**
+   * Returns the html text for the About screen, including any available version
+   * number, build details, author details and citation reference, but without
+   * the enclosing {@code html} tags
+   * 
+   * @return
+   */
+  public String getAboutMessage()
   {
-    StringBuffer message = new StringBuffer();
-    message.append("<html>");
-    if (shortv)
-    {
-      message.append("<h1><strong>Version: "
-              + Cache.getProperty("VERSION")
-              + "</strong></h1>");
-      message.append("<strong>Built: <em>"
-              + Cache.getDefault("BUILD_DATE", "unknown") + "</em> from "
-              + Cache.getBuildDetailsForSplash()
-              + "</strong>");
-
-    }
-    else
-    {
-
-      message.append("<strong>Version "
-              + Cache.getProperty("VERSION")
-              + "; last updated: "
-              + Cache.getDefault("BUILD_DATE", "unknown"));
-    }
+    StringBuilder message = new StringBuilder(1024);
+    message.append("<h1><strong>Version: ")
+            .append(Cache.getProperty("VERSION")).append("</strong></h1>")
+            .append("<strong>Built: <em>")
+            .append(Cache.getDefault("BUILD_DATE", "unknown"))
+            .append("</em> from ").append(Cache.getBuildDetailsForSplash())
+            .append("</strong>");
 
-    if (Cache.getDefault("LATEST_VERSION", "Checking")
-            .equals("Checking"))
+    String latestVersion = Cache.getDefault("LATEST_VERSION", "Checking");
+    if (latestVersion.equals("Checking"))
     {
       // JBP removed this message for 2.11: May be reinstated in future version
       // message.append("<br>...Checking latest version...</br>");
     }
-    else if (!Cache.getDefault("LATEST_VERSION", "Checking")
-            .equals(Cache.getProperty("VERSION")))
+    else if (!latestVersion.equals(Cache.getProperty("VERSION")))
     {
       boolean red = false;
       if (Cache.getProperty("VERSION").toLowerCase()
@@ -1403,29 +1388,22 @@ public class Desktop extends jalview.jbgui.GDesktop
         message.append("<div style=\"color: #FF0000;font-style: bold;\">");
       }
 
-      message.append("<br>!! Version "
-              + Cache.getDefault("LATEST_VERSION",
-                      "..Checking..")
-              + " is available for download from "
-              + Cache.getDefault("www.jalview.org",
-                      "http://www.jalview.org")
-              + " !!");
+      message.append("<br>!! Version ")
+              .append(Cache.getDefault("LATEST_VERSION", "..Checking.."))
+              .append(" is available for download from ")
+              .append(Cache.getDefault("www.jalview.org",
+                      "http://www.jalview.org"))
+              .append(" !!");
       if (red)
       {
         message.append("</div>");
       }
     }
-    message.append("<br>Authors:  " + Cache.getDefault(
-            "AUTHORFNAMES",
-            "The Jalview Authors (See AUTHORS file for current list)")
-            + "<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"
-            + "</html>");
-    return message;
+    message.append("<br>Authors:  ");
+    message.append(Cache.getDefault("AUTHORFNAMES", DEFAULT_AUTHORS));
+    message.append(CITATION);
+
+    return message.toString();
   }
 
   /**