+ @Override
+ public boolean isOutwithThreshold(SequenceFeature feature)
+ {
+ if (!isGraduatedColour())
+ {
+ return false;
+ }
+ float scr = feature.getScore();
+ if (attributeName != null)
+ {
+ try
+ {
+ String attVal = feature.getValueAsString(attributeName);
+ scr = Float.valueOf(attVal);
+ } catch (Throwable e)
+ {
+ scr = Float.NaN;
+ }
+ }
+ if (Float.isNaN(scr))
+ {
+ return false;
+ }
+
+ return ((isAboveThreshold() && scr <= threshold)
+ || (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();
+ }
+