Revert "JAL-2799 all tabs now get mouse listeners and Jalview switches tree view"
[jalview.git] / src / jalview / ws / jws2 / MsaWSThread.java
index 89cf024..ee0fbc5 100644 (file)
@@ -21,7 +21,7 @@
 package jalview.ws.jws2;
 
 import jalview.analysis.AlignSeq;
-import jalview.bin.Cache;
+import jalview.bin.Console;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AlignmentOrder;
@@ -574,7 +574,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
           {
             cancelledMessage += ("\nProblems cancelling the job : Exception received...\n"
                     + exc + "\n");
-            Cache.log.warn(
+            Console.warn(
                     "Exception whilst cancelling " + jobs[job].getJobId(),
                     exc);
           }
@@ -667,9 +667,9 @@ class MsaWSThread extends AWS2Thread implements WSClientI
     MsaWSJob j = (MsaWSJob) job;
     if (j.isSubmitted())
     {
-      if (Cache.log.isDebugEnabled())
+      if (Console.isDebugEnabled())
       {
-        Cache.log.debug(
+        Console.debug(
                 "Tried to submit an already submitted job " + j.getJobId());
       }
       return;
@@ -811,7 +811,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
             } catch (Exception e)
             {
 
-              Cache.log.warn(
+              Console.warn(
                       "Exception when retrieving remaining Job progress data for job "
                               + msjob.getJobId() + " on server " + WsUrl);
               e.printStackTrace();
@@ -835,7 +835,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
             }
           } while (nunchanged > 0 && nexcept > 0);
 
-          if (Cache.log.isDebugEnabled())
+          if (Console.isDebugEnabled())
           {
             System.out.println("Job Execution file for job: "
                     + msjob.getJobId() + " on server " + WsUrl);
@@ -850,7 +850,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
           {
             // job has failed for some reason - probably due to invalid
             // parameters
-            Cache.log.debug(
+            Console.debug(
                     "Results not available for finished job - marking as broken job.",
                     e);
             msjob.jobProgress.append(
@@ -859,7 +859,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
             msjob.setjobStatus(JobStatus.FAILED);
           } catch (Exception e)
           {
-            Cache.log.error("Couldn't get Alignment for job.", e);
+            Console.error("Couldn't get Alignment for job.", e);
             // TODO: Increment count and retry ?
             msjob.setjobStatus(JobStatus.UNDEFINED);
           }
@@ -887,7 +887,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
     } catch (Exception ex)
     {
 
-      Cache.log.error(
+      Console.error(
               "Unexpected exception when processing results for " + alTitle,
               ex);
       wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
@@ -974,24 +974,13 @@ class MsaWSThread extends AWS2Thread implements WSClientI
     {
       al.setDataset(dataset);
     }
+
     propagateDatasetMappings(al);
-    Alignment complement=null;
-    if (input.hasComplementView())
-    {
-      Object[] newcompl = input
-              .getComplementView()
-              .getAlignmentAndHiddenColumns(getRequestingAlignFrame()
-                      .getViewport().getCodingComplement().getGapCharacter());
-      complement = new Alignment((SequenceI[])newcompl[0]);
-      complement.setHiddenColumns((HiddenColumns) newcompl[1]);
-      complement.setDataset(dataset);
-      complement.alignAs(al);
-    }
     // JBNote- TODO: warn user if a block is input rather than aligned data ?
 
     if (newFrame)
     {
-      displayInNewFrame(al, alorders, hidden, complement);
+      displayInNewFrame(al, alorders, hidden);
 
     }
     else
@@ -1009,11 +998,10 @@ class MsaWSThread extends AWS2Thread implements WSClientI
    * 
    * @param al
    * @param alorders
-   * @param complement2 
    * @param columnselection
    */
   protected void displayInNewFrame(AlignmentI al,
-          List<AlignmentOrder> alorders, HiddenColumns hidden, AlignmentI complement)
+          List<AlignmentOrder> alorders, HiddenColumns hidden)
   {
     AlignFrame af = new AlignFrame(al, hidden, AlignFrame.DEFAULT_WIDTH,
             AlignFrame.DEFAULT_HEIGHT);
@@ -1033,18 +1021,26 @@ class MsaWSThread extends AWS2Thread implements WSClientI
      * SplitFrame with the other pane similarly aligned.
      */
     AlignFrame requestedBy = getRequestingAlignFrame();
-    if (complement!=null && requestedBy != null && requestedBy.getSplitViewContainer() != null
+    if (requestedBy != null && requestedBy.getSplitViewContainer() != null
             && requestedBy.getSplitViewContainer()
                     .getComplement(requestedBy) != null)
     {
+      AlignmentI complement = requestedBy.getSplitViewContainer()
+              .getComplement(requestedBy);
       String complementTitle = requestedBy.getSplitViewContainer()
               .getComplementTitle(requestedBy);
       // becomes null if the alignment window was closed before the alignment
       // job finished.
-      if (complement.getHeight() > 0)
+      AlignmentI copyComplement = new Alignment(complement);
+      // todo should this be done by copy constructor?
+      copyComplement.setGapCharacter(complement.getGapCharacter());
+      // share the same dataset (and the mappings it holds)
+      copyComplement.setDataset(complement.getDataset());
+      copyComplement.alignAs(al);
+      if (copyComplement.getHeight() > 0)
       {
         af.setTitle(alTitle);
-        AlignFrame af2 = new AlignFrame(complement,
+        AlignFrame af2 = new AlignFrame(copyComplement,
                 AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
         af2.setTitle(complementTitle);
         String linkedTitle = MessageManager