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