case COLOUR_COLUMN:
FeatureColourI colour = (FeatureColourI) table.getValueAt(row,
column);
- tip = getColorTooltip(colour);
+ tip = getColorTooltip(colour, true);
break;
case FILTER_COLUMN:
FeatureMatcherSet o = (FeatureMatcherSet) table.getValueAt(row,
* Answers a suitable tooltip to show on the colour cell of the table
*
* @param fcol
+ * @param withHint
+ * if true include 'click to edit' and similar text
* @return
*/
- public static String getColorTooltip(FeatureColourI fcol)
+ public static String getColorTooltip(FeatureColourI fcol,
+ boolean withHint)
{
if (fcol == null)
{
}
if (fcol.isSimpleColour())
{
- return BASE_TOOLTIP;
+ return withHint ? BASE_TOOLTIP : null;
}
String description = fcol.getDescription();
description = description.replaceAll("<", "<");
description = description.replaceAll(">", ">");
StringBuilder tt = new StringBuilder(description);
- tt.append("<br>").append(BASE_TOOLTIP).append("</br>");
+ if (withHint)
+ {
+ tt.append("<br>").append(BASE_TOOLTIP).append("</br>");
+ }
return JvSwingUtils.wrapTooltip(true, tt.toString());
}
@Test(groups = "Functional")
public void testGetColorTooltip() throws IOException
{
- assertNull(FeatureSettings.getColorTooltip(null));
+ assertNull(FeatureSettings.getColorTooltip(null, false));
/*
* simple colour
*/
FeatureColourI fc = new FeatureColour(Color.black);
String simpleTooltip = "Click to edit, right-click for menu";
- assertEquals(FeatureSettings.getColorTooltip(fc), simpleTooltip);
+ assertEquals(FeatureSettings.getColorTooltip(fc, true), simpleTooltip);
+ assertNull(FeatureSettings.getColorTooltip(fc, false));
/*
* graduated colour tooltip includes description of colour
*/
fc.setColourByLabel(true);
- assertEquals(FeatureSettings.getColorTooltip(fc),
+ assertEquals(FeatureSettings.getColorTooltip(fc, false),
+ "<html>By Label</html>");
+ assertEquals(FeatureSettings.getColorTooltip(fc, true),
"<html>By Label<br>" + simpleTooltip + "</br></html>");
/*
fc = new FeatureColour(null, Color.red, Color.blue, null, 2f, 10f);
fc.setBelowThreshold(true);
fc.setThreshold(4f);
- assertEquals(FeatureSettings.getColorTooltip(fc),
+ assertEquals(FeatureSettings.getColorTooltip(fc, false),
+ "<html>By Score (< 4.0)</html>");
+ assertEquals(FeatureSettings.getColorTooltip(fc, true),
"<html>By Score (< 4.0)<br>" + simpleTooltip
+ "</br></html>");
+
fc.setAboveThreshold(true);
- assertEquals(FeatureSettings.getColorTooltip(fc),
+ assertEquals(FeatureSettings.getColorTooltip(fc, false),
+ "<html>By Score (> 4.0)</html>");
+ assertEquals(FeatureSettings.getColorTooltip(fc, true),
"<html>By Score (> 4.0)<br>" + simpleTooltip
+ "</br></html>");
}