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.analysis.AnnotationSorter.SequenceAnnotationOrder; |
24 |
|
import jalview.bin.Cache; |
25 |
|
import jalview.bin.Jalview; |
26 |
|
import jalview.gui.Help.HelpId; |
27 |
|
import jalview.gui.StructureViewer.ViewerType; |
28 |
|
import jalview.io.FileFormatI; |
29 |
|
import jalview.io.JalviewFileChooser; |
30 |
|
import jalview.io.JalviewFileView; |
31 |
|
import jalview.jbgui.GPreferences; |
32 |
|
import jalview.jbgui.GSequenceLink; |
33 |
|
import jalview.schemes.ColourSchemeI; |
34 |
|
import jalview.schemes.ColourSchemes; |
35 |
|
import jalview.schemes.ResidueColourScheme; |
36 |
|
import jalview.urls.UrlLinkTableModel; |
37 |
|
import jalview.urls.api.UrlProviderFactoryI; |
38 |
|
import jalview.urls.api.UrlProviderI; |
39 |
|
import jalview.urls.desktop.DesktopUrlProviderFactory; |
40 |
|
import jalview.util.MessageManager; |
41 |
|
import jalview.util.Platform; |
42 |
|
import jalview.util.UrlConstants; |
43 |
|
import jalview.ws.sifts.SiftsSettings; |
44 |
|
|
45 |
|
import java.awt.BorderLayout; |
46 |
|
import java.awt.Color; |
47 |
|
import java.awt.Component; |
48 |
|
import java.awt.Dimension; |
49 |
|
import java.awt.Font; |
50 |
|
import java.awt.event.ActionEvent; |
51 |
|
import java.awt.event.ActionListener; |
52 |
|
import java.awt.event.MouseEvent; |
53 |
|
import java.io.File; |
54 |
|
import java.util.ArrayList; |
55 |
|
import java.util.List; |
56 |
|
|
57 |
|
import javax.help.HelpSetException; |
58 |
|
import javax.swing.JComboBox; |
59 |
|
import javax.swing.JFileChooser; |
60 |
|
import javax.swing.JInternalFrame; |
61 |
|
import javax.swing.JPanel; |
62 |
|
import javax.swing.ListSelectionModel; |
63 |
|
import javax.swing.RowFilter; |
64 |
|
import javax.swing.RowSorter; |
65 |
|
import javax.swing.SortOrder; |
66 |
|
import javax.swing.event.DocumentEvent; |
67 |
|
import javax.swing.event.DocumentListener; |
68 |
|
import javax.swing.event.ListSelectionEvent; |
69 |
|
import javax.swing.event.ListSelectionListener; |
70 |
|
import javax.swing.table.TableCellRenderer; |
71 |
|
import javax.swing.table.TableColumn; |
72 |
|
import javax.swing.table.TableModel; |
73 |
|
import javax.swing.table.TableRowSorter; |
74 |
|
|
75 |
|
import ext.edu.ucsf.rbvi.strucviz2.StructureManager; |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
@author |
81 |
|
@version |
82 |
|
|
|
|
| 1.9% |
Uncovered Elements: 524 (534) |
Complexity: 87 |
Complexity Density: 0.21 |
|
83 |
|
public class Preferences extends GPreferences |
84 |
|
{ |
85 |
|
public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME"; |
86 |
|
|
87 |
|
public static final String SCALE_PROTEIN_TO_CDNA = "SCALE_PROTEIN_TO_CDNA"; |
88 |
|
|
89 |
|
public static final String DEFAULT_COLOUR = "DEFAULT_COLOUR"; |
90 |
|
|
91 |
|
public static final String DEFAULT_COLOUR_PROT = "DEFAULT_COLOUR_PROT"; |
92 |
|
|
93 |
|
public static final String DEFAULT_COLOUR_NUC = "DEFAULT_COLOUR_NUC"; |
94 |
|
|
95 |
|
public static final String ADD_TEMPFACT_ANN = "ADD_TEMPFACT_ANN"; |
96 |
|
|
97 |
|
public static final String ADD_SS_ANN = "ADD_SS_ANN"; |
98 |
|
|
99 |
|
public static final String USE_RNAVIEW = "USE_RNAVIEW"; |
100 |
|
|
101 |
|
public static final String STRUCT_FROM_PDB = "STRUCT_FROM_PDB"; |
102 |
|
|
103 |
|
public static final String STRUCTURE_DISPLAY = "STRUCTURE_DISPLAY"; |
104 |
|
|
105 |
|
public static final String CHIMERA_PATH = "CHIMERA_PATH"; |
106 |
|
|
107 |
|
public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS"; |
108 |
|
|
109 |
|
public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE"; |
110 |
|
|
111 |
|
public static final String SHOW_OCCUPANCY = "SHOW_OCCUPANCY"; |
112 |
|
|
113 |
|
public static final String SHOW_OV_HIDDEN_AT_START = "SHOW_OV_HIDDEN_AT_START"; |
114 |
|
|
115 |
|
public static final String USE_LEGACY_GAP = "USE_LEGACY_GAP"; |
116 |
|
|
117 |
|
public static final String GAP_COLOUR = "GAP_COLOUR"; |
118 |
|
|
119 |
|
public static final String HIDDEN_COLOUR = "HIDDEN_COLOUR"; |
120 |
|
|
121 |
|
private static final int MIN_FONT_SIZE = 1; |
122 |
|
|
123 |
|
private static final int MAX_FONT_SIZE = 30; |
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
public static UrlProviderI sequenceUrlLinks; |
130 |
|
|
131 |
|
public static UrlLinkTableModel dataModel; |
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
public static List<String> groupURLLinks; |
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 3 |
Complexity Density: 0.33 |
|
142 |
1 |
static... |
143 |
|
{ |
144 |
|
|
145 |
|
|
146 |
1 |
String inMenuString = Cache.getDefault("SEQUENCE_LINKS", ""); |
147 |
1 |
String notInMenuString = Cache.getDefault("STORED_LINKS", ""); |
148 |
1 |
String defaultUrl = Cache.getDefault("DEFAULT_URL", |
149 |
|
UrlConstants.DEFAULT_LABEL); |
150 |
|
|
151 |
|
|
152 |
|
|
153 |
1 |
if (inMenuString.isEmpty() && notInMenuString.isEmpty()) |
154 |
|
{ |
155 |
0 |
inMenuString = UrlConstants.DEFAULT_STRING; |
156 |
|
} |
157 |
1 |
UrlProviderFactoryI factory = new DesktopUrlProviderFactory(defaultUrl, |
158 |
|
inMenuString, notInMenuString); |
159 |
1 |
sequenceUrlLinks = factory.createUrlProvider(); |
160 |
1 |
dataModel = new UrlLinkTableModel(sequenceUrlLinks); |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
1 |
groupURLLinks = new ArrayList<>(); |
168 |
|
} |
169 |
|
|
170 |
|
JInternalFrame frame; |
171 |
|
|
172 |
|
private WsPreferences wsPrefs; |
173 |
|
|
174 |
|
private OptionsParam promptEachTimeOpt = new OptionsParam( |
175 |
|
MessageManager.getString("label.prompt_each_time"), |
176 |
|
"Prompt each time"); |
177 |
|
|
178 |
|
private OptionsParam lineArtOpt = new OptionsParam( |
179 |
|
MessageManager.getString("label.lineart"), "Lineart"); |
180 |
|
|
181 |
|
private OptionsParam textOpt = new OptionsParam( |
182 |
|
MessageManager.getString("action.text"), "Text"); |
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
|
|
| 0% |
Uncovered Elements: 179 (179) |
Complexity: 12 |
Complexity Density: 0.08 |
|
187 |
0 |
public Preferences()... |
188 |
|
{ |
189 |
0 |
super(); |
190 |
0 |
frame = new JInternalFrame(); |
191 |
0 |
frame.setContentPane(this); |
192 |
0 |
if (!Jalview.isJS()) |
193 |
|
{ |
194 |
0 |
wsPrefs = new WsPreferences(); |
195 |
0 |
wsTab.add(wsPrefs, BorderLayout.CENTER); |
196 |
|
} |
197 |
0 |
int width = 500, height = 450; |
198 |
0 |
if (Platform.isAMac()) |
199 |
|
{ |
200 |
0 |
width = 570; |
201 |
0 |
height = 480; |
202 |
|
} |
203 |
|
|
204 |
0 |
Desktop.addInternalFrame(frame, |
205 |
|
MessageManager.getString("label.preferences"), width, height); |
206 |
0 |
frame.setMinimumSize(new Dimension(width, height)); |
207 |
|
|
208 |
|
|
209 |
|
|
210 |
|
|
211 |
0 |
seqLimit.setSelected(Cache.getDefault("SHOW_JVSUFFIX", true)); |
212 |
0 |
rightAlign.setSelected(Cache.getDefault("RIGHT_ALIGN_IDS", false)); |
213 |
0 |
fullScreen.setSelected(Cache.getDefault("SHOW_FULLSCREEN", false)); |
214 |
0 |
annotations.setSelected(Cache.getDefault("SHOW_ANNOTATIONS", true)); |
215 |
|
|
216 |
0 |
conservation.setSelected(Cache.getDefault("SHOW_CONSERVATION", true)); |
217 |
0 |
quality.setSelected(Cache.getDefault("SHOW_QUALITY", true)); |
218 |
0 |
identity.setSelected(Cache.getDefault("SHOW_IDENTITY", true)); |
219 |
0 |
openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false)); |
220 |
0 |
showUnconserved |
221 |
|
.setSelected(Cache.getDefault("SHOW_UNCONSERVED", false)); |
222 |
0 |
showOccupancy.setSelected(Cache.getDefault(SHOW_OCCUPANCY, false)); |
223 |
0 |
showGroupConsensus |
224 |
|
.setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS", false)); |
225 |
0 |
showGroupConservation.setSelected( |
226 |
|
Cache.getDefault("SHOW_GROUP_CONSERVATION", false)); |
227 |
0 |
showConsensHistogram.setSelected( |
228 |
|
Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM", true)); |
229 |
0 |
showConsensLogo |
230 |
|
.setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO", false)); |
231 |
0 |
showNpTooltip |
232 |
|
.setSelected(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true)); |
233 |
0 |
showDbRefTooltip |
234 |
|
.setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true)); |
235 |
|
|
236 |
0 |
String[] fonts = java.awt.GraphicsEnvironment |
237 |
|
.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); |
238 |
0 |
for (int i = 0; i < fonts.length; i++) |
239 |
|
{ |
240 |
0 |
fontNameCB.addItem(fonts[i]); |
241 |
|
} |
242 |
|
|
243 |
0 |
for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++) |
244 |
|
{ |
245 |
0 |
fontSizeCB.addItem(i + ""); |
246 |
|
} |
247 |
|
|
248 |
0 |
fontStyleCB.addItem("plain"); |
249 |
0 |
fontStyleCB.addItem("bold"); |
250 |
0 |
fontStyleCB.addItem("italic"); |
251 |
|
|
252 |
0 |
fontNameCB.setSelectedItem(Cache.getDefault("FONT_NAME", "SansSerif")); |
253 |
0 |
fontSizeCB.setSelectedItem(Cache.getDefault("FONT_SIZE", "10")); |
254 |
0 |
fontStyleCB.setSelectedItem( |
255 |
|
Cache.getDefault("FONT_STYLE", Font.PLAIN + "")); |
256 |
|
|
257 |
0 |
smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", false)); |
258 |
0 |
scaleProteinToCdna |
259 |
|
.setSelected(Cache.getDefault(SCALE_PROTEIN_TO_CDNA, false)); |
260 |
|
|
261 |
0 |
idItalics.setSelected(Cache.getDefault("ID_ITALICS", true)); |
262 |
|
|
263 |
0 |
wrap.setSelected(Cache.getDefault("WRAP_ALIGNMENT", false)); |
264 |
|
|
265 |
0 |
gapSymbolCB.addItem("-"); |
266 |
0 |
gapSymbolCB.addItem("."); |
267 |
|
|
268 |
0 |
gapSymbolCB.setSelectedItem(Cache.getDefault("GAP_SYMBOL", "-")); |
269 |
|
|
270 |
0 |
sortby.addItem("No sort"); |
271 |
0 |
sortby.addItem("Id"); |
272 |
0 |
sortby.addItem("Pairwise Identity"); |
273 |
0 |
sortby.setSelectedItem(Cache.getDefault("SORT_ALIGNMENT", "No sort")); |
274 |
|
|
275 |
0 |
sortAnnBy.addItem(SequenceAnnotationOrder.NONE.toString()); |
276 |
0 |
sortAnnBy |
277 |
|
.addItem(SequenceAnnotationOrder.SEQUENCE_AND_LABEL.toString()); |
278 |
0 |
sortAnnBy |
279 |
|
.addItem(SequenceAnnotationOrder.LABEL_AND_SEQUENCE.toString()); |
280 |
0 |
SequenceAnnotationOrder savedSort = SequenceAnnotationOrder |
281 |
|
.valueOf(Cache.getDefault(SORT_ANNOTATIONS, |
282 |
|
SequenceAnnotationOrder.NONE.name())); |
283 |
0 |
sortAnnBy.setSelectedItem(savedSort.toString()); |
284 |
|
|
285 |
0 |
sortAutocalc.addItem("Autocalculated first"); |
286 |
0 |
sortAutocalc.addItem("Autocalculated last"); |
287 |
0 |
final boolean showAbove = Cache.getDefault(SHOW_AUTOCALC_ABOVE, true); |
288 |
0 |
sortAutocalc.setSelectedItem(showAbove ? sortAutocalc.getItemAt(0) |
289 |
|
: sortAutocalc.getItemAt(1)); |
290 |
0 |
startupCheckbox |
291 |
|
.setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true)); |
292 |
0 |
startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE", |
293 |
|
Cache.getDefault("www.jalview.org", "http://www.jalview.org") |
294 |
|
+ "/examples/exampleFile_2_3.jar")); |
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
|
299 |
0 |
protColour.addItem(ResidueColourScheme.NONE); |
300 |
0 |
nucColour.addItem(ResidueColourScheme.NONE); |
301 |
0 |
for (ColourSchemeI cs : ColourSchemes.getInstance().getColourSchemes()) |
302 |
|
{ |
303 |
0 |
String name = cs.getSchemeName(); |
304 |
0 |
protColour.addItem(name); |
305 |
0 |
nucColour.addItem(name); |
306 |
|
} |
307 |
0 |
String oldProp = Cache.getDefault(DEFAULT_COLOUR, |
308 |
|
ResidueColourScheme.NONE); |
309 |
0 |
String newProp = Cache.getDefault(DEFAULT_COLOUR_PROT, null); |
310 |
0 |
protColour.setSelectedItem(newProp != null ? newProp : oldProp); |
311 |
0 |
newProp = Cache.getDefault(DEFAULT_COLOUR_NUC, null); |
312 |
0 |
nucColour.setSelectedItem(newProp != null ? newProp : oldProp); |
313 |
0 |
minColour.setBackground( |
314 |
|
Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange)); |
315 |
0 |
maxColour.setBackground( |
316 |
|
Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red)); |
317 |
|
|
318 |
|
|
319 |
|
|
320 |
|
|
321 |
0 |
gapColour.setBackground( |
322 |
|
Cache.getDefaultColour(GAP_COLOUR, |
323 |
|
jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP)); |
324 |
0 |
hiddenColour.setBackground( |
325 |
|
Cache.getDefaultColour(HIDDEN_COLOUR, |
326 |
|
jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN)); |
327 |
0 |
useLegacyGap.setSelected(Cache.getDefault(USE_LEGACY_GAP, false)); |
328 |
0 |
gapLabel.setEnabled(!useLegacyGap.isSelected()); |
329 |
0 |
gapColour.setEnabled(!useLegacyGap.isSelected()); |
330 |
0 |
showHiddenAtStart |
331 |
|
.setSelected(Cache.getDefault(SHOW_OV_HIDDEN_AT_START, true)); |
332 |
|
|
333 |
|
|
334 |
|
|
335 |
|
|
336 |
0 |
final boolean structSelected = Cache.getDefault(STRUCT_FROM_PDB, false); |
337 |
0 |
structFromPdb.setSelected(structSelected); |
338 |
0 |
useRnaView.setSelected(Cache.getDefault(USE_RNAVIEW, false)); |
339 |
0 |
useRnaView.setEnabled(structSelected); |
340 |
0 |
addSecondaryStructure.setSelected(Cache.getDefault(ADD_SS_ANN, false)); |
341 |
0 |
addSecondaryStructure.setEnabled(structSelected); |
342 |
0 |
addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false)); |
343 |
0 |
addTempFactor.setEnabled(structSelected); |
344 |
0 |
structViewer.setSelectedItem( |
345 |
|
Cache.getDefault(STRUCTURE_DISPLAY, ViewerType.JMOL.name())); |
346 |
0 |
chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, "")); |
347 |
0 |
chimeraPath.addActionListener(new ActionListener() |
348 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
349 |
0 |
@Override... |
350 |
|
public void actionPerformed(ActionEvent e) |
351 |
|
{ |
352 |
0 |
validateChimeraPath(); |
353 |
|
} |
354 |
|
}); |
355 |
|
|
356 |
0 |
if (Cache.getDefault("MAP_WITH_SIFTS", false)) |
357 |
|
{ |
358 |
0 |
siftsMapping.setSelected(true); |
359 |
|
} |
360 |
|
else |
361 |
|
{ |
362 |
0 |
nwMapping.setSelected(true); |
363 |
|
} |
364 |
|
|
365 |
0 |
SiftsSettings |
366 |
|
.setMapWithSifts(Cache.getDefault("MAP_WITH_SIFTS", false)); |
367 |
|
|
368 |
|
|
369 |
|
|
370 |
|
|
371 |
|
|
372 |
|
|
373 |
0 |
linkUrlTable.setModel(dataModel); |
374 |
0 |
final TableRowSorter<TableModel> sorter = new TableRowSorter<>( |
375 |
|
linkUrlTable.getModel()); |
376 |
0 |
linkUrlTable.setRowSorter(sorter); |
377 |
0 |
List<RowSorter.SortKey> sortKeys = new ArrayList<>(); |
378 |
|
|
379 |
0 |
UrlLinkTableModel m = (UrlLinkTableModel) linkUrlTable.getModel(); |
380 |
0 |
sortKeys.add(new RowSorter.SortKey(m.getPrimaryColumn(), |
381 |
|
SortOrder.DESCENDING)); |
382 |
0 |
sortKeys.add(new RowSorter.SortKey(m.getSelectedColumn(), |
383 |
|
SortOrder.DESCENDING)); |
384 |
0 |
sortKeys.add( |
385 |
|
new RowSorter.SortKey(m.getNameColumn(), SortOrder.ASCENDING)); |
386 |
|
|
387 |
0 |
sorter.setSortKeys(sortKeys); |
388 |
|
|
389 |
|
|
390 |
|
|
391 |
|
|
392 |
0 |
ActionListener onReset; |
393 |
0 |
onReset = new ActionListener() |
394 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
395 |
0 |
@Override... |
396 |
|
public void actionPerformed(ActionEvent e) |
397 |
|
{ |
398 |
0 |
filterTB.setText(""); |
399 |
0 |
sorter.setRowFilter(RowFilter.regexFilter("")); |
400 |
|
} |
401 |
|
|
402 |
|
}; |
403 |
0 |
doReset.addActionListener(onReset); |
404 |
|
|
405 |
|
|
406 |
0 |
final RowFilter<TableModel, Object> customUrlFilter = new RowFilter<TableModel, Object>() |
407 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
408 |
0 |
@Override... |
409 |
|
public boolean include( |
410 |
|
Entry<? extends TableModel, ? extends Object> entry) |
411 |
|
{ |
412 |
0 |
return ((UrlLinkTableModel) entry.getModel()).isUserEntry(entry); |
413 |
|
} |
414 |
|
}; |
415 |
|
|
416 |
0 |
final TableRowSorter<TableModel> customSorter = new TableRowSorter<>( |
417 |
|
linkUrlTable.getModel()); |
418 |
0 |
customSorter.setRowFilter(customUrlFilter); |
419 |
|
|
420 |
0 |
ActionListener onCustomOnly; |
421 |
0 |
onCustomOnly = new ActionListener() |
422 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
423 |
0 |
@Override... |
424 |
|
public void actionPerformed(ActionEvent e) |
425 |
|
{ |
426 |
0 |
filterTB.setText(""); |
427 |
0 |
sorter.setRowFilter(customUrlFilter); |
428 |
|
} |
429 |
|
}; |
430 |
0 |
userOnly.addActionListener(onCustomOnly); |
431 |
|
|
432 |
0 |
filterTB.getDocument().addDocumentListener(new DocumentListener() |
433 |
|
{ |
434 |
|
String caseInsensitiveFlag = "(?i)"; |
435 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
436 |
0 |
@Override... |
437 |
|
public void changedUpdate(DocumentEvent e) |
438 |
|
{ |
439 |
0 |
sorter.setRowFilter(RowFilter |
440 |
|
.regexFilter(caseInsensitiveFlag + filterTB.getText())); |
441 |
|
} |
442 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
443 |
0 |
@Override... |
444 |
|
public void removeUpdate(DocumentEvent e) |
445 |
|
{ |
446 |
0 |
sorter.setRowFilter(RowFilter |
447 |
|
.regexFilter(caseInsensitiveFlag + filterTB.getText())); |
448 |
|
} |
449 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
450 |
0 |
@Override... |
451 |
|
public void insertUpdate(DocumentEvent e) |
452 |
|
{ |
453 |
0 |
sorter.setRowFilter(RowFilter |
454 |
|
.regexFilter(caseInsensitiveFlag + filterTB.getText())); |
455 |
|
} |
456 |
|
}); |
457 |
|
|
458 |
|
|
459 |
0 |
linkUrlTable.getSelectionModel() |
460 |
|
.addListSelectionListener(new UrlListSelectionHandler()); |
461 |
|
|
462 |
|
|
463 |
0 |
int onClickCol = ((UrlLinkTableModel) linkUrlTable.getModel()) |
464 |
|
.getPrimaryColumn(); |
465 |
0 |
String onClickName = linkUrlTable.getColumnName(onClickCol); |
466 |
0 |
linkUrlTable.getColumn(onClickName) |
467 |
|
.setCellRenderer(new RadioButtonRenderer()); |
468 |
0 |
linkUrlTable.getColumn(onClickName) |
469 |
|
.setCellEditor(new RadioButtonEditor()); |
470 |
|
|
471 |
|
|
472 |
0 |
for (int column = 0; column < linkUrlTable.getColumnCount(); column++) |
473 |
|
{ |
474 |
0 |
if (linkUrlTable.getModel().getColumnClass(column) |
475 |
|
.equals(Boolean.class)) |
476 |
|
{ |
477 |
0 |
TableColumn tableColumn = linkUrlTable.getColumnModel() |
478 |
|
.getColumn(column); |
479 |
0 |
int preferredWidth = tableColumn.getMinWidth(); |
480 |
|
|
481 |
0 |
TableCellRenderer cellRenderer = linkUrlTable.getCellRenderer(0, |
482 |
|
column); |
483 |
0 |
Component c = linkUrlTable.prepareRenderer(cellRenderer, 0, column); |
484 |
0 |
int cwidth = c.getPreferredSize().width |
485 |
|
+ linkUrlTable.getIntercellSpacing().width; |
486 |
0 |
preferredWidth = Math.max(preferredWidth, cwidth); |
487 |
|
|
488 |
0 |
tableColumn.setPreferredWidth(preferredWidth); |
489 |
|
} |
490 |
|
} |
491 |
|
|
492 |
0 |
useProxy.setSelected(Cache.getDefault("USE_PROXY", false)); |
493 |
0 |
useProxy_actionPerformed(); |
494 |
0 |
proxyServerTB.setText(Cache.getDefault("PROXY_SERVER", "")); |
495 |
0 |
proxyPortTB.setText(Cache.getDefault("PROXY_PORT", "")); |
496 |
|
|
497 |
0 |
defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", "")); |
498 |
|
|
499 |
0 |
usagestats.setSelected(Cache.getDefault("USAGESTATS", false)); |
500 |
|
|
501 |
0 |
questionnaire |
502 |
|
.setSelected(Cache.getProperty("NOQUESTIONNAIRES") == null); |
503 |
0 |
versioncheck.setSelected(Cache.getDefault("VERSION_CHECK", true)); |
504 |
|
|
505 |
|
|
506 |
|
|
507 |
|
|
508 |
0 |
setupOutputCombo(epsRendering, "EPS_RENDERING"); |
509 |
0 |
setupOutputCombo(htmlRendering, "HTML_RENDERING"); |
510 |
0 |
setupOutputCombo(svgRendering, "SVG_RENDERING"); |
511 |
0 |
autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false)); |
512 |
0 |
userIdWidth.setEnabled(!autoIdWidth.isSelected()); |
513 |
0 |
userIdWidthlabel.setEnabled(!autoIdWidth.isSelected()); |
514 |
0 |
Integer wi = Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH"); |
515 |
0 |
userIdWidth.setText(wi == null ? "" : wi.toString()); |
516 |
|
|
517 |
|
|
518 |
0 |
blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true)); |
519 |
0 |
clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true)); |
520 |
0 |
fastajv.setSelected(Cache.getDefault("FASTA_JVSUFFIX", true)); |
521 |
0 |
msfjv.setSelected(Cache.getDefault("MSF_JVSUFFIX", true)); |
522 |
0 |
pfamjv.setSelected(Cache.getDefault("PFAM_JVSUFFIX", true)); |
523 |
0 |
pileupjv.setSelected(Cache.getDefault("PILEUP_JVSUFFIX", true)); |
524 |
0 |
pirjv.setSelected(Cache.getDefault("PIR_JVSUFFIX", true)); |
525 |
0 |
modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false)); |
526 |
0 |
embbedBioJSON |
527 |
|
.setSelected(Cache.getDefault("EXPORT_EMBBED_BIOJSON", true)); |
528 |
|
|
529 |
|
|
530 |
|
|
531 |
|
|
532 |
0 |
autoCalculateConsCheck |
533 |
|
.setSelected(Cache.getDefault("AUTO_CALC_CONSENSUS", true)); |
534 |
0 |
padGaps.setSelected(Cache.getDefault("PAD_GAPS", false)); |
535 |
0 |
sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false)); |
536 |
|
|
537 |
0 |
annotations_actionPerformed(null); |
538 |
|
|
539 |
|
} |
540 |
|
|
541 |
|
|
542 |
|
|
543 |
|
|
544 |
|
|
545 |
|
@param |
546 |
|
@param |
547 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
548 |
0 |
protected void setupOutputCombo(JComboBox<Object> comboBox,... |
549 |
|
String propertyKey) |
550 |
|
{ |
551 |
0 |
comboBox.addItem(promptEachTimeOpt); |
552 |
0 |
comboBox.addItem(lineArtOpt); |
553 |
0 |
comboBox.addItem(textOpt); |
554 |
|
|
555 |
|
|
556 |
|
|
557 |
|
|
558 |
0 |
String defaultOption = Jalview.isJS() ? "Text" |
559 |
|
: Cache.getDefault(propertyKey, "Prompt each time"); |
560 |
0 |
if (defaultOption.equalsIgnoreCase("Text")) |
561 |
|
{ |
562 |
0 |
comboBox.setSelectedItem(textOpt); |
563 |
|
} |
564 |
0 |
else if (defaultOption.equalsIgnoreCase("Lineart")) |
565 |
|
{ |
566 |
0 |
comboBox.setSelectedItem(lineArtOpt); |
567 |
|
} |
568 |
|
else |
569 |
|
{ |
570 |
0 |
comboBox.setSelectedItem(promptEachTimeOpt); |
571 |
|
} |
572 |
|
} |
573 |
|
|
574 |
|
|
575 |
|
|
576 |
|
|
577 |
|
|
578 |
|
@param |
579 |
|
|
|
|
| 0% |
Uncovered Elements: 116 (116) |
Complexity: 11 |
Complexity Density: 0.11 |
|
580 |
0 |
@Override... |
581 |
|
public void ok_actionPerformed(ActionEvent e) |
582 |
|
{ |
583 |
0 |
if (!validateSettings()) |
584 |
|
{ |
585 |
0 |
return; |
586 |
|
} |
587 |
|
|
588 |
|
|
589 |
|
|
590 |
|
|
591 |
0 |
Cache.applicationProperties.setProperty("SHOW_JVSUFFIX", |
592 |
|
Boolean.toString(seqLimit.isSelected())); |
593 |
0 |
Cache.applicationProperties.setProperty("RIGHT_ALIGN_IDS", |
594 |
|
Boolean.toString(rightAlign.isSelected())); |
595 |
0 |
Cache.applicationProperties.setProperty("SHOW_FULLSCREEN", |
596 |
|
Boolean.toString(fullScreen.isSelected())); |
597 |
0 |
Cache.applicationProperties.setProperty("SHOW_OVERVIEW", |
598 |
|
Boolean.toString(openoverv.isSelected())); |
599 |
0 |
Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", |
600 |
|
Boolean.toString(annotations.isSelected())); |
601 |
0 |
Cache.applicationProperties.setProperty("SHOW_CONSERVATION", |
602 |
|
Boolean.toString(conservation.isSelected())); |
603 |
0 |
Cache.applicationProperties.setProperty("SHOW_QUALITY", |
604 |
|
Boolean.toString(quality.isSelected())); |
605 |
0 |
Cache.applicationProperties.setProperty("SHOW_IDENTITY", |
606 |
|
Boolean.toString(identity.isSelected())); |
607 |
|
|
608 |
0 |
Cache.applicationProperties.setProperty("GAP_SYMBOL", |
609 |
|
gapSymbolCB.getSelectedItem().toString()); |
610 |
|
|
611 |
0 |
Cache.applicationProperties.setProperty("FONT_NAME", |
612 |
|
fontNameCB.getSelectedItem().toString()); |
613 |
0 |
Cache.applicationProperties.setProperty("FONT_STYLE", |
614 |
|
fontStyleCB.getSelectedItem().toString()); |
615 |
0 |
Cache.applicationProperties.setProperty("FONT_SIZE", |
616 |
|
fontSizeCB.getSelectedItem().toString()); |
617 |
|
|
618 |
0 |
Cache.applicationProperties.setProperty("ID_ITALICS", |
619 |
|
Boolean.toString(idItalics.isSelected())); |
620 |
0 |
Cache.applicationProperties.setProperty("SHOW_UNCONSERVED", |
621 |
|
Boolean.toString(showUnconserved.isSelected())); |
622 |
0 |
Cache.applicationProperties.setProperty(SHOW_OCCUPANCY, |
623 |
|
Boolean.toString(showOccupancy.isSelected())); |
624 |
0 |
Cache.applicationProperties.setProperty("SHOW_GROUP_CONSENSUS", |
625 |
|
Boolean.toString(showGroupConsensus.isSelected())); |
626 |
0 |
Cache.applicationProperties.setProperty("SHOW_GROUP_CONSERVATION", |
627 |
|
Boolean.toString(showGroupConservation.isSelected())); |
628 |
0 |
Cache.applicationProperties.setProperty("SHOW_CONSENSUS_HISTOGRAM", |
629 |
|
Boolean.toString(showConsensHistogram.isSelected())); |
630 |
0 |
Cache.applicationProperties.setProperty("SHOW_CONSENSUS_LOGO", |
631 |
|
Boolean.toString(showConsensLogo.isSelected())); |
632 |
0 |
Cache.applicationProperties.setProperty("ANTI_ALIAS", |
633 |
|
Boolean.toString(smoothFont.isSelected())); |
634 |
0 |
Cache.applicationProperties.setProperty(SCALE_PROTEIN_TO_CDNA, |
635 |
|
Boolean.toString(scaleProteinToCdna.isSelected())); |
636 |
0 |
Cache.applicationProperties.setProperty("SHOW_NPFEATS_TOOLTIP", |
637 |
|
Boolean.toString(showNpTooltip.isSelected())); |
638 |
0 |
Cache.applicationProperties.setProperty("SHOW_DBREFS_TOOLTIP", |
639 |
|
Boolean.toString(showDbRefTooltip.isSelected())); |
640 |
|
|
641 |
0 |
Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", |
642 |
|
Boolean.toString(wrap.isSelected())); |
643 |
|
|
644 |
0 |
Cache.applicationProperties.setProperty("STARTUP_FILE", |
645 |
|
startupFileTextfield.getText()); |
646 |
0 |
Cache.applicationProperties.setProperty("SHOW_STARTUP_FILE", |
647 |
|
Boolean.toString(startupCheckbox.isSelected())); |
648 |
|
|
649 |
0 |
Cache.applicationProperties.setProperty("SORT_ALIGNMENT", |
650 |
|
sortby.getSelectedItem().toString()); |
651 |
|
|
652 |
|
|
653 |
0 |
SequenceAnnotationOrder annSortOrder = SequenceAnnotationOrder |
654 |
|
.forDescription(sortAnnBy.getSelectedItem().toString()); |
655 |
0 |
if (annSortOrder != null) |
656 |
|
{ |
657 |
0 |
Cache.applicationProperties.setProperty(SORT_ANNOTATIONS, |
658 |
|
annSortOrder.name()); |
659 |
|
} |
660 |
|
|
661 |
0 |
final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0; |
662 |
0 |
Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE, |
663 |
|
Boolean.valueOf(showAutocalcFirst).toString()); |
664 |
|
|
665 |
|
|
666 |
|
|
667 |
|
|
668 |
0 |
Cache.applicationProperties.setProperty(DEFAULT_COLOUR_PROT, |
669 |
|
protColour.getSelectedItem().toString()); |
670 |
0 |
Cache.applicationProperties.setProperty(DEFAULT_COLOUR_NUC, |
671 |
|
nucColour.getSelectedItem().toString()); |
672 |
0 |
Cache.setColourProperty("ANNOTATIONCOLOUR_MIN", |
673 |
|
minColour.getBackground()); |
674 |
0 |
Cache.setColourProperty("ANNOTATIONCOLOUR_MAX", |
675 |
|
maxColour.getBackground()); |
676 |
|
|
677 |
|
|
678 |
|
|
679 |
|
|
680 |
0 |
Cache.setColourProperty(GAP_COLOUR, gapColour.getBackground()); |
681 |
0 |
Cache.setColourProperty(HIDDEN_COLOUR, hiddenColour.getBackground()); |
682 |
0 |
Cache.applicationProperties.setProperty(USE_LEGACY_GAP, |
683 |
|
Boolean.toString(useLegacyGap.isSelected())); |
684 |
0 |
Cache.applicationProperties.setProperty(SHOW_OV_HIDDEN_AT_START, |
685 |
|
Boolean.toString(showHiddenAtStart.isSelected())); |
686 |
|
|
687 |
|
|
688 |
|
|
689 |
|
|
690 |
0 |
Cache.applicationProperties.setProperty(ADD_TEMPFACT_ANN, |
691 |
|
Boolean.toString(addTempFactor.isSelected())); |
692 |
0 |
Cache.applicationProperties.setProperty(ADD_SS_ANN, |
693 |
|
Boolean.toString(addSecondaryStructure.isSelected())); |
694 |
0 |
Cache.applicationProperties.setProperty(USE_RNAVIEW, |
695 |
|
Boolean.toString(useRnaView.isSelected())); |
696 |
0 |
Cache.applicationProperties.setProperty(STRUCT_FROM_PDB, |
697 |
|
Boolean.toString(structFromPdb.isSelected())); |
698 |
0 |
Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY, |
699 |
|
structViewer.getSelectedItem().toString()); |
700 |
0 |
Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText()); |
701 |
0 |
Cache.applicationProperties.setProperty("MAP_WITH_SIFTS", |
702 |
|
Boolean.toString(siftsMapping.isSelected())); |
703 |
0 |
SiftsSettings.setMapWithSifts(siftsMapping.isSelected()); |
704 |
|
|
705 |
|
|
706 |
|
|
707 |
|
|
708 |
0 |
Cache.applicationProperties.setProperty("EPS_RENDERING", |
709 |
|
((OptionsParam) epsRendering.getSelectedItem()).getCode()); |
710 |
0 |
Cache.applicationProperties.setProperty("HTML_RENDERING", |
711 |
|
((OptionsParam) htmlRendering.getSelectedItem()).getCode()); |
712 |
0 |
Cache.applicationProperties.setProperty("SVG_RENDERING", |
713 |
|
((OptionsParam) svgRendering.getSelectedItem()).getCode()); |
714 |
|
|
715 |
|
|
716 |
|
|
717 |
|
|
718 |
0 |
Cache.setOrRemove("DEFAULT_BROWSER", defaultBrowser.getText()); |
719 |
|
|
720 |
0 |
jalview.util.BrowserLauncher.resetBrowser(); |
721 |
|
|
722 |
|
|
723 |
0 |
String menuLinks = sequenceUrlLinks.writeUrlsAsString(true); |
724 |
0 |
if (menuLinks.isEmpty()) |
725 |
|
{ |
726 |
0 |
Cache.applicationProperties.remove("SEQUENCE_LINKS"); |
727 |
|
} |
728 |
|
else |
729 |
|
{ |
730 |
0 |
Cache.applicationProperties.setProperty("SEQUENCE_LINKS", |
731 |
|
menuLinks.toString()); |
732 |
|
} |
733 |
|
|
734 |
0 |
String nonMenuLinks = sequenceUrlLinks.writeUrlsAsString(false); |
735 |
0 |
if (nonMenuLinks.isEmpty()) |
736 |
|
{ |
737 |
0 |
Cache.applicationProperties.remove("STORED_LINKS"); |
738 |
|
} |
739 |
|
else |
740 |
|
{ |
741 |
0 |
Cache.applicationProperties.setProperty("STORED_LINKS", |
742 |
|
nonMenuLinks.toString()); |
743 |
|
} |
744 |
|
|
745 |
0 |
Cache.applicationProperties.setProperty("DEFAULT_URL", |
746 |
|
sequenceUrlLinks.getPrimaryUrlId()); |
747 |
|
|
748 |
0 |
Cache.applicationProperties.setProperty("USE_PROXY", |
749 |
|
Boolean.toString(useProxy.isSelected())); |
750 |
|
|
751 |
0 |
Cache.setOrRemove("PROXY_SERVER", proxyServerTB.getText()); |
752 |
|
|
753 |
0 |
Cache.setOrRemove("PROXY_PORT", proxyPortTB.getText()); |
754 |
|
|
755 |
0 |
if (useProxy.isSelected()) |
756 |
|
{ |
757 |
0 |
System.setProperty("http.proxyHost", proxyServerTB.getText()); |
758 |
0 |
System.setProperty("http.proxyPort", proxyPortTB.getText()); |
759 |
|
} |
760 |
|
else |
761 |
|
{ |
762 |
0 |
System.setProperty("http.proxyHost", ""); |
763 |
0 |
System.setProperty("http.proxyPort", ""); |
764 |
|
} |
765 |
0 |
Cache.setProperty("VERSION_CHECK", |
766 |
|
Boolean.toString(versioncheck.isSelected())); |
767 |
0 |
if (Cache.getProperty("USAGESTATS") != null || usagestats.isSelected()) |
768 |
|
{ |
769 |
|
|
770 |
0 |
Cache.setProperty("USAGESTATS", |
771 |
|
Boolean.toString(usagestats.isSelected())); |
772 |
|
} |
773 |
0 |
if (!questionnaire.isSelected()) |
774 |
|
{ |
775 |
0 |
Cache.setProperty("NOQUESTIONNAIRES", "true"); |
776 |
|
} |
777 |
|
else |
778 |
|
{ |
779 |
|
|
780 |
|
|
781 |
0 |
Cache.removeProperty("NOQUESTIONNAIRES"); |
782 |
|
} |
783 |
|
|
784 |
|
|
785 |
|
|
786 |
|
|
787 |
0 |
Cache.applicationProperties.setProperty("BLC_JVSUFFIX", |
788 |
|
Boolean.toString(blcjv.isSelected())); |
789 |
0 |
Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX", |
790 |
|
Boolean.toString(clustaljv.isSelected())); |
791 |
0 |
Cache.applicationProperties.setProperty("FASTA_JVSUFFIX", |
792 |
|
Boolean.toString(fastajv.isSelected())); |
793 |
0 |
Cache.applicationProperties.setProperty("MSF_JVSUFFIX", |
794 |
|
Boolean.toString(msfjv.isSelected())); |
795 |
0 |
Cache.applicationProperties.setProperty("PFAM_JVSUFFIX", |
796 |
|
Boolean.toString(pfamjv.isSelected())); |
797 |
0 |
Cache.applicationProperties.setProperty("PILEUP_JVSUFFIX", |
798 |
|
Boolean.toString(pileupjv.isSelected())); |
799 |
0 |
Cache.applicationProperties.setProperty("PIR_JVSUFFIX", |
800 |
|
Boolean.toString(pirjv.isSelected())); |
801 |
0 |
Cache.applicationProperties.setProperty("PIR_MODELLER", |
802 |
|
Boolean.toString(modellerOutput.isSelected())); |
803 |
0 |
Cache.applicationProperties.setProperty("EXPORT_EMBBED_BIOJSON", |
804 |
|
Boolean.toString(embbedBioJSON.isSelected())); |
805 |
0 |
jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected(); |
806 |
|
|
807 |
0 |
Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH", |
808 |
|
Boolean.toString(autoIdWidth.isSelected())); |
809 |
0 |
userIdWidth_actionPerformed(); |
810 |
0 |
Cache.applicationProperties.setProperty("FIGURE_FIXEDIDWIDTH", |
811 |
|
userIdWidth.getText()); |
812 |
|
|
813 |
|
|
814 |
|
|
815 |
|
|
816 |
0 |
Cache.applicationProperties.setProperty("AUTO_CALC_CONSENSUS", |
817 |
|
Boolean.toString(autoCalculateConsCheck.isSelected())); |
818 |
0 |
Cache.applicationProperties.setProperty("SORT_BY_TREE", |
819 |
|
Boolean.toString(sortByTree.isSelected())); |
820 |
0 |
Cache.applicationProperties.setProperty("PAD_GAPS", |
821 |
|
Boolean.toString(padGaps.isSelected())); |
822 |
|
|
823 |
0 |
if (!Jalview.isJS()) |
824 |
|
{ |
825 |
0 |
wsPrefs.updateAndRefreshWsMenuConfig(false); |
826 |
|
} |
827 |
0 |
Cache.saveProperties(); |
828 |
0 |
Desktop.instance.doConfigureStructurePrefs(); |
829 |
0 |
try |
830 |
|
{ |
831 |
0 |
frame.setClosed(true); |
832 |
|
} catch (Exception ex) |
833 |
|
{ |
834 |
|
} |
835 |
|
} |
836 |
|
|
837 |
|
|
838 |
|
|
839 |
|
|
840 |
|
|
841 |
|
@return |
842 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
843 |
0 |
private boolean validateSettings()... |
844 |
|
{ |
845 |
0 |
if (!validateStructure()) |
846 |
|
{ |
847 |
0 |
structureTab.requestFocusInWindow(); |
848 |
0 |
return false; |
849 |
|
} |
850 |
0 |
return true; |
851 |
|
} |
852 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
853 |
0 |
@Override... |
854 |
|
protected boolean validateStructure() |
855 |
|
{ |
856 |
0 |
return validateChimeraPath(); |
857 |
|
|
858 |
|
} |
859 |
|
|
860 |
|
|
861 |
|
|
862 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
863 |
0 |
@Override... |
864 |
|
public void startupFileTextfield_mouseClicked() |
865 |
|
{ |
866 |
|
|
867 |
0 |
String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT"); |
868 |
0 |
JalviewFileChooser chooser = JalviewFileChooser |
869 |
|
.forRead(Cache.getProperty("LAST_DIRECTORY"), fileFormat); |
870 |
0 |
chooser.setFileView(new JalviewFileView()); |
871 |
0 |
chooser.setDialogTitle( |
872 |
|
MessageManager.getString("label.select_startup_file")); |
873 |
|
|
874 |
0 |
int value = chooser.showOpenDialog(this); |
875 |
|
|
876 |
0 |
if (value == JalviewFileChooser.APPROVE_OPTION) |
877 |
|
{ |
878 |
0 |
FileFormatI format = chooser.getSelectedFormat(); |
879 |
0 |
if (format != null) |
880 |
|
{ |
881 |
0 |
Cache.applicationProperties.setProperty("DEFAULT_FILE_FORMAT", |
882 |
|
format.getName()); |
883 |
|
} |
884 |
0 |
startupFileTextfield |
885 |
|
.setText(chooser.getSelectedFile().getAbsolutePath()); |
886 |
|
} |
887 |
|
} |
888 |
|
|
889 |
|
|
890 |
|
|
891 |
|
|
892 |
|
@param |
893 |
|
|
894 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
895 |
0 |
@Override... |
896 |
|
public void cancel_actionPerformed(ActionEvent e) |
897 |
|
{ |
898 |
0 |
try |
899 |
|
{ |
900 |
0 |
if (!Jalview.isJS()) |
901 |
|
{ |
902 |
0 |
wsPrefs.updateWsMenuConfig(true); |
903 |
0 |
wsPrefs.refreshWs_actionPerformed(e); |
904 |
|
} |
905 |
0 |
frame.setClosed(true); |
906 |
|
} catch (Exception ex) |
907 |
|
{ |
908 |
|
} |
909 |
|
} |
910 |
|
|
911 |
|
|
912 |
|
|
913 |
|
|
914 |
|
@param |
915 |
|
|
916 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
917 |
0 |
@Override... |
918 |
|
public void annotations_actionPerformed(ActionEvent e) |
919 |
|
{ |
920 |
0 |
conservation.setEnabled(annotations.isSelected()); |
921 |
0 |
quality.setEnabled(annotations.isSelected()); |
922 |
0 |
identity.setEnabled(annotations.isSelected()); |
923 |
0 |
showOccupancy.setEnabled(annotations.isSelected()); |
924 |
0 |
showGroupConsensus.setEnabled(annotations.isSelected()); |
925 |
0 |
showGroupConservation.setEnabled(annotations.isSelected()); |
926 |
0 |
showConsensHistogram.setEnabled(annotations.isSelected() |
927 |
|
&& (identity.isSelected() || showGroupConsensus.isSelected())); |
928 |
0 |
showConsensLogo.setEnabled(annotations.isSelected() |
929 |
|
&& (identity.isSelected() || showGroupConsensus.isSelected())); |
930 |
|
} |
931 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0.45 |
|
932 |
0 |
@Override... |
933 |
|
public void newLink_actionPerformed(ActionEvent e) |
934 |
|
{ |
935 |
0 |
GSequenceLink link = new GSequenceLink(); |
936 |
0 |
boolean valid = false; |
937 |
0 |
while (!valid) |
938 |
|
{ |
939 |
0 |
if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link, |
940 |
|
MessageManager.getString("label.new_sequence_url_link"), |
941 |
|
JvOptionPane.OK_CANCEL_OPTION, -1, |
942 |
|
null) == JvOptionPane.OK_OPTION) |
943 |
|
{ |
944 |
0 |
if (link.checkValid()) |
945 |
|
{ |
946 |
0 |
if (((UrlLinkTableModel) linkUrlTable.getModel()) |
947 |
|
.isUniqueName(link.getName())) |
948 |
|
{ |
949 |
0 |
((UrlLinkTableModel) linkUrlTable.getModel()) |
950 |
|
.insertRow(link.getName(), link.getURL()); |
951 |
0 |
valid = true; |
952 |
|
} |
953 |
|
else |
954 |
|
{ |
955 |
0 |
link.notifyDuplicate(); |
956 |
0 |
continue; |
957 |
|
} |
958 |
|
} |
959 |
|
} |
960 |
|
else |
961 |
|
{ |
962 |
0 |
break; |
963 |
|
} |
964 |
|
} |
965 |
|
} |
966 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 7 |
Complexity Density: 0.33 |
|
967 |
0 |
@Override... |
968 |
|
public void editLink_actionPerformed(ActionEvent e) |
969 |
|
{ |
970 |
0 |
GSequenceLink link = new GSequenceLink(); |
971 |
|
|
972 |
0 |
int index = linkUrlTable.getSelectedRow(); |
973 |
0 |
if (index == -1) |
974 |
|
{ |
975 |
|
|
976 |
0 |
Cache.log.debug("Edit with no row selected in linkUrlTable"); |
977 |
0 |
return; |
978 |
|
} |
979 |
|
|
980 |
0 |
int nameCol = ((UrlLinkTableModel) linkUrlTable.getModel()) |
981 |
|
.getNameColumn(); |
982 |
0 |
int urlCol = ((UrlLinkTableModel) linkUrlTable.getModel()) |
983 |
|
.getUrlColumn(); |
984 |
0 |
String oldName = linkUrlTable.getValueAt(index, nameCol).toString(); |
985 |
0 |
link.setName(oldName); |
986 |
0 |
link.setURL(linkUrlTable.getValueAt(index, urlCol).toString()); |
987 |
|
|
988 |
0 |
boolean valid = false; |
989 |
0 |
while (!valid) |
990 |
|
{ |
991 |
0 |
if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link, |
992 |
|
MessageManager.getString("label.edit_sequence_url_link"), |
993 |
|
JvOptionPane.OK_CANCEL_OPTION, -1, |
994 |
|
null) == JvOptionPane.OK_OPTION) |
995 |
|
{ |
996 |
0 |
if (link.checkValid()) |
997 |
|
{ |
998 |
0 |
if ((oldName.equals(link.getName())) |
999 |
|
|| (((UrlLinkTableModel) linkUrlTable.getModel()) |
1000 |
|
.isUniqueName(link.getName()))) |
1001 |
|
{ |
1002 |
0 |
linkUrlTable.setValueAt(link.getName(), index, nameCol); |
1003 |
0 |
linkUrlTable.setValueAt(link.getURL(), index, urlCol); |
1004 |
0 |
valid = true; |
1005 |
|
} |
1006 |
|
else |
1007 |
|
{ |
1008 |
0 |
link.notifyDuplicate(); |
1009 |
0 |
continue; |
1010 |
|
} |
1011 |
|
} |
1012 |
|
} |
1013 |
|
else |
1014 |
|
{ |
1015 |
0 |
break; |
1016 |
|
} |
1017 |
|
} |
1018 |
|
} |
1019 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
1020 |
0 |
@Override... |
1021 |
|
public void deleteLink_actionPerformed(ActionEvent e) |
1022 |
|
{ |
1023 |
0 |
int index = linkUrlTable.getSelectedRow(); |
1024 |
0 |
int modelIndex = -1; |
1025 |
0 |
if (index == -1) |
1026 |
|
{ |
1027 |
|
|
1028 |
0 |
Cache.log.debug("Delete with no row selected in linkUrlTable"); |
1029 |
0 |
return; |
1030 |
|
} |
1031 |
|
else |
1032 |
|
{ |
1033 |
0 |
modelIndex = linkUrlTable.convertRowIndexToModel(index); |
1034 |
|
} |
1035 |
|
|
1036 |
|
|
1037 |
0 |
((UrlLinkTableModel) linkUrlTable.getModel()).removeRow(modelIndex); |
1038 |
|
} |
1039 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
1040 |
0 |
@Override... |
1041 |
|
public void defaultBrowser_mouseClicked(MouseEvent e) |
1042 |
|
{ |
1043 |
|
|
1044 |
|
|
1045 |
|
|
1046 |
|
|
1047 |
|
{ |
1048 |
0 |
JFileChooser chooser = new JFileChooser("."); |
1049 |
0 |
chooser.setDialogTitle( |
1050 |
|
MessageManager.getString("label.select_default_browser")); |
1051 |
|
|
1052 |
0 |
int value = chooser.showOpenDialog(this); |
1053 |
|
|
1054 |
0 |
if (value == JFileChooser.APPROVE_OPTION) |
1055 |
|
{ |
1056 |
0 |
defaultBrowser.setText(chooser.getSelectedFile().getAbsolutePath()); |
1057 |
|
} |
1058 |
|
} |
1059 |
|
} |
1060 |
|
|
1061 |
|
|
1062 |
|
|
1063 |
|
|
1064 |
|
@see |
1065 |
|
|
1066 |
|
|
1067 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1068 |
0 |
@Override... |
1069 |
|
protected void showunconserved_actionPerformed(ActionEvent e) |
1070 |
|
{ |
1071 |
|
|
1072 |
0 |
super.showunconserved_actionPerformed(e); |
1073 |
|
} |
1074 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1075 |
0 |
public static List<String> getGroupURLLinks()... |
1076 |
|
{ |
1077 |
0 |
return groupURLLinks; |
1078 |
|
} |
1079 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1080 |
0 |
@Override... |
1081 |
|
public void minColour_actionPerformed(JPanel panel) |
1082 |
|
{ |
1083 |
0 |
JalviewColourChooser.showColourChooser(this, |
1084 |
|
MessageManager.getString("label.select_colour_minimum_value"), |
1085 |
|
panel); |
1086 |
|
} |
1087 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1088 |
0 |
@Override... |
1089 |
|
public void maxColour_actionPerformed(JPanel panel) |
1090 |
|
{ |
1091 |
0 |
JalviewColourChooser.showColourChooser(this, |
1092 |
|
MessageManager.getString("label.select_colour_maximum_value"), |
1093 |
|
panel); |
1094 |
|
} |
1095 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1096 |
0 |
@Override... |
1097 |
|
public void gapColour_actionPerformed(JPanel gap) |
1098 |
|
{ |
1099 |
0 |
if (!useLegacyGap.isSelected()) |
1100 |
|
{ |
1101 |
0 |
JalviewColourChooser.showColourChooser(this, |
1102 |
|
MessageManager.getString("label.select_gap_colour"), |
1103 |
|
gap); |
1104 |
|
} |
1105 |
|
} |
1106 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1107 |
0 |
@Override... |
1108 |
|
public void hiddenColour_actionPerformed(JPanel hidden) |
1109 |
|
{ |
1110 |
0 |
JalviewColourChooser.showColourChooser(this, |
1111 |
|
MessageManager.getString("label.select_hidden_colour"), |
1112 |
|
hidden); |
1113 |
|
} |
1114 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
1115 |
0 |
@Override... |
1116 |
|
protected void useLegacyGaps_actionPerformed(ActionEvent e) |
1117 |
|
{ |
1118 |
0 |
boolean enabled = useLegacyGap.isSelected(); |
1119 |
0 |
if (enabled) |
1120 |
|
{ |
1121 |
0 |
gapColour.setBackground( |
1122 |
|
jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_LEGACY_GAP); |
1123 |
|
} |
1124 |
|
else |
1125 |
|
{ |
1126 |
0 |
gapColour.setBackground( |
1127 |
|
jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP); |
1128 |
|
} |
1129 |
0 |
gapColour.setEnabled(!enabled); |
1130 |
0 |
gapLabel.setEnabled(!enabled); |
1131 |
|
} |
1132 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
1133 |
0 |
@Override... |
1134 |
|
protected void resetOvDefaults_actionPerformed(ActionEvent e) |
1135 |
|
{ |
1136 |
0 |
useLegacyGap.setSelected(false); |
1137 |
0 |
useLegacyGaps_actionPerformed(null); |
1138 |
0 |
showHiddenAtStart.setSelected(true); |
1139 |
0 |
hiddenColour.setBackground( |
1140 |
|
jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN); |
1141 |
|
} |
1142 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.44 |
|
1143 |
0 |
@Override... |
1144 |
|
protected void userIdWidth_actionPerformed() |
1145 |
|
{ |
1146 |
0 |
try |
1147 |
|
{ |
1148 |
0 |
String val = userIdWidth.getText().trim(); |
1149 |
0 |
if (val.length() > 0) |
1150 |
|
{ |
1151 |
0 |
Integer iw = Integer.parseInt(val); |
1152 |
0 |
if (iw.intValue() < 12) |
1153 |
|
{ |
1154 |
0 |
throw new NumberFormatException(); |
1155 |
|
} |
1156 |
0 |
userIdWidth.setText(iw.toString()); |
1157 |
|
} |
1158 |
|
} catch (NumberFormatException x) |
1159 |
|
{ |
1160 |
0 |
userIdWidth.setText(""); |
1161 |
0 |
JvOptionPane.showInternalMessageDialog(Desktop.desktop, |
1162 |
|
MessageManager |
1163 |
|
.getString("warn.user_defined_width_requirements"), |
1164 |
|
MessageManager.getString("label.invalid_id_column_width"), |
1165 |
|
JvOptionPane.WARNING_MESSAGE); |
1166 |
|
} |
1167 |
|
} |
1168 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1169 |
0 |
@Override... |
1170 |
|
protected void autoIdWidth_actionPerformed() |
1171 |
|
{ |
1172 |
0 |
userIdWidth.setEnabled(!autoIdWidth.isSelected()); |
1173 |
0 |
userIdWidthlabel.setEnabled(!autoIdWidth.isSelected()); |
1174 |
|
} |
1175 |
|
|
1176 |
|
|
1177 |
|
|
1178 |
|
|
1179 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
1180 |
0 |
private boolean validateChimeraPath()... |
1181 |
|
{ |
1182 |
0 |
if (chimeraPath.getText().trim().length() > 0) |
1183 |
|
{ |
1184 |
0 |
File f = new File(chimeraPath.getText()); |
1185 |
0 |
if (!f.canExecute()) |
1186 |
|
{ |
1187 |
0 |
JvOptionPane.showInternalMessageDialog(Desktop.desktop, |
1188 |
|
MessageManager.getString("label.invalid_chimera_path"), |
1189 |
|
MessageManager.getString("label.invalid_name"), |
1190 |
|
JvOptionPane.ERROR_MESSAGE); |
1191 |
0 |
return false; |
1192 |
|
} |
1193 |
|
} |
1194 |
0 |
return true; |
1195 |
|
} |
1196 |
|
|
1197 |
|
|
1198 |
|
|
1199 |
|
|
1200 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 6 |
Complexity Density: 0.38 |
|
1201 |
0 |
@Override... |
1202 |
|
protected void structureViewer_actionPerformed(String selectedItem) |
1203 |
|
{ |
1204 |
0 |
if (!selectedItem.equals(ViewerType.CHIMERA.name())) |
1205 |
|
{ |
1206 |
0 |
return; |
1207 |
|
} |
1208 |
0 |
boolean found = false; |
1209 |
|
|
1210 |
|
|
1211 |
|
|
1212 |
|
|
1213 |
0 |
List<String> paths = StructureManager.getChimeraPaths(); |
1214 |
0 |
paths.add(0, chimeraPath.getText()); |
1215 |
0 |
for (String path : paths) |
1216 |
|
{ |
1217 |
0 |
if (new File(path.trim()).canExecute()) |
1218 |
|
{ |
1219 |
0 |
found = true; |
1220 |
0 |
break; |
1221 |
|
} |
1222 |
|
} |
1223 |
0 |
if (!found) |
1224 |
|
{ |
1225 |
0 |
String[] options = { "OK", "Help" }; |
1226 |
0 |
int showHelp = JvOptionPane.showInternalOptionDialog(Desktop.desktop, |
1227 |
|
JvSwingUtils.wrapTooltip(true, |
1228 |
|
MessageManager.getString("label.chimera_missing")), |
1229 |
|
"", JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE, |
1230 |
|
null, options, options[0]); |
1231 |
0 |
if (showHelp == JvOptionPane.NO_OPTION) |
1232 |
|
{ |
1233 |
0 |
try |
1234 |
|
{ |
1235 |
0 |
Help.showHelpWindow(HelpId.StructureViewer); |
1236 |
|
} catch (HelpSetException e) |
1237 |
|
{ |
1238 |
0 |
e.printStackTrace(); |
1239 |
|
} |
1240 |
|
} |
1241 |
|
} |
1242 |
|
} |
1243 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 9 |
Complexity Density: 0.82 |
|
1244 |
|
public class OptionsParam |
1245 |
|
{ |
1246 |
|
private String name; |
1247 |
|
|
1248 |
|
private String code; |
1249 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1250 |
0 |
public OptionsParam(String name, String code)... |
1251 |
|
{ |
1252 |
0 |
this.name = name; |
1253 |
0 |
this.code = code; |
1254 |
|
} |
1255 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1256 |
0 |
public String getName()... |
1257 |
|
{ |
1258 |
0 |
return name; |
1259 |
|
} |
1260 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1261 |
0 |
public void setName(String name)... |
1262 |
|
{ |
1263 |
0 |
this.name = name; |
1264 |
|
} |
1265 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1266 |
0 |
public String getCode()... |
1267 |
|
{ |
1268 |
0 |
return code; |
1269 |
|
} |
1270 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1271 |
0 |
public void setCode(String code)... |
1272 |
|
{ |
1273 |
0 |
this.code = code; |
1274 |
|
} |
1275 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1276 |
0 |
@Override... |
1277 |
|
public String toString() |
1278 |
|
{ |
1279 |
0 |
return name; |
1280 |
|
} |
1281 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1282 |
0 |
@Override... |
1283 |
|
public boolean equals(Object that) |
1284 |
|
{ |
1285 |
0 |
if (!(that instanceof OptionsParam)) |
1286 |
|
{ |
1287 |
0 |
return false; |
1288 |
|
} |
1289 |
0 |
return this.code.equalsIgnoreCase(((OptionsParam) that).code); |
1290 |
|
} |
1291 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1292 |
0 |
@Override... |
1293 |
|
public int hashCode() |
1294 |
|
{ |
1295 |
0 |
return name.hashCode() + code.hashCode(); |
1296 |
|
} |
1297 |
|
} |
1298 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 4 |
Complexity Density: 0.31 |
|
1299 |
|
private class UrlListSelectionHandler implements ListSelectionListener |
1300 |
|
{ |
1301 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 4 |
Complexity Density: 0.31 |
|
1302 |
0 |
@Override... |
1303 |
|
public void valueChanged(ListSelectionEvent e) |
1304 |
|
{ |
1305 |
0 |
ListSelectionModel lsm = (ListSelectionModel) e.getSource(); |
1306 |
|
|
1307 |
0 |
int index = lsm.getMinSelectionIndex(); |
1308 |
0 |
if (index == -1) |
1309 |
|
{ |
1310 |
|
|
1311 |
0 |
editLink.setEnabled(false); |
1312 |
0 |
deleteLink.setEnabled(false); |
1313 |
0 |
return; |
1314 |
|
} |
1315 |
0 |
int modelIndex = linkUrlTable.convertRowIndexToModel(index); |
1316 |
|
|
1317 |
|
|
1318 |
0 |
if (((UrlLinkTableModel) linkUrlTable.getModel()) |
1319 |
|
.isRowDeletable(modelIndex)) |
1320 |
|
{ |
1321 |
0 |
deleteLink.setEnabled(true); |
1322 |
|
} |
1323 |
|
else |
1324 |
|
{ |
1325 |
0 |
deleteLink.setEnabled(false); |
1326 |
|
} |
1327 |
|
|
1328 |
0 |
if (((UrlLinkTableModel) linkUrlTable.getModel()) |
1329 |
|
.isRowEditable(modelIndex)) |
1330 |
|
{ |
1331 |
0 |
editLink.setEnabled(true); |
1332 |
|
} |
1333 |
|
else |
1334 |
|
{ |
1335 |
0 |
editLink.setEnabled(false); |
1336 |
|
} |
1337 |
|
} |
1338 |
|
} |
1339 |
|
} |