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.setColourPropertyNoSave("ANNOTATIONCOLOUR_MIN",
785 minColour.getBackground());
786 Cache.setColourPropertyNoSave("ANNOTATIONCOLOUR_MAX",
787 maxColour.getBackground());
790 * Save Overview settings
792 Cache.setColourPropertyNoSave(GAP_COLOUR, gapColour.getBackground());
793 Cache.setColourPropertyNoSave(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 if (!Platform.isJS())
812 Cache.setPropertyNoSave(STRUCTURE_DISPLAY,
813 structViewer.getSelectedItem().toString());
815 Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
816 Cache.setPropertyNoSave("MAP_WITH_SIFTS",
817 Boolean.toString(siftsMapping.isSelected()));
818 SiftsSettings.setMapWithSifts(siftsMapping.isSelected());
821 * Save Output settings
823 Cache.setPropertyNoSave("EPS_RENDERING",
824 ((OptionsParam) epsRendering.getSelectedItem()).getCode());
825 Cache.setPropertyNoSave("HTML_RENDERING",
826 ((OptionsParam) htmlRendering.getSelectedItem()).getCode());
827 Cache.setPropertyNoSave("SVG_RENDERING",
828 ((OptionsParam) svgRendering.getSelectedItem()).getCode());
831 * Save Connections settings
833 Cache.setOrRemove("DEFAULT_BROWSER", defaultBrowser.getText());
835 jalview.util.BrowserLauncher.resetBrowser();
837 // save user-defined and selected links
838 String menuLinks = sequenceUrlLinks.writeUrlsAsString(true);
839 if (menuLinks.isEmpty())
841 Cache.removePropertyNoSave("SEQUENCE_LINKS");
845 Cache.setPropertyNoSave("SEQUENCE_LINKS",
846 menuLinks.toString());
849 String nonMenuLinks = sequenceUrlLinks.writeUrlsAsString(false);
850 if (nonMenuLinks.isEmpty())
852 Cache.removePropertyNoSave("STORED_LINKS");
856 Cache.setPropertyNoSave("STORED_LINKS",
857 nonMenuLinks.toString());
860 Cache.setPropertyNoSave("DEFAULT_URL",
861 sequenceUrlLinks.getPrimaryUrlId());
863 Cache.setPropertyNoSave("USE_PROXY",
864 Boolean.toString(useProxy.isSelected()));
866 Cache.setOrRemove("PROXY_SERVER", proxyServerTB.getText());
868 Cache.setOrRemove("PROXY_PORT", proxyPortTB.getText());
870 if (useProxy.isSelected())
872 System.setProperty("http.proxyHost", proxyServerTB.getText());
873 System.setProperty("http.proxyPort", proxyPortTB.getText());
877 System.setProperty("http.proxyHost", "");
878 System.setProperty("http.proxyPort", "");
880 Cache.setProperty("VERSION_CHECK",
881 Boolean.toString(versioncheck.isSelected()));
882 if (Cache.getProperty("USAGESTATS") != null || usagestats.isSelected())
884 // default is false - we only set this if the user has actively agreed
885 Cache.setProperty("USAGESTATS",
886 Boolean.toString(usagestats.isSelected()));
888 if (!questionnaire.isSelected())
890 Cache.setProperty("NOQUESTIONNAIRES", "true");
894 // special - made easy to edit a property file to disable questionnaires
895 // by just adding the given line
896 Cache.removeProperty("NOQUESTIONNAIRES");
900 * Save Output settings
902 Cache.setPropertyNoSave("BLC_JVSUFFIX",
903 Boolean.toString(blcjv.isSelected()));
904 Cache.setPropertyNoSave("CLUSTAL_JVSUFFIX",
905 Boolean.toString(clustaljv.isSelected()));
906 Cache.setPropertyNoSave("FASTA_JVSUFFIX",
907 Boolean.toString(fastajv.isSelected()));
908 Cache.setPropertyNoSave("MSF_JVSUFFIX",
909 Boolean.toString(msfjv.isSelected()));
910 Cache.setPropertyNoSave("PFAM_JVSUFFIX",
911 Boolean.toString(pfamjv.isSelected()));
912 Cache.setPropertyNoSave("PILEUP_JVSUFFIX",
913 Boolean.toString(pileupjv.isSelected()));
914 Cache.setPropertyNoSave("PIR_JVSUFFIX",
915 Boolean.toString(pirjv.isSelected()));
916 Cache.setPropertyNoSave("PIR_MODELLER",
917 Boolean.toString(modellerOutput.isSelected()));
918 Cache.setPropertyNoSave("EXPORT_EMBBED_BIOJSON",
919 Boolean.toString(embbedBioJSON.isSelected()));
920 jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected();
922 Cache.setPropertyNoSave("FIGURE_AUTOIDWIDTH",
923 Boolean.toString(autoIdWidth.isSelected()));
924 userIdWidth_actionPerformed();
925 Cache.setPropertyNoSave("FIGURE_FIXEDIDWIDTH",
926 userIdWidth.getText());
929 * Save Editing settings
931 Cache.setPropertyNoSave("AUTO_CALC_CONSENSUS",
932 Boolean.toString(autoCalculateConsCheck.isSelected()));
933 Cache.setPropertyNoSave("SORT_BY_TREE",
934 Boolean.toString(sortByTree.isSelected()));
935 Cache.setPropertyNoSave("PAD_GAPS",
936 Boolean.toString(padGaps.isSelected()));
938 if (!Platform.isJS())
940 wsPrefs.updateAndRefreshWsMenuConfig(false);
944 * Save Backups settings
946 Cache.setPropertyNoSave(BackupFiles.ENABLED,
947 Boolean.toString(enableBackupFiles.isSelected()));
948 int preset = getComboIntStringKey(backupfilesPresetsCombo);
949 Cache.setPropertyNoSave(BackupFiles.NS + "_PRESET", Integer.toString(preset));
951 if (preset == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM)
953 BackupFilesPresetEntry customBFPE = getBackupfilesCurrentEntry();
954 BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
955 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM, customBFPE);
956 Cache.setPropertyNoSave(BackupFilesPresetEntry.CUSTOMCONFIG,
957 customBFPE.toString());
960 BackupFilesPresetEntry savedBFPE = BackupFilesPresetEntry.backupfilesPresetEntriesValues
962 Cache.setPropertyNoSave(
963 BackupFilesPresetEntry.SAVEDCONFIG, savedBFPE.toString());
965 Cache.saveProperties();
966 Desktop.instance.doConfigureStructurePrefs();
969 frame.setClosed(true);
970 } catch (Exception ex)
975 public static void setAppletDefaults()
978 // http://www.jalview.org/old/v2_8/examples/appletParameters.html
980 // showConservation true or false Default is true.
981 // showQuality true or false Default is true.
982 // showConsensus true or false Default is true.
983 // showFeatureSettings true or false Shows the feature settings window when
985 // showTreeBootstraps true or false (default is true) show or hide branch
987 // showTreeDistances true or false (default is true) show or hide branch
989 // showUnlinkedTreeNodes true or false (default is false) indicate if
990 // unassociated nodes should be highlighted in the tree view
991 // showUnconserved true of false (default is false) When true, only gaps and
992 // symbols different to the consensus sequence ions of the alignment
993 // showGroupConsensus true of false (default is false) When true, shows
994 // consensus annotation row for any groups on the alignment. (since 2.7)
995 // showGroupConservation true of false (default is false) When true, shows
996 // amino-acid property conservation annotation row for any groups on the
997 // showConsensusHistogram true of false (default is true) When true, shows
998 // the percentage occurence of the consensus symbol for each column as a
999 // showSequenceLogo true of false (default is false) When true, shows a
1000 // sequence logo above the consensus sequence (overlaid above the Consensus
1002 Cache.setPropertyNoSave(SHOW_CONSERVATION, "true");
1003 Cache.setPropertyNoSave(SHOW_QUALITY, "false");
1004 Cache.setPropertyNoSave(SHOW_CONSENSUS, "true");
1005 Cache.setPropertyNoSave(SHOW_UNCONSERVED, "false");
1006 Cache.setPropertyNoSave(SHOW_GROUP_CONSERVATION, "false");
1007 Cache.setPropertyNoSave(SHOW_GROUP_CONSENSUS, "false");
1009 // TODO -- just a start here
1012 * Do any necessary validation before saving settings. Return focus to the
1013 * first tab which fails validation.
1017 private boolean validateSettings()
1019 if (!validateStructure())
1021 structureTab.requestFocusInWindow();
1028 protected boolean validateStructure()
1030 return validateChimeraPath();
1038 public void startupFileTextfield_mouseClicked()
1040 // TODO: JAL-3048 not needed for Jalview-JS
1041 String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT");
1042 JalviewFileChooser chooser = JalviewFileChooser
1043 .forRead(Cache.getProperty("LAST_DIRECTORY"), fileFormat);
1044 chooser.setFileView(new JalviewFileView());
1045 chooser.setDialogTitle(
1046 MessageManager.getString("label.select_startup_file"));
1048 int value = chooser.showOpenDialog(this);
1050 if (value == JalviewFileChooser.APPROVE_OPTION)
1052 FileFormatI format = chooser.getSelectedFormat();
1055 Cache.setPropertyNoSave("DEFAULT_FILE_FORMAT",
1058 startupFileTextfield
1059 .setText(chooser.getSelectedFile().getAbsolutePath());
1070 public void cancel_actionPerformed(ActionEvent e)
1074 if (!Platform.isJS())
1076 wsPrefs.updateWsMenuConfig(true);
1077 wsPrefs.refreshWs_actionPerformed(e);
1079 frame.setClosed(true);
1080 } catch (Exception ex)
1092 public void annotations_actionPerformed(ActionEvent e)
1094 conservation.setEnabled(annotations.isSelected());
1095 quality.setEnabled(annotations.isSelected());
1096 identity.setEnabled(annotations.isSelected());
1097 showOccupancy.setEnabled(annotations.isSelected());
1098 showGroupConsensus.setEnabled(annotations.isSelected());
1099 showGroupConservation.setEnabled(annotations.isSelected());
1100 showConsensHistogram.setEnabled(annotations.isSelected()
1101 && (identity.isSelected() || showGroupConsensus.isSelected()));
1102 showConsensLogo.setEnabled(annotations.isSelected()
1103 && (identity.isSelected() || showGroupConsensus.isSelected()));
1107 public void newLink_actionPerformed(ActionEvent e)
1109 GSequenceLink link = new GSequenceLink();
1110 boolean valid = false;
1113 if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
1114 MessageManager.getString("label.new_sequence_url_link"),
1115 JvOptionPane.OK_CANCEL_OPTION, -1,
1116 null) == JvOptionPane.OK_OPTION)
1118 if (link.checkValid())
1120 if (((UrlLinkTableModel) linkUrlTable.getModel())
1121 .isUniqueName(link.getName()))
1123 ((UrlLinkTableModel) linkUrlTable.getModel())
1124 .insertRow(link.getName(), link.getURL());
1129 link.notifyDuplicate();
1142 public void editLink_actionPerformed(ActionEvent e)
1144 GSequenceLink link = new GSequenceLink();
1146 int index = linkUrlTable.getSelectedRow();
1149 // button no longer enabled if row is not selected
1150 Cache.log.debug("Edit with no row selected in linkUrlTable");
1154 int nameCol = ((UrlLinkTableModel) linkUrlTable.getModel())
1156 int urlCol = ((UrlLinkTableModel) linkUrlTable.getModel())
1158 String oldName = linkUrlTable.getValueAt(index, nameCol).toString();
1159 link.setName(oldName);
1160 link.setURL(linkUrlTable.getValueAt(index, urlCol).toString());
1162 boolean valid = false;
1165 if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
1166 MessageManager.getString("label.edit_sequence_url_link"),
1167 JvOptionPane.OK_CANCEL_OPTION, -1,
1168 null) == JvOptionPane.OK_OPTION)
1170 if (link.checkValid())
1172 if ((oldName.equals(link.getName()))
1173 || (((UrlLinkTableModel) linkUrlTable.getModel())
1174 .isUniqueName(link.getName())))
1176 linkUrlTable.setValueAt(link.getName(), index, nameCol);
1177 linkUrlTable.setValueAt(link.getURL(), index, urlCol);
1182 link.notifyDuplicate();
1195 public void deleteLink_actionPerformed(ActionEvent e)
1197 int index = linkUrlTable.getSelectedRow();
1198 int modelIndex = -1;
1201 // button no longer enabled if row is not selected
1202 Cache.log.debug("Delete with no row selected in linkUrlTable");
1207 modelIndex = linkUrlTable.convertRowIndexToModel(index);
1210 // make sure we use the model index to delete, and not the table index
1211 ((UrlLinkTableModel) linkUrlTable.getModel()).removeRow(modelIndex);
1215 public void defaultBrowser_mouseClicked(MouseEvent e)
1217 // TODO: JAL-3048 not needed for j2s
1218 if (!Platform.isJS()) // BH 2019
1225 JFileChooser chooser = new JFileChooser(".");
1226 chooser.setDialogTitle(
1227 MessageManager.getString("label.select_default_browser"));
1229 int value = chooser.showOpenDialog(this);
1231 if (value == JFileChooser.APPROVE_OPTION)
1233 defaultBrowser.setText(chooser.getSelectedFile().getAbsolutePath());
1242 * jalview.jbgui.GPreferences#showunconserved_actionPerformed(java.awt.event
1246 protected void showunconserved_actionPerformed(ActionEvent e)
1248 // TODO Auto-generated method stub
1249 super.showunconserved_actionPerformed(e);
1252 public static List<String> getGroupURLLinks()
1254 return groupURLLinks;
1258 public void minColour_actionPerformed(JPanel panel)
1260 JalviewColourChooser.showColourChooser(this,
1261 MessageManager.getString("label.select_colour_minimum_value"),
1266 public void maxColour_actionPerformed(JPanel panel)
1268 JalviewColourChooser.showColourChooser(this,
1269 MessageManager.getString("label.select_colour_maximum_value"),
1274 public void gapColour_actionPerformed(JPanel gap)
1276 if (!useLegacyGap.isSelected())
1278 JalviewColourChooser.showColourChooser(this,
1279 MessageManager.getString("label.select_gap_colour"),
1285 public void hiddenColour_actionPerformed(JPanel hidden)
1287 JalviewColourChooser.showColourChooser(this,
1288 MessageManager.getString("label.select_hidden_colour"),
1293 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1295 boolean enabled = useLegacyGap.isSelected();
1298 gapColour.setBackground(
1299 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_LEGACY_GAP);
1303 gapColour.setBackground(
1304 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP);
1306 gapColour.setEnabled(!enabled);
1307 gapLabel.setEnabled(!enabled);
1311 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1313 useLegacyGap.setSelected(false);
1314 useLegacyGaps_actionPerformed(null);
1315 showHiddenAtStart.setSelected(false);
1316 hiddenColour.setBackground(
1317 jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_HIDDEN);
1321 protected void userIdWidth_actionPerformed()
1325 String val = userIdWidth.getText().trim();
1326 if (val.length() > 0)
1328 Integer iw = Integer.parseInt(val);
1329 if (iw.intValue() < 12)
1331 throw new NumberFormatException();
1333 userIdWidth.setText(iw.toString());
1335 } catch (NumberFormatException x)
1337 userIdWidth.setText("");
1338 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
1340 .getString("warn.user_defined_width_requirements"),
1341 MessageManager.getString("label.invalid_id_column_width"),
1342 JvOptionPane.WARNING_MESSAGE);
1347 protected void autoIdWidth_actionPerformed()
1349 userIdWidth.setEnabled(!autoIdWidth.isSelected());
1350 userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
1354 * Returns true if chimera path is to a valid executable, else show an error
1357 private boolean validateChimeraPath()
1359 if (chimeraPath.getText().trim().length() > 0)
1361 File f = new File(chimeraPath.getText());
1362 if (!f.canExecute())
1364 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
1365 MessageManager.getString("label.invalid_chimera_path"),
1366 MessageManager.getString("label.invalid_name"),
1367 JvOptionPane.ERROR_MESSAGE);
1375 * If Chimera is selected, check it can be found on default or user-specified
1376 * path, if not show a warning/help dialog.
1379 protected void structureViewer_actionPerformed(String selectedItem)
1381 if (!selectedItem.equals(ViewerType.CHIMERA.name()))
1385 boolean found = false;
1388 * Try user-specified and standard paths for Chimera executable.
1390 List<String> paths = StructureManager.getChimeraPaths();
1391 paths.add(0, chimeraPath.getText());
1392 for (String path : paths)
1394 if (new File(path.trim()).canExecute())
1402 String[] options = { "OK", "Help" };
1403 int showHelp = JvOptionPane.showInternalOptionDialog(Desktop.desktop,
1404 JvSwingUtils.wrapTooltip(true,
1405 MessageManager.getString("label.chimera_missing")),
1406 "", JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE,
1407 null, options, options[0]);
1408 if (showHelp == JvOptionPane.NO_OPTION)
1412 Help.showHelpWindow(HelpId.StructureViewer);
1413 } catch (HelpSetException e)
1415 e.printStackTrace();
1421 public class OptionsParam
1423 private String name;
1425 private String code;
1427 public OptionsParam(String name, String code)
1433 public String getName()
1438 public void setName(String name)
1443 public String getCode()
1448 public void setCode(String code)
1454 public String toString()
1460 public boolean equals(Object that)
1462 if (!(that instanceof OptionsParam))
1466 return this.code.equalsIgnoreCase(((OptionsParam) that).code);
1470 public int hashCode()
1472 return name.hashCode() + code.hashCode();
1476 private class UrlListSelectionHandler implements ListSelectionListener
1480 public void valueChanged(ListSelectionEvent e)
1482 ListSelectionModel lsm = (ListSelectionModel) e.getSource();
1484 int index = lsm.getMinSelectionIndex();
1487 // no selection, so disable delete/edit buttons
1488 editLink.setEnabled(false);
1489 deleteLink.setEnabled(false);
1492 int modelIndex = linkUrlTable.convertRowIndexToModel(index);
1494 // enable/disable edit and delete link buttons
1495 if (((UrlLinkTableModel) linkUrlTable.getModel())
1496 .isRowDeletable(modelIndex))
1498 deleteLink.setEnabled(true);
1502 deleteLink.setEnabled(false);
1505 if (((UrlLinkTableModel) linkUrlTable.getModel())
1506 .isRowEditable(modelIndex))
1508 editLink.setEnabled(true);
1512 editLink.setEnabled(false);