Merge branch 'task/JAL-3236_install4j_linux_unix_userland_installers' into task/JAL...
authorBen Soares <bsoares@dundee.ac.uk>
Mon, 13 May 2019 15:01:14 +0000 (16:01 +0100)
committerBen Soares <bsoares@dundee.ac.uk>
Mon, 13 May 2019 15:01:14 +0000 (16:01 +0100)
.gitignore
gradle.properties
help/help/html/releases.html
src/jalview/ext/jmol/JalviewJmolBinding.java
src/jalview/gui/AppJmol.java
src/jalview/gui/ChimeraViewFrame.java
src/jalview/gui/SequenceRenderer.java
src/jalview/project/Jalview2XML.java
src/jalview/structure/StructureSelectionManager.java
src/jalview/util/Platform.java
test/jalview/util/PlatformTest.java

index 84f4385..a2a64e7 100644 (file)
@@ -25,6 +25,7 @@ TESTNG
 /getdown/files
 /getdown/src/getdown/*/target/
 /getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Build.java
+/getdown/src/getdown/launcher/dependency-reduced-pom.xml
 /utils/install4j/jalview-installers-*.install4j
 *.swp
 /bin
index 294ac23..e49c3ab 100644 (file)
@@ -102,6 +102,7 @@ install4jInfoPlistFileAssociations = file_associations_auto-Info_plist.xml
 install4jInstallerFileAssociations = file_associations_auto-install4j.xml
 install4jBuildDir = build/install4j
 install4jMediaTypes = windows,macosArchive,linuxRPM,linuxDeb,unixArchive
+install4jMediaTypes = windows,macosArchive,linuxRPM,linuxDeb,unixArchive,unixInstaller
 install4jFaster = false
 
 OSX_KEYSTORE =
index a8fce60..a98b060 100755 (executable)
@@ -165,6 +165,10 @@ li:before {
           <li>
             <!-- JAL-3143 -->Timeouts when retrieving data from Ensembl</li>
           <li>
+            <!-- JAL-3244 -->'View [Structure] Mappings' and structure superposition in Jmol fail on Windows</li>
+          <li>
+            <!-- JAL-3239 -->Text misaligned in EPS or SVG image export with monospaced font</li>
+          <li>
             <!-- JAL-3171 -->Warning of 'Duplicate entry' when saving
             Jalview project involving multiple views</li>
           <li>
@@ -262,6 +266,8 @@ li:before {
             <!-- JAL-2647 -->Input Data menu entry is greyed out when PCA View is restored from a Jalview 2.11 project</li> 
           <li>
             <!-- JAL-3213 -->Alignment panel height can be too small after 'New View'</li> 
+          <li>
+            <!-- JAL-3240 -->Display is incorrect after removing gapped columns within hidden columns</li> 
         </ul>
       </td>
     </tr>
index 4406e73..c0a1e0d 100644 (file)
@@ -44,7 +44,6 @@ import java.awt.event.ComponentEvent;
 import java.awt.event.ComponentListener;
 import java.io.File;
 import java.net.URL;
-import java.security.AccessControlException;
 import java.util.ArrayList;
 import java.util.BitSet;
 import java.util.Hashtable;
@@ -614,74 +613,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
    */
   private int _modelFileNameMap[];
 
