* if selected, colour settings are also applied to any
* feature sub-types in the Sequence Ontology
*/
- private JCheckBox applyColourToChildren;
+ private JCheckBox applyColourToSubtypes;
/**
* Constructor
colourByPanel.setLayout(new BoxLayout(colourByPanel, BoxLayout.Y_AXIS));
/*
+ * option to apply colour to sub-types as well (if there are any)
+ */
+ if (!subTypes.isEmpty())
+ {
+ JPanel toSubtypes = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+ toSubtypes.setBackground(Color.WHITE);
+ applyColourToSubtypes = new JCheckBox("Apply also to child terms");
+ applyColourToSubtypes.setToolTipText(getSubtypesTooltip());
+ toSubtypes.add(applyColourToSubtypes);
+ colourByPanel.add(toSubtypes);
+ }
+
+ /*
* simple colour radio button and colour picker
*/
JPanel simpleColourPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
FeatureColourI acg = makeColourFromInputs();
/*
- * save the colour, and repaint stuff
+ * save the colour, and set on subtypes if selected
*/
fr.setColour(featureType, acg);
+ if (applyColourToSubtypes.isSelected())
+ {
+ for (String child : subTypes)
+ {
+ fr.setColour(child, acg);
+ }
+ }
refreshFeatureSettings();
ap.paintAlignment(updateStructsAndOverview, updateStructsAndOverview);
JPanel panel2 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
panel2.setBackground(Color.white);
andOrPanel.add(panel2, BorderLayout.EAST);
- StringBuilder sb = new StringBuilder(20 * subTypes.size());
- sb.append("Apply filters also to child terms" + ":"); // todo i18n
- for (String child : subTypes)
- {
- sb.append("<br>").append(child);
- }
- String tooltip = JvSwingUtils.wrapTooltip(true, sb.toString());
+ String tooltip = getSubtypesTooltip();
applyFiltersToSubtypes.setToolTipText(tooltip);
panel2.add(applyFiltersToSubtypes);
}
}
/**
+ * Builds a tooltip for the 'Apply to subtypes' checkbox with a list of
+ * subtypes of this feature type
+ *
+ * @return
+ */
+ protected String getSubtypesTooltip()
+ {
+ StringBuilder sb = new StringBuilder(20 * subTypes.size());
+ sb.append("Apply filters also to child terms" + ":"); // todo i18n
+ for (String child : subTypes)
+ {
+ sb.append("<br>").append(child);
+ }
+ String tooltip = JvSwingUtils.wrapTooltip(true, sb.toString());
+ return tooltip;
+ }
+
+ /**
* Refreshes the display to show any filters currently configured for the
* selected feature type (editable, with 'remove' option), plus one extra row
* for adding a condition. This should be called after a filter has been