1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import jalview.api.AlignExportSettingsI; |
24 |
|
import jalview.api.AlignViewportI; |
25 |
|
import jalview.io.FileFormatI; |
26 |
|
import jalview.util.MessageManager; |
27 |
|
|
28 |
|
import java.awt.BorderLayout; |
29 |
|
import java.awt.FlowLayout; |
30 |
|
import java.awt.event.ActionEvent; |
31 |
|
import java.awt.event.ActionListener; |
32 |
|
import java.awt.event.ItemEvent; |
33 |
|
import java.awt.event.ItemListener; |
34 |
|
|
35 |
|
import javax.swing.JCheckBox; |
36 |
|
import javax.swing.JPanel; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
@SuppressWarnings("serial") |
|
|
| 5% |
Uncovered Elements: 76 (80) |
Complexity: 18 |
Complexity Density: 0.29 |
|
44 |
|
public class AlignExportOptions extends JPanel |
45 |
|
{ |
46 |
|
protected JCheckBox chkHiddenSeqs = new JCheckBox(); |
47 |
|
|
48 |
|
protected JCheckBox chkHiddenCols = new JCheckBox(); |
49 |
|
|
50 |
|
protected JCheckBox chkExportAnnots = new JCheckBox(); |
51 |
|
|
52 |
|
protected JCheckBox chkExportFeats = new JCheckBox(); |
53 |
|
|
54 |
|
protected JCheckBox chkExportGrps = new JCheckBox(); |
55 |
|
|
56 |
|
protected AlignExportSettingsI settings; |
57 |
|
|
58 |
|
private boolean isComplexAlignFile; |
59 |
|
|
60 |
|
JvOptionPane dialog; |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
@param |
69 |
|
@param |
70 |
|
@return |
71 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 4 |
Complexity Density: 1.33 |
|
72 |
43 |
public static boolean isNeeded(AlignViewportI viewport,... |
73 |
|
FileFormatI format) |
74 |
|
{ |
75 |
43 |
if (viewport.hasHiddenColumns() || viewport.hasHiddenRows() |
76 |
|
|| format.isComplexAlignFile()) |
77 |
|
{ |
78 |
0 |
return true; |
79 |
|
} |
80 |
43 |
return false; |
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
@param |
90 |
|
@param |
91 |
|
@param |
92 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
93 |
0 |
public AlignExportOptions(AlignViewportI viewport, FileFormatI format,... |
94 |
|
AlignExportSettingsI defaults) |
95 |
|
{ |
96 |
0 |
this.settings = defaults; |
97 |
0 |
this.isComplexAlignFile = format.isComplexAlignFile(); |
98 |
0 |
init(viewport.hasHiddenRows(), viewport.hasHiddenColumns()); |
99 |
0 |
dialog = JvOptionPane.newOptionDialog(Desktop.desktop); |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
106 |
0 |
public void showDialog()... |
107 |
|
{ |
108 |
0 |
Object[] options = new Object[] { MessageManager.getString("action.ok"), |
109 |
|
MessageManager.getString("action.cancel") }; |
110 |
0 |
dialog.showInternalDialog(this, |
111 |
|
MessageManager.getString("label.export_settings"), |
112 |
|
JvOptionPane.OK_CANCEL_OPTION, JvOptionPane.PLAIN_MESSAGE, |
113 |
|
null, options, MessageManager.getString("action.ok")); |
114 |
|
} |
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
@param |
121 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
0 |
public void setResponseAction(Object response, Runnable action)... |
123 |
|
{ |
124 |
0 |
dialog.setResponseHandler(response, action); |
125 |
|
} |
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
@param |
132 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
|
133 |
0 |
void checkAllAction(boolean isSelected)... |
134 |
|
{ |
135 |
0 |
boolean set = chkHiddenSeqs.isEnabled() && isSelected; |
136 |
0 |
chkHiddenSeqs.setSelected(set); |
137 |
0 |
settings.setExportHiddenSequences(set); |
138 |
|
|
139 |
0 |
set = chkHiddenCols.isEnabled() && isSelected; |
140 |
0 |
chkHiddenCols.setSelected(set); |
141 |
0 |
settings.setExportHiddenColumns(set); |
142 |
|
|
143 |
0 |
set = isComplexAlignFile && chkExportAnnots.isEnabled() && isSelected; |
144 |
0 |
chkExportAnnots.setSelected(set); |
145 |
0 |
settings.setExportAnnotations(set); |
146 |
|
|
147 |
0 |
set = isComplexAlignFile && chkExportFeats.isEnabled() && isSelected; |
148 |
0 |
chkExportFeats.setSelected(set); |
149 |
0 |
settings.setExportFeatures(set); |
150 |
|
|
151 |
0 |
set = isComplexAlignFile && chkExportGrps.isEnabled() && isSelected; |
152 |
0 |
chkExportGrps.setSelected(set); |
153 |
0 |
settings.setExportGroups(set); |
154 |
|
} |
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
@param |
160 |
|
@param |
161 |
|
|
|
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 4 |
Complexity Density: 0.13 |
|
162 |
0 |
private void init(boolean hasHiddenSeq, boolean hasHiddenCols)... |
163 |
|
{ |
164 |
0 |
chkHiddenSeqs.setText( |
165 |
|
MessageManager.getString("action.export_hidden_sequences")); |
166 |
0 |
chkHiddenSeqs.addActionListener(new ActionListener() |
167 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
168 |
0 |
@Override... |
169 |
|
public void actionPerformed(ActionEvent e) |
170 |
|
{ |
171 |
0 |
settings.setExportHiddenSequences(chkHiddenSeqs.isSelected()); |
172 |
|
} |
173 |
|
}); |
174 |
|
|
175 |
0 |
chkHiddenCols.setText( |
176 |
|
MessageManager.getString("action.export_hidden_columns")); |
177 |
0 |
chkHiddenCols.addActionListener(new ActionListener() |
178 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
179 |
0 |
@Override... |
180 |
|
public void actionPerformed(ActionEvent e) |
181 |
|
{ |
182 |
0 |
settings.setExportHiddenColumns(chkHiddenCols.isSelected()); |
183 |
|
} |
184 |
|
}); |
185 |
|
|
186 |
0 |
chkExportAnnots |
187 |
|
.setText(MessageManager.getString("action.export_annotations")); |
188 |
0 |
chkExportAnnots.addActionListener(new ActionListener() |
189 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
190 |
0 |
@Override... |
191 |
|
public void actionPerformed(ActionEvent e) |
192 |
|
{ |
193 |
0 |
settings.setExportAnnotations(chkExportAnnots.isSelected()); |
194 |
|
} |
195 |
|
}); |
196 |
|
|
197 |
0 |
chkExportFeats |
198 |
|
.setText(MessageManager.getString("action.export_features")); |
199 |
0 |
chkExportFeats.addActionListener(new ActionListener() |
200 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
201 |
0 |
@Override... |
202 |
|
public void actionPerformed(ActionEvent e) |
203 |
|
{ |
204 |
0 |
settings.setExportFeatures(chkExportFeats.isSelected()); |
205 |
|
} |
206 |
|
}); |
207 |
|
|
208 |
0 |
chkExportGrps.setText(MessageManager.getString("action.export_groups")); |
209 |
0 |
chkExportGrps.addActionListener(new ActionListener() |
210 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
211 |
0 |
@Override... |
212 |
|
public void actionPerformed(ActionEvent e) |
213 |
|
{ |
214 |
0 |
settings.setExportGroups(chkExportGrps.isSelected()); |
215 |
|
} |
216 |
|
}); |
217 |
|
|
218 |
0 |
JCheckBox chkAll = new JCheckBox( |
219 |
|
MessageManager.getString("action.select_all")); |
220 |
|
|
221 |
0 |
JPanel hiddenRegionConfPanel = new JPanel(new BorderLayout()); |
222 |
0 |
JPanel complexExportPanel = new JPanel(new BorderLayout()); |
223 |
0 |
this.setLayout(new BorderLayout()); |
224 |
|
|
225 |
0 |
chkAll.addItemListener(new ItemListener() |
226 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
227 |
0 |
@Override... |
228 |
|
public void itemStateChanged(ItemEvent e) |
229 |
|
{ |
230 |
0 |
checkAllAction(chkAll.isSelected()); |
231 |
|
} |
232 |
|
}); |
233 |
|
|
234 |
0 |
hiddenRegionConfPanel.add(chkHiddenSeqs, BorderLayout.CENTER); |
235 |
0 |
hiddenRegionConfPanel.add(chkHiddenCols, BorderLayout.SOUTH); |
236 |
0 |
chkHiddenSeqs.setEnabled(hasHiddenSeq); |
237 |
0 |
chkHiddenCols.setEnabled(hasHiddenCols); |
238 |
|
|
239 |
0 |
complexExportPanel.add(chkExportAnnots, BorderLayout.NORTH); |
240 |
0 |
complexExportPanel.add(chkExportFeats, BorderLayout.CENTER); |
241 |
0 |
complexExportPanel.add(chkExportGrps, BorderLayout.SOUTH); |
242 |
|
|
243 |
0 |
JPanel actionPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); |
244 |
0 |
actionPanel.add(chkAll); |
245 |
|
|
246 |
0 |
JPanel optionsPanel = new JPanel(); |
247 |
0 |
if (this.isComplexAlignFile) |
248 |
|
{ |
249 |
0 |
optionsPanel.add(complexExportPanel); |
250 |
|
} |
251 |
|
|
252 |
0 |
if (hasHiddenSeq || hasHiddenCols) |
253 |
|
{ |
254 |
0 |
optionsPanel.add(hiddenRegionConfPanel); |
255 |
|
} |
256 |
|
|
257 |
0 |
add(optionsPanel, BorderLayout.NORTH); |
258 |
0 |
add(actionPanel, BorderLayout.SOUTH); |
259 |
|
} |
260 |
|
} |