2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 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 jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
24 import jalview.bin.Cache;
25 import jalview.gui.StructureViewer.Viewer;
26 import jalview.io.JalviewFileChooser;
27 import jalview.io.JalviewFileView;
28 import jalview.jbgui.GPreferences;
29 import jalview.jbgui.GSequenceLink;
30 import jalview.schemes.ColourSchemeProperty;
31 import jalview.util.MessageManager;
33 import java.awt.BorderLayout;
34 import java.awt.Color;
35 import java.awt.Dimension;
37 import java.awt.event.ActionEvent;
38 import java.awt.event.ActionListener;
39 import java.awt.event.MouseEvent;
41 import java.util.Collection;
42 import java.util.StringTokenizer;
43 import java.util.Vector;
45 import javax.swing.JColorChooser;
46 import javax.swing.JFileChooser;
47 import javax.swing.JInternalFrame;
48 import javax.swing.JOptionPane;
49 import javax.swing.JPanel;
57 public class Preferences extends GPreferences
60 public static final String ADD_TEMPFACT_ANN = "ADD_TEMPFACT_ANN";
62 public static final String ADD_SS_ANN = "ADD_SS_ANN";
64 public static final String USE_RNAVIEW = "USE_RNAVIEW";
66 public static final String STRUCT_FROM_PDB = "STRUCT_FROM_PDB";
68 public static final String STRUCTURE_DISPLAY = "STRUCTURE_DISPLAY";
70 public static final String CHIMERA_PATH = "CHIMERA_PATH";
72 public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
74 public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
76 private static final int MIN_FONT_SIZE = 1;
78 private static final int MAX_FONT_SIZE = 30;
81 * Holds name and link separated with | character. Sequence ID must be
82 * $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
84 public static Vector sequenceURLLinks;
87 * Holds name and link separated with | character. Sequence IDS and Sequences
88 * must be $SEQUENCEIDS$ or $SEQUENCEIDS=/.possible | chars ./=$ and
89 * $SEQUENCES$ or $SEQUENCES=/.possible | chars ./=$ and separation character
90 * for first and second token specified after a pipe character at end |,|.
91 * (TODO: proper escape for using | to separate ids or sequences
94 public static Vector groupURLLinks;
100 "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$");
101 sequenceURLLinks = new Vector();
105 StringTokenizer st = new StringTokenizer(string, "|");
106 while (st.hasMoreElements())
108 String name = st.nextToken();
109 String url = st.nextToken();
110 // check for '|' within a regex
111 int rxstart = url.indexOf("$SEQUENCE_ID$");
112 while (rxstart == -1 && url.indexOf("/=$") == -1)
114 url = url + "|" + st.nextToken();
116 sequenceURLLinks.addElement(name + "|" + url);
118 } catch (Exception ex)
120 System.out.println(ex + "\nError parsing sequence links");
123 // upgrade old SRS link
124 int srsPos = sequenceURLLinks
125 .indexOf("SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry");
130 "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$",
136 * TODO: reformulate groupURL encoding so two or more can be stored in the
137 * .properties file as '|' separated strings
140 groupURLLinks = new Vector();
143 Vector nameLinks, urlLinks;
145 JInternalFrame frame;
147 DasSourceBrowser dasSource;
149 private WsPreferences wsPrefs;
152 * Creates a new Preferences object.
157 frame = new JInternalFrame();
158 frame.setContentPane(this);
159 dasSource = new DasSourceBrowser();
160 dasTab.add(dasSource, BorderLayout.CENTER);
161 wsPrefs = new WsPreferences();
162 wsTab.add(wsPrefs, BorderLayout.CENTER);
163 int width = 500, height = 420;
164 if (new jalview.util.Platform().isAMac())
170 Desktop.addInternalFrame(frame,
171 MessageManager.getString("label.preferences"), width, height);
172 frame.setMinimumSize(new Dimension(width, height));
175 * Set Visual tab defaults
177 seqLimit.setSelected(Cache.getDefault("SHOW_JVSUFFIX", true));
178 rightAlign.setSelected(Cache.getDefault("RIGHT_ALIGN_IDS", false));
179 fullScreen.setSelected(Cache.getDefault("SHOW_FULLSCREEN", false));
180 annotations.setSelected(Cache.getDefault("SHOW_ANNOTATIONS", true));
182 conservation.setSelected(Cache.getDefault("SHOW_CONSERVATION", true));
183 quality.setSelected(Cache.getDefault("SHOW_QUALITY", true));
184 identity.setSelected(Cache.getDefault("SHOW_IDENTITY", true));
185 openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false));
187 .setSelected(Cache.getDefault("SHOW_UNCONSERVED", false));
188 showGroupConsensus.setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS",
190 showGroupConservation.setSelected(Cache.getDefault(
191 "SHOW_GROUP_CONSERVATION", false));
192 showConsensHistogram.setSelected(Cache.getDefault(
193 "SHOW_CONSENSUS_HISTOGRAM", true));
194 showConsensLogo.setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO",
196 showNpTooltip.setSelected(Cache
197 .getDefault("SHOW_NPFEATS_TOOLTIP", true));
198 showDbRefTooltip.setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP",
201 String[] fonts = java.awt.GraphicsEnvironment
202 .getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
203 for (int i = 0; i < fonts.length; i++)
205 fontNameCB.addItem(fonts[i]);
208 for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++)
210 fontSizeCB.addItem(i + "");
213 fontStyleCB.addItem("plain");
214 fontStyleCB.addItem("bold");
215 fontStyleCB.addItem("italic");
217 fontNameCB.setSelectedItem(Cache.getDefault("FONT_NAME", "SansSerif"));
218 fontSizeCB.setSelectedItem(Cache.getDefault("FONT_SIZE", "10"));
219 fontStyleCB.setSelectedItem(Cache.getDefault("FONT_STYLE", Font.PLAIN
222 smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", false));
224 idItalics.setSelected(Cache.getDefault("ID_ITALICS", true));
226 wrap.setSelected(Cache.getDefault("WRAP_ALIGNMENT", false));
228 gapSymbolCB.addItem("-");
229 gapSymbolCB.addItem(".");
231 gapSymbolCB.setSelectedItem(Cache.getDefault("GAP_SYMBOL", "-"));
233 sortby.addItem("No sort");
234 sortby.addItem("Id");
235 sortby.addItem("Pairwise Identity");
236 sortby.setSelectedItem(Cache.getDefault("SORT_ALIGNMENT", "No sort"));
238 sortAnnBy.addItem(SequenceAnnotationOrder.NONE.toString());
240 .addItem(SequenceAnnotationOrder.SEQUENCE_AND_LABEL.toString());
242 .addItem(SequenceAnnotationOrder.LABEL_AND_SEQUENCE.toString());
243 SequenceAnnotationOrder savedSort = SequenceAnnotationOrder
244 .valueOf(Cache.getDefault(SORT_ANNOTATIONS,
245 SequenceAnnotationOrder.NONE.name()));
246 sortAnnBy.setSelectedItem(savedSort.toString());
248 sortAutocalc.addItem("Autocalculated first");
249 sortAutocalc.addItem("Autocalculated last");
250 final boolean showAbove = Cache.getDefault(SHOW_AUTOCALC_ABOVE,
252 sortAutocalc.setSelectedItem(showAbove ? sortAutocalc.getItemAt(0)
253 : sortAutocalc.getItemAt(1));
255 .setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true));
256 startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE",
257 Cache.getDefault("www.jalview.org", "http://www.jalview.org")
258 + "/examples/exampleFile_2_3.jar"));
261 * Set Colours tab defaults
263 for (int i = ColourSchemeProperty.FIRST_COLOUR; i <= ColourSchemeProperty.LAST_COLOUR; i++)
265 colour.addItem(ColourSchemeProperty.getColourName(i));
267 String string = Cache.getDefault("DEFAULT_COLOUR", "None");
268 colour.setSelectedItem(string);
269 minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN",
271 maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX",
275 * Set Structure tab defaults.
277 final boolean structSelected = Cache.getDefault(STRUCT_FROM_PDB, false);
278 structFromPdb.setSelected(structSelected);
279 useRnaView.setSelected(Cache.getDefault(USE_RNAVIEW, false));
280 useRnaView.setEnabled(structSelected);
281 addSecondaryStructure
282 .setSelected(Cache.getDefault(ADD_SS_ANN, false));
283 addSecondaryStructure.setEnabled(structSelected);
284 addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false));
285 addTempFactor.setEnabled(structSelected);
286 structViewer.setSelectedItem(Cache.getDefault(STRUCTURE_DISPLAY,
287 Viewer.JMOL.name()));
288 chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, ""));
289 chimeraPath.addActionListener(new ActionListener()
292 public void actionPerformed(ActionEvent e)
294 if (chimeraPath.getText().trim().length() > 0)
296 File f = new File(chimeraPath.getText());
299 JOptionPane.showInternalMessageDialog(Desktop.desktop,
300 MessageManager.getString("label.invalid_path"),
301 MessageManager.getString("label.invalid_name"),
302 JOptionPane.ERROR_MESSAGE);
309 * Set Connections tab defaults
311 nameLinks = new Vector();
312 urlLinks = new Vector();
313 for (int i = 0; i < sequenceURLLinks.size(); i++)
315 String link = sequenceURLLinks.elementAt(i).toString();
316 nameLinks.addElement(link.substring(0, link.indexOf("|")));
317 urlLinks.addElement(link.substring(link.indexOf("|") + 1));
322 useProxy.setSelected(Cache.getDefault("USE_PROXY", false));
323 proxyServerTB.setEnabled(useProxy.isSelected());
324 proxyPortTB.setEnabled(useProxy.isSelected());
325 proxyServerTB.setText(Cache.getDefault("PROXY_SERVER", ""));
326 proxyPortTB.setText(Cache.getDefault("PROXY_PORT", ""));
328 defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", ""));
330 usagestats.setSelected(Cache.getDefault("USAGESTATS", false));
331 // note antisense here: default is true
333 .setSelected(Cache.getProperty("NOQUESTIONNAIRES") == null);
334 versioncheck.setSelected(Cache.getDefault("VERSION_CHECK", true));
337 * Set Output tab defaults
340 .addItem(MessageManager.getString("label.prompt_each_time"));
341 epsRendering.addItem(MessageManager.getString("label.lineart"));
342 epsRendering.addItem(MessageManager.getString("action.text"));
343 epsRendering.setSelectedItem(Cache.getDefault("EPS_RENDERING",
344 "Prompt each time"));
345 autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false));
346 userIdWidth.setEnabled(autoIdWidth.isSelected());
347 userIdWidthlabel.setEnabled(autoIdWidth.isSelected());
348 Integer wi = Cache.getIntegerProperty("FIGURE_USERIDWIDTH");
349 userIdWidth.setText(wi == null ? "" : wi.toString());
350 blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true));
351 clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true));
352 fastajv.setSelected(Cache.getDefault("FASTA_JVSUFFIX", true));
353 msfjv.setSelected(Cache.getDefault("MSF_JVSUFFIX", true));
354 pfamjv.setSelected(Cache.getDefault("PFAM_JVSUFFIX", true));
355 pileupjv.setSelected(Cache.getDefault("PILEUP_JVSUFFIX", true));
356 pirjv.setSelected(Cache.getDefault("PIR_JVSUFFIX", true));
357 modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false));
360 * Set Editing tab defaults
362 autoCalculateConsCheck.setSelected(Cache.getDefault(
363 "AUTO_CALC_CONSENSUS", true));
364 padGaps.setSelected(Cache.getDefault("PAD_GAPS", false));
365 sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false));
367 annotations_actionPerformed(null); // update the display of the annotation
372 * Save user selections on the Preferences tabs to the Cache and write out to
377 public void ok_actionPerformed(ActionEvent e)
380 * Save Visual settings
382 Cache.applicationProperties.setProperty("SHOW_JVSUFFIX",
383 Boolean.toString(seqLimit.isSelected()));
384 Cache.applicationProperties.setProperty("RIGHT_ALIGN_IDS",
385 Boolean.toString(rightAlign.isSelected()));
386 Cache.applicationProperties.setProperty("SHOW_FULLSCREEN",
387 Boolean.toString(fullScreen.isSelected()));
388 Cache.applicationProperties.setProperty("SHOW_OVERVIEW",
389 Boolean.toString(openoverv.isSelected()));
390 Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS",
391 Boolean.toString(annotations.isSelected()));
392 Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
393 Boolean.toString(conservation.isSelected()));
394 Cache.applicationProperties.setProperty("SHOW_QUALITY",
395 Boolean.toString(quality.isSelected()));
396 Cache.applicationProperties.setProperty("SHOW_IDENTITY",
397 Boolean.toString(identity.isSelected()));
399 Cache.applicationProperties.setProperty("GAP_SYMBOL", gapSymbolCB
400 .getSelectedItem().toString());
402 Cache.applicationProperties.setProperty("FONT_NAME", fontNameCB
403 .getSelectedItem().toString());
404 Cache.applicationProperties.setProperty("FONT_STYLE", fontStyleCB
405 .getSelectedItem().toString());
406 Cache.applicationProperties.setProperty("FONT_SIZE", fontSizeCB
407 .getSelectedItem().toString());
409 Cache.applicationProperties.setProperty("ID_ITALICS",
410 Boolean.toString(idItalics.isSelected()));
411 Cache.applicationProperties.setProperty("SHOW_UNCONSERVED",
412 Boolean.toString(showUnconserved.isSelected()));
413 Cache.applicationProperties.setProperty("SHOW_GROUP_CONSENSUS",
414 Boolean.toString(showGroupConsensus.isSelected()));
415 Cache.applicationProperties.setProperty("SHOW_GROUP_CONSERVATION",
416 Boolean.toString(showGroupConservation.isSelected()));
417 Cache.applicationProperties.setProperty("SHOW_CONSENSUS_HISTOGRAM",
418 Boolean.toString(showConsensHistogram.isSelected()));
419 Cache.applicationProperties.setProperty("SHOW_CONSENSUS_LOGO",
420 Boolean.toString(showConsensLogo.isSelected()));
421 Cache.applicationProperties.setProperty("ANTI_ALIAS",
422 Boolean.toString(smoothFont.isSelected()));
423 Cache.applicationProperties.setProperty("SHOW_NPFEATS_TOOLTIP",
424 Boolean.toString(showNpTooltip.isSelected()));
425 Cache.applicationProperties.setProperty("SHOW_DBREFS_TOOLTIP",
426 Boolean.toString(showDbRefTooltip.isSelected()));
428 Cache.applicationProperties.setProperty("WRAP_ALIGNMENT",
429 Boolean.toString(wrap.isSelected()));
431 Cache.applicationProperties.setProperty("STARTUP_FILE",
432 startupFileTextfield.getText());
433 Cache.applicationProperties.setProperty("SHOW_STARTUP_FILE",
434 Boolean.toString(startupCheckbox.isSelected()));
436 Cache.applicationProperties.setProperty("SORT_ALIGNMENT", sortby
437 .getSelectedItem().toString());
439 // convert description of sort order to enum name for save
440 SequenceAnnotationOrder annSortOrder = SequenceAnnotationOrder
441 .forDescription(sortAnnBy.getSelectedItem().toString());
442 if (annSortOrder != null)
444 Cache.applicationProperties.setProperty(SORT_ANNOTATIONS,
445 annSortOrder.name());
448 final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0;
449 Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE,
450 Boolean.valueOf(showAutocalcFirst).toString());
453 * Save Colours settings
455 Cache.applicationProperties.setProperty("DEFAULT_COLOUR", colour
456 .getSelectedItem().toString());
457 Cache.setColourProperty("ANNOTATIONCOLOUR_MIN",
458 minColour.getBackground());
459 Cache.setColourProperty("ANNOTATIONCOLOUR_MAX",
460 maxColour.getBackground());
463 * Save Structure settings
465 Cache.applicationProperties.setProperty(ADD_TEMPFACT_ANN,
466 Boolean.toString(addTempFactor.isSelected()));
467 Cache.applicationProperties.setProperty(ADD_SS_ANN,
468 Boolean.toString(addSecondaryStructure.isSelected()));
469 Cache.applicationProperties.setProperty(USE_RNAVIEW,
470 Boolean.toString(useRnaView.isSelected()));
471 Cache.applicationProperties.setProperty(STRUCT_FROM_PDB,
472 Boolean.toString(structFromPdb.isSelected()));
473 Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY, structViewer
474 .getSelectedItem().toString());
475 Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
478 * Save Output settings
480 if (epsRendering.getSelectedItem().equals("Prompt each time"))
482 Cache.applicationProperties.remove("EPS_RENDERING");
486 Cache.applicationProperties.setProperty("EPS_RENDERING", epsRendering
487 .getSelectedItem().toString());
491 * Save Connections settings
493 Cache.setOrRemove("DEFAULT_BROWSER", defaultBrowser.getText());
495 jalview.util.BrowserLauncher.resetBrowser();
497 if (nameLinks.size() > 0)
499 StringBuffer links = new StringBuffer();
500 sequenceURLLinks = new Vector();
501 for (int i = 0; i < nameLinks.size(); i++)
503 sequenceURLLinks.addElement(nameLinks.elementAt(i) + "|"
504 + urlLinks.elementAt(i));
505 links.append(sequenceURLLinks.elementAt(i).toString());
509 links.setLength(links.length() - 1);
510 Cache.applicationProperties.setProperty("SEQUENCE_LINKS",
515 Cache.applicationProperties.remove("SEQUENCE_LINKS");
518 Cache.applicationProperties.setProperty("USE_PROXY",
519 Boolean.toString(useProxy.isSelected()));
521 Cache.setOrRemove("PROXY_SERVER", proxyServerTB.getText());
523 Cache.setOrRemove("PROXY_PORT", proxyPortTB.getText());
525 if (useProxy.isSelected())
527 System.setProperty("http.proxyHost", proxyServerTB.getText());
528 System.setProperty("http.proxyPort", proxyPortTB.getText());
532 System.setProperty("http.proxyHost", "");
533 System.setProperty("http.proxyPort", "");
535 Cache.setProperty("VERSION_CHECK",
536 Boolean.toString(versioncheck.isSelected()));
537 if (Cache.getProperty("USAGESTATS") != null || usagestats.isSelected())
539 // default is false - we only set this if the user has actively agreed
540 Cache.setProperty("USAGESTATS",
541 Boolean.toString(usagestats.isSelected()));
543 if (!questionnaire.isSelected())
545 Cache.setProperty("NOQUESTIONNAIRES", "true");
549 // special - made easy to edit a property file to disable questionnaires
550 // by just adding the given line
551 Cache.removeProperty("NOQUESTIONNAIRES");
555 * Save Output settings
557 Cache.applicationProperties.setProperty("BLC_JVSUFFIX",
558 Boolean.toString(blcjv.isSelected()));
559 Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX",
560 Boolean.toString(clustaljv.isSelected()));
561 Cache.applicationProperties.setProperty("FASTA_JVSUFFIX",
562 Boolean.toString(fastajv.isSelected()));
563 Cache.applicationProperties.setProperty("MSF_JVSUFFIX",
564 Boolean.toString(msfjv.isSelected()));
565 Cache.applicationProperties.setProperty("PFAM_JVSUFFIX",
566 Boolean.toString(pfamjv.isSelected()));
567 Cache.applicationProperties.setProperty("PILEUP_JVSUFFIX",
568 Boolean.toString(pileupjv.isSelected()));
569 Cache.applicationProperties.setProperty("PIR_JVSUFFIX",
570 Boolean.toString(pirjv.isSelected()));
571 Cache.applicationProperties.setProperty("PIR_MODELLER",
572 Boolean.toString(modellerOutput.isSelected()));
573 jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected();
575 Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH",
576 Boolean.toString(autoIdWidth.isSelected()));
577 userIdWidth_actionPerformed();
578 Cache.applicationProperties.setProperty("FIGURE_USERIDWIDTH",
579 userIdWidth.getText());
582 * Save Editing settings
584 Cache.applicationProperties.setProperty("AUTO_CALC_CONSENSUS",
585 Boolean.toString(autoCalculateConsCheck.isSelected()));
586 Cache.applicationProperties.setProperty("SORT_BY_TREE",
587 Boolean.toString(sortByTree.isSelected()));
588 Cache.applicationProperties.setProperty("PAD_GAPS",
589 Boolean.toString(padGaps.isSelected()));
591 dasSource.saveProperties(Cache.applicationProperties);
592 wsPrefs.updateAndRefreshWsMenuConfig(false);
594 Cache.saveProperties();
598 frame.setClosed(true);
599 } catch (Exception ex)
607 public void startupFileTextfield_mouseClicked()
609 JalviewFileChooser chooser = new JalviewFileChooser(
610 jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
612 { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "jar" },
614 { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview" },
615 jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
616 chooser.setFileView(new JalviewFileView());
617 chooser.setDialogTitle(MessageManager.getString("label.select_startup_file"));
619 int value = chooser.showOpenDialog(this);
621 if (value == JalviewFileChooser.APPROVE_OPTION)
623 jalview.bin.Cache.applicationProperties.setProperty(
624 "DEFAULT_FILE_FORMAT", chooser.getSelectedFormat());
625 startupFileTextfield.setText(chooser.getSelectedFile()
636 public void cancel_actionPerformed(ActionEvent e)
640 wsPrefs.updateWsMenuConfig(true);
641 wsPrefs.refreshWs_actionPerformed(e);
642 frame.setClosed(true);
643 } catch (Exception ex)
654 public void annotations_actionPerformed(ActionEvent e)
656 conservation.setEnabled(annotations.isSelected());
657 quality.setEnabled(annotations.isSelected());
658 identity.setEnabled(annotations.isSelected());
659 showGroupConsensus.setEnabled(annotations.isSelected());
660 showGroupConservation.setEnabled(annotations.isSelected());
661 showConsensHistogram.setEnabled(annotations.isSelected()
662 && (identity.isSelected() || showGroupConsensus.isSelected()));
663 showConsensLogo.setEnabled(annotations.isSelected()
664 && (identity.isSelected() || showGroupConsensus.isSelected()));
667 public void newLink_actionPerformed(ActionEvent e)
670 GSequenceLink link = new GSequenceLink();
671 boolean valid = false;
674 if (JOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
675 MessageManager.getString("label.new_sequence_url_link"),
676 JOptionPane.OK_CANCEL_OPTION, -1, null) == JOptionPane.OK_OPTION)
678 if (link.checkValid())
680 nameLinks.addElement(link.getName());
681 urlLinks.addElement(link.getURL());
693 public void editLink_actionPerformed(ActionEvent e)
695 GSequenceLink link = new GSequenceLink();
697 int index = linkNameList.getSelectedIndex();
700 JOptionPane.showInternalMessageDialog(Desktop.desktop,
701 MessageManager.getString("label.no_link_selected"),
702 MessageManager.getString("label.no_link_selected"),
703 JOptionPane.WARNING_MESSAGE);
707 link.setName(nameLinks.elementAt(index).toString());
708 link.setURL(urlLinks.elementAt(index).toString());
710 boolean valid = false;
714 if (JOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
715 MessageManager.getString("label.new_sequence_url_link"),
716 JOptionPane.OK_CANCEL_OPTION, -1, null) == JOptionPane.OK_OPTION)
718 if (link.checkValid())
720 nameLinks.setElementAt(link.getName(), index);
721 urlLinks.setElementAt(link.getURL(), index);
734 public void deleteLink_actionPerformed(ActionEvent e)
736 int index = linkNameList.getSelectedIndex();
739 JOptionPane.showInternalMessageDialog(Desktop.desktop,
740 MessageManager.getString("label.no_link_selected"),
741 MessageManager.getString("label.no_link_selected"),
742 JOptionPane.WARNING_MESSAGE);
745 nameLinks.removeElementAt(index);
746 urlLinks.removeElementAt(index);
750 void updateLinkData()
752 linkNameList.setListData(nameLinks);
753 linkURLList.setListData(urlLinks);
756 public void defaultBrowser_mouseClicked(MouseEvent e)
758 JFileChooser chooser = new JFileChooser(".");
759 chooser.setDialogTitle(MessageManager.getString("label.select_default_browser"));
761 int value = chooser.showOpenDialog(this);
763 if (value == JFileChooser.APPROVE_OPTION)
765 defaultBrowser.setText(chooser.getSelectedFile().getAbsolutePath());
774 * jalview.jbgui.GPreferences#showunconserved_actionPerformed(java.awt.event
777 protected void showunconserved_actionPerformed(ActionEvent e)
779 // TODO Auto-generated method stub
780 super.showunconserved_actionPerformed(e);
783 public static Collection getGroupURLLinks()
785 return groupURLLinks;
789 public void minColour_actionPerformed(JPanel panel)
791 Color col = JColorChooser.showDialog(this,
792 MessageManager.getString("label.select_colour_minimum_value"), minColour.getBackground());
795 panel.setBackground(col);
801 public void maxColour_actionPerformed(JPanel panel)
803 Color col = JColorChooser.showDialog(this,
804 MessageManager.getString("label.select_colour_maximum_value"), maxColour.getBackground());
807 panel.setBackground(col);
813 protected void userIdWidth_actionPerformed()
817 String val = userIdWidth.getText().trim();
818 if (val.length() > 0)
820 Integer iw = Integer.parseInt(val);
821 if (iw.intValue() < 12)
823 throw new NumberFormatException();
825 userIdWidth.setText(iw.toString());
827 } catch (NumberFormatException x)
830 .showInternalMessageDialog(
832 MessageManager.getString("warn.user_defined_width_requirements"),
833 MessageManager.getString("label.invalid_id_column_width"),
834 JOptionPane.WARNING_MESSAGE);
835 userIdWidth.setText("");
840 protected void autoIdWidth_actionPerformed()
842 userIdWidth.setEnabled(!autoIdWidth.isSelected());
843 userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());