JAL-3521 Change grouped Jalview windows on linux taskbar to have name Jalview
[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.io.FileFormatI;
26 import jalview.jbgui.GAlignExportSettings;
27 import jalview.util.MessageManager;
28
29 import java.awt.event.ActionEvent;
30 import java.awt.event.WindowAdapter;
31 import java.awt.event.WindowEvent;
32
33 import javax.swing.JDialog;
34 import javax.swing.JOptionPane;
35
36 @SuppressWarnings("serial")
37 public class AlignExportSettings extends GAlignExportSettings
38         implements AlignExportSettingI
39 {
40   boolean cancelled = false;
41
42   JDialog dialog;
43
44   public AlignExportSettings(boolean hasHiddenSeq, boolean hasHiddenCols,
45           FileFormatI format)
46   {
47     super(hasHiddenSeq, hasHiddenCols, format);
48     if (!Jalview.isHeadlessMode() && isShowDialog())
49     {
50
51       JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION,
52               JvOptionPane.DEFAULT_OPTION, null, new Object[]
53               { this });
54       dialog = pane.createDialog(Desktop.desktop,
55               MessageManager.getString("label.export_settings"));
56       dialog.addWindowListener(new WindowAdapter()
57       {
58         @Override
59         public void windowClosing(WindowEvent e)
60         {
61           cancelled = true;
62         }
63       });
64       dialog.pack();
65       dialog.setVisible(true);
66       dialog.setContentPane(this);
67       dialog.validate();
68
69     }
70   }
71
72   @Override
73   public void ok_actionPerformed(ActionEvent e)
74   {
75     cancelled = false;
76     dialog.setVisible(false);
77     dialog.dispose();
78   }
79
80   @Override
81   public void cancel_actionPerformed(ActionEvent e)
82   {
83     cancelled = true;
84     dialog.setVisible(false);
85     dialog.dispose();
86   }
87
88   @Override
89   public boolean isExportHiddenSequences()
90   {
91     return chkHiddenSeqs.isSelected();
92   }
93
94   @Override
95   public boolean isExportHiddenColumns()
96   {
97     return chkHiddenCols.isSelected();
98   }
99
100   @Override
101   public boolean isExportAnnotations()
102   {
103     return chkExportAnnots.isSelected();
104   }
105
106   @Override
107   public boolean isExportFeatures()
108   {
109     return chkExportFeats.isSelected();
110   }
111
112   @Override
113   public boolean isExportGroups()
114   {
115     return chkExportGrps.isSelected();
116   }
117
118   @Override
119   public boolean isCancelled()
120   {
121     return cancelled;
122   }
123
124 }