+
+ public ColumnSelection getOldColumnSelection()
+ {
+ return oldColumnSelection;
+ }
+
+ public void setOldColumnSelection(ColumnSelection currentColumnSelection)
+ {
+ if (currentColumnSelection != null)
+ {
+ this.oldColumnSelection = new ColumnSelection(currentColumnSelection);
+ }
+ }
+
+ public FurtherActionPanel getCurrentFutherActionPanel()
+ {
+ return currentFurtherActionPanel;
+ }
+
+ public void setCurrentFutherActionPanel(
+ FurtherActionPanel currentFutherActionPanel)
+ {
+ this.currentFurtherActionPanel = currentFutherActionPanel;
+ }
+
+ public SearchPanel getCurrentSearchPanel()
+ {
+ return currentSearchPanel;
+ }
+
+ public void setCurrentSearchPanel(SearchPanel currentSearchPanel)
+ {
+ this.currentSearchPanel = currentSearchPanel;
+ }
+
+ public int getActionOption()
+ {
+ return actionOption;
+ }
+
+ public void setActionOption(int actionOption)
+ {
+ this.actionOption = actionOption;
+ }
+
+ public StructureFilterPanel getCurrentStructureFilterPanel()
+ {
+ return currentStructureFilterPanel;
+ }
+
+ public void setCurrentStructureFilterPanel(
+ StructureFilterPanel currentStructureFilterPanel)
+ {
+ this.currentStructureFilterPanel = currentStructureFilterPanel;
+ }
+
+ public void select_action(ActionEvent actionEvent)
+ {
+ JRadioButton radioButton = (JRadioButton) actionEvent.getSource();
+ if (radioButton.isSelected())
+ {
+ setActionOption(ACTION_OPTION_SELECT);
+ updateView();
+ }
+ }
+
+ public void hide_action(ActionEvent actionEvent)
+ {
+ JRadioButton radioButton = (JRadioButton) actionEvent.getSource();
+ if (radioButton.isSelected())
+ {
+ setActionOption(ACTION_OPTION_HIDE);
+ updateView();
+ }
+ }
+
+ @Override
+ public void itemStateChanged(ItemEvent e)
+ {
+ selectedAnnotationChanged();
+ }
+
+ public void selectedAnnotationChanged()
+ {
+ String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW;
+ if (av.getAlignment().getAlignmentAnnotation()[annmap[getAnnotations()
+ .getSelectedIndex()]].graph != AlignmentAnnotation.NO_GRAPH)
+ {
+ currentView = AnnotationColumnChooser.GRAPH_VIEW;
+ }
+
+ gSearchPanel.syncState();
+ gFurtherActionPanel.syncState();
+ gStructureFilterPanel.syncState();
+
+ ngSearchPanel.syncState();
+ ngFurtherActionPanel.syncState();
+ ngStructureFilterPanel.syncState();
+
+ switchableViewsLayout.show(switchableViewsPanel, currentView);
+ updateView();
+ }
+
+ 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;
+ JvSwingUtils.jvInitComponent(selectOption, "action.select");
+ selectOption.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ selectRadioAction(actionEvent);
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(hideOption, "action.hide");
+ hideOption.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ hideRadioAction(actionEvent);
+ }
+ });
+
+ optionsGroup.add(selectOption);
+ optionsGroup.add(hideOption);
+ optionsGroup.setSelected(selectOption.getModel(), true);
+
+ JvSwingUtils.jvInitComponent(this);
+ syncState();
+
+ this.add(selectOption);
+ this.add(hideOption);
+ }
+
+ 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 void syncState()
+ {
+ if (aColChooser.getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE)
+ {
+ this.optionsGroup.setSelected(this.hideOption.getModel(), true);
+ }
+ else
+ {
+ this.optionsGroup.setSelected(this.selectOption.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;
+
+ JvSwingUtils.jvInitComponent(alphaHelix, "label.alpha_helix");
+ alphaHelix.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ alphaHelix_actionPerformed();
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(betaStrand, "label.beta_strand");
+ betaStrand.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ betaStrand_actionPerformed();
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(turn, "label.turn");
+ turn.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ turn_actionPerformed();
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(all, "label.select_all");
+ all.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ all_actionPerformed();
+ }
+ });
+
+ this.setBorder(new TitledBorder(MessageManager
+ .getString("label.structures_filter")));
+ JvSwingUtils.jvInitComponent(this);
+
+ 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.alphaHelix.isSelected());
+ betaStrand.setSelected(sfp.betaStrand.isSelected());
+ turn.setSelected(sfp.turn.isSelected());
+ if (sfp.all.isSelected())
+ {
+ all.setSelected(true);
+ alphaHelix.setSelected(true);
+ betaStrand.setSelected(true);
+ turn.setSelected(true);
+ }
+ }
+
+ }
+ }
+
+ public class SearchPanel extends JPanel
+ {
+ private AnnotationColumnChooser aColChooser;
+
+ private JCheckBox displayName = new JCheckBox();
+
+ private JCheckBox description = new JCheckBox();
+
+ private JTextField searchBox = new JTextField(10);
+
+ public SearchPanel(AnnotationColumnChooser aColChooser)
+ {
+
+ this.aColChooser = aColChooser;
+ JvSwingUtils.jvInitComponent(this);
+ this.setBorder(new TitledBorder(MessageManager
+ .getString("label.search_filter")));
+
+ JvSwingUtils.jvInitComponent(searchBox);
+ searchBox.setToolTipText(MessageManager
+ .getString("info.enter_search_text_here"));
+ searchBox.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();
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(displayName, "label.label");
+ displayName.setEnabled(false);
+ displayName.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ displayNameCheckboxAction();
+ }
+ });
+
+ JvSwingUtils.jvInitComponent(description, "label.description");
+ description.setEnabled(false);
+ description.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ discriptionCheckboxAction();
+ }
+ });
+
+ syncState();
+ this.add(searchBox);
+ this.add(displayName);
+ this.add(description);
+ }
+
+ public void displayNameCheckboxAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void discriptionCheckboxAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ }
+
+ public void searchStringAction()
+ {
+ aColChooser.setCurrentSearchPanel(this);
+ aColChooser.updateView();
+ updateSearchPanelToolTips();
+ }
+
+ public void syncState()
+ {
+ SearchPanel sp = aColChooser.getCurrentSearchPanel();
+ if (sp != null)
+ {
+ description.setEnabled(sp.description.isEnabled());
+ description.setSelected(sp.description.isSelected());
+
+ displayName.setEnabled(sp.displayName.isEnabled());
+ displayName.setSelected(sp.displayName.isSelected());
+
+ searchBox.setText(sp.searchBox.getText());
+ }
+ updateSearchPanelToolTips();
+ }
+
+ public void updateSearchPanelToolTips()
+ {
+ String defaultTtip = MessageManager
+ .getString("info.enter_search_text_to_enable");
+ String labelTtip = MessageManager.formatMessage(
+ "info.search_in_annotation_label", annotations
+ .getSelectedItem().toString());
+ String descTtip = MessageManager.formatMessage(
+ "info.search_in_annotation_description", annotations
+ .getSelectedItem().toString());
+ displayName.setToolTipText(displayName.isEnabled() ? labelTtip
+ : defaultTtip);
+ description.setToolTipText(description.isEnabled() ? descTtip
+ : defaultTtip);
+ }
+ }
+