From aa9a4b5f3c7b97646d7ca7164f4211ab651c0862 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 31 Oct 2007 15:13:30 +0000 Subject: [PATCH] factored out reference to parent alignFrame (so all views can be closed whilst a job is in progress) --- src/jalview/ws/JPredThread.java | 7 +++---- src/jalview/ws/MsaWSThread.java | 8 +++----- src/jalview/ws/WSThread.java | 24 +++++++++++++++++++----- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/jalview/ws/JPredThread.java b/src/jalview/ws/JPredThread.java index c2305e6..ba114f2 100644 --- a/src/jalview/ws/JPredThread.java +++ b/src/jalview/ws/JPredThread.java @@ -88,7 +88,7 @@ class JPredThread if (predMap != null) { Object[] alandcolsel = input.getAlignmentAndColumnSelection( - alignFrame.getViewport().getGapCharacter()); + getGapChar()); sqs = (SequenceI[]) alandcolsel[0]; al = new Alignment(sqs); alcsel = (ColumnSelection) alandcolsel[1]; @@ -131,7 +131,7 @@ class JPredThread FirstSeq = prediction.getQuerySeqPosition(); if (predMap != null) { - char gc = alignFrame.getViewport().getGapCharacter(); + char gc = getGapChar(); SequenceI[] sqs = (SequenceI[]) ( (java.lang.Object[]) input. getAlignmentAndColumnSelection(gc))[ 0]; @@ -146,8 +146,7 @@ class JPredThread new jalview.commands.RemoveGapsCommand("Remove Gaps", new SequenceI[] {sqs[msaIndex]}, - alignFrame.getCurrentView(). - getAlignment()); + currentView); SequenceI profileseq = al.getSequenceAt(FirstSeq); profileseq.setSequence(sqs[msaIndex].getSequenceAsString()); diff --git a/src/jalview/ws/MsaWSThread.java b/src/jalview/ws/MsaWSThread.java index 0dedce2..3be0c56 100644 --- a/src/jalview/ws/MsaWSThread.java +++ b/src/jalview/ws/MsaWSThread.java @@ -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; diff --git a/src/jalview/ws/WSThread.java b/src/jalview/ws/WSThread.java index f3dd969..a69e434 100644 --- a/src/jalview/ws/WSThread.java +++ b/src/jalview/ws/WSThread.java @@ -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]; -- 1.7.10.2