+ filters = new ArrayList<>();
+
+ /*
+ * choose feature type
+ */
+ JPanel chooseTypePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ chooseTypePanel.setBackground(Color.white);
+ JvSwingUtils.createItalicTitledBorder(chooseTypePanel,
+ MessageManager.getString("label.feature_type"), true);
+ filteredFeatureChoice = new JComboBox<>();
+ filteredFeatureChoice.addItemListener(new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ refreshFiltersDisplay();
+ }
+ });
+ chooseTypePanel.add(new JLabel(MessageManager
+ .getString("label.feature_to_filter")));
+ chooseTypePanel.add(filteredFeatureChoice);
+ populateFilterableFeatures();
+
+ /*
+ * the panel with the filters for the selected feature type
+ */
+ JPanel filtersPanel = new JPanel();
+ filtersPanel.setLayout(new BoxLayout(filtersPanel, BoxLayout.Y_AXIS));
+ filtersPanel.setBackground(Color.white);
+ JvSwingUtils.createItalicTitledBorder(filtersPanel,
+ MessageManager.getString("label.filters"), true);
+
+ /*
+ * add AND or OR radio buttons
+ */
+ JPanel andOrPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ andOrPanel.setBackground(Color.white);
+ andOrPanel.setBorder(BorderFactory.createLineBorder(debugBorderColour));
+ 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();
+ LayoutManager box = new BoxLayout(chooseFiltersPanel,
+ BoxLayout.Y_AXIS);
+ chooseFiltersPanel.setLayout(box);
+ filtersPanel.add(chooseFiltersPanel);
+
+ /*
+ * a read-only text view of the current filters
+ */
+ JPanel showFiltersPanel = new JPanel(new BorderLayout(5, 5));
+ showFiltersPanel.setBackground(Color.white);
+ JvSwingUtils.createItalicTitledBorder(showFiltersPanel,
+ MessageManager.getString("label.match_condition"), true);
+ filtersAsText = new JTextArea();
+ filtersAsText.setLineWrap(true);
+ filtersAsText.setWrapStyleWord(true);
+ showFiltersPanel.add(filtersAsText);
+
+ filtersPane.setLayout(new BorderLayout());
+ filtersPane.add(chooseTypePanel, BorderLayout.NORTH);
+ filtersPane.add(filtersPanel, BorderLayout.CENTER);
+ filtersPane.add(showFiltersPanel, BorderLayout.SOUTH);
+
+ /*
+ * update display for initial feature type selection
+ */
+ refreshFiltersDisplay();