From: gmungoc Date: Mon, 28 Mar 2016 09:02:46 +0000 (+0100) Subject: JAL-2016 push getFeatureColourScheme(source) into SequenceFetcher X-Git-Tag: Release_2_10_0~270^2~1^2~12 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5abaf9d49abf02d536fb657d33b3fcde91ddb42c;p=jalview.git JAL-2016 push getFeatureColourScheme(source) into SequenceFetcher --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 9e52fa3..b48a750 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -100,7 +100,6 @@ import jalview.ws.SequenceFetcher; import jalview.ws.jws1.Discoverer; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.jabaws2.Jws2Instance; -import jalview.ws.seqfetcher.ASequenceFetcher; import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; @@ -4733,21 +4732,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (xrefs != null) { /* - * figure out colour scheme if any to apply to features + * get display scheme (if any) to apply to features */ - ASequenceFetcher sftch = new SequenceFetcher(); - List proxies = sftch.getSourceProxy(source); - FeatureSettingsModelI featureColourScheme = null; - for (DbSourceProxy proxy : proxies) - { - FeatureSettingsModelI preferredColours = proxy - .getFeatureColourScheme(); - if (preferredColours != null) - { - featureColourScheme = preferredColours; - break; - } - } + FeatureSettingsModelI featureColourScheme = new SequenceFetcher() + .getFeatureColourScheme(source); + AlignmentI al = makeCrossReferencesAlignment( alignment.getDataset(), xrefs); diff --git a/src/jalview/ws/seqfetcher/ASequenceFetcher.java b/src/jalview/ws/seqfetcher/ASequenceFetcher.java index 2ed3263..2392476 100644 --- a/src/jalview/ws/seqfetcher/ASequenceFetcher.java +++ b/src/jalview/ws/seqfetcher/ASequenceFetcher.java @@ -20,6 +20,7 @@ */ package jalview.ws.seqfetcher; +import jalview.api.FeatureSettingsModelI; import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; @@ -435,4 +436,28 @@ public class ASequenceFetcher return prlist.toArray(new DbSourceProxy[0]); } + /** + * Returns a preferred feature colouring scheme for the given source, or null + * if none is defined. + * + * @param source + * @return + */ + public FeatureSettingsModelI getFeatureColourScheme(String source) + { + /* + * return the first non-null colour scheme for any proxy for + * this database source + */ + for (DbSourceProxy proxy : getSourceProxy(source)) + { + FeatureSettingsModelI preferredColours = proxy + .getFeatureColourScheme(); + if (preferredColours != null) + { + return preferredColours; + } + } + return null; + } }