private final List<String> subTypes;
/*
- * if selected, filter settings are also applied to any
- * feature sub-types in the Sequence Ontology
- */
- private JCheckBox applyFiltersToSubtypes;
-
- /*
* if selected, colour settings are also applied to any
* feature sub-types in the Sequence Ontology
*/
- private JCheckBox applyColourToSubtypes;
+ private JCheckBox applyToSubtypes;
/**
* Constructor
*/
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);
+ colourByPanel.add(initSubtypesPanel());
}
/*
return colourByPanel;
}
+ /**
+ * Constructs and returns a panel with a checkbox for the option to apply any
+ * changes also to sub-types of the feature type
+ *
+ * @return
+ */
+ protected JPanel initSubtypesPanel()
+ {
+ JPanel toSubtypes = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ toSubtypes.setBackground(Color.WHITE);
+ applyToSubtypes = new JCheckBox(
+ "Apply changes also to sub-types of " + featureType);
+ applyToSubtypes.setToolTipText(getSubtypesTooltip());
+ toSubtypes.add(applyToSubtypes);
+ return toSubtypes;
+ }
+
private void showColourChooser(JPanel colourPanel, String key)
{
Color col = JColorChooser.showDialog(this,
* save the colour, and set on subtypes if selected
*/
fr.setColour(featureType, acg);
- if (applyColourToSubtypes.isSelected())
+ if (applyToSubtypes.isSelected())
{
for (String child : subTypes)
{
{
filters = new ArrayList<>();
+ JPanel outerPanel = new JPanel();
+ outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.Y_AXIS));
+ outerPanel.setBackground(Color.white);
+
+ /*
+ * option to apply colour to sub-types as well (if there are any)
+ */
+ if (!subTypes.isEmpty())
+ {
+ outerPanel.add(initSubtypesPanel());
+ }
+
JPanel filtersPanel = new JPanel();
filtersPanel.setLayout(new BoxLayout(filtersPanel, BoxLayout.Y_AXIS));
filtersPanel.setBackground(Color.white);
JvSwingUtils.createTitledBorder(filtersPanel,
MessageManager.getString("label.filters"), true);
+ outerPanel.add(filtersPanel);
JPanel andOrPanel = initialiseAndOrPanel();
filtersPanel.add(andOrPanel);
chooseFiltersPanel.setBackground(Color.white);
filtersPanel.add(chooseFiltersPanel);
- return filtersPanel;
+ return outerPanel;
}
/**
panel1.add(andFilters);
panel1.add(orFilters);
- /*
- * add an 'Apply to child terms' checkbox if there are any child terms
- */
- applyFiltersToSubtypes = new JCheckBox("Apply also to child terms");
- if (!subTypes.isEmpty())
- {
- JPanel panel2 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
- panel2.setBackground(Color.white);
- andOrPanel.add(panel2, BorderLayout.EAST);
- String tooltip = getSubtypesTooltip();
- applyFiltersToSubtypes.setToolTipText(tooltip);
- panel2.add(applyFiltersToSubtypes);
- }
-
return andOrPanel;
}
protected String getSubtypesTooltip()
{
StringBuilder sb = new StringBuilder(20 * subTypes.size());
- sb.append("Apply filters also to child terms" + ":"); // todo i18n
+ sb.append("Apply settings also to" + ":"); // todo i18n
for (String child : subTypes)
{
sb.append("<br>").append(child);
* (note this might now be an empty filter with no conditions)
*/
fr.setFeatureFilter(featureType, combined.isEmpty() ? null : combined);
- if (applyFiltersToSubtypes.isSelected())
+ if (applyToSubtypes.isSelected())
{
for (String child : subTypes)
{