+ /**
+ * Answers a suitable tooltip to show on the colour cell of the table
+ *
+ * @param gcol
+ * @return
+ */
+ public String getColorTooltip(FeatureColourI gcol)
+ {
+ if (gcol.isSimpleColour())
+ {
+ return BASE_TOOLTIP;
+ }
+ StringBuilder tt = new StringBuilder();
+ if (gcol.isAboveThreshold())
+ {
+ tt.append("Thresholded (Above ").append(gcol.getThreshold())
+ .append(")");
+ }
+ else if (gcol.isBelowThreshold())
+ {
+ tt.append("Thresholded (Below ").append(gcol.getThreshold())
+ .append(")");
+ }
+ else if (gcol.isColourByLabel())
+ {
+ tt.insert(0, "Coloured by label text ");
+ }
+ tt.append("; ").append(BASE_TOOLTIP);
+ return tt.toString();
+ }
+
+ public static void renderGraduatedColor(JLabel comp, FeatureColourI gcol,
+ int w, int h)
+ {
+ boolean thr = false;
+ StringBuilder tx = new StringBuilder();
+
+ if (gcol.isColourByAttribute())
+ {
+ tx.append(FeatureMatcher
+ .toAttributeDisplayName(gcol.getAttributeName()));
+ }
+ else if (!gcol.isColourByLabel())
+ {
+ tx.append(MessageManager.getString("label.score"));
+ }
+ tx.append(" ");
+ if (gcol.isAboveThreshold())
+ {
+ thr = true;
+ tx.append(">");
+ }
+ if (gcol.isBelowThreshold())
+ {
+ thr = true;
+ tx.append("<");
+ }
+ if (gcol.isColourByLabel())
+ {
+ if (thr)
+ {
+ tx.append(" ");
+ }
+ if (!gcol.isColourByAttribute())
+ {
+ tx.append("Label");
+ }
+ comp.setIcon(null);
+ }
+ else
+ {
+ Color newColor = gcol.getMaxColour();
+ comp.setBackground(newColor);
+ // System.err.println("Width is " + w / 2);
+ Icon ficon = new FeatureIcon(gcol, comp.getBackground(), w, h, thr);
+ comp.setIcon(ficon);
+ // tt+="RGB value: Max (" + newColor.getRed() + ", "
+ // + newColor.getGreen() + ", " + newColor.getBlue()
+ // + ")\nMin (" + minCol.getRed() + ", " + minCol.getGreen()
+ // + ", " + minCol.getBlue() + ")");
+ }
+ comp.setHorizontalAlignment(SwingConstants.CENTER);
+ comp.setText(tx.toString());
+ }
+