From: gmungoc Date: Thu, 16 Nov 2017 14:23:00 +0000 (+0000) Subject: JAL-2069 fix minor bugs in variable setting X-Git-Tag: Release_2_11_0~119 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fac8703b72442854d4b91fd71483455058b41e2b;p=jalview.git JAL-2069 fix minor bugs in variable setting --- diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index da3819c..d3d9e1a 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -263,7 +263,7 @@ public class FeatureColourChooser extends JalviewDialog textAttributeCombo.setEnabled(true); String[] attributeName = cs.getAttributeName(); textAttributeCombo - .setSelectedItem(String.join(COLON, attributeName)); + .setSelectedItem(toAttributeDisplayName(attributeName)); } else { @@ -278,7 +278,7 @@ public class FeatureColourChooser extends JalviewDialog byAttributeValue.setSelected(true); String[] attributeName = cs.getAttributeName(); valueAttributeCombo - .setSelectedItem(String.join(COLON, attributeName)); + .setSelectedItem(toAttributeDisplayName(attributeName)); valueAttributeCombo.setEnabled(true); updateMinMax(); } @@ -393,7 +393,7 @@ public class FeatureColourChooser extends JalviewDialog else if (byAttributeValue.isSelected()) { String attName = (String) valueAttributeCombo.getSelectedItem(); - String[] attNames = attName.split(COLON); + String[] attNames = fromAttributeDisplayName(attName); minMax = FeatureAttributes.getInstance().getMinMax(type, attNames); } if (minMax != null) @@ -740,17 +740,17 @@ public class FeatureColourChooser extends JalviewDialog { attribute = (String) textAttributeCombo.getSelectedItem(); textAttributeCombo.setEnabled(true); - acg.setAttributeName(attribute.split(COLON)); + acg.setAttributeName(fromAttributeDisplayName(attribute)); } else if (byAttributeValue.isSelected()) { attribute = (String) valueAttributeCombo.getSelectedItem(); valueAttributeCombo.setEnabled(true); - acg.setAttributeName(attribute.split(COLON)); + acg.setAttributeName(fromAttributeDisplayName(attribute)); } else { - acg.setAttributeName((String) null); + acg.setAttributeName((String[]) null); } if (!hasThreshold) @@ -839,6 +839,11 @@ public class FeatureColourChooser extends JalviewDialog ap.paintAlignment(updateStructsAndOverview, updateStructsAndOverview); } + private String[] fromAttributeDisplayName(String attribute) + { + return attribute == null ? null : attribute.split(COLON); + } + @Override protected void raiseClosed() { @@ -972,7 +977,7 @@ public class FeatureColourChooser extends JalviewDialog continue; } } - validAtts.add(String.join(COLON, attName)); + validAtts.add(toAttributeDisplayName(attName)); String desc = fa.getDescription(featureType, attName); if (desc != null && desc.length() > MAX_TOOLTIP_LENGTH) { @@ -1003,4 +1008,9 @@ public class FeatureColourChooser extends JalviewDialog return attCombo; } + private String toAttributeDisplayName(String[] attName) + { + return attName == null ? "" : String.join(COLON, attName); + } + }