+ public class FurtherActionPanel extends JPanel
+ {
+ private AnnotationColumnChooser aColChooser;
+
+ private JRadioButton hideOption = new JRadioButton();
+
+ private JRadioButton selectOption = new JRadioButton();
+
+ private ButtonGroup optionsGroup = new ButtonGroup();
+
+ public FurtherActionPanel(AnnotationColumnChooser aColChooser)
+ {
+ this.aColChooser = aColChooser;
+ getSelectOption().setBackground(Color.white);
+ getSelectOption().setFont(JvSwingUtils.getLabelFont());
+ getSelectOption().setText("Select");
+ getSelectOption().addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ selectRadioAction(actionEvent);
+ }
+ });
+
+ getHideOption().setBackground(Color.white);
+ getHideOption().setFont(JvSwingUtils.getLabelFont());
+ getHideOption().setText("Hide");
+ getHideOption().addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ hideRadioAction(actionEvent);
+ }
+ });
+
+ getOptionsGroup().add(getSelectOption());
+ getOptionsGroup().add(getHideOption());
+ getOptionsGroup().setSelected(getSelectOption().getModel(), true);
+
+ this.setBackground(Color.white);
+ this.setFont(JvSwingUtils.getLabelFont());
+ syncState();
+
+ this.add(getSelectOption());
+ this.add(getHideOption());
+ }
+
+ public void selectRadioAction(ActionEvent actionEvent)
+ {
+ aColChooser.setCurrentFutherActionPanel(this);
+ aColChooser.select_action(actionEvent);
+ }
+
+ public void hideRadioAction(ActionEvent actionEvent)
+ {
+ aColChooser.setCurrentFutherActionPanel(this);
+ aColChooser.hide_action(actionEvent);
+ }
+
+ public JRadioButton getHideOption()
+ {
+ return hideOption;
+ }
+
+ public void setHideOption(JRadioButton hideOption)
+ {
+ this.hideOption = hideOption;
+ }
+
+ public JRadioButton getSelectOption()
+ {
+ return selectOption;
+ }
+
+ public void setSelectOption(JRadioButton selectOption)
+ {
+ this.selectOption = selectOption;
+ }
+
+ public ButtonGroup getOptionsGroup()
+ {
+ return optionsGroup;
+ }
+
+ public void setOptionsGroup(ButtonGroup optionsGroup)
+ {
+ this.optionsGroup = optionsGroup;
+ }
+
+ public void syncState()
+ {
+ if (aColChooser.getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE)
+ {
+ this.getOptionsGroup().setSelected(this.getHideOption().getModel(),
+ true);
+ }
+ else
+ {
+ this.getOptionsGroup().setSelected(
+ this.getSelectOption().getModel(), true);
+ }
+ }
+ }
+
+ public class StructureFilterPanel extends JPanel
+ {
+ private AnnotationColumnChooser aColChooser;
+
+ private JCheckBox alphaHelix = new JCheckBox();
+
+ private JCheckBox betaStrand = new JCheckBox();
+
+ private JCheckBox turn = new JCheckBox();
+
+ private JCheckBox all = new JCheckBox();
+
+ public StructureFilterPanel(AnnotationColumnChooser aColChooser)
+ {
+ this.aColChooser = aColChooser;
+
+ alphaHelix.setBackground(Color.white);
+ alphaHelix.setFont(JvSwingUtils.getLabelFont());
+ alphaHelix.setText("Alpha Helix");
+ alphaHelix.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ alphaHelix_actionPerformed();
+ }
+ });
+
+ betaStrand.setBackground(Color.white);
+ betaStrand.setFont(JvSwingUtils.getLabelFont());
+ betaStrand.setText("Beta Strand");
+ betaStrand.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ betaStrand_actionPerformed();
+ }
+ });
+
+ turn.setBackground(Color.white);
+ turn.setFont(JvSwingUtils.getLabelFont());
+ turn.setText("Turn");
+ turn.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ turn_actionPerformed();
+ }
+ });
+
+ all.setBackground(Color.white);
+ all.setFont(JvSwingUtils.getLabelFont());
+ all.setText("Select all");
+ all.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ all_actionPerformed();
+ }
+ });
+
+ this.setBorder(new TitledBorder("Structures Filter"));
+ this.setBackground(Color.white);
+ this.setFont(JvSwingUtils.getLabelFont());
+
+ this.add(all);
+ this.add(alphaHelix);
+ this.add(betaStrand);
+ this.add(turn);
+ }
+
+ public void alphaHelix_actionPerformed()
+ {
+ updateSelectAllState();
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void betaStrand_actionPerformed()
+ {
+ updateSelectAllState();
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void turn_actionPerformed()
+ {
+ updateSelectAllState();
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void all_actionPerformed()
+ {
+ if (all.isSelected())
+ {
+ alphaHelix.setSelected(true);
+ betaStrand.setSelected(true);
+ turn.setSelected(true);
+ }
+ else
+ {
+ alphaHelix.setSelected(false);
+ betaStrand.setSelected(false);
+ turn.setSelected(false);
+ }
+ aColChooser.setCurrentStructureFilterPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void updateSelectAllState()
+ {
+ if (alphaHelix.isSelected() && betaStrand.isSelected()
+ && turn.isSelected())
+ {
+ all.setSelected(true);
+ }
+ else
+ {
+ all.setSelected(false);
+ }
+ }
+
+ public void syncState()
+ {
+ StructureFilterPanel sfp = aColChooser
+ .getCurrentStructureFilterPanel();
+ if (sfp != null)
+ {
+ alphaHelix.setSelected(sfp.getAlphaHelix().isSelected());
+ betaStrand.setSelected(sfp.getBetaStrand().isSelected());
+ turn.setSelected(sfp.getTurn().isSelected());
+ if (sfp.getAll().isSelected())
+ {
+ all.setSelected(true);
+ alphaHelix.setSelected(true);
+ betaStrand.setSelected(true);
+ turn.setSelected(true);
+ }
+ }
+
+ }
+
+ public JCheckBox getAlphaHelix()
+ {
+ return alphaHelix;
+ }
+
+ public void setAlphaHelix(JCheckBox alphaHelix)
+ {
+ this.alphaHelix = alphaHelix;
+ }
+
+ public JCheckBox getBetaStrand()
+ {
+ return betaStrand;
+ }
+
+ public void setBetaStrand(JCheckBox betaStrand)
+ {
+ this.betaStrand = betaStrand;
+ }
+
+ public JCheckBox getTurn()
+ {
+ return turn;
+ }
+
+ public void setTurn(JCheckBox turn)
+ {
+ this.turn = turn;
+ }
+
+ public JCheckBox getAll()
+ {
+ return all;
+ }
+
+ public void setAll(JCheckBox all)
+ {
+ this.all = all;
+
+ }
+ }
+
+ public class SearchPanel extends JPanel
+ {
+ private AnnotationColumnChooser aColChooser;
+
+ private JCheckBox displayName = new JCheckBox();
+
+ private JCheckBox description = new JCheckBox();
+
+ private JTextField searchBox = new JTextField(10);
+
+ private JCheckBox structuresFilter = new JCheckBox();
+
+ public SearchPanel(AnnotationColumnChooser aColChooser)
+ {
+
+ this.aColChooser = aColChooser;
+ this.setBorder(new TitledBorder("Search Filter"));
+ this.setBackground(Color.white);
+ this.setFont(JvSwingUtils.getLabelFont());
+
+ getSearchBox().setBackground(Color.white);
+ getSearchBox().setFont(JvSwingUtils.getLabelFont());
+ getSearchBox().getDocument().addDocumentListener(
+ new DocumentListener()
+ {
+ @Override
+ public void insertUpdate(DocumentEvent e)
+ {
+ searchStringAction();
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e)
+ {
+ searchStringAction();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e)
+ {
+ searchStringAction();
+ }
+ });
+
+ getDisplayName().setBackground(Color.white);
+ getDisplayName().setFont(JvSwingUtils.getLabelFont());
+ getDisplayName().setText("Display Name");
+ getDisplayName().setEnabled(false);
+ getDisplayName().addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ displayNameCheckboxAction();
+ }
+ });
+
+ getDescription().setBackground(Color.white);
+ getDescription().setFont(JvSwingUtils.getLabelFont());
+ getDescription().setText("Description");
+ getDescription().setEnabled(false);
+ getDescription().addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ discriptionCheckboxAction();
+ }
+ });
+
+ syncState();
+ this.add(getSearchBox());
+ this.add(getDisplayName());
+ this.add(getDescription());
+ }
+
+ public boolean isDescriptionChecked()
+ {
+ return getDescription().isSelected();
+ }
+
+ public boolean isDisplayNameChecked()
+ {
+ return getDisplayName().isSelected();
+ }
+
+ public String getSearchString()
+ {
+ return getSearchBox().getText();
+ }
+
+ public void displayNameCheckboxAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void discriptionCheckboxAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void searchStringAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ }
+
+ public JCheckBox getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(JCheckBox displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ public JCheckBox getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(JCheckBox description)
+ {
+ this.description = description;
+ }
+
+ public JTextField getSearchBox()
+ {
+ return searchBox;
+ }
+
+ public void setSearchBox(JTextField searchBox)
+ {
+ this.searchBox = searchBox;
+ }
+
+ public JCheckBox getStructuresFilter()
+ {
+ return structuresFilter;
+ }
+
+ public void setStructuresFilter(JCheckBox structuresFilter)
+ {
+ this.structuresFilter = structuresFilter;
+ }
+
+ public void syncState()
+ {
+ SearchPanel sp = aColChooser.getCurrentSearchPanel();
+ if (sp != null)
+ {
+ description.setEnabled(sp.getDescription().isEnabled());
+ description.setSelected(sp.getDescription().isSelected());
+
+ displayName.setEnabled(sp.getDisplayName().isEnabled());
+ displayName.setSelected(sp.getDisplayName().isSelected());
+
+ searchBox.setText(sp.getSearchBox().getText());
+ }
+ }
+ }
+