JAL-1620 version bump and release notes
[jalview.git] / src / jalview / ws / jws2 / MsaWSClient.java
index 76a1c56..49a3412 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
  * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
@@ -21,9 +21,7 @@
 package jalview.ws.jws2;
 
 import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AlignmentView;
-import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
 import jalview.gui.Desktop;
 import jalview.gui.JvSwingUtils;
@@ -129,8 +127,10 @@ public class MsaWSClient extends Jws2Client
 
       return;
     }
+
     startMsaWSClient(altitle, msa, submitGaps, preserveOrder, seqdataset);
 
+
   }
 
   public MsaWSClient()
@@ -174,54 +174,25 @@ public class MsaWSClient extends Jws2Client
     MsaWSThread msathread = new MsaWSThread(server, preset, paramset,
             WsURL, wsInfo, alignFrame, WebServiceName, jobtitle, msa,
             submitGaps, preserveOrder, seqdataset);
-    wsInfo.setthisService(msathread);
-    if (isValidAlignment(alignFrame.getCurrentView().getAlignment()))
+    if (msathread.hasValidInput())
     {
-
-    msathread.start();
+      wsInfo.setthisService(msathread);
+      wsInfo.setVisible(true);
+      msathread.start();
     }
-  }
-
-  private boolean isValidAlignment(AlignmentI seqdataset)
-  {
-    String header = wsInfo.getInfoText()
-            + "\nValidating submited Alignment...";
-    wsInfo.setInfoText(header);
-    int validSeqCount = 0;
-    List<SequenceI> seqs = seqdataset.getSequences();
-    if (seqs.size() < 2)
+    else
     {
-      wsInfo.setInfoText(header
-              + "\nA minimum of two sequences is required to perform this operation");
-      return false;
+      JOptionPane.showMessageDialog(alignFrame,
+              MessageManager.getString("info.invalid_msa_input_mininfo"),
+              MessageManager.getString("info.invalid_msa_notenough"),
+              JOptionPane.INFORMATION_MESSAGE);
+      wsInfo.setVisible(false);
     }
-
-    for (SequenceI seq : seqs)
-    {
-
-      if (seq.getSequenceAsString().matches(
-              "([(a-zA-Z?)(-?)(.?)]+)?[a-zA-Z]([(a-zA-Z?)(-?)(.?)]+)?"))
-      {
-        ++validSeqCount;
-      }
-      if (validSeqCount > 1)
-      {
-        wsInfo.setInfoText(header
-                + "\nAlignment sequences was successfully validated");
-        return true;
-      }
-    }
-
-    wsInfo.setInfoText(header
-            + "\nA minimum of two sequences with at least one non-gap character in each sequence is required to perform this operation");
-    return false;
   }
 
   public static void main(String[] args)
   {
-    System.out
-            .println("A"
-                    .matches("([(a-zA-Z?)(-?)(.?)]+)?[a-zA-Z]([(a-zA-Z?)(-?)(.?)]+)?"));
+    System.out.println("A".matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*"));
   }
 
 
@@ -300,9 +271,13 @@ public class MsaWSClient extends Jws2Client
         public void actionPerformed(ActionEvent e)
         {
           AlignmentView msa = alignFrame.gatherSequencesForAlignment();
+
+          if (msa != null)
+          {
           new MsaWSClient(service, alignFrame.getTitle(), msa, withGaps,
                   true, alignFrame.getViewport().getAlignment()
                           .getDataset(), alignFrame);
+          }
 
         }
       });
@@ -321,9 +296,12 @@ public class MsaWSClient extends Jws2Client
           public void actionPerformed(ActionEvent e)
           {
             AlignmentView msa = alignFrame.gatherSequencesForAlignment();
-            new MsaWSClient(service, null, null, true, alignFrame
+            if (msa != null)
+            {
+              new MsaWSClient(service, null, null, true, alignFrame
                     .getTitle(), msa, withGaps, true, alignFrame
                     .getViewport().getAlignment().getDataset(), alignFrame);
+            }
 
           }
         });
@@ -374,9 +352,14 @@ public class MsaWSClient extends Jws2Client
               {
                 AlignmentView msa = alignFrame
                         .gatherSequencesForAlignment();
-                new MsaWSClient(service, preset, alignFrame.getTitle(),
+
+                if (msa != null)
+                {
+                  MsaWSClient msac = new MsaWSClient(service, preset,
+                          alignFrame.getTitle(),
                         msa, false, true, alignFrame.getViewport()
                                 .getAlignment().getDataset(), alignFrame);
+                }
 
               }