(JAL-957) change splash screen and about to HTML text, and author list now stored...
[jalview.git] / src / jalview / gui / Desktop.java
index 3205cab..01a7e69 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -319,8 +319,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       @Override
       public void run()
       {
+        Cache.log.debug("Starting news thread.");
+
         jvnews = new BlogReader(me);
         showNews.setVisible(true);
+        Cache.log.debug("Completed news thread.");
       }
     }).start();
     
@@ -409,22 +412,19 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   void showNews(boolean visible)
   {
     {
-      jvnews.setVisible(visible);
+      Cache.log.debug((visible?"Showing":"Hiding")+" news.");
       showNews.setSelected(visible);
-      if (visible)
+      if (visible && !jvnews.isVisible())
       {
-        jvnews.refreshNews();
-        jvnews.toFront();
-        // try real hard to get focus when the news is first opened
         new Thread(new Runnable() {
           @Override
           public void run()
           {
-            while (jvnews.isVisible() && !jvnews.requestFocusInWindow())
-            {
-              try { Thread.sleep(50); } catch (InterruptedException x) {}; 
-            }
-            
+            long instance=System.currentTimeMillis();
+            Desktop.instance.setProgressBar("Refreshing news", instance);
+            jvnews.refreshNews();
+            Desktop.instance.setProgressBar(null, instance);
+            jvnews.showNews();
           }
         }).start();
       }
@@ -1046,30 +1046,63 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    */
   public void aboutMenuItem_actionPerformed(ActionEvent e)
   {
-    StringBuffer message = new StringBuffer("Jalview version "
+    StringBuffer message = getAboutMessage(false);
+    JOptionPane.showInternalMessageDialog(Desktop.desktop,
+
+    message.toString(), "About Jalview", JOptionPane.INFORMATION_MESSAGE);
+  }
+  public StringBuffer getAboutMessage(boolean shortv)
+  {
+    StringBuffer message=new StringBuffer();
+    message.append("<html>");
+    if (shortv)
+    { 
+      message.append("<h1><strong>Jalview "
+              + jalview.bin.Cache.getProperty("VERSION") + "</strong></h1><br>");
+      message.append("<strong>Last Updated: <em>"+jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")+"</em></strong>");
+      
+    } else {
+      
+    message.append("<strong>Jalview version "
             + jalview.bin.Cache.getProperty("VERSION") + "; last updated: "
             + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"));
-
-    if (!jalview.bin.Cache.getProperty("LATEST_VERSION").equals(
-            jalview.bin.Cache.getProperty("VERSION")))
+    }
+    
+    if (jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals(
+            "Checking"))
     {
-      message.append("\n\n!! Jalview version "
-              + jalview.bin.Cache.getProperty("LATEST_VERSION")
-              + " is available for download from "+jalview.bin.Cache.getDefault("www.jalview.org","http://www.jalview.org")+" !!\n");
-
+      message.append("<br>...Checking latest version...</br>");
     }
-    // TODO: update this text for each release or centrally store it for lite
-    // and application
-    message.append("\nAuthors:  Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,\n    David Martin & Geoff Barton."
-            + "\nDevelopment managed by The Barton Group, University of Dundee, Scotland, UK.\n"
-            + "\nFor help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list\n"
-            + "\nIf  you use Jalview, please cite:"
-            + "\nWaterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
-            + "\nJalview Version 2 - a multiple sequence alignment editor and analysis workbench"
-            + "\nBioinformatics doi: 10.1093/bioinformatics/btp033");
-    JOptionPane.showInternalMessageDialog(Desktop.desktop,
-
-    message.toString(), "About Jalview", JOptionPane.INFORMATION_MESSAGE);
+    else if (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking")
+            .equals(jalview.bin.Cache.getProperty("VERSION")))
+    {
+      boolean red=false;
+      if (jalview.bin.Cache.getProperty("VERSION").toLowerCase()
+              .indexOf("automated build") == -1)
+      {
+        red=true;
+        // Displayed when code version and jnlp version do not match and code
+        // version is not a development build
+        message.append("<div style=\"color: #FF0000;font-style: bold;\">");
+      }
+      
+      message.append("<br>!! Jalview version "
+                      + jalview.bin.Cache.getDefault("LATEST_VERSION",
+                              "..Checking..")
+                      + " is available for download from "+jalview.bin.Cache.getDefault("www.jalview.org","http://www.jalview.org")+" !!");
+      if (red) {
+        message.append("</div>");
+      }
+    }    
+    message.append("<br>Authors:  "+jalview.bin.Cache.getDefault("AUTHORNAMES","Jim Procter, Andrew Waterhouse, Jan Engelhardt, Lauren Lui, Michele Clamp, James Cuff, Steve Searle, David Martin & Geoff Barton")
+            + "<br>Development managed by The Barton Group, University of Dundee, Scotland, UK.<br>"
+            + "<br>For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list"
+            + "<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;
   }
 
   /**
@@ -2060,10 +2093,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    */
   public void relayerWindows()
   {
-    if (jvnews!=null && jvnews.isVisible())
-    {
-      jvnews.toFront();
-    }
+    
   }
 
   protected JMenuItem groovyShell;