X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fcontroller%2FAlignViewController.java;h=ca2ae6d552f7cef5bca66cfc13d24270eaf4946b;hb=a4ace9297e743fb504dffd43ebb11074db263e10;hp=151af0ee96650316df0e32356ad2530499b3c0a3;hpb=a6b324e3f5edac3df0b968f0037b1cc8b651598e;p=jalview.git diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index 151af0e..ca2ae6d 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -37,7 +37,6 @@ import jalview.io.FeaturesFile; import jalview.util.MessageManager; import java.awt.Color; -import java.util.ArrayList; import java.util.BitSet; import java.util.List; @@ -317,46 +316,23 @@ public class AlignViewController implements AlignViewControllerI } @Override - public void sortAlignmentByFeatureDensity(String[] typ) + public void sortAlignmentByFeatureDensity(List typ) { sortBy(typ, "Sort by Density", AlignmentSorter.FEATURE_DENSITY); } - protected void sortBy(String[] typ, String methodText, final String method) + protected void sortBy(List typ, String methodText, + final String method) { FeatureRenderer fr = alignPanel.getFeatureRenderer(); - if (typ == null) + if (typ == null && fr != null) { - typ = fr == null ? null : fr.getDisplayedFeatureTypes(); + typ = fr.getDisplayedFeatureTypes(); } - String gps[] = null; - gps = fr == null ? null : fr.getDisplayedFeatureGroups(); - if (typ != null) + List gps = null; + if (fr != null) { - ArrayList types = new ArrayList(); - for (int i = 0; i < typ.length; i++) - { - if (typ[i] != null) - { - types.add(typ[i]); - } - typ = new String[types.size()]; - types.toArray(typ); - } - } - if (gps != null) - { - ArrayList grps = new ArrayList(); - - for (int i = 0; i < gps.length; i++) - { - if (gps[i] != null) - { - grps.add(gps[i]); - } - } - gps = new String[grps.size()]; - grps.toArray(gps); + gps = fr.getDisplayedFeatureGroups(); } AlignmentI al = viewport.getAlignment(); @@ -381,7 +357,7 @@ public class AlignViewController implements AlignViewControllerI } @Override - public void sortAlignmentByFeatureScore(String[] typ) + public void sortAlignmentByFeatureScore(List typ) { sortBy(typ, "Sort by Feature Score", AlignmentSorter.FEATURE_SCORE); }