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.MouseEvent;
39 import java.util.Collection;
40 import java.util.StringTokenizer;
41 import java.util.Vector;
43 import javax.swing.JColorChooser;
44 import javax.swing.JFileChooser;
45 import javax.swing.JInternalFrame;
46 import javax.swing.JOptionPane;
47 import javax.swing.JPanel;
55 public class Preferences extends GPreferences
58 public static final String ADD_TEMPFACT_ANN = "ADD_TEMPFACT_ANN";
60 public static final String ADD_SS_ANN = "ADD_SS_ANN";
62 public static final String USE_RNAVIEW = "USE_RNAVIEW";
64 public static final String STRUCT_FROM_PDB = "STRUCT_FROM_PDB";
66 public static final String STRUCTURE_DISPLAY = "STRUCTURE_DISPLAY";
68 public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
70 public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
72 private static final int MIN_FONT_SIZE = 1;
74 private static final int MAX_FONT_SIZE = 30;
77 * Holds name and link separated with | character. Sequence ID must be
78 * $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
80 public static Vector sequenceURLLinks;
83 * Holds name and link separated with | character. Sequence IDS and Sequences
84 * must be $SEQUENCEIDS$ or $SEQUENCEIDS=/.possible | chars ./=$ and
85 * $SEQUENCES$ or $SEQUENCES=/.possible | chars ./=$ and separation character
86 * for first and second token specified after a pipe character at end |,|.
87 * (TODO: proper escape for using | to separate ids or sequences
90 public static Vector groupURLLinks;
96 "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$");
97 sequenceURLLinks = new Vector();
101 StringTokenizer st = new StringTokenizer(string, "|");
102 while (st.hasMoreElements())
104 String name = st.nextToken();
105 String url = st.nextToken();
106 // check for '|' within a regex
107 int rxstart = url.indexOf("$SEQUENCE_ID$");
108 while (rxstart == -1 && url.indexOf("/=$") == -1)
110 url = url + "|" + st.nextToken();
112 sequenceURLLinks.addElement(name + "|" + url);
114 } catch (Exception ex)
116 System.out.println(ex + "\nError parsing sequence links");
119 // upgrade old SRS link
120 int srsPos = sequenceURLLinks
121 .indexOf("SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry");
126 "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$",
132 * TODO: reformulate groupURL encoding so two or more can be stored in the
133 * .properties file as '|' separated strings
136 groupURLLinks = new Vector();
139 Vector nameLinks, urlLinks;
141 JInternalFrame frame;
143 DasSourceBrowser dasSource;
145 private WsPreferences wsPrefs;
148 * Creates a new Preferences object.
153 frame = new JInternalFrame();
154 frame.setContentPane(this);
155 dasSource = new DasSourceBrowser();
156 dasTab.add(dasSource, BorderLayout.CENTER);
157 wsPrefs = new WsPreferences();
158 wsTab.add(wsPrefs, BorderLayout.CENTER);
159 int width = 500, height = 420;
160 if (new jalview.util.Platform().isAMac())
166 Desktop.addInternalFrame(frame,
167 MessageManager.getString("label.preferences"), width, height);
168 frame.setMinimumSize(new Dimension(width, height));
171 * Set Visual tab defaults
173 seqLimit.setSelected(Cache.getDefault("SHOW_JVSUFFIX", true));
174 rightAlign.setSelected(Cache.getDefault("RIGHT_ALIGN_IDS", false));
175 fullScreen.setSelected(Cache.getDefault("SHOW_FULLSCREEN", false));
176 annotations.setSelected(Cache.getDefault("SHOW_ANNOTATIONS", true));
178 conservation.setSelected(Cache.getDefault("SHOW_CONSERVATION", true));
179 quality.setSelected(Cache.getDefault("SHOW_QUALITY", true));
180 identity.setSelected(Cache.getDefault("SHOW_IDENTITY", true));
181 openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false));
183 .setSelected(Cache.getDefault("SHOW_UNCONSERVED", false));
184 showGroupConsensus.setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS",
186 showGroupConservation.setSelected(Cache.getDefault(
187 "SHOW_GROUP_CONSERVATION", false));
188 showConsensHistogram.setSelected(Cache.getDefault(
189 "SHOW_CONSENSUS_HISTOGRAM", true));
190 showConsensLogo.setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO",
192 showNpTooltip.setSelected(Cache
193 .getDefault("SHOW_NPFEATS_TOOLTIP", true));
194 showDbRefTooltip.setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP",
197 String[] fonts = java.awt.GraphicsEnvironment
198 .getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
199 for (int i = 0; i < fonts.length; i++)
201 fontNameCB.addItem(fonts[i]);
204 for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++)
206 fontSizeCB.addItem(i + "");
209 fontStyleCB.addItem("plain");
210 fontStyleCB.addItem("bold");
211 fontStyleCB.addItem("italic");
213 fontNameCB.setSelectedItem(Cache.getDefault("FONT_NAME", "SansSerif"));
214 fontSizeCB.setSelectedItem(Cache.getDefault("FONT_SIZE", "10"));
215 fontStyleCB.setSelectedItem(Cache.getDefault("FONT_STYLE", Font.PLAIN
218 smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", false));
220 idItalics.setSelected(Cache.getDefault("ID_ITALICS", true));
222 wrap.setSelected(Cache.getDefault("WRAP_ALIGNMENT", false));
224 gapSymbolCB.addItem("-");
225 gapSymbolCB.addItem(".");
227 gapSymbolCB.setSelectedItem(Cache.getDefault("GAP_SYMBOL", "-"));
229 sortby.addItem("No sort");
230 sortby.addItem("Id");
231 sortby.addItem("Pairwise Identity");
232 sortby.setSelectedItem(Cache.getDefault("SORT_ALIGNMENT", "No sort"));
234 sortAnnBy.addItem(SequenceAnnotationOrder.NONE.toString());
236 .addItem(SequenceAnnotationOrder.SEQUENCE_AND_LABEL.toString());
238 .addItem(SequenceAnnotationOrder.LABEL_AND_SEQUENCE.toString());
239 SequenceAnnotationOrder savedSort = SequenceAnnotationOrder
240 .valueOf(Cache.getDefault(SORT_ANNOTATIONS,
241 SequenceAnnotationOrder.NONE.name()));
242 sortAnnBy.setSelectedItem(savedSort.toString());
244 sortAutocalc.addItem("Autocalculated first");
245 sortAutocalc.addItem("Autocalculated last");
246 final boolean showAbove = Cache.getDefault(SHOW_AUTOCALC_ABOVE,
248 sortAutocalc.setSelectedItem(showAbove ? sortAutocalc.getItemAt(0)
249 : sortAutocalc.getItemAt(1));
251 .setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true));
252 startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE",
253 Cache.getDefault("www.jalview.org", "http://www.jalview.org")
254 + "/examples/exampleFile_2_3.jar"));
257 * Set Colours tab defaults
259 for (int i = ColourSchemeProperty.FIRST_COLOUR; i <= ColourSchemeProperty.LAST_COLOUR; i++)
261 colour.addItem(ColourSchemeProperty.getColourName(i));
263 String string = Cache.getDefault("DEFAULT_COLOUR", "None");
264 colour.setSelectedItem(string);
265 minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN",
267 maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX",
271 * Set Structure tab defaults.
273 final boolean structSelected = Cache.getDefault(STRUCT_FROM_PDB, false);
274 structFromPdb.setSelected(structSelected);
275 useRnaView.setSelected(Cache.getDefault(USE_RNAVIEW, false));
276 useRnaView.setEnabled(structSelected);
277 addSecondaryStructure
278 .setSelected(Cache.getDefault(ADD_SS_ANN, false));
279 addSecondaryStructure.setEnabled(structSelected);
280 addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false));
281 addTempFactor.setEnabled(structSelected);
282 structViewer.setSelectedItem(Cache.getDefault(STRUCTURE_DISPLAY,
283 Viewer.JMOL.name()));
286 * Set Connections tab defaults
288 nameLinks = new Vector();
289 urlLinks = new Vector();
290 for (int i = 0; i < sequenceURLLinks.size(); i++)
292 String link = sequenceURLLinks.elementAt(i).toString();
293 nameLinks.addElement(link.substring(0, link.indexOf("|")));
294 urlLinks.addElement(link.substring(link.indexOf("|") + 1));
299 useProxy.setSelected(Cache.getDefault("USE_PROXY", false));
300 proxyServerTB.setEnabled(useProxy.isSelected());
301 proxyPortTB.setEnabled(useProxy.isSelected());
302 proxyServerTB.setText(Cache.getDefault("PROXY_SERVER", ""));
303 proxyPortTB.setText(Cache.getDefault("PROXY_PORT", ""));
305 defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", ""));
307 usagestats.setSelected(Cache.getDefault("USAGESTATS", false));
308 // note antisense here: default is true
310 .setSelected(Cache.getProperty("NOQUESTIONNAIRES") == null);
311 versioncheck.setSelected(Cache.getDefault("VERSION_CHECK", true));
314 * Set Output tab defaults
317 .addItem(MessageManager.getString("label.prompt_each_time"));
318 epsRendering.addItem(MessageManager.getString("label.lineart"));
319 epsRendering.addItem(MessageManager.getString("action.text"));
320 epsRendering.setSelectedItem(Cache.getDefault("EPS_RENDERING",
321 "Prompt each time"));
322 autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false));
323 userIdWidth.setEnabled(autoIdWidth.isSelected());
324 userIdWidthlabel.setEnabled(autoIdWidth.isSelected());
325 Integer wi = Cache.getIntegerProperty("FIGURE_USERIDWIDTH");
326 userIdWidth.setText(wi == null ? "" : wi.toString());
327 blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true));
328 clustaljv.setSelected(Cache.getDefault("CLUSTAL_JVSUFFIX", true));
329 fastajv.setSelected(Cache.getDefault("FASTA_JVSUFFIX", true));
330 msfjv.setSelected(Cache.getDefault("MSF_JVSUFFIX", true));
331 pfamjv.setSelected(Cache.getDefault("PFAM_JVSUFFIX", true));
332 pileupjv.setSelected(Cache.getDefault("PILEUP_JVSUFFIX", true));
333 pirjv.setSelected(Cache.getDefault("PIR_JVSUFFIX", true));
334 modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false));
337 * Set Editing tab defaults
339 autoCalculateConsCheck.setSelected(Cache.getDefault(
340 "AUTO_CALC_CONSENSUS", true));
341 padGaps.setSelected(Cache.getDefault("PAD_GAPS", false));
342 sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false));
344 annotations_actionPerformed(null); // update the display of the annotation
349 * Save user selections on the Preferences tabs to the Cache and write out to
354 public void ok_actionPerformed(ActionEvent e)
357 * Save Visual settings
359 Cache.applicationProperties.setProperty("SHOW_JVSUFFIX",
360 Boolean.toString(seqLimit.isSelected()));
361 Cache.applicationProperties.setProperty("RIGHT_ALIGN_IDS",
362 Boolean.toString(rightAlign.isSelected()));
363 Cache.applicationProperties.setProperty("SHOW_FULLSCREEN",
364 Boolean.toString(fullScreen.isSelected()));
365 Cache.applicationProperties.setProperty("SHOW_OVERVIEW",
366 Boolean.toString(openoverv.isSelected()));
367 Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS",
368 Boolean.toString(annotations.isSelected()));
369 Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
370 Boolean.toString(conservation.isSelected()));
371 Cache.applicationProperties.setProperty("SHOW_QUALITY",
372 Boolean.toString(quality.isSelected()));
373 Cache.applicationProperties.setProperty("SHOW_IDENTITY",
374 Boolean.toString(identity.isSelected()));
376 Cache.applicationProperties.setProperty("GAP_SYMBOL", gapSymbolCB
377 .getSelectedItem().toString());
379 Cache.applicationProperties.setProperty("FONT_NAME", fontNameCB
380 .getSelectedItem().toString());
381 Cache.applicationProperties.setProperty("FONT_STYLE", fontStyleCB
382 .getSelectedItem().toString());
383 Cache.applicationProperties.setProperty("FONT_SIZE", fontSizeCB
384 .getSelectedItem().toString());
386 Cache.applicationProperties.setProperty("ID_ITALICS",
387 Boolean.toString(idItalics.isSelected()));
388 Cache.applicationProperties.setProperty("SHOW_UNCONSERVED",
389 Boolean.toString(showUnconserved.isSelected()));
390 Cache.applicationProperties.setProperty("SHOW_GROUP_CONSENSUS",
391 Boolean.toString(showGroupConsensus.isSelected()));
392 Cache.applicationProperties.setProperty("SHOW_GROUP_CONSERVATION",
393 Boolean.toString(showGroupConservation.isSelected()));
394 Cache.applicationProperties.setProperty("SHOW_CONSENSUS_HISTOGRAM",
395 Boolean.toString(showConsensHistogram.isSelected()));
396 Cache.applicationProperties.setProperty("SHOW_CONSENSUS_LOGO",
397 Boolean.toString(showConsensLogo.isSelected()));
398 Cache.applicationProperties.setProperty("ANTI_ALIAS",
399 Boolean.toString(smoothFont.isSelected()));
400 Cache.applicationProperties.setProperty("SHOW_NPFEATS_TOOLTIP",
401 Boolean.toString(showNpTooltip.isSelected()));
402 Cache.applicationProperties.setProperty("SHOW_DBREFS_TOOLTIP",
403 Boolean.toString(showDbRefTooltip.isSelected()));
405 Cache.applicationProperties.setProperty("WRAP_ALIGNMENT",
406 Boolean.toString(wrap.isSelected()));
408 Cache.applicationProperties.setProperty("STARTUP_FILE",
409 startupFileTextfield.getText());
410 Cache.applicationProperties.setProperty("SHOW_STARTUP_FILE",
411 Boolean.toString(startupCheckbox.isSelected()));
413 Cache.applicationProperties.setProperty("SORT_ALIGNMENT", sortby
414 .getSelectedItem().toString());
416 // convert description of sort order to enum name for save
417 SequenceAnnotationOrder annSortOrder = SequenceAnnotationOrder
418 .forDescription(sortAnnBy.getSelectedItem().toString());
419 if (annSortOrder != null)
421 Cache.applicationProperties.setProperty(SORT_ANNOTATIONS,
422 annSortOrder.name());
425 final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0;
426 Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE,
427 Boolean.valueOf(showAutocalcFirst).toString());
430 * Save Colours settings
432 Cache.applicationProperties.setProperty("DEFAULT_COLOUR", colour
433 .getSelectedItem().toString());
434 Cache.setColourProperty("ANNOTATIONCOLOUR_MIN",
435 minColour.getBackground());
436 Cache.setColourProperty("ANNOTATIONCOLOUR_MAX",
437 maxColour.getBackground());
440 * Save Structure settings
442 Cache.applicationProperties.setProperty(ADD_TEMPFACT_ANN,
443 Boolean.toString(addTempFactor.isSelected()));
444 Cache.applicationProperties.setProperty(ADD_SS_ANN,
445 Boolean.toString(addSecondaryStructure.isSelected()));
446 Cache.applicationProperties.setProperty(USE_RNAVIEW,
447 Boolean.toString(useRnaView.isSelected()));
448 Cache.applicationProperties.setProperty(STRUCT_FROM_PDB,
449 Boolean.toString(structFromPdb.isSelected()));
450 Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY, structViewer
451 .getSelectedItem().toString());
454 * Save Output settings
456 if (epsRendering.getSelectedItem().equals("Prompt each time"))
458 Cache.applicationProperties.remove("EPS_RENDERING");
462 Cache.applicationProperties.setProperty("EPS_RENDERING", epsRendering
463 .getSelectedItem().toString());
467 * Save Connections settings
469 if (defaultBrowser.getText().trim().length() < 1)
471 Cache.applicationProperties.remove("DEFAULT_BROWSER");
475 Cache.applicationProperties.setProperty("DEFAULT_BROWSER",
476 defaultBrowser.getText());
479 jalview.util.BrowserLauncher.resetBrowser();
481 if (nameLinks.size() > 0)
483 StringBuffer links = new StringBuffer();
484 sequenceURLLinks = new Vector();
485 for (int i = 0; i < nameLinks.size(); i++)
487 sequenceURLLinks.addElement(nameLinks.elementAt(i) + "|"
488 + urlLinks.elementAt(i));
489 links.append(sequenceURLLinks.elementAt(i).toString());
493 links.setLength(links.length() - 1);
494 Cache.applicationProperties.setProperty("SEQUENCE_LINKS",
499 Cache.applicationProperties.remove("SEQUENCE_LINKS");
502 Cache.applicationProperties.setProperty("USE_PROXY",
503 Boolean.toString(useProxy.isSelected()));
505 if (proxyServerTB.getText().trim().length() < 1)
507 Cache.applicationProperties.remove("PROXY_SERVER");
511 Cache.applicationProperties.setProperty("PROXY_SERVER",
512 proxyServerTB.getText());
515 if (proxyPortTB.getText().trim().length() < 1)
517 Cache.applicationProperties.remove("PROXY_PORT");
521 Cache.applicationProperties.setProperty("PROXY_PORT",
522 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());