Merge branch 'develop' into JAL-3416_different_look_and_feel_on_linux
authorBen Soares <b.soares@dundee.ac.uk>
Mon, 4 Oct 2021 16:46:03 +0000 (17:46 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Mon, 4 Oct 2021 16:46:03 +0000 (17:46 +0100)
1  2 
src/jalview/bin/Jalview.java

@@@ -20,7 -20,8 +20,7 @@@
   */
  package jalview.bin;
  
 -import java.util.Locale;
 -
 +import java.awt.Color;
  import java.io.BufferedReader;
  import java.io.File;
  import java.io.FileOutputStream;
@@@ -38,6 -39,6 +38,7 @@@ import java.security.PermissionCollecti
  import java.security.Permissions;
  import java.security.Policy;
  import java.util.HashMap;
++import java.util.Locale;
  import java.util.Map;
  import java.util.Vector;
  import java.util.logging.ConsoleHandler;
@@@ -454,7 -455,7 +455,7 @@@ public class Jalvie
                // String defurl =
                // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
                // //
-               String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
+               String defurl = "https://www.jalview.org/cgi-bin/questionnaire.pl";
                Cache.log.debug(
                        "Starting questionnaire with default url: " + defurl);
                desktop.checkForQuestionnaire(defurl);
       * @j2sIgnore
       */
      {
-       file = Cache.getDefault("STARTUP_FILE",
-               Cache.getDefault("www.jalview.org", "http://www.jalview.org")
-                       + "/examples/exampleFile_2_7.jar");
+       file = jalview.bin.Cache.getDefault("STARTUP_FILE",
+               jalview.bin.Cache.getDefault("www.jalview.org",
+                       "https://www.jalview.org")
+                       + "/examples/exampleFile_2_7.jvp");
        if (file.equals(
-               "http://www.jalview.org/examples/exampleFile_2_3.jar"))
+               "http://www.jalview.org/examples/exampleFile_2_3.jar") || file.equals(
+                       "http://www.jalview.org/examples/exampleFile_2_7.jar"))
        {
+         file.replace("http:", "https:");
          // hardwire upgrade of the startup file
-         file.replace("_2_3.jar", "_2_7.jar");
+         file.replace("_2_3", "_2_7");
+         file.replace("2_7.jar", "2_7.jvp");
          // and remove the stale setting
          Cache.removeProperty("STARTUP_FILE");
        }
  
    private static void setLookAndFeel()
    {
 -    // property laf = "crossplatform", "system", "gtk", "metal", "nimbus" or
 -    // "mac"
 +    // property laf = "crossplatform", "system", "gtk", "metal", "nimbus",
 +    // "mac" or "flat"
      // If not set (or chosen laf fails), use the normal SystemLaF and if on Mac,
      // try Quaqua/Vaqua.
      String lafProp = System.getProperty("laf");
          Cache.log.error("Could not set requested laf=" + laf);
        }
        break;
 +    case "flat":
 +      lafSet = setFlatLookAndFeel();
 +      if (!lafSet)
 +      {
 +        Cache.log.error("Could not set requested laf=" + laf);
 +      }
 +      break;
      case "quaqua":
        lafSet = setQuaquaLookAndFeel();
        if (!lafSet)
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels())
        {
          if (info.getName() != null && nameStartsWith
-                 ? info.getName().toLowerCase()
-                         .startsWith(name.toLowerCase())
-                 : info.getName().equalsIgnoreCase(name.toLowerCase()))
+                 ? info.getName().toLowerCase(Locale.ROOT)
+                         .startsWith(name.toLowerCase(Locale.ROOT))
+                 : info.getName().toLowerCase(Locale.ROOT).equals(name.toLowerCase(Locale.ROOT)))
          {
            className = info.getClassName();
            break;
              "javax.swing.plaf.nimbus.NimbusLookAndFeel", false);
    }
  
 +  private static boolean setFlatLookAndFeel()
 +  {
 +    boolean set = setSpecificLookAndFeel("flatlaf light",
 +            "com.formdev.flatlaf.FlatLightLaf", false);
 +    if (set)
 +    {
 +      UIManager.put("TabbedPane.showTabSeparators", true);
 +      UIManager.put("TabbedPane.tabSeparatorsFullHeight", true);
 +      UIManager.put("TabbedPane.selectedBackground", Color.white);
 +    }
 +    return set;
 +  }
 +
    private static boolean setQuaquaLookAndFeel()
    {
      return setSpecificLookAndFeel("quaqua",
      System.setProperty("apple.laf.useScreenMenuBar", "true");
      set = setQuaquaLookAndFeel();
      if ((!set) || !UIManager.getLookAndFeel().getClass().toString()
-             .toLowerCase().contains("quaqua"))
+             .toLowerCase(Locale.ROOT).contains("quaqua"))
      {
        set = setVaquaLookAndFeel();
      }
                      + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n"
                      + "-jvmmempc=PERCENT\tOnly available with standalone executable jar or jalview.bin.Launcher. Limit maximum heap size (memory) to PERCENT% of total physical memory detected. This defaults to 90 if total physical memory can be detected. See https://www.jalview.org/help/html/memory.html for more details.\n"
                      + "-jvmmemmax=MAXMEMORY\tOnly available with standalone executable jar or jalview.bin.Launcher. Limit maximum heap size (memory) to MAXMEMORY. MAXMEMORY can be specified in bytes, kilobytes(k), megabytes(m), gigabytes(g) or if you're lucky enough, terabytes(t). This defaults to 32g if total physical memory can be detected, or to 8g if total physical memory cannot be detected. See https://www.jalview.org/help/html/memory.html for more details.\n"
-                     + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
+                     + "\n~Read documentation in Application or visit https://www.jalview.org for description of Features and Annotations file~\n\n");
    }
  
    private static void startUsageStats(final Desktop desktop)