package jalview.gui;
+import jalview.api.analysis.AnnotationFilterParameter;
import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AnnotationFilterParameter;
import jalview.datamodel.ColumnSelection;
-import jalview.jbgui.FurtherActionPanel;
-import jalview.jbgui.SearchPanel;
-import jalview.jbgui.StructureFilterPanel;
import jalview.schemes.AnnotationColourGradient;
import jalview.util.MessageManager;
import java.awt.event.ItemListener;
import java.util.Iterator;
+import javax.swing.ButtonGroup;
import javax.swing.JButton;
+import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
+import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
import net.miginfocom.swing.MigLayout;
ItemListener
{
- private ColumnSelection oldColumnSelection;
-
private JComboBox<String> annotations;
- JButton ok = new JButton();
+ private JButton ok = new JButton();
- JButton cancel = new JButton();
+ private JButton cancel = new JButton();
- JPanel actionPanel = new JPanel();
+ private JPanel actionPanel = new JPanel();
- JPanel thresholdPanel = new JPanel();
+ private JPanel thresholdPanel = new JPanel();
- JPanel switchableViewsPanel = new JPanel(new CardLayout());
+ private JPanel switchableViewsPanel = new JPanel(new CardLayout());
- CardLayout switchableViewsLayout = (CardLayout) (switchableViewsPanel
+ private CardLayout switchableViewsLayout = (CardLayout) (switchableViewsPanel
.getLayout());
- JPanel noGraphFilterView = new JPanel();
+ private JPanel noGraphFilterView = new JPanel();
- JPanel graphFilterView = new JPanel();
+ private JPanel graphFilterView = new JPanel();
- JPanel annotationComboBoxPanel = new JPanel();
+ private JPanel annotationComboBoxPanel = new JPanel();
- StructureFilterPanel gStructureFilterPanel;
+ private JLabel annotationLabel = new JLabel();
- StructureFilterPanel ngStructureFilterPanel;
+ private BorderLayout borderLayout1 = new BorderLayout();
- private StructureFilterPanel currentStructureFilterPanel;
+ private JComboBox<String> threshold = new JComboBox<String>();
- JLabel annotationLabel = new JLabel();
+ private StructureFilterPanel gStructureFilterPanel;
- BorderLayout borderLayout1 = new BorderLayout();
+ private StructureFilterPanel ngStructureFilterPanel;
- private JComboBox<String> threshold = new JComboBox<String>();
+ private StructureFilterPanel currentStructureFilterPanel;
private SearchPanel currentSearchPanel;
private int actionOption = ACTION_OPTION_SELECT;
+ private ColumnSelection oldColumnSelection;
+
+ public AnnotationColumnChooser()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap)
{
super(av, ap);
setAnnotations(new JComboBox<String>(getAnnotationItems(false)));
populateThresholdComboBox(threshold);
- // restore the Object state from the previous session if one exists
+ // restore Object state from the previous session if one exists
if (av.getAnnotationColumnSelectionState() != null)
{
currentSearchPanel = av.getAnnotationColumnSelectionState()
.getThreshold().getSelectedIndex());
actionOption = av.getAnnotationColumnSelectionState()
.getActionOption();
-
}
try
frame.pack();
}
- public AnnotationColumnChooser()
- {
- try
- {
- jbInit();
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
private void jbInit() throws Exception
{
ok.setOpaque(false);
ok_actionPerformed(e);
}
});
+
cancel.setOpaque(false);
cancel.setText(MessageManager.getString("action.cancel"));
cancel.addActionListener(new ActionListener()
}
});
- getAnnotations().addItemListener(this);
- getThreshold().addActionListener(new ActionListener()
+ annotations.addItemListener(this);
+ threshold.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
}
});
+ thresholdValue.setEnabled(false);
+ thresholdValue.setColumns(7);
thresholdValue.addActionListener(new ActionListener()
{
@Override
thresholdValue_actionPerformed(e);
}
});
+
slider.setPaintLabels(false);
slider.setPaintTicks(true);
slider.setBackground(Color.white);
slider.setEnabled(false);
slider.setOpaque(false);
slider.setPreferredSize(new Dimension(100, 32));
- thresholdValue.setEnabled(false);
- thresholdValue.setColumns(7);
annotationLabel.setBackground(Color.white);
annotationLabel.setFont(JvSwingUtils.getLabelFont());
actionPanel.setBackground(Color.white);
actionPanel.setFont(JvSwingUtils.getLabelFont());
- this.setLayout(borderLayout1);
graphFilterView.setLayout(new MigLayout("", "[left][right]", "[][]"));
graphFilterView.setBackground(Color.white);
gStructureFilterPanel = new StructureFilterPanel(this);
ngStructureFilterPanel = new StructureFilterPanel(this);
-
thresholdPanel.add(getThreshold());
thresholdPanel.add(thresholdValue, "wrap");
thresholdPanel.add(slider, "grow, span, wrap");
switchableViewsPanel.add(graphFilterView,
AnnotationColumnChooser.GRAPH_VIEW);
+ this.setLayout(borderLayout1);
this.add(annotationComboBoxPanel, java.awt.BorderLayout.PAGE_START);
this.add(switchableViewsPanel, java.awt.BorderLayout.CENTER);
this.add(actionPanel, java.awt.BorderLayout.SOUTH);
}
av.setColumnSelection(oldSelection);
}
- // ap.alignmentChanged();
ap.paintAlignment(true);
}
}
}
-
public void select_action(ActionEvent actionEvent)
{
JRadioButton radioButton = (JRadioButton) actionEvent.getSource();
}
}
-
@Override
public void itemStateChanged(ItemEvent e)
{
{
currentView = AnnotationColumnChooser.GRAPH_VIEW;
}
- // else{
- // threshold.setSelectedIndex(AlignmentAnnotation.NO_GRAPH);
- // }
-
+
gSearchPanel.syncState();
gFurtherActionPanel.syncState();
- gFurtherActionPanel.syncState();
- gFurtherActionPanel.syncState();
+ gStructureFilterPanel.syncState();
ngSearchPanel.syncState();
ngFurtherActionPanel.syncState();
ngStructureFilterPanel.syncState();
- ngFurtherActionPanel.syncState();
switchableViewsLayout.show(switchableViewsPanel, currentView);
updateView();
}
-
public FurtherActionPanel getCurrentFutherActionPanel()
{
return currentFurtherActionPanel;
this.currentStructureFilterPanel = currentStructureFilterPanel;
}
+ 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());
+ }
+ }
+ }
+
}
+++ /dev/null
-package jalview.jbgui;
-
-import jalview.gui.AnnotationColumnChooser;
-import jalview.gui.JvSwingUtils;
-
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JCheckBox;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.TitledBorder;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-@SuppressWarnings("serial")
-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());
- }
- }
-}
+++ /dev/null
-package jalview.jbgui;
-
-import jalview.gui.AnnotationColumnChooser;
-import jalview.gui.JvSwingUtils;
-
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JCheckBox;
-import javax.swing.JPanel;
-import javax.swing.border.TitledBorder;
-
-@SuppressWarnings("serial")
-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;
-
- }
-}
\ No newline at end of file