2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.io.FileFormatI;
24 import jalview.util.MessageManager;
26 import java.awt.BorderLayout;
27 import java.awt.event.ActionEvent;
28 import java.awt.event.ActionListener;
29 import java.awt.event.ItemEvent;
30 import java.awt.event.ItemListener;
32 import javax.swing.JButton;
33 import javax.swing.JCheckBox;
34 import javax.swing.JPanel;
36 @SuppressWarnings("serial")
37 public abstract class GAlignExportSettings extends JPanel
39 protected JPanel hiddenRegionConfPanel = new JPanel();
41 protected JPanel complexExportPanel = new JPanel();
43 protected JPanel optionsPanel = new JPanel();
45 protected JPanel actionPanel = new JPanel();
47 protected BorderLayout hiddenRegionLayout = new BorderLayout();
49 protected BorderLayout complexExportLayout = new BorderLayout();
51 protected BorderLayout mainLayout = new BorderLayout();
53 protected JCheckBox chkAll = new JCheckBox();
55 protected JCheckBox chkHiddenSeqs = new JCheckBox();
57 protected JCheckBox chkHiddenCols = new JCheckBox();
59 protected JCheckBox chkExportAnnots = new JCheckBox();
61 protected JCheckBox chkExportFeats = new JCheckBox();
63 protected JCheckBox chkExportGrps = new JCheckBox();
65 private boolean hasHiddenSeq, hasHiddenCols, isComplexAlignFile,
68 public GAlignExportSettings(boolean hasHiddenSeq, boolean hasHiddenCols,
71 this.hasHiddenSeq = hasHiddenSeq;
72 this.hasHiddenCols = hasHiddenCols;
73 this.isComplexAlignFile = format.isComplexAlignFile();
74 if (this.hasHiddenCols || this.hasHiddenSeq || this.isComplexAlignFile)
76 this.showDialog = true;
83 chkHiddenSeqs.setText(
84 MessageManager.getString("action.export_hidden_sequences"));
85 chkHiddenCols.setText(
86 MessageManager.getString("action.export_hidden_columns"));
88 .setText(MessageManager.getString("action.export_annotations"));
90 .setText(MessageManager.getString("action.export_features"));
91 chkExportGrps.setText(MessageManager.getString("action.export_groups"));
92 chkAll.setText(MessageManager.getString("action.select_all"));
94 hiddenRegionConfPanel.setLayout(hiddenRegionLayout);
95 complexExportPanel.setLayout(complexExportLayout);
96 setLayout(mainLayout);
98 chkAll.addItemListener(new ItemListener()
101 public void itemStateChanged(ItemEvent e)
107 // hiddenRegionConfPanel.add(chkAll, BorderLayout.NORTH);
108 hiddenRegionConfPanel.add(chkHiddenSeqs, BorderLayout.CENTER);
109 hiddenRegionConfPanel.add(chkHiddenCols, BorderLayout.SOUTH);
110 chkHiddenSeqs.setEnabled(hasHiddenSeq);
111 chkHiddenCols.setEnabled(hasHiddenCols);
113 complexExportPanel.add(chkExportAnnots, BorderLayout.NORTH);
114 complexExportPanel.add(chkExportFeats, BorderLayout.CENTER);
115 complexExportPanel.add(chkExportGrps, BorderLayout.SOUTH);
117 actionPanel.add(chkAll);
119 if (this.isComplexAlignFile)
121 optionsPanel.add(complexExportPanel);
124 if (hasHiddenSeq || hasHiddenCols)
126 optionsPanel.add(hiddenRegionConfPanel);
129 add(optionsPanel, BorderLayout.NORTH);
130 add(actionPanel, BorderLayout.SOUTH);
134 private void checkAllAction()
136 boolean isSelected = chkAll.isSelected();
137 chkHiddenSeqs.setSelected(chkHiddenSeqs.isEnabled() && isSelected);
138 chkHiddenCols.setSelected(chkHiddenCols.isEnabled() && isSelected);
139 chkExportAnnots.setSelected(isComplexAlignFile
140 && chkExportAnnots.isEnabled() && isSelected);
141 chkExportFeats.setSelected(
142 isComplexAlignFile && chkExportFeats.isEnabled() && isSelected);
143 chkExportGrps.setSelected(
144 isComplexAlignFile && chkExportGrps.isEnabled() && isSelected);
147 public boolean isShowDialog()
152 public void setShowDialog(boolean showDialog)
154 this.showDialog = showDialog;
157 public abstract void ok_actionPerformed(ActionEvent e);
159 public abstract void cancel_actionPerformed(ActionEvent e);