-  // ////////////////////////////////
-  // /StructureListener
-  // @Override
-  public synchronized String[] getPdbFilex()
-  {
-    if (viewer == null)
-    {
-      return new String[0];
-    }
-    if (modelFileNames == null)
-    {
-      List<String> mset = new ArrayList<>();
-      _modelFileNameMap = new int[viewer.ms.mc];
-      String m = viewer.ms.getModelFileName(0);
-      if (m != null)
-      {
-        String filePath = m;
-        try
-        {
-          filePath = new File(m).getAbsolutePath();
-        } catch (AccessControlException x)
-        {
-          // usually not allowed to do this in applet
-          System.err.println(
-                  "jmolBinding: Using local file string from Jmol: " + m);
-        }
-        if (filePath.indexOf("/file:") != -1)
-        {
-          // applet path with docroot - discard as format won't match pdbfile
-          filePath = m;
-        }
-        mset.add(filePath);
-        _modelFileNameMap[0] = 0; // filename index for first model is always 0.
-      }
-      int j = 1;
-      for (int i = 1; i < viewer.ms.mc; i++)
-      {
-        m = viewer.ms.getModelFileName(i);
-        String filePath = m;
-        if (m != null)
-        {
-          try
-          {
-            filePath = new File(m).getAbsolutePath();
-          } catch (AccessControlException x)
-          {
-            // usually not allowed to do this in applet, so keep raw handle
-            // System.err.println("jmolBinding: Using local file string from
-            // Jmol: "+m);
-          }
-        }
-
-        /*
-         * add this model unless it is read from a structure file we have
-         * already seen (example: 2MJW is an NMR structure with 10 models)
-         */
-        if (!mset.contains(filePath))
-        {
-          mset.add(filePath);
-          _modelFileNameMap[j] = i; // record the model index for the filename
-          j++;
-        }
-      }
-      modelFileNames = mset.toArray(new String[mset.size()]);
-    }
-    return modelFileNames;
-  }
-
   @Override
   public synchronized String[] getStructureFiles()
   {
index 6c934c8..ea7fb6b 100644 (file)
@@ -326,7 +326,7 @@ public class AppJmol extends StructureViewerBase
     for (String s : files)
     {
       fileList.append(SPACE).append(QUOTE)
-              .append(Platform.escapeString(s)).append(QUOTE);
+              .append(Platform.escapeBackslashes(s)).append(QUOTE);
     }
     String filesString = fileList.toString();
 
@@ -515,7 +515,7 @@ public class AppJmol extends StructureViewerBase
             addingStructures = true; // already files loaded.
             for (int c = 0; c < filesInViewer.length; c++)
             {
-              if (filesInViewer[c].equals(file))
+              if (Platform.pathEquals(filesInViewer[c], file))
               {
                 file = null;
                 break;
index d07a7c2..a7349b8 100644 (file)
@@ -480,7 +480,7 @@ public class ChimeraViewFrame extends StructureViewerBase
         {
           filePDB.add(thePdbEntry);
           filePDBpos.add(Integer.valueOf(pi));
-          files.append(" \"" + Platform.escapeString(file) + "\"");
+          files.append(" \"" + Platform.escapeBackslashes(file) + "\"");
         }
       }
     } catch (OutOfMemoryError oomerror)
index 81b394b..fb967ed 100755 (executable)
@@ -30,6 +30,9 @@ import java.awt.Color;
 import java.awt.FontMetrics;
 import java.awt.Graphics;
 
+import org.jfree.graphics2d.svg.SVGGraphics2D;
+import org.jibble.epsgraphics.EpsGraphics2D;
+
 public class SequenceRenderer implements jalview.api.SequenceRenderer
 {
   final static int CHAR_TO_UPPER = 'A' - 'a';
@@ -254,8 +257,19 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
     }
     graphics.setColor(av.getTextColour());
 
-    if (monospacedFont && av.getShowText() && allGroups.length == 0
-            && !av.getColourText() && av.getThresholdTextColour() == 0)
+    boolean drawAllText = monospacedFont && av.getShowText() && allGroups.length == 0
+            && !av.getColourText() && av.getThresholdTextColour() == 0;
+
+    /*
+     * EPS or SVG misaligns monospaced strings (JAL-3239)
+     * so always draw these one character at a time
+     */
+    if (graphics instanceof EpsGraphics2D
+            || graphics instanceof SVGGraphics2D)
+    {
+      drawAllText = false;
+    }
+    if (drawAllText)
     {
       if (av.isRenderGaps())
       {
index 2aefd81..0d2ec68 100644 (file)
@@ -4520,7 +4520,7 @@ public class Jalview2XML
           String reformatedOldFilename = oldfilenam.replaceAll("/", "\\\\");
           filedat = oldFiles.get(new File(reformatedOldFilename));
         }
-        newFileLoc.append(Platform.escapeString(filedat.getFilePath()));
+        newFileLoc.append(Platform.escapeBackslashes(filedat.getFilePath()));
         pdbfilenames.add(filedat.getFilePath());
         pdbids.add(filedat.getPdbId());
         seqmaps.add(filedat.getSeqList().toArray(new SequenceI[0]));
index 9513220..ff88bb7 100644 (file)
@@ -41,6 +41,7 @@ import jalview.io.DataSourceType;
 import jalview.io.StructureFile;
 import jalview.util.MappingUtils;
 import jalview.util.MessageManager;
+import jalview.util.Platform;
 import jalview.ws.sifts.SiftsClient;
 import jalview.ws.sifts.SiftsException;
 import jalview.ws.sifts.SiftsSettings;
@@ -1170,7 +1171,8 @@ public class StructureSelectionManager
     StringBuilder sb = new StringBuilder(64);
     for (StructureMapping sm : mappings)
     {
-      if (sm.pdbfile.equals(pdbfile) && seqs.contains(sm.sequence))
+      if (Platform.pathEquals(sm.pdbfile, pdbfile)
+              && seqs.contains(sm.sequence))
       {
         sb.append(sm.mappingDetails);
         sb.append(NEWLINE);
index 22032b5..c1d8228 100644 (file)
@@ -20,7 +20,6 @@
  */
 package jalview.util;
 
-import java.awt.Toolkit;
 import java.awt.event.MouseEvent;
 
 /**
@@ -88,23 +87,15 @@ public class Platform
   }
 
   /**
-   * escape a string according to the local platform's escape character
+   * Answers the input with every backslash replaced with a double backslash (an
+   * 'escaped' single backslash)
    * 
-   * @param file
-   * @return escaped file
+   * @param s
+   * @return
    */
-  public static String escapeString(String file)
+  public static String escapeBackslashes(String s)
   {
-    StringBuffer f = new StringBuffer();
-    int p = 0, lastp = 0;
-    while ((p = file.indexOf('\\', lastp)) > -1)
-    {
-      f.append(file.subSequence(lastp, p));
-      f.append("\\\\");
-      lastp = p + 1;
-    }
-    f.append(file.substring(lastp));
-    return f.toString();
+    return s == null ? null : s.replace("\\", "\\\\");
   }
 
   /**
@@ -145,4 +136,27 @@ public class Platform
     }
     return e.isControlDown();
   }
+
+  /**
+   * A (case sensitive) file path comparator that ignores the difference between /
+   * and \
+   * 
+   * @param path1
+   * @param path2
+   * @return
+   */
+  public static boolean pathEquals(String path1, String path2)
+  {
+    if (path1 == null)
+    {
+      return path2 == null;
+    }
+    if (path2 == null)
+    {
+      return false;
+    }
+    String p1 = path1.replace('\\', '/');
+    String p2 = path2.replace('\\', '/');
+    return p1.equals(p2);
+  }
 }
index 617bf42..d2c48f1 100644 (file)
@@ -20,7 +20,9 @@
  */
 package jalview.util;
 
+import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 
 import jalview.gui.JvOptionPane;
@@ -120,4 +122,23 @@ public class PlatformTest
     assertTrue(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0,
             0, 0, clickCount, isPopupTrigger, buttonNo), mac));
   }
+
+  @Test(groups = "Functional")
+  public void testPathEquals()
+  {
+    assertTrue(Platform.pathEquals(null, null));
+    assertFalse(Platform.pathEquals(null, "apath"));
+    assertFalse(Platform.pathEquals("apath", null));
+    assertFalse(Platform.pathEquals("apath", "APATH"));
+    assertTrue(Platform.pathEquals("apath", "apath"));
+    assertTrue(Platform.pathEquals("apath/a/b", "apath\\a\\b"));
+  }
+
+  @Test(groups = "Functional")
+  public void testEscapeBackslashes()
+  {
+    assertNull(Platform.escapeBackslashes(null));
+    assertEquals(Platform.escapeBackslashes("hello world"), "hello world");
+    assertEquals(Platform.escapeBackslashes("hello\\world"), "hello\\\\world");
+  }
 }