factored out reference to parent alignFrame (so all views can be closed whilst a...
authorjprocter <Jim Procter>
Wed, 31 Oct 2007 15:13:30 +0000 (15:13 +0000)
committerjprocter <Jim Procter>
Wed, 31 Oct 2007 15:13:30 +0000 (15:13 +0000)
src/jalview/ws/JPredThread.java
src/jalview/ws/MsaWSThread.java
src/jalview/ws/WSThread.java

index c2305e6..ba114f2 100644 (file)
@@ -88,7 +88,7 @@ class JPredThread
           if (predMap != null)\r
           {\r
             Object[] alandcolsel = input.getAlignmentAndColumnSelection(\r
-                alignFrame.getViewport().getGapCharacter());\r
+                getGapChar());\r
             sqs = (SequenceI[]) alandcolsel[0];\r
             al = new Alignment(sqs);\r
             alcsel = (ColumnSelection) alandcolsel[1];\r
@@ -131,7 +131,7 @@ class JPredThread
         FirstSeq = prediction.getQuerySeqPosition();\r
         if (predMap != null)\r
         {\r
-          char gc = alignFrame.getViewport().getGapCharacter();\r
+          char gc = getGapChar();\r
           SequenceI[] sqs = (SequenceI[]) ( (java.lang.Object[]) input.\r
                                            getAlignmentAndColumnSelection(gc))[\r
               0];\r
@@ -146,8 +146,7 @@ class JPredThread
           new jalview.commands.RemoveGapsCommand("Remove Gaps",\r
                                                  new SequenceI[]\r
                                                  {sqs[msaIndex]},\r
-                                                 alignFrame.getCurrentView().\r
-                                                 getAlignment());\r
+                                                 currentView);\r
 \r
           SequenceI profileseq = al.getSequenceAt(FirstSeq);\r
           profileseq.setSequence(sqs[msaIndex].getSequenceAsString());\r
index 0dedce2..3be0c56 100644 (file)
@@ -622,7 +622,7 @@ class MsaWSThread
         results[j] = null;
       }
     }
-    Object[] newview = input.getUpdatedView(results, orders, '-');
+    Object[] newview = input.getUpdatedView(results, orders, getGapChar());
     // trash references to original result data
     for (int j = 0; j < jobs.length; j++)
     {
@@ -647,10 +647,9 @@ class MsaWSThread
                                      AlignFrame.DEFAULT_WIDTH,
                                      AlignFrame.DEFAULT_HEIGHT);
 
-      // >>>This is a fix for the moment, until a better solution is
-      // found!!<<<
+      // initialise with same renderer settings as in parent alignframe.
       af.getFeatureRenderer().transferSettings(
-          alignFrame.getFeatureRenderer());
+          this.featureSettings);
       // update orders
       if (alorders.size() > 0)
       {
@@ -714,7 +713,6 @@ class MsaWSThread
     }
   }
 
-
   public boolean canMergeResults()
   {
     return false;
index f3dd969..a69e434 100644 (file)
@@ -23,6 +23,7 @@ import javax.swing.*;
 import jalview.bin.*;
 import jalview.datamodel.*;
 import jalview.gui.*;
+import jalview.gui.FeatureRenderer.FeatureRendererSettings;
 
 public abstract class WSThread
     extends Thread
@@ -30,7 +31,8 @@ public abstract class WSThread
   /**
    * Generic properties for Web Service Client threads.
    */
-  AlignFrame alignFrame = null;
+  AlignmentI currentView = null;
+  FeatureRendererSettings featureSettings = null;
   WebserviceInfo wsInfo = null;
   AlignmentView input = null;
   AlignedCodonFrame[] codonframe = null;
@@ -320,10 +322,19 @@ public abstract class WSThread
     this(alignFrame, wsinfo, input, wsUrl);
     WebServiceName = webServiceName;
   }
+  char defGapChar = '-';
+  /**
+   * 
+   * @return gap character to use for any alignment generation
+   */
+  public char getGapChar()
+  {
+    return defGapChar;
+  }
 
   /**
    * 
-   * @param alframe - reference for copying mappings across
+   * @param alframe - reference for copying mappings and display styles across
    * @param wsinfo2 - gui attachment point
    * @param alview - input data for the calculation
    * @param wsurl2 - url of the service being invoked
@@ -332,13 +343,16 @@ public abstract class WSThread
           AlignmentView alview, String wsurl2)
   {
     super();
-    this.alignFrame = alframe;
+    // this.alignFrame = alframe;
+    currentView = alframe.getCurrentView().getAlignment();
+    featureSettings = alframe.getFeatureRenderer().getSettings();
+    defGapChar = alframe.getViewport().getGapCharacter();
     this.wsInfo = wsinfo2;
     this.input = alview;
     WsUrl = wsurl2;
-    if (alignFrame!=null)
+    if (alframe!=null)
     {
-      AlignedCodonFrame[] cf = alignFrame.getViewport().getAlignment().getCodonFrames();
+      AlignedCodonFrame[] cf = alframe.getViewport().getAlignment().getCodonFrames();
       if (cf!=null)
       {
         codonframe = new AlignedCodonFrame[cf.length];