X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FFeatureColour.java;h=6483b85eb67900b4abacd867dc25f675b4f6156c;hb=ee7d621eea4811c90ce8bc470cc1e217cd2d806c;hp=c73e32bdfea0551c4c267a5e6fe6978e64f2f47b;hpb=3c8a25936a2d805e7e3d7ab82f83b13135406d18;p=jalview.git diff --git a/src/jalview/schemes/FeatureColour.java b/src/jalview/schemes/FeatureColour.java index c73e32b..6483b85 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"; @@ -915,4 +922,50 @@ public class FeatureColour implements FeatureColourI || (isBelowThreshold() && scr >= threshold)); } + @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(); + } + }