JAL-2326 updated references of JOptionPane to JvOptionPane
[jalview.git] / src / jalview / gui / AlignExportSettings.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
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.
11  *  
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.
16  * 
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.
20  */
21 package jalview.gui;
22
23 import jalview.api.AlignExportSettingI;
24 import jalview.bin.Jalview;
25 import jalview.jbgui.GAlignExportSettings;
26 import jalview.util.MessageManager;
27
28 import java.awt.event.ActionEvent;
29 import java.awt.event.WindowAdapter;
30 import java.awt.event.WindowEvent;
31
32 import javax.swing.JDialog;
33 import javax.swing.JOptionPane;
34
35 @SuppressWarnings("serial")
36 public class AlignExportSettings extends GAlignExportSettings implements
37         AlignExportSettingI
38 {
39   boolean cancelled = false;
40
41   JDialog dialog;
42
43   public AlignExportSettings(boolean hasHiddenSeq, boolean hasHiddenCols,
44           String alignFileFormat)
45   {
46     super(hasHiddenSeq, hasHiddenCols, alignFileFormat);
47     if (!Jalview.isHeadlessMode() && isShowDialog())
48     {
49
50       JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION,
51               JvOptionPane.DEFAULT_OPTION, null, new Object[] { this });
52       dialog = pane.createDialog(Desktop.desktop,
53               MessageManager.getString("label.export_settings"));
54       dialog.addWindowListener(new WindowAdapter()
55       {
56         @Override
57         public void windowClosing(WindowEvent e)
58         {
59           cancelled = true;
60         }
61       });
62       dialog.pack();
63       dialog.setVisible(true);
64       dialog.setContentPane(this);
65       dialog.validate();
66
67     }
68   }
69
70   @Override
71   public void ok_actionPerformed(ActionEvent e)
72   {
73     cancelled = false;
74     dialog.setVisible(false);
75     dialog.dispose();
76   }
77
78   @Override
79   public void cancel_actionPerformed(ActionEvent e)
80   {
81     cancelled = true;
82     dialog.setVisible(false);
83     dialog.dispose();
84   }
85
86   @Override
87   public boolean isExportHiddenSequences()
88   {
89     return chkHiddenSeqs.isSelected();
90   }
91
92   @Override
93   public boolean isExportHiddenColumns()
94   {
95     return chkHiddenCols.isSelected();
96   }
97
98   @Override
99   public boolean isExportAnnotations()
100   {
101     return chkExportAnnots.isSelected();
102   }
103
104   @Override
105   public boolean isExportFeatures()
106   {
107     return chkExportFeats.isSelected();
108   }
109
110   @Override
111   public boolean isExportGroups()
112   {
113     return chkExportGrps.isSelected();
114   }
115
116   @Override
117   public boolean isCancelled()
118   {
119     return cancelled;
120   }
121
122 }