X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FFeatureColour.java;h=71a3d51209827c16224b79973d775d19079007b6;hb=36067eda8f713ab855b839fd4cc9af5cf36854a4;hp=7d14662238f5b7ee3b6f2d03ccb3895e58a329a4;hpb=007f2c0fa4563baa95d43da08b5e4edc99ddc9a0;p=jalview.git diff --git a/src/jalview/schemes/FeatureColour.java b/src/jalview/schemes/FeatureColour.java index 7d14662..71a3d51 100644 --- a/src/jalview/schemes/FeatureColour.java +++ b/src/jalview/schemes/FeatureColour.java @@ -25,6 +25,7 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.features.FeatureMatcher; import jalview.util.ColorUtils; import jalview.util.Format; +import jalview.util.MessageManager; import java.awt.Color; import java.util.StringTokenizer; @@ -50,6 +51,12 @@ import java.util.StringTokenizer; */ public class FeatureColour implements FeatureColourI { + private static final String I18N_LABEL = MessageManager + .getString("label.label"); + + private static final String I18N_SCORE = MessageManager + .getString("label.score"); + private static final String ABSOLUTE = "abso"; private static final String ABOVE = "above"; @@ -321,8 +328,8 @@ public class FeatureColour implements FeatureColourI } catch (Exception e) { throw new IllegalArgumentException( - "Couldn't parse the minimum value for graduated colour (" - + descriptor + ")"); + "Couldn't parse the minimum value for graduated colour ('" + + minval + "')"); } try { @@ -890,4 +897,50 @@ public class FeatureColour implements FeatureColourI attributeName = name; } + @Override + public String getDescription() + { + if (isSimpleColour()) + { + return "r=" + colour.getRed() + ",g=" + colour.getGreen() + ",b=" + + colour.getBlue(); + } + StringBuilder tt = new StringBuilder(); + String by = null; + + if (getAttributeName() != null) + { + by = FeatureMatcher.toAttributeDisplayName(getAttributeName()); + } + else if (isColourByLabel()) + { + by = I18N_LABEL; + } + else + { + by = I18N_SCORE; + } + tt.append(MessageManager.formatMessage("action.by_title_param", by)); + + /* + * add threshold if any + */ + if (isAboveThreshold() || isBelowThreshold()) + { + tt.append(" ("); + if (isColourByLabel()) + { + /* + * Jalview features file supports the combination of + * colour by label or attribute text with score threshold + */ + tt.append(I18N_SCORE).append(" "); + } + tt.append(isAboveThreshold() ? "> " : "< "); + tt.append(getThreshold()).append(")"); + } + + return tt.toString(); + } + }