2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import java.awt.BorderLayout;
24 import java.awt.Color;
25 import java.awt.Component;
26 import java.awt.Dimension;
28 import java.awt.event.ActionEvent;
29 import java.awt.event.ActionListener;
30 import java.awt.event.MouseEvent;
32 import java.util.ArrayList;
33 import java.util.List;
35 import javax.help.HelpSetException;
36 import javax.swing.JComboBox;
37 import javax.swing.JFileChooser;
38 import javax.swing.JInternalFrame;
39 import javax.swing.JPanel;
40 import javax.swing.ListSelectionModel;
41 import javax.swing.RowFilter;
42 import javax.swing.RowSorter;
43 import javax.swing.SortOrder;
44 import javax.swing.event.DocumentEvent;
45 import javax.swing.event.DocumentListener;
46 import javax.swing.event.ListSelectionEvent;
47 import javax.swing.event.ListSelectionListener;
48 import javax.swing.table.TableCellRenderer;
49 import javax.swing.table.TableColumn;
50 import javax.swing.table.TableModel;
51 import javax.swing.table.TableRowSorter;
53 import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
54 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
55 import jalview.bin.Cache;
56 import jalview.gui.Help.HelpId;
57 import jalview.gui.StructureViewer.ViewerType;
58 import jalview.io.BackupFiles;
59 import jalview.io.BackupFilesPresetEntry;
60 import jalview.io.FileFormatI;
61 import jalview.io.JalviewFileChooser;
62 import jalview.io.JalviewFileView;
63 import jalview.jbgui.GPreferences;
64 import jalview.jbgui.GSequenceLink;
65 import jalview.schemes.ColourSchemeI;
66 import jalview.schemes.ColourSchemes;
67 import jalview.schemes.ResidueColourScheme;
68 import jalview.urls.UrlLinkTableModel;
69 import jalview.urls.api.UrlProviderFactoryI;
70 import jalview.urls.api.UrlProviderI;
71 import jalview.urls.desktop.DesktopUrlProviderFactory;
72 import jalview.util.MessageManager;
73 import jalview.util.Platform;
74 import jalview.util.UrlConstants;
75 import jalview.ws.sifts.SiftsSettings;
83 public class Preferences extends GPreferences
86 public static final String ADD_SS_ANN = "ADD_SS_ANN";
88 public static final String ADD_TEMPFACT_ANN = "ADD_TEMPFACT_ANN";
90 public static final String ALLOW_UNPUBLISHED_PDB_QUERYING = "ALLOW_UNPUBLISHED_PDB_QUERYING";
92 public static final String ANNOTATIONCOLOUR_MAX = "ANNOTATIONCOLOUR_MAX";
94 public static final String ANNOTATIONCOLOUR_MIN = "ANNOTATIONCOLOUR_MIN";
96 public static final String ANTI_ALIAS = "ANTI_ALIAS";
98 public static final String AUTO_CALC_CONSENSUS = "AUTO_CALC_CONSENSUS";
100 public static final String AUTOASSOCIATE_PDBANDSEQS = "AUTOASSOCIATE_PDBANDSEQS";
102 public static final String BLOSUM62_PCA_FOR_NUCLEOTIDE = "BLOSUM62_PCA_FOR_NUCLEOTIDE";
104 public static final String CENTRE_COLUMN_LABELS = "CENTRE_COLUMN_LABELS";
106 public static final String CHIMERA_PATH = "CHIMERA_PATH";
108 public static final String DBREFFETCH_USEPICR = "DBREFFETCH_USEPICR";
110 public static final String DEFAULT_COLOUR = "DEFAULT_COLOUR";
112 public static final String DEFAULT_COLOUR_NUC = "DEFAULT_COLOUR_NUC";
114 public static final String DEFAULT_COLOUR_PROT = "DEFAULT_COLOUR_PROT";
116 public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME";
118 public static final String FIGURE_AUTOIDWIDTH = "FIGURE_AUTOIDWIDTH";
120 public static final String FIGURE_FIXEDIDWIDTH = "FIGURE_FIXEDIDWIDTH";
122 public static final String FOLLOW_SELECTIONS = "FOLLOW_SELECTIONS";
124 public static final String FONT_NAME = "FONT_NAME";
126 public static final String FONT_SIZE = "FONT_SIZE";
128 public static final String FONT_STYLE = "FONT_STYLE";
130 public static final String GAP_COLOUR = "GAP_COLOUR";
132 public static final String GAP_SYMBOL = "GAP_SYMBOL";
134 public static final String HIDDEN_COLOUR = "HIDDEN_COLOUR";
136 public static final String HIDE_INTRONS = "HIDE_INTRONS";
138 public static final String ID_ITALICS = "ID_ITALICS";
140 public static final String ID_ORG_HOSTURL = "ID_ORG_HOSTURL";
142 public static final String MAP_WITH_SIFTS = "MAP_WITH_SIFTS";
144 public static final String NOQUESTIONNAIRES = "NOQUESTIONNAIRES";
146 public static final String NORMALISE_CONSENSUS_LOGO = "NORMALISE_CONSENSUS_LOGO";
148 public static final String NORMALISE_LOGO = "NORMALISE_LOGO";
150 public static final String PAD_GAPS = "PAD_GAPS";
152 public static final String PDB_DOWNLOAD_FORMAT = "PDB_DOWNLOAD_FORMAT";
154 public static final String QUESTIONNAIRE = "QUESTIONNAIRE";
156 public static final String RELAXEDSEQIDMATCHING = "RELAXEDSEQIDMATCHING";
158 public static final String RIGHT_ALIGN_IDS = "RIGHT_ALIGN_IDS";
160 public static final String SCALE_PROTEIN_TO_CDNA = "SCALE_PROTEIN_TO_CDNA";
162 public static final String SHOW_ANNOTATIONS = "SHOW_ANNOTATIONS";
164 public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
166 public static final String SHOW_CONSENSUS = "SHOW_CONSENSUS";
168 public static final String SHOW_CONSENSUS_HISTOGRAM = "SHOW_CONSENSUS_HISTOGRAM";
170 public static final String SHOW_CONSENSUS_LOGO = "SHOW_CONSENSUS_LOGO";
172 public static final String SHOW_CONSERVATION = "SHOW_CONSERVATION";
174 public static final String SHOW_DBREFS_TOOLTIP = "SHOW_DBREFS_TOOLTIP";
176 public static final String SHOW_GROUP_CONSENSUS = "SHOW_GROUP_CONSENSUS";
178 public static final String SHOW_GROUP_CONSERVATION = "SHOW_GROUP_CONSERVATION";
180 public static final String SHOW_JVSUFFIX = "SHOW_JVSUFFIX";
182 public static final String SHOW_NPFEATS_TOOLTIP = "SHOW_NPFEATS_TOOLTIP";
184 public static final String SHOW_OCCUPANCY = "SHOW_OCCUPANCY";
186 public static final String SHOW_OV_HIDDEN_AT_START = "SHOW_OV_HIDDEN_AT_START";
188 public static final String SHOW_OVERVIEW = "SHOW_OVERVIEW";
190 public static final String SHOW_QUALITY = "SHOW_QUALITY";
192 public static final String SHOW_UNCONSERVED = "SHOW_UNCONSERVED";
194 public static final String SORT_ALIGNMENT = "SORT_ALIGNMENT";
196 public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
198 public static final String SORT_BY_TREE = "SORT_BY_TREE";
200 public static final String STRUCT_FROM_PDB = "STRUCT_FROM_PDB";
202 public static final String STRUCTURE_DISPLAY = "STRUCTURE_DISPLAY";
204 public static final String STRUCTURE_DIMENSIONS = "STRUCTURE_DIMENSIONS";
206 public static final String UNIPROT_DOMAIN = "UNIPROT_DOMAIN";
208 public static final String USE_FULL_SO = "USE_FULL_SO";
210 public static final String USE_LEGACY_GAP = "USE_LEGACY_GAP";
212 public static final String USE_RNAVIEW = "USE_RNAVIEW";
214 public static final String USER_DEFINED_COLOURS = "USER_DEFINED_COLOURS";
216 public static final String WRAP_ALIGNMENT = "WRAP_ALIGNMENT";
219 private static final int MIN_FONT_SIZE = 1;
221 private static final int MAX_FONT_SIZE = 30;
224 * Holds name and link separated with | character. Sequence ID must be
225 * $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
227 public static UrlProviderI sequenceUrlLinks;
229 public static UrlLinkTableModel dataModel;
232 * Holds name and link separated with | character. Sequence IDS and Sequences
233 * must be $SEQUENCEIDS$ or $SEQUENCEIDS=/.possible | chars ./=$ and
234 * $SEQUENCES$ or $SEQUENCES=/.possible | chars ./=$ and separation character
235 * for first and second token specified after a pipe character at end |,|.
236 * (TODO: proper escape for using | to separate ids or sequences
239 public static List<String> groupURLLinks;
242 // get links selected to be in the menu (SEQUENCE_LINKS)
243 // and links entered by the user but not selected (STORED_LINKS)
244 String inMenuString = Cache.getDefault("SEQUENCE_LINKS", "");
245 String notInMenuString = Cache.getDefault("STORED_LINKS", "");
246 String defaultUrl = Cache.getDefault("DEFAULT_URL",
247 UrlConstants.DEFAULT_LABEL);
249 // if both links lists are empty, add the DEFAULT_URL link
250 // otherwise we assume the default link is in one of the lists
251 if (inMenuString.isEmpty() && notInMenuString.isEmpty())
253 inMenuString = UrlConstants.DEFAULT_STRING;
255 UrlProviderFactoryI factory = new DesktopUrlProviderFactory(defaultUrl,
256 inMenuString, notInMenuString);
257 sequenceUrlLinks = factory.createUrlProvider();
258 dataModel = new UrlLinkTableModel(sequenceUrlLinks);
261 * TODO: reformulate groupURL encoding so two or more can be stored in the
262 * .properties file as '|' separated strings
265 groupURLLinks = new ArrayList<>();
268 JInternalFrame frame;
270 private WsPreferences wsPrefs;
272 private OptionsParam promptEachTimeOpt = new OptionsParam(
273 MessageManager.getString("label.prompt_each_time"),
276 private OptionsParam lineArtOpt = new OptionsParam(
277 MessageManager.getString("label.lineart"), "Lineart");
279 private OptionsParam textOpt = new OptionsParam(
280 MessageManager.getString("action.text"), "Text");
283 * Creates a new Preferences object.
288 frame = new JInternalFrame();
289 frame.setContentPane(this);
290 if (!Platform.isJS())
297 wsPrefs = new WsPreferences();
298 wsTab.add(wsPrefs, BorderLayout.CENTER);
300 int width = 500, height = 450;
301 if (Platform.isAMacAndNotJS())
307 Desktop.addInternalFrame(frame,
308 MessageManager.getString("label.preferences"), width, height);
309 frame.setMinimumSize(new Dimension(width, height));
312 * Set Visual tab defaults
314 seqLimit.setSelected(Cache.getDefault("SHOW_JVSUFFIX", true));
315 rightAlign.setSelected(Cache.getDefault("RIGHT_ALIGN_IDS", false));
316 fullScreen.setSelected(Cache.getDefault("SHOW_FULLSCREEN", false));
317 annotations.setSelected(Cache.getDefault("SHOW_ANNOTATIONS", true));
319 conservation.setSelected(Cache.getDefault("SHOW_CONSERVATION", true));
320 quality.setSelected(Cache.getDefault("SHOW_QUALITY", true));
321 identity.setSelected(Cache.getDefault("SHOW_IDENTITY", true));
322 openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false));
324 .setSelected(Cache.getDefault("SHOW_UNCONSERVED", false));
325 showOccupancy.setSelected(Cache.getDefault(SHOW_OCCUPANCY, false));
327 .setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS", false));
328 showGroupConservation.setSelected(
329 Cache.getDefault("SHOW_GROUP_CONSERVATION", false));
330 showConsensHistogram.setSelected(
331 Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM", true));
333 .setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO", false));
335 .setSelected(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
337 .setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true));
339 String[] fonts = java.awt.GraphicsEnvironment
340 .getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
341 for (int i = 0; i < fonts.length; i++)
343 fontNameCB.addItem(fonts[i]);
346 for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++)
348 fontSizeCB.addItem(i + "");
351 fontStyleCB.addItem("plain");
352 fontStyleCB.addItem("bold");
353 fontStyleCB.addItem("italic");
355 fontNameCB.setSelectedItem(Cache.getDefault("FONT_NAME", "SansSerif"));
356 fontSizeCB.setSelectedItem(Cache.getDefault("FONT_SIZE", "10"));
357 fontStyleCB.setSelectedItem(
358 Cache.getDefault("FONT_STYLE", Font.PLAIN + ""));
360 smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", true));
362 .setSelected(Cache.getDefault(SCALE_PROTEIN_TO_CDNA, false));
364 idItalics.setSelected(Cache.getDefault("ID_ITALICS", true));
366 wrap.setSelected(Cache.getDefault("WRAP_ALIGNMENT", false));
368 gapSymbolCB.addItem("-");
369 gapSymbolCB.addItem(".");
371 gapSymbolCB.setSelectedItem(Cache.getDefault("GAP_SYMBOL", "-"));
373 sortby.addItem("No sort");
374 sortby.addItem("Id");
375 sortby.addItem("Pairwise Identity");
376 sortby.setSelectedItem(Cache.getDefault("SORT_ALIGNMENT", "No sort"));
378 sortAnnBy.addItem(SequenceAnnotationOrder.NONE.toString());
380 .addItem(SequenceAnnotationOrder.SEQUENCE_AND_LABEL.toString());
382 .addItem(SequenceAnnotationOrder.LABEL_AND_SEQUENCE.toString());
383 SequenceAnnotationOrder savedSort = SequenceAnnotationOrder
384 .valueOf(Cache.getDefault(SORT_ANNOTATIONS,
385 SequenceAnnotationOrder.NONE.name()));
386 sortAnnBy.setSelectedItem(savedSort.toString());
388 sortAutocalc.addItem("Autocalculated first");
389 sortAutocalc.addItem("Autocalculated last");
390 final boolean showAbove = Cache.getDefault(SHOW_AUTOCALC_ABOVE, true);
391 sortAutocalc.setSelectedItem(showAbove ? sortAutocalc.getItemAt(0)
392 : sortAutocalc.getItemAt(1));
394 .setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true));
395 startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE",
396 Cache.getDefault("www.jalview.org", "http://www.jalview.org")
397 + "/examples/exampleFile_2_3.jar"));
400 * Set Colours tab defaults
402 protColour.addItem(ResidueColourScheme.NONE);
403 nucColour.addItem(ResidueColourScheme.NONE);
404 for (ColourSchemeI cs : ColourSchemes.getInstance().getColourSchemes())
406 String name = cs.getSchemeName();
407 protColour.addItem(name);
408 nucColour.addItem(name);
410 String oldProp = Cache.getDefault(DEFAULT_COLOUR,
411 ResidueColourScheme.NONE);
412 String newProp = Cache.getDefault(DEFAULT_COLOUR_PROT, null);
413 protColour.setSelectedItem(newProp != null ? newProp : oldProp);
414 newProp = Cache.getDefault(DEFAULT_COLOUR_NUC, null);
415 nucColour.setSelectedItem(newProp != null ? newProp : oldProp);
416 minColour.setBackground(
417 Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange));
418 maxColour.setBackground(
419 Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red));
422 * Set overview panel defaults
424 gapColour.setBackground(
425 Cache.getDefaultColour(GAP_COLOUR,
426 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP));
427 hiddenColour.setBackground(
428 Cache.getDefaultColour(HIDDEN_COLOUR,
429 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN));
430 useLegacyGap.setSelected(Cache.getDefault(USE_LEGACY_GAP, false));
431 gapLabel.setEnabled(!useLegacyGap.isSelected());
432 gapColour.setEnabled(!useLegacyGap.isSelected());
434 .setSelected(Cache.getDefault(SHOW_OV_HIDDEN_AT_START, false));
437 * Set Structure tab defaults.
439 final boolean structSelected = Cache.getDefault(STRUCT_FROM_PDB, false);
440 structFromPdb.setSelected(structSelected);
441 useRnaView.setSelected(Cache.getDefault(USE_RNAVIEW, false));
442 useRnaView.setEnabled(structSelected);
443 addSecondaryStructure.setSelected(Cache.getDefault(ADD_SS_ANN, false));
444 addSecondaryStructure.setEnabled(structSelected);
445 addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false));
446 addTempFactor.setEnabled(structSelected);
447 if (!Platform.isJS())
449 structViewer.setSelectedItem(
450 Cache.getDefault(STRUCTURE_DISPLAY, ViewerType.JMOL.name()));
452 chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, ""));
453 chimeraPath.addActionListener(new ActionListener()
456 public void actionPerformed(ActionEvent e)
458 validateChimeraPath();
462 if (Cache.getDefault("MAP_WITH_SIFTS", false))
464 siftsMapping.setSelected(true);
468 nwMapping.setSelected(true);
472 .setMapWithSifts(Cache.getDefault("MAP_WITH_SIFTS", false));
475 * Set Connections tab defaults
479 linkUrlTable.setModel(dataModel);
480 final TableRowSorter<TableModel> sorter = new TableRowSorter<>(
481 linkUrlTable.getModel());
482 linkUrlTable.setRowSorter(sorter);
483 List<RowSorter.SortKey> sortKeys = new ArrayList<>();
485 UrlLinkTableModel m = (UrlLinkTableModel) linkUrlTable.getModel();
486 sortKeys.add(new RowSorter.SortKey(m.getPrimaryColumn(),
487 SortOrder.DESCENDING));
488 sortKeys.add(new RowSorter.SortKey(m.getSelectedColumn(),
489 SortOrder.DESCENDING));
491 new RowSorter.SortKey(m.getNameColumn(), SortOrder.ASCENDING));
493 sorter.setSortKeys(sortKeys);
494 // BH 2018 setSortKeys will do the sort
498 ActionListener onReset;
499 onReset = new ActionListener()
502 public void actionPerformed(ActionEvent e)
504 filterTB.setText("");
505 sorter.setRowFilter(RowFilter.regexFilter(""));
509 doReset.addActionListener(onReset);
511 // filter to display only custom urls
512 final RowFilter<TableModel, Object> customUrlFilter = new RowFilter<TableModel, Object>()
515 public boolean include(
516 Entry<? extends TableModel, ? extends Object> entry)
518 return ((UrlLinkTableModel) entry.getModel()).isUserEntry(entry);
522 final TableRowSorter<TableModel> customSorter = new TableRowSorter<>(
523 linkUrlTable.getModel());
524 customSorter.setRowFilter(customUrlFilter);
526 ActionListener onCustomOnly;
527 onCustomOnly = new ActionListener()
530 public void actionPerformed(ActionEvent e)
532 filterTB.setText("");
533 sorter.setRowFilter(customUrlFilter);
536 userOnly.addActionListener(onCustomOnly);
538 filterTB.getDocument().addDocumentListener(new DocumentListener()
540 String caseInsensitiveFlag = "(?i)";
543 public void changedUpdate(DocumentEvent e)
545 sorter.setRowFilter(RowFilter
546 .regexFilter(caseInsensitiveFlag + filterTB.getText()));
550 public void removeUpdate(DocumentEvent e)
552 sorter.setRowFilter(RowFilter
553 .regexFilter(caseInsensitiveFlag + filterTB.getText()));
557 public void insertUpdate(DocumentEvent e)
559 sorter.setRowFilter(RowFilter
560 .regexFilter(caseInsensitiveFlag + filterTB.getText()));
564 // set up list selection functionality
565 linkUrlTable.getSelectionModel()
566 .addListSelectionListener(new UrlListSelectionHandler());
568 // set up radio buttons
569 int onClickCol = ((UrlLinkTableModel) linkUrlTable.getModel())
571 String onClickName = linkUrlTable.getColumnName(onClickCol);
572 linkUrlTable.getColumn(onClickName)
573 .setCellRenderer(new RadioButtonRenderer());
574 linkUrlTable.getColumn(onClickName)
575 .setCellEditor(new RadioButtonEditor());
577 // get boolean columns and resize those to min possible
578 for (int column = 0; column < linkUrlTable.getColumnCount(); column++)
580 if (linkUrlTable.getModel().getColumnClass(column)
581 .equals(Boolean.class))
583 TableColumn tableColumn = linkUrlTable.getColumnModel()
585 int preferredWidth = tableColumn.getMinWidth();
587 TableCellRenderer cellRenderer = linkUrlTable.getCellRenderer(0,
589 Component c = linkUrlTable.prepareRenderer(cellRenderer, 0, column);
590 int cwidth = c.getPreferredSize().width
591 + linkUrlTable.getIntercellSpacing().width;
592 preferredWidth = Math.max(preferredWidth, cwidth);
594 tableColumn.setPreferredWidth(preferredWidth);
598 useProxy.setSelected(Cache.getDefault("USE_PROXY", false));
599 useProxy_actionPerformed(); // make sure useProxy is correctly initialised
600 proxyServerTB.setText(Cache.getDefault("PROXY_SERVER", ""));
601 proxyPortTB.setText(Cache.getDefault("PROXY_PORT", ""));
603 defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", ""));
605 usagestats.setSelected(Cache.getDefault("USAGESTATS", false));
606 // note antisense here: default is true
608 .setSelected(Cache.getProperty("NOQUESTIONNAIRES") == null);
609 versioncheck.setSelected(Cache.getDefault("VERSION_CHECK", true));
612 * Set Output tab defaults
614 setupOutputCombo(epsRendering, "EPS_RENDERING");
615 setupOutputCombo(htmlRendering, "HTML_RENDERING");
616 setupOutputCombo(svgRendering, "SVG_RENDERING");
617 autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false));
618 userIdWidth.setEnabled(!autoIdWidth.isSelected());
619 userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
620 Integer wi = Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH");
621 userIdWidth.setText(wi == null ? "" : wi.toString());
622 // TODO: refactor to use common enum via FormatAdapter and allow extension
623 // for new flat file formats
624 blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true));
625 clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true));
626 fastajv.setSelected(Cache.getDefault("FASTA_JVSUFFIX", true));
627 msfjv.setSelected(Cache.getDefault("MSF_JVSUFFIX", true));
628 pfamjv.setSelected(Cache.getDefault("PFAM_JVSUFFIX", true));
629 pileupjv.setSelected(Cache.getDefault("PILEUP_JVSUFFIX", true));
630 pirjv.setSelected(Cache.getDefault("PIR_JVSUFFIX", true));
631 modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false));
633 .setSelected(Cache.getDefault("EXPORT_EMBBED_BIOJSON", true));
636 * Set Editing tab defaults
638 autoCalculateConsCheck
639 .setSelected(Cache.getDefault("AUTO_CALC_CONSENSUS", true));
640 padGaps.setSelected(Cache.getDefault("PAD_GAPS", false));
641 sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false));
643 annotations_actionPerformed(null); // update the display of the annotation
648 * Set Backups tab defaults
650 loadLastSavedBackupsOptions();
654 * A helper method that sets the items and initial selection in a character
655 * rendering option list (Prompt each time/Lineart/Text)
660 protected void setupOutputCombo(JComboBox<Object> comboBox,
663 comboBox.addItem(promptEachTimeOpt);
664 comboBox.addItem(lineArtOpt);
665 comboBox.addItem(textOpt);
668 * JalviewJS doesn't support Lineart so force it to Text
670 String defaultOption = Platform.isJS() ? "Text"
671 : Cache.getDefault(propertyKey, "Prompt each time");
672 if (defaultOption.equalsIgnoreCase("Text"))
674 comboBox.setSelectedItem(textOpt);
676 else if (defaultOption.equalsIgnoreCase("Lineart"))
678 comboBox.setSelectedItem(lineArtOpt);
682 comboBox.setSelectedItem(promptEachTimeOpt);
687 * Save user selections on the Preferences tabs to the Cache and write out to
693 public void ok_actionPerformed(ActionEvent e)
695 if (!validateSettings())
701 * Save Visual settings
703 Cache.setPropertyNoSave("SHOW_JVSUFFIX",
704 Boolean.toString(seqLimit.isSelected()));
705 Cache.setPropertyNoSave("RIGHT_ALIGN_IDS",
706 Boolean.toString(rightAlign.isSelected()));
707 Cache.setPropertyNoSave("SHOW_FULLSCREEN",
708 Boolean.toString(fullScreen.isSelected()));
709 Cache.setPropertyNoSave("SHOW_OVERVIEW",
710 Boolean.toString(openoverv.isSelected()));
711 Cache.setPropertyNoSave("SHOW_ANNOTATIONS",
712 Boolean.toString(annotations.isSelected()));
713 Cache.setPropertyNoSave("SHOW_CONSERVATION",
714 Boolean.toString(conservation.isSelected()));
715 Cache.setPropertyNoSave("SHOW_QUALITY",
716 Boolean.toString(quality.isSelected()));
717 Cache.setPropertyNoSave("SHOW_IDENTITY",
718 Boolean.toString(identity.isSelected()));
720 Cache.setPropertyNoSave("GAP_SYMBOL",
721 gapSymbolCB.getSelectedItem().toString());
723 Cache.setPropertyNoSave("FONT_NAME",
724 fontNameCB.getSelectedItem().toString());
725 Cache.setPropertyNoSave("FONT_STYLE",
726 fontStyleCB.getSelectedItem().toString());
727 Cache.setPropertyNoSave("FONT_SIZE",
728 fontSizeCB.getSelectedItem().toString());
730 Cache.setPropertyNoSave("ID_ITALICS",
731 Boolean.toString(idItalics.isSelected()));
732 Cache.setPropertyNoSave("SHOW_UNCONSERVED",
733 Boolean.toString(showUnconserved.isSelected()));
734 Cache.setPropertyNoSave(SHOW_OCCUPANCY,
735 Boolean.toString(showOccupancy.isSelected()));
736 Cache.setPropertyNoSave("SHOW_GROUP_CONSENSUS",
737 Boolean.toString(showGroupConsensus.isSelected()));
738 Cache.setPropertyNoSave("SHOW_GROUP_CONSERVATION",
739 Boolean.toString(showGroupConservation.isSelected()));
740 Cache.setPropertyNoSave("SHOW_CONSENSUS_HISTOGRAM",
741 Boolean.toString(showConsensHistogram.isSelected()));
742 Cache.setPropertyNoSave("SHOW_CONSENSUS_LOGO",
743 Boolean.toString(showConsensLogo.isSelected()));
744 Cache.setPropertyNoSave("ANTI_ALIAS",
745 Boolean.toString(smoothFont.isSelected()));
746 Cache.setPropertyNoSave(SCALE_PROTEIN_TO_CDNA,
747 Boolean.toString(scaleProteinToCdna.isSelected()));
748 Cache.setPropertyNoSave("SHOW_NPFEATS_TOOLTIP",
749 Boolean.toString(showNpTooltip.isSelected()));
750 Cache.setPropertyNoSave("SHOW_DBREFS_TOOLTIP",
751 Boolean.toString(showDbRefTooltip.isSelected()));
753 Cache.setPropertyNoSave("WRAP_ALIGNMENT",
754 Boolean.toString(wrap.isSelected()));
756 Cache.setPropertyNoSave("STARTUP_FILE",
757 startupFileTextfield.getText());
758 Cache.setPropertyNoSave("SHOW_STARTUP_FILE",
759 Boolean.toString(startupCheckbox.isSelected()));
761 Cache.setPropertyNoSave("SORT_ALIGNMENT",
762 sortby.getSelectedItem().toString());
764 // convert description of sort order to enum name for save
765 SequenceAnnotationOrder annSortOrder = SequenceAnnotationOrder
766 .forDescription(sortAnnBy.getSelectedItem().toString());
767 if (annSortOrder != null)
769 Cache.setPropertyNoSave(SORT_ANNOTATIONS,
770 annSortOrder.name());
773 final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0;
774 Cache.setPropertyNoSave(SHOW_AUTOCALC_ABOVE,
775 Boolean.valueOf(showAutocalcFirst).toString());
778 * Save Colours settings
780 Cache.setPropertyNoSave(DEFAULT_COLOUR_PROT,
781 protColour.getSelectedItem().toString());
782 Cache.setPropertyNoSave(DEFAULT_COLOUR_NUC,
783 nucColour.getSelectedItem().toString());
784 Cache.setColourProperty("ANNOTATIONCOLOUR_MIN",
785 minColour.getBackground());
786 Cache.setColourProperty("ANNOTATIONCOLOUR_MAX",
787 maxColour.getBackground());
790 * Save Overview settings
792 Cache.setColourProperty(GAP_COLOUR, gapColour.getBackground());
793 Cache.setColourProperty(HIDDEN_COLOUR, hiddenColour.getBackground());
794 Cache.setPropertyNoSave(USE_LEGACY_GAP,
795 Boolean.toString(useLegacyGap.isSelected()));
796 Cache.setPropertyNoSave(SHOW_OV_HIDDEN_AT_START,
797 Boolean.toString(showHiddenAtStart.isSelected()));
800 * Save Structure settings
802 Cache.setPropertyNoSave(ADD_TEMPFACT_ANN,
803 Boolean.toString(addTempFactor.isSelected()));
804 Cache.setPropertyNoSave(ADD_SS_ANN,
805 Boolean.toString(addSecondaryStructure.isSelected()));
806 Cache.setPropertyNoSave(USE_RNAVIEW,
807 Boolean.toString(useRnaView.isSelected()));
808 Cache.setPropertyNoSave(STRUCT_FROM_PDB,
809 Boolean.toString(structFromPdb.isSelected()));
810 Cache.setPropertyNoSave(STRUCTURE_DISPLAY,
811 structViewer.getSelectedItem().toString());
812 Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
813 Cache.setPropertyNoSave("MAP_WITH_SIFTS",
814 Boolean.toString(siftsMapping.isSelected()));
815 SiftsSettings.setMapWithSifts(siftsMapping.isSelected());
818 * Save Output settings
820 Cache.setPropertyNoSave("EPS_RENDERING",
821 ((OptionsParam) epsRendering.getSelectedItem()).getCode());
822 Cache.setPropertyNoSave("HTML_RENDERING",
823 ((OptionsParam) htmlRendering.getSelectedItem()).getCode());
824 Cache.setPropertyNoSave("SVG_RENDERING",
825 ((OptionsParam) svgRendering.getSelectedItem()).getCode());
828 * Save Connections settings
830 Cache.setOrRemove("DEFAULT_BROWSER", defaultBrowser.getText());
832 jalview.util.BrowserLauncher.resetBrowser();
834 // save user-defined and selected links
835 String menuLinks = sequenceUrlLinks.writeUrlsAsString(true);
836 if (menuLinks.isEmpty())
838 Cache.removePropertyNoSave("SEQUENCE_LINKS");
842 Cache.setPropertyNoSave("SEQUENCE_LINKS",
843 menuLinks.toString());
846 String nonMenuLinks = sequenceUrlLinks.writeUrlsAsString(false);
847 if (nonMenuLinks.isEmpty())
849 Cache.removePropertyNoSave("STORED_LINKS");
853 Cache.setPropertyNoSave("STORED_LINKS",
854 nonMenuLinks.toString());
857 Cache.setPropertyNoSave("DEFAULT_URL",
858 sequenceUrlLinks.getPrimaryUrlId());
860 Cache.setPropertyNoSave("USE_PROXY",
861 Boolean.toString(useProxy.isSelected()));
863 Cache.setOrRemove("PROXY_SERVER", proxyServerTB.getText());
865 Cache.setOrRemove("PROXY_PORT", proxyPortTB.getText());
867 if (useProxy.isSelected())
869 System.setProperty("http.proxyHost", proxyServerTB.getText());
870 System.setProperty("http.proxyPort", proxyPortTB.getText());
874 System.setProperty("http.proxyHost", "");
875 System.setProperty("http.proxyPort", "");
877 Cache.setProperty("VERSION_CHECK",
878 Boolean.toString(versioncheck.isSelected()));
879 if (Cache.getProperty("USAGESTATS") != null || usagestats.isSelected())
881 // default is false - we only set this if the user has actively agreed
882 Cache.setProperty("USAGESTATS",
883 Boolean.toString(usagestats.isSelected()));
885 if (!questionnaire.isSelected())
887 Cache.setProperty("NOQUESTIONNAIRES", "true");
891 // special - made easy to edit a property file to disable questionnaires
892 // by just adding the given line
893 Cache.removeProperty("NOQUESTIONNAIRES");
897 * Save Output settings
899 Cache.setPropertyNoSave("BLC_JVSUFFIX",
900 Boolean.toString(blcjv.isSelected()));
901 Cache.setPropertyNoSave("CLUSTAL_JVSUFFIX",
902 Boolean.toString(clustaljv.isSelected()));
903 Cache.setPropertyNoSave("FASTA_JVSUFFIX",
904 Boolean.toString(fastajv.isSelected()));
905 Cache.setPropertyNoSave("MSF_JVSUFFIX",
906 Boolean.toString(msfjv.isSelected()));
907 Cache.setPropertyNoSave("PFAM_JVSUFFIX",
908 Boolean.toString(pfamjv.isSelected()));
909 Cache.setPropertyNoSave("PILEUP_JVSUFFIX",
910 Boolean.toString(pileupjv.isSelected()));
911 Cache.setPropertyNoSave("PIR_JVSUFFIX",
912 Boolean.toString(pirjv.isSelected()));
913 Cache.setPropertyNoSave("PIR_MODELLER",
914 Boolean.toString(modellerOutput.isSelected()));
915 Cache.setPropertyNoSave("EXPORT_EMBBED_BIOJSON",
916 Boolean.toString(embbedBioJSON.isSelected()));
917 jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected();
919 Cache.setPropertyNoSave("FIGURE_AUTOIDWIDTH",
920 Boolean.toString(autoIdWidth.isSelected()));
921 userIdWidth_actionPerformed();
922 Cache.setPropertyNoSave("FIGURE_FIXEDIDWIDTH",
923 userIdWidth.getText());
926 * Save Editing settings
928 Cache.setPropertyNoSave("AUTO_CALC_CONSENSUS",
929 Boolean.toString(autoCalculateConsCheck.isSelected()));
930 Cache.setPropertyNoSave("SORT_BY_TREE",
931 Boolean.toString(sortByTree.isSelected()));
932 Cache.setPropertyNoSave("PAD_GAPS",
933 Boolean.toString(padGaps.isSelected()));
935 if (!Platform.isJS())
937 wsPrefs.updateAndRefreshWsMenuConfig(false);
941 * Save Backups settings
943 Cache.setPropertyNoSave(BackupFiles.ENABLED,
944 Boolean.toString(enableBackupFiles.isSelected()));
945 int preset = getComboIntStringKey(backupfilesPresetsCombo);
946 Cache.setPropertyNoSave(BackupFiles.NS + "_PRESET", Integer.toString(preset));
948 if (preset == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM)
950 BackupFilesPresetEntry customBFPE = getBackupfilesCurrentEntry();
951 BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
952 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM, customBFPE);
953 Cache.setPropertyNoSave(BackupFilesPresetEntry.CUSTOMCONFIG,
954 customBFPE.toString());
957 BackupFilesPresetEntry savedBFPE = BackupFilesPresetEntry.backupfilesPresetEntriesValues
959 Cache.setPropertyNoSave(
960 BackupFilesPresetEntry.SAVEDCONFIG, savedBFPE.toString());
962 Cache.saveProperties();
963 Desktop.instance.doConfigureStructurePrefs();
966 frame.setClosed(true);
967 } catch (Exception ex)
972 public static void setAppletDefaults()
975 // http://www.jalview.org/old/v2_8/examples/appletParameters.html
977 // showConservation true or false Default is true.
978 // showQuality true or false Default is true.
979 // showConsensus true or false Default is true.
980 // showFeatureSettings true or false Shows the feature settings window when
982 // showTreeBootstraps true or false (default is true) show or hide branch
984 // showTreeDistances true or false (default is true) show or hide branch
986 // showUnlinkedTreeNodes true or false (default is false) indicate if
987 // unassociated nodes should be highlighted in the tree view
988 // showUnconserved true of false (default is false) When true, only gaps and
989 // symbols different to the consensus sequence ions of the alignment
990 // showGroupConsensus true of false (default is false) When true, shows
991 // consensus annotation row for any groups on the alignment. (since 2.7)
992 // showGroupConservation true of false (default is false) When true, shows
993 // amino-acid property conservation annotation row for any groups on the
994 // showConsensusHistogram true of false (default is true) When true, shows
995 // the percentage occurence of the consensus symbol for each column as a
996 // showSequenceLogo true of false (default is false) When true, shows a
997 // sequence logo above the consensus sequence (overlaid above the Consensus
999 Cache.setPropertyNoSave(SHOW_CONSERVATION, "true");
1000 Cache.setPropertyNoSave(SHOW_QUALITY, "false");
1001 Cache.setPropertyNoSave(SHOW_CONSENSUS, "true");
1002 Cache.setPropertyNoSave(SHOW_UNCONSERVED, "false");
1003 Cache.setPropertyNoSave(SHOW_GROUP_CONSERVATION, "false");
1004 Cache.setPropertyNoSave(SHOW_GROUP_CONSENSUS, "false");
1006 // TODO -- just a start here
1009 * Do any necessary validation before saving settings. Return focus to the
1010 * first tab which fails validation.
1014 private boolean validateSettings()
1016 if (!validateStructure())
1018 structureTab.requestFocusInWindow();
1025 protected boolean validateStructure()
1027 return validateChimeraPath();
1035 public void startupFileTextfield_mouseClicked()
1037 // TODO: JAL-3048 not needed for Jalview-JS
1038 String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT");
1039 JalviewFileChooser chooser = JalviewFileChooser
1040 .forRead(Cache.getProperty("LAST_DIRECTORY"), fileFormat);
1041 chooser.setFileView(new JalviewFileView());
1042 chooser.setDialogTitle(
1043 MessageManager.getString("label.select_startup_file"));
1045 int value = chooser.showOpenDialog(this);
1047 if (value == JalviewFileChooser.APPROVE_OPTION)
1049 FileFormatI format = chooser.getSelectedFormat();
1052 Cache.setPropertyNoSave("DEFAULT_FILE_FORMAT",
1055 startupFileTextfield
1056 .setText(chooser.getSelectedFile().getAbsolutePath());
1067 public void cancel_actionPerformed(ActionEvent e)
1071 if (!Platform.isJS())
1073 wsPrefs.updateWsMenuConfig(true);
1074 wsPrefs.refreshWs_actionPerformed(e);
1076 frame.setClosed(true);
1077 } catch (Exception ex)
1089 public void annotations_actionPerformed(ActionEvent e)
1091 conservation.setEnabled(annotations.isSelected());
1092 quality.setEnabled(annotations.isSelected());
1093 identity.setEnabled(annotations.isSelected());
1094 showOccupancy.setEnabled(annotations.isSelected());
1095 showGroupConsensus.setEnabled(annotations.isSelected());
1096 showGroupConservation.setEnabled(annotations.isSelected());
1097 showConsensHistogram.setEnabled(annotations.isSelected()
1098 && (identity.isSelected() || showGroupConsensus.isSelected()));
1099 showConsensLogo.setEnabled(annotations.isSelected()
1100 && (identity.isSelected() || showGroupConsensus.isSelected()));
1104 public void newLink_actionPerformed(ActionEvent e)
1106 GSequenceLink link = new GSequenceLink();
1107 boolean valid = false;
1110 if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
1111 MessageManager.getString("label.new_sequence_url_link"),
1112 JvOptionPane.OK_CANCEL_OPTION, -1,
1113 null) == JvOptionPane.OK_OPTION)
1115 if (link.checkValid())
1117 if (((UrlLinkTableModel) linkUrlTable.getModel())
1118 .isUniqueName(link.getName()))
1120 ((UrlLinkTableModel) linkUrlTable.getModel())
1121 .insertRow(link.getName(), link.getURL());
1126 link.notifyDuplicate();
1139 public void editLink_actionPerformed(ActionEvent e)
1141 GSequenceLink link = new GSequenceLink();
1143 int index = linkUrlTable.getSelectedRow();
1146 // button no longer enabled if row is not selected
1147 Cache.log.debug("Edit with no row selected in linkUrlTable");
1151 int nameCol = ((UrlLinkTableModel) linkUrlTable.getModel())
1153 int urlCol = ((UrlLinkTableModel) linkUrlTable.getModel())
1155 String oldName = linkUrlTable.getValueAt(index, nameCol).toString();
1156 link.setName(oldName);
1157 link.setURL(linkUrlTable.getValueAt(index, urlCol).toString());
1159 boolean valid = false;
1162 if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
1163 MessageManager.getString("label.edit_sequence_url_link"),
1164 JvOptionPane.OK_CANCEL_OPTION, -1,
1165 null) == JvOptionPane.OK_OPTION)
1167 if (link.checkValid())
1169 if ((oldName.equals(link.getName()))
1170 || (((UrlLinkTableModel) linkUrlTable.getModel())
1171 .isUniqueName(link.getName())))
1173 linkUrlTable.setValueAt(link.getName(), index, nameCol);
1174 linkUrlTable.setValueAt(link.getURL(), index, urlCol);
1179 link.notifyDuplicate();
1192 public void deleteLink_actionPerformed(ActionEvent e)
1194 int index = linkUrlTable.getSelectedRow();
1195 int modelIndex = -1;
1198 // button no longer enabled if row is not selected
1199 Cache.log.debug("Delete with no row selected in linkUrlTable");
1204 modelIndex = linkUrlTable.convertRowIndexToModel(index);
1207 // make sure we use the model index to delete, and not the table index
1208 ((UrlLinkTableModel) linkUrlTable.getModel()).removeRow(modelIndex);
1212 public void defaultBrowser_mouseClicked(MouseEvent e)
1214 // TODO: JAL-3048 not needed for j2s
1215 if (!Platform.isJS()) // BH 2019
1222 JFileChooser chooser = new JFileChooser(".");
1223 chooser.setDialogTitle(
1224 MessageManager.getString("label.select_default_browser"));
1226 int value = chooser.showOpenDialog(this);
1228 if (value == JFileChooser.APPROVE_OPTION)
1230 defaultBrowser.setText(chooser.getSelectedFile().getAbsolutePath());
1239 * jalview.jbgui.GPreferences#showunconserved_actionPerformed(java.awt.event
1243 protected void showunconserved_actionPerformed(ActionEvent e)
1245 // TODO Auto-generated method stub
1246 super.showunconserved_actionPerformed(e);
1249 public static List<String> getGroupURLLinks()
1251 return groupURLLinks;
1255 public void minColour_actionPerformed(JPanel panel)
1257 JalviewColourChooser.showColourChooser(this,
1258 MessageManager.getString("label.select_colour_minimum_value"),
1263 public void maxColour_actionPerformed(JPanel panel)
1265 JalviewColourChooser.showColourChooser(this,
1266 MessageManager.getString("label.select_colour_maximum_value"),
1271 public void gapColour_actionPerformed(JPanel gap)
1273 if (!useLegacyGap.isSelected())
1275 JalviewColourChooser.showColourChooser(this,
1276 MessageManager.getString("label.select_gap_colour"),
1282 public void hiddenColour_actionPerformed(JPanel hidden)
1284 JalviewColourChooser.showColourChooser(this,
1285 MessageManager.getString("label.select_hidden_colour"),
1290 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1292 boolean enabled = useLegacyGap.isSelected();
1295 gapColour.setBackground(
1296 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_LEGACY_GAP);
1300 gapColour.setBackground(
1301 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP);
1303 gapColour.setEnabled(!enabled);
1304 gapLabel.setEnabled(!enabled);
1308 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1310 useLegacyGap.setSelected(false);
1311 useLegacyGaps_actionPerformed(null);
1312 showHiddenAtStart.setSelected(false);
1313 hiddenColour.setBackground(
1314 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN);
1318 protected void userIdWidth_actionPerformed()
1322 String val = userIdWidth.getText().trim();
1323 if (val.length() > 0)
1325 Integer iw = Integer.parseInt(val);
1326 if (iw.intValue() < 12)
1328 throw new NumberFormatException();
1330 userIdWidth.setText(iw.toString());
1332 } catch (NumberFormatException x)
1334 userIdWidth.setText("");
1335 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
1337 .getString("warn.user_defined_width_requirements"),
1338 MessageManager.getString("label.invalid_id_column_width"),
1339 JvOptionPane.WARNING_MESSAGE);
1344 protected void autoIdWidth_actionPerformed()
1346 userIdWidth.setEnabled(!autoIdWidth.isSelected());
1347 userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
1351 * Returns true if chimera path is to a valid executable, else show an error
1354 private boolean validateChimeraPath()
1356 if (chimeraPath.getText().trim().length() > 0)
1358 File f = new File(chimeraPath.getText());
1359 if (!f.canExecute())
1361 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
1362 MessageManager.getString("label.invalid_chimera_path"),
1363 MessageManager.getString("label.invalid_name"),
1364 JvOptionPane.ERROR_MESSAGE);
1372 * If Chimera is selected, check it can be found on default or user-specified
1373 * path, if not show a warning/help dialog.
1376 protected void structureViewer_actionPerformed(String selectedItem)
1378 if (!selectedItem.equals(ViewerType.CHIMERA.name()))
1382 boolean found = false;
1385 * Try user-specified and standard paths for Chimera executable.
1387 List<String> paths = StructureManager.getChimeraPaths();
1388 paths.add(0, chimeraPath.getText());
1389 for (String path : paths)
1391 if (new File(path.trim()).canExecute())
1399 String[] options = { "OK", "Help" };
1400 int showHelp = JvOptionPane.showInternalOptionDialog(Desktop.desktop,
1401 JvSwingUtils.wrapTooltip(true,
1402 MessageManager.getString("label.chimera_missing")),
1403 "", JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE,
1404 null, options, options[0]);
1405 if (showHelp == JvOptionPane.NO_OPTION)
1409 Help.showHelpWindow(HelpId.StructureViewer);
1410 } catch (HelpSetException e)
1412 e.printStackTrace();
1418 public class OptionsParam
1420 private String name;
1422 private String code;
1424 public OptionsParam(String name, String code)
1430 public String getName()
1435 public void setName(String name)
1440 public String getCode()
1445 public void setCode(String code)
1451 public String toString()
1457 public boolean equals(Object that)
1459 if (!(that instanceof OptionsParam))
1463 return this.code.equalsIgnoreCase(((OptionsParam) that).code);
1467 public int hashCode()
1469 return name.hashCode() + code.hashCode();
1473 private class UrlListSelectionHandler implements ListSelectionListener
1477 public void valueChanged(ListSelectionEvent e)
1479 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
1481 int index = lsm.getMinSelectionIndex();
1484 // no selection, so disable delete/edit buttons
1485 editLink.setEnabled(false);
1486 deleteLink.setEnabled(false);
1489 int modelIndex = linkUrlTable.convertRowIndexToModel(index);
1491 // enable/disable edit and delete link buttons
1492 if (((UrlLinkTableModel) linkUrlTable.getModel())
1493 .isRowDeletable(modelIndex))
1495 deleteLink.setEnabled(true);
1499 deleteLink.setEnabled(false);
1502 if (((UrlLinkTableModel) linkUrlTable.getModel())
1503 .isRowEditable(modelIndex))
1505 editLink.setEnabled(true);
1509 editLink.setEnabled(false);