JAL-2843 methods relocated
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 8 Dec 2017 15:17:25 +0000 (15:17 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 8 Dec 2017 15:17:25 +0000 (15:17 +0000)
src/jalview/gui/FeatureTypeSettings.java

index c356731..c784d8d 100644 (file)
@@ -295,8 +295,8 @@ public class FeatureTypeSettings extends JalviewDialog
         if (fc.isColourByAttribute())
         {
           String[] attributeName = fc.getAttributeName();
-          colourByTextCombo
-                  .setSelectedItem(toAttributeDisplayName(attributeName));
+          colourByTextCombo.setSelectedItem(
+                  FeatureMatcher.toAttributeDisplayName(attributeName));
         }
         else
         {
@@ -336,8 +336,8 @@ public class FeatureTypeSettings extends JalviewDialog
       if (fc.isColourByAttribute())
       {
         String[] attributeName = fc.getAttributeName();
-        colourByRangeCombo
-                .setSelectedItem(toAttributeDisplayName(attributeName));
+        colourByRangeCombo.setSelectedItem(
+                FeatureMatcher.toAttributeDisplayName(attributeName));
       }
       else
       {
@@ -478,7 +478,7 @@ public class FeatureTypeSettings extends JalviewDialog
     {
       // colour by attribute range
       minMax = FeatureAttributes.getInstance().getMinMax(featureType,
-              fromAttributeDisplayName(attName));
+              FeatureMatcher.fromAttributeDisplayName(attName));
     }
     return minMax;
   }
@@ -907,7 +907,8 @@ public class FeatureTypeSettings extends JalviewDialog
       String byWhat = (String) colourByTextCombo.getSelectedItem();
       if (!LABEL_18N.equals(byWhat))
       {
-        fc.setAttributeName(fromAttributeDisplayName(byWhat));
+        fc.setAttributeName(
+                FeatureMatcher.fromAttributeDisplayName(byWhat));
       }
       return fc;
     }
@@ -964,7 +965,7 @@ public class FeatureTypeSettings extends JalviewDialog
     String byWhat = (String) colourByRangeCombo.getSelectedItem();
     if (!SCORE_18N.equals(byWhat))
     {
-      fc.setAttributeName(fromAttributeDisplayName(byWhat));
+      fc.setAttributeName(FeatureMatcher.fromAttributeDisplayName(byWhat));
     }
 
     /*
@@ -989,30 +990,6 @@ public class FeatureTypeSettings extends JalviewDialog
     return fc;
   }
 
-  /**
-   * A helper method that converts a 'compound' attribute name from its display
-   * form, e.g. CSQ:PolyPhen to array form, e.g. { "CSQ", "PolyPhen" }
-   * 
-   * @param attribute
-   * @return
-   */
-  private String[] fromAttributeDisplayName(String attribute)
-  {
-    return attribute == null ? null : attribute.split(COLON);
-  }
-
-  /**
-   * A helper method that converts a 'compound' attribute name to its display
-   * form, e.g. CSQ:PolyPhen from its array form, e.g. { "CSQ", "PolyPhen" }
-   * 
-   * @param attName
-   * @return
-   */
-  private String toAttributeDisplayName(String[] attName)
-  {
-    return attName == null ? "" : String.join(COLON, attName);
-  }
-
   @Override
   protected void raiseClosed()
   {
@@ -1159,7 +1136,7 @@ public class FeatureTypeSettings extends JalviewDialog
       {
         continue;
       }
-      displayAtts.add(toAttributeDisplayName(attName));
+      displayAtts.add(FeatureMatcher.toAttributeDisplayName(attName));
       String desc = fa.getDescription(featureType, attName);
       if (desc != null && desc.length() > MAX_TOOLTIP_LENGTH)
       {
@@ -1383,7 +1360,8 @@ public class FeatureTypeSettings extends JalviewDialog
     }
     else
     {
-      attCombo.setSelectedItem(toAttributeDisplayName(attName));
+      attCombo.setSelectedItem(
+              FeatureMatcher.toAttributeDisplayName(attName));
     }
     attCombo.addItemListener(new ItemListener()
     {
@@ -1486,7 +1464,7 @@ public class FeatureTypeSettings extends JalviewDialog
     }
     else
     {
-      item = toAttributeDisplayName(filter.getAttribute());
+      item = FeatureMatcher.toAttributeDisplayName(filter.getAttribute());
     }
     attCombo.setSelectedItem(item);
     return item;
@@ -1533,7 +1511,7 @@ public class FeatureTypeSettings extends JalviewDialog
           JComboBox<Condition> condCombo, JTextField patternField)
   {
     Datatype type = FeatureAttributes.getInstance().getDatatype(featureType,
-            fromAttributeDisplayName(attName));
+            FeatureMatcher.fromAttributeDisplayName(attName));
     if (LABEL_18N.equals(attName))
     {
       type = Datatype.Character;
@@ -1693,7 +1671,7 @@ public class FeatureTypeSettings extends JalviewDialog
     else
     {
       km = FeatureMatcher.byAttribute(cond, pattern,
-              fromAttributeDisplayName(attName));
+              FeatureMatcher.fromAttributeDisplayName(attName));
     }
 
     filters.set(filterIndex, km);