From: gmungoc Date: Thu, 2 Nov 2017 15:49:38 +0000 (+0000) Subject: JAL-2808 only initialise AND and OR buttons once X-Git-Tag: Release_2_11_0~156 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e86b28f4a636d6d7980830775a114023f4da5cf5;p=jalview.git JAL-2808 only initialise AND and OR buttons once --- diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index d90bf4e..d724b8c 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -1379,12 +1379,45 @@ public class FeatureSettings extends JPanel /* * the panel with the filters for the selected feature type */ - chooseFiltersPanel = new JPanel(new GridLayout(0, 1)); - chooseFiltersPanel.setBackground(Color.white); - chooseFiltersPanel.setBorder(BorderFactory + JPanel filtersPanel = new JPanel(new GridLayout(0, 1)); + filtersPanel.setBackground(Color.white); + filtersPanel.setBorder(BorderFactory .createTitledBorder(MessageManager.getString("label.filters"))); /* + * add AND or OR radio buttons + */ + JPanel andOrPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + andOrPanel.setBackground(Color.white); + andFilters = new JRadioButton("And"); + orFilters = new JRadioButton("Or"); + ActionListener actionListener = new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + filtersChanged(); + } + }; + andFilters.addActionListener(actionListener); + orFilters.addActionListener(actionListener); + ButtonGroup andOr = new ButtonGroup(); + andOr.add(andFilters); + andOr.add(orFilters); + andFilters.setSelected(true); + andOrPanel.add(new JLabel(MessageManager + .getString("label.join_conditions"))); + andOrPanel.add(andFilters); + andOrPanel.add(orFilters); + filtersPanel.add(andOrPanel); + + /* + * panel with filters - populated by refreshFiltersDisplay + */ + chooseFiltersPanel = new JPanel(new GridLayout(0, 1)); + filtersPanel.add(chooseFiltersPanel); + + /* * a read-only text view of the current filters */ JPanel showFiltersPanel = new JPanel(new BorderLayout(5, 5)); @@ -1399,7 +1432,7 @@ public class FeatureSettings extends JPanel filtersPane.setLayout(new BorderLayout()); filtersPane.add(chooseTypePanel, BorderLayout.NORTH); - filtersPane.add(chooseFiltersPanel, BorderLayout.CENTER); + filtersPane.add(filtersPanel, BorderLayout.CENTER); filtersPane.add(showFiltersPanel, BorderLayout.SOUTH); /* @@ -1464,33 +1497,6 @@ public class FeatureSettings extends JPanel filters.clear(); /* - * add AND or OR radio buttons - */ - JPanel andOrPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); - andOrPanel.setBackground(Color.white); - andFilters = new JRadioButton("And"); - orFilters = new JRadioButton("Or"); - ActionListener actionListener = new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - filtersChanged(); - } - }; - andFilters.addActionListener(actionListener); - orFilters.addActionListener(actionListener); - ButtonGroup andOr = new ButtonGroup(); - andOr.add(andFilters); - andOr.add(orFilters); - andFilters.setSelected(true); - andOrPanel.add(new JLabel(MessageManager - .getString("label.join_conditions"))); - andOrPanel.add(andFilters); - andOrPanel.add(orFilters); - chooseFiltersPanel.add(andOrPanel); - - /* * look up attributes known for feature type */ List attNames = FeatureAttributes.getInstance().getAttributes( @@ -1500,7 +1506,6 @@ public class FeatureSettings extends JPanel * if this feature type has filters set, load them first */ KeyedMatcherSetI featureFilters = fr.getFeatureFilter(selectedType); - andFilters.setSelected(true); filtersAsText.setText(""); if (featureFilters != null) {