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.
21 package jalview.jbgui;
23 import jalview.gui.JvSwingUtils;
24 import jalview.gui.StructureViewer.Viewer;
25 import jalview.util.MessageManager;
27 import java.awt.BorderLayout;
28 import java.awt.Color;
29 import java.awt.Component;
30 import java.awt.Dimension;
31 import java.awt.FlowLayout;
33 import java.awt.GridBagConstraints;
34 import java.awt.GridBagLayout;
35 import java.awt.GridLayout;
36 import java.awt.Insets;
37 import java.awt.Rectangle;
38 import java.awt.event.ActionEvent;
39 import java.awt.event.ActionListener;
40 import java.awt.event.FocusEvent;
41 import java.awt.event.KeyEvent;
42 import java.awt.event.MouseAdapter;
43 import java.awt.event.MouseEvent;
45 import javax.swing.BorderFactory;
46 import javax.swing.DefaultListCellRenderer;
47 import javax.swing.JButton;
48 import javax.swing.JCheckBox;
49 import javax.swing.JComboBox;
50 import javax.swing.JFileChooser;
51 import javax.swing.JLabel;
52 import javax.swing.JList;
53 import javax.swing.JPanel;
54 import javax.swing.JScrollPane;
55 import javax.swing.JTabbedPane;
56 import javax.swing.JTextField;
57 import javax.swing.ListSelectionModel;
58 import javax.swing.SwingConstants;
59 import javax.swing.border.Border;
60 import javax.swing.border.EmptyBorder;
61 import javax.swing.border.TitledBorder;
62 import javax.swing.event.ChangeEvent;
63 import javax.swing.event.ChangeListener;
64 import javax.swing.event.ListSelectionEvent;
65 import javax.swing.event.ListSelectionListener;
68 * Base class for the Preferences panel.
73 public class GPreferences extends JPanel
75 private static final Font verdana11 = JvSwingUtils.getLabelFont();
78 * Visual tab components
80 protected JCheckBox fullScreen = new JCheckBox();
82 protected JCheckBox openoverv = new JCheckBox();
84 protected JCheckBox seqLimit = new JCheckBox();
86 protected JCheckBox rightAlign = new JCheckBox();
88 protected JComboBox<String> fontSizeCB = new JComboBox<String>();
90 protected JComboBox<String> fontStyleCB = new JComboBox<String>();
92 protected JComboBox<String> fontNameCB = new JComboBox<String>();
94 protected JCheckBox showUnconserved = new JCheckBox();
96 protected JCheckBox idItalics = new JCheckBox();
98 protected JCheckBox smoothFont = new JCheckBox();
100 protected JComboBox<String> gapSymbolCB = new JComboBox<String>();
102 protected JCheckBox wrap = new JCheckBox();
104 protected JComboBox<String> sortby = new JComboBox<String>();
106 protected JComboBox<String> sortAnnBy = new JComboBox<String>();
108 protected JComboBox<String> sortAutocalc = new JComboBox<String>();
110 protected JCheckBox startupCheckbox = new JCheckBox();
112 protected JTextField startupFileTextfield = new JTextField();
114 // below are in the 'second column'
115 protected JCheckBox annotations = new JCheckBox();
117 protected JCheckBox quality = new JCheckBox();
119 protected JCheckBox conservation = new JCheckBox();
121 protected JCheckBox identity = new JCheckBox();
123 protected JCheckBox showGroupConsensus = new JCheckBox();
125 protected JCheckBox showGroupConservation = new JCheckBox();
127 protected JCheckBox showConsensHistogram = new JCheckBox();
129 protected JCheckBox showConsensLogo = new JCheckBox();
131 protected JCheckBox showDbRefTooltip = new JCheckBox();
133 protected JCheckBox showNpTooltip = new JCheckBox();
136 * Structure tab and components
138 protected JPanel structureTab;
140 protected JCheckBox structFromPdb = new JCheckBox();
142 protected JCheckBox useRnaView = new JCheckBox();
144 protected JCheckBox addSecondaryStructure = new JCheckBox();
146 protected JCheckBox addTempFactor = new JCheckBox();
148 protected JComboBox<String> structViewer = new JComboBox<String>();
150 protected JTextField chimeraPath = new JTextField();
153 * Colours tab components
155 protected JPanel minColour = new JPanel();
157 protected JPanel maxColour = new JPanel();
159 protected JComboBox<String> colour = new JComboBox<String>();
162 * Connections tab components
164 protected JList linkURLList = new JList();
166 protected JTextField proxyServerTB = new JTextField();
168 protected JTextField proxyPortTB = new JTextField();
170 protected JTextField defaultBrowser = new JTextField();
172 protected JList linkNameList = new JList();
174 protected JCheckBox useProxy = new JCheckBox();
176 protected JCheckBox usagestats = new JCheckBox();
178 protected JCheckBox questionnaire = new JCheckBox();
180 protected JCheckBox versioncheck = new JCheckBox();
183 * Output tab components
185 protected JComboBox<String> epsRendering = new JComboBox<String>();
187 protected JLabel userIdWidthlabel = new JLabel();
189 protected JCheckBox autoIdWidth = new JCheckBox();
191 protected JTextField userIdWidth = new JTextField();
193 protected JCheckBox blcjv = new JCheckBox();
195 protected JCheckBox pileupjv = new JCheckBox();
197 protected JCheckBox clustaljv = new JCheckBox();
199 protected JCheckBox msfjv = new JCheckBox();
201 protected JCheckBox fastajv = new JCheckBox();
203 protected JCheckBox pfamjv = new JCheckBox();
205 protected JCheckBox pirjv = new JCheckBox();
207 protected JCheckBox modellerOutput = new JCheckBox();
210 * Editing tab components
212 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
214 protected JCheckBox padGaps = new JCheckBox();
216 protected JCheckBox sortByTree = new JCheckBox();
221 protected JPanel dasTab = new JPanel();
226 protected JPanel wsTab = new JPanel();
229 * Creates a new GPreferences object.
231 public GPreferences()
236 } catch (Exception ex)
238 ex.printStackTrace();
243 * Construct the panel and its tabbed sub-panels.
247 private void jbInit() throws Exception
249 final JTabbedPane tabbedPane = new JTabbedPane();
250 this.setLayout(new BorderLayout());
251 JPanel okCancelPanel = initOkCancelPanel();
252 this.add(tabbedPane, BorderLayout.CENTER);
253 this.add(okCancelPanel, BorderLayout.SOUTH);
255 tabbedPane.add(initVisualTab(),
256 MessageManager.getString("label.visual"));
258 tabbedPane.add(initColoursTab(),
259 MessageManager.getString("label.colours"));
261 tabbedPane.add(initStructureTab(),
262 MessageManager.getString("label.structure"));
264 tabbedPane.add(initConnectionsTab(),
265 MessageManager.getString("label.connections"));
267 tabbedPane.add(initOutputTab(), MessageManager.getString("label.output"));
269 tabbedPane.add(initEditingTab(), MessageManager.getString("label.editing"));
272 * See DasSourceBrowser for the real work of configuring this tab.
274 dasTab.setLayout(new BorderLayout());
276 .add(dasTab, MessageManager.getString("label.das_settings"));
279 * See WsPreferences for the real work of configuring this tab.
281 wsTab.setLayout(new BorderLayout());
282 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
285 * Handler to validate a tab before leaving it - currently only for
288 tabbedPane.addChangeListener(new ChangeListener()
290 private Component lastTab;
293 public void stateChanged(ChangeEvent e)
295 if (lastTab == structureTab
296 && tabbedPane.getSelectedComponent() != structureTab)
298 if (!validateStructure())
300 tabbedPane.setSelectedComponent(structureTab);
304 lastTab = tabbedPane.getSelectedComponent();
311 * Initialises the Editing tabbed panel.
315 private JPanel initEditingTab()
317 JPanel editingTab = new JPanel();
318 editingTab.setLayout(null);
319 autoCalculateConsCheck.setFont(verdana11);
320 autoCalculateConsCheck.setText(MessageManager
321 .getString("label.autocalculate_consensus"));
322 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
323 padGaps.setFont(verdana11);
324 padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
325 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
326 sortByTree.setFont(verdana11);
328 .setText(MessageManager.getString("label.sort_with_new_tree"));
330 .setToolTipText(MessageManager
331 .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
332 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
333 editingTab.add(autoCalculateConsCheck);
334 editingTab.add(padGaps);
335 editingTab.add(sortByTree);
340 * Initialises the Output tabbed panel.
344 private JPanel initOutputTab()
346 JPanel outputTab = new JPanel();
347 outputTab.setLayout(null);
348 JLabel epsLabel = new JLabel();
349 epsLabel.setFont(verdana11);
350 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
351 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
352 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
353 epsRendering.setFont(verdana11);
354 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
355 JLabel jLabel1 = new JLabel();
356 jLabel1.setFont(verdana11);
357 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
358 jLabel1.setText(MessageManager.getString("label.append_start_end"));
359 jLabel1.setFont(verdana11);
360 fastajv.setFont(verdana11);
361 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
362 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
363 blcjv.setText(MessageManager.getString("label.blc") + " ");
364 fastajv.setText(MessageManager.getString("label.fasta") + " ");
365 msfjv.setText(MessageManager.getString("label.msf") + " ");
366 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
367 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
368 msfjv.setFont(verdana11);
369 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
370 pirjv.setText(MessageManager.getString("label.pir") + " ");
371 JPanel jPanel11 = new JPanel();
372 jPanel11.setFont(verdana11);
373 TitledBorder titledBorder2 = new TitledBorder(
374 MessageManager.getString("label.file_output"));
375 jPanel11.setBorder(titledBorder2);
376 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
377 GridLayout gridLayout3 = new GridLayout();
378 jPanel11.setLayout(gridLayout3);
379 gridLayout3.setRows(8);
380 blcjv.setFont(verdana11);
381 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
382 clustaljv.setFont(verdana11);
383 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
384 pfamjv.setFont(verdana11);
385 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
386 pileupjv.setFont(verdana11);
387 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
388 pirjv.setFont(verdana11);
389 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
390 autoIdWidth.setFont(verdana11);
391 autoIdWidth.setText(MessageManager
392 .getString("label.automatically_set_id_width"));
394 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.adjusts_width_generated_eps_png")));
395 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
396 autoIdWidth.addActionListener(new ActionListener()
400 public void actionPerformed(ActionEvent e)
402 autoIdWidth_actionPerformed();
405 userIdWidthlabel.setFont(verdana11);
406 userIdWidthlabel.setText(MessageManager
407 .getString("label.figure_id_column_width"));
409 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
411 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
412 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
413 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
414 userIdWidth.setText("");
415 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
416 userIdWidth.addActionListener(new ActionListener()
420 public void actionPerformed(ActionEvent e)
422 userIdWidth_actionPerformed();
425 jPanel11.add(jLabel1);
427 jPanel11.add(clustaljv);
428 jPanel11.add(fastajv);
430 jPanel11.add(pfamjv);
431 jPanel11.add(pileupjv);
433 outputTab.add(autoIdWidth);
434 outputTab.add(userIdWidth);
435 outputTab.add(userIdWidthlabel);
436 outputTab.add(modellerOutput);
437 outputTab.add(epsLabel);
438 outputTab.add(epsRendering);
439 outputTab.add(jPanel11);
440 modellerOutput.setFont(verdana11);
441 modellerOutput.setText(MessageManager
442 .getString("label.use_modeller_output"));
443 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
448 * Initialises the Connections tabbed panel.
452 private JPanel initConnectionsTab()
454 JPanel connectTab = new JPanel();
455 connectTab.setLayout(new GridBagLayout());
456 JLabel serverLabel = new JLabel();
457 serverLabel.setText(MessageManager.getString("label.address"));
458 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
459 serverLabel.setFont(verdana11);
460 proxyServerTB.setFont(verdana11);
461 proxyPortTB.setFont(verdana11);
462 JLabel portLabel = new JLabel();
463 portLabel.setFont(verdana11);
464 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
465 portLabel.setText(MessageManager.getString("label.port"));
466 JLabel browserLabel = new JLabel();
467 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
468 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
469 browserLabel.setText(MessageManager
470 .getString("label.default_browser_unix"));
471 defaultBrowser.setFont(verdana11);
472 defaultBrowser.setText("");
473 usagestats.setText(MessageManager
474 .getString("label.send_usage_statistics"));
475 usagestats.setFont(verdana11);
476 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
477 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
478 questionnaire.setText(MessageManager
479 .getString("label.check_for_questionnaires"));
480 questionnaire.setFont(verdana11);
481 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
482 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
483 versioncheck.setText(MessageManager
484 .getString("label.check_for_latest_version"));
485 versioncheck.setFont(verdana11);
486 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
487 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
488 JButton newLink = new JButton();
489 newLink.setText(MessageManager.getString("action.new"));
490 newLink.addActionListener(new java.awt.event.ActionListener()
492 public void actionPerformed(ActionEvent e)
494 newLink_actionPerformed(e);
497 JButton editLink = new JButton();
498 editLink.setText(MessageManager.getString("action.edit"));
499 editLink.addActionListener(new java.awt.event.ActionListener()
501 public void actionPerformed(ActionEvent e)
503 editLink_actionPerformed(e);
506 JButton deleteLink = new JButton();
507 deleteLink.setText(MessageManager.getString("action.delete"));
508 deleteLink.addActionListener(new java.awt.event.ActionListener()
510 public void actionPerformed(ActionEvent e)
512 deleteLink_actionPerformed(e);
516 linkURLList.addListSelectionListener(new ListSelectionListener()
518 public void valueChanged(ListSelectionEvent e)
520 int index = linkURLList.getSelectedIndex();
521 linkNameList.setSelectedIndex(index);
525 linkNameList.addListSelectionListener(new ListSelectionListener()
527 public void valueChanged(ListSelectionEvent e)
529 int index = linkNameList.getSelectedIndex();
530 linkURLList.setSelectedIndex(index);
534 JScrollPane linkScrollPane = new JScrollPane();
535 linkScrollPane.setBorder(null);
536 JPanel linkPanel = new JPanel();
537 linkPanel.setBorder(new TitledBorder(MessageManager
538 .getString("label.url_linkfrom_sequence_id")));
539 linkPanel.setLayout(new BorderLayout());
540 GridLayout gridLayout1 = new GridLayout();
541 JPanel editLinkButtons = new JPanel();
542 editLinkButtons.setLayout(gridLayout1);
543 gridLayout1.setRows(3);
544 linkNameList.setFont(verdana11);
545 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
546 BorderLayout borderLayout3 = new BorderLayout();
547 JPanel linkPanel2 = new JPanel();
548 linkPanel2.setLayout(borderLayout3);
549 linkURLList.setFont(verdana11);
550 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
552 defaultBrowser.addMouseListener(new MouseAdapter()
554 public void mouseClicked(MouseEvent e)
556 if (e.getClickCount() > 1)
558 defaultBrowser_mouseClicked(e);
562 useProxy.setFont(verdana11);
563 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
564 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
565 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
566 useProxy.addActionListener(new ActionListener()
568 public void actionPerformed(ActionEvent e)
570 useProxy_actionPerformed();
573 linkPanel.add(editLinkButtons, BorderLayout.EAST);
574 editLinkButtons.add(newLink, null);
575 editLinkButtons.add(editLink, null);
576 editLinkButtons.add(deleteLink, null);
577 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
578 linkScrollPane.getViewport().add(linkPanel2, null);
579 linkPanel2.add(linkURLList, BorderLayout.CENTER);
580 linkPanel2.add(linkNameList, BorderLayout.WEST);
581 JPanel jPanel1 = new JPanel();
582 TitledBorder titledBorder1 = new TitledBorder(
583 MessageManager.getString("label.proxy_server"));
584 jPanel1.setBorder(titledBorder1);
585 jPanel1.setLayout(new GridBagLayout());
586 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
587 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
589 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
590 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
592 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
593 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
594 16, 0, 0, 12), 359, -17));
595 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0,
596 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
597 21, 0, 35, 12), 4, 6));
598 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
599 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
600 new Insets(16, 0, 0, 0), 5, 1));
601 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
602 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
604 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
605 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
606 new Insets(0, 2, 4, 2), 54, 1));
607 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
608 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
609 new Insets(0, 2, 4, 0), 263, 1));
610 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
611 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
612 new Insets(15, 0, 0, 15), 307, 1));
613 connectTab.add(usagestats, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0,
614 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
615 new Insets(0, 2, 4, 2), 70, 1));
616 connectTab.add(questionnaire, new GridBagConstraints(1, 4, 1, 1, 1.0,
617 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
618 new Insets(0, 2, 4, 2), 70, 1));
619 connectTab.add(versioncheck, new GridBagConstraints(0, 5, 1, 1, 1.0,
620 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
621 new Insets(0, 2, 4, 2), 70, 1));
626 * Initialises the parent panel which contains the tabbed sections.
630 private JPanel initOkCancelPanel()
632 JButton ok = new JButton();
633 ok.setText(MessageManager.getString("action.ok"));
634 ok.addActionListener(new ActionListener()
636 public void actionPerformed(ActionEvent e)
638 ok_actionPerformed(e);
641 JButton cancel = new JButton();
642 cancel.setText(MessageManager.getString("action.cancel"));
643 cancel.addActionListener(new ActionListener()
645 public void actionPerformed(ActionEvent e)
647 cancel_actionPerformed(e);
650 JPanel okCancelPanel = new JPanel();
651 okCancelPanel.add(ok);
652 okCancelPanel.add(cancel);
653 return okCancelPanel;
657 * Initialises the Colours tabbed panel.
661 private JPanel initColoursTab()
663 JPanel coloursTab = new JPanel();
664 coloursTab.setBorder(new TitledBorder(MessageManager
665 .getString("action.open_new_alignment")));
666 coloursTab.setLayout(new FlowLayout());
667 JLabel mincolourLabel = new JLabel();
668 mincolourLabel.setFont(verdana11);
669 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
670 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
671 minColour.setFont(verdana11);
672 minColour.setBorder(BorderFactory.createEtchedBorder());
673 minColour.setPreferredSize(new Dimension(40, 20));
674 minColour.addMouseListener(new MouseAdapter()
676 public void mousePressed(MouseEvent e)
678 minColour_actionPerformed(minColour);
681 JLabel maxcolourLabel = new JLabel();
682 maxcolourLabel.setFont(verdana11);
683 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
684 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
685 maxColour.setFont(verdana11);
686 maxColour.setBorder(BorderFactory.createEtchedBorder());
687 maxColour.setPreferredSize(new Dimension(40, 20));
688 maxColour.addMouseListener(new MouseAdapter()
690 public void mousePressed(MouseEvent e)
692 maxColour_actionPerformed(maxColour);
695 colour.setFont(verdana11);
696 colour.setBounds(new Rectangle(172, 225, 155, 21));
697 JLabel colourLabel = new JLabel();
698 colourLabel.setFont(verdana11);
699 colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
700 colourLabel.setText(MessageManager.getString("label.alignment_colour")
702 JvSwingUtils.addtoLayout(coloursTab, MessageManager
703 .getString("label.default_colour_scheme_for_alignment"),
704 colourLabel, colour);
705 JPanel annotationShding = new JPanel();
706 annotationShding.setBorder(new TitledBorder(MessageManager
707 .getString("label.annotation_shading_default")));
708 annotationShding.setLayout(new GridLayout(1, 2));
709 JvSwingUtils.addtoLayout(annotationShding, MessageManager
710 .getString("label.default_minimum_colour_annotation_shading"),
711 mincolourLabel, minColour);
712 JvSwingUtils.addtoLayout(annotationShding, MessageManager
713 .getString("label.default_maximum_colour_annotation_shading"),
714 maxcolourLabel, maxColour);
715 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
720 * Initialises the Structure tabbed panel.
724 private JPanel initStructureTab()
726 structureTab = new JPanel();
728 structureTab.setBorder(new TitledBorder(MessageManager
729 .getString("label.structure_options")));
730 structureTab.setLayout(null);
731 final int width = 400;
732 final int height = 23;
733 final int lineSpacing = 30;
736 structFromPdb.setFont(verdana11);
737 structFromPdb.setText(MessageManager.getString("label.struct_from_pdb"));
738 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
739 structFromPdb.addActionListener(new ActionListener()
742 public void actionPerformed(ActionEvent e)
744 boolean selected = structFromPdb.isSelected();
745 // enable other options only when the first is checked
746 useRnaView.setEnabled(selected);
747 addSecondaryStructure.setEnabled(selected);
748 addTempFactor.setEnabled(selected);
751 structureTab.add(structFromPdb);
753 // indent checkboxes that are conditional on the first one
755 useRnaView.setFont(verdana11);
756 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
757 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
758 structureTab.add(useRnaView);
761 addSecondaryStructure.setFont(verdana11);
762 addSecondaryStructure.setText(MessageManager
763 .getString("label.autoadd_secstr"));
764 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
765 structureTab.add(addSecondaryStructure);
768 addTempFactor.setFont(verdana11);
769 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
770 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
771 structureTab.add(addTempFactor);
774 JLabel viewerLabel = new JLabel();
775 viewerLabel.setFont(verdana11);
776 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
777 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
778 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
779 structureTab.add(viewerLabel);
781 structViewer.setFont(verdana11);
782 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
783 structViewer.addItem(Viewer.JMOL.name());
784 structViewer.addItem(Viewer.CHIMERA.name());
785 structureTab.add(structViewer);
788 JLabel pathLabel = new JLabel();
789 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
790 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
791 pathLabel.setText(MessageManager.getString("label.chimera_path"));
792 final String tooltip = JvSwingUtils.wrapTooltip(true,
793 MessageManager.getString("label.chimera_path_tip"));
794 pathLabel.setToolTipText(tooltip);
795 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
796 structureTab.add(pathLabel);
798 chimeraPath.setFont(verdana11);
799 chimeraPath.setText("");
800 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
801 chimeraPath.addMouseListener(new MouseAdapter()
804 public void mouseClicked(MouseEvent e)
806 if (e.getClickCount() == 2)
808 String chosen = openFileChooser();
811 chimeraPath.setText(chosen);
816 structureTab.add(chimeraPath);
822 * Show a dialog for the user to choose a file. Returns the chosen path, or
827 protected String openFileChooser()
829 String choice = null;
830 JFileChooser chooser = new JFileChooser();
832 // chooser.setFileView(new JalviewFileView());
833 chooser.setDialogTitle(MessageManager
834 .getString("label.open_local_file"));
835 chooser.setToolTipText(MessageManager.getString("action.open"));
837 int value = chooser.showOpenDialog(this);
839 if (value == JFileChooser.APPROVE_OPTION)
841 choice = chooser.getSelectedFile().getPath();
847 * Validate the structure tab preferences; if invalid, set focus on this tab.
851 protected boolean validateStructure(FocusEvent e)
853 if (!validateStructure())
855 e.getComponent().requestFocusInWindow();
861 protected boolean validateStructure()
867 * Initialises the Visual tabbed panel.
871 private JPanel initVisualTab()
873 JPanel visualTab = new JPanel();
874 visualTab.setBorder(new TitledBorder(MessageManager
875 .getString("action.open_new_alignment")));
876 visualTab.setLayout(null);
877 fullScreen.setFont(verdana11);
878 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
879 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
880 fullScreen.setText(MessageManager.getString("label.maximize_window"));
881 quality.setEnabled(false);
882 quality.setFont(verdana11);
883 quality.setHorizontalAlignment(SwingConstants.RIGHT);
884 quality.setHorizontalTextPosition(SwingConstants.LEFT);
885 quality.setSelected(true);
886 quality.setText(MessageManager.getString("label.quality"));
887 conservation.setEnabled(false);
888 conservation.setFont(verdana11);
889 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
890 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
891 conservation.setSelected(true);
892 conservation.setText(MessageManager.getString("label.conservation"));
893 identity.setEnabled(false);
894 identity.setFont(verdana11);
895 identity.setHorizontalAlignment(SwingConstants.RIGHT);
896 identity.setHorizontalTextPosition(SwingConstants.LEFT);
897 identity.setSelected(true);
898 identity.setText(MessageManager.getString("label.consensus"));
899 JLabel showGroupbits = new JLabel();
900 showGroupbits.setFont(verdana11);
901 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
902 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
903 showGroupbits.setText(MessageManager.getString("action.show_group")
905 JLabel showConsensbits = new JLabel();
906 showConsensbits.setFont(verdana11);
907 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
908 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
909 showConsensbits.setText(MessageManager.getString("label.consensus")
911 showConsensHistogram.setEnabled(false);
912 showConsensHistogram.setFont(verdana11);
913 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
914 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
915 showConsensHistogram.setSelected(true);
916 showConsensHistogram.setText(MessageManager
917 .getString("label.histogram"));
918 showConsensLogo.setEnabled(false);
919 showConsensLogo.setFont(verdana11);
920 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
921 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
922 showConsensLogo.setSelected(true);
923 showConsensLogo.setText(MessageManager.getString("label.logo"));
924 showGroupConsensus.setEnabled(false);
925 showGroupConsensus.setFont(verdana11);
926 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
927 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
928 showGroupConsensus.setSelected(true);
929 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
930 showGroupConservation.setEnabled(false);
931 showGroupConservation.setFont(verdana11);
932 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
933 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
934 showGroupConservation.setSelected(true);
935 showGroupConservation.setText(MessageManager
936 .getString("label.conservation"));
937 showNpTooltip.setEnabled(true);
938 showNpTooltip.setFont(verdana11);
939 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
940 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
941 showNpTooltip.setSelected(true);
942 showNpTooltip.setText(MessageManager
943 .getString("label.non_positional_features"));
944 showDbRefTooltip.setEnabled(true);
945 showDbRefTooltip.setFont(verdana11);
946 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
947 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
948 showDbRefTooltip.setSelected(true);
949 showDbRefTooltip.setText(MessageManager
950 .getString("label.database_references"));
951 annotations.setFont(verdana11);
952 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
953 annotations.setHorizontalTextPosition(SwingConstants.LEADING);
954 annotations.setSelected(true);
955 annotations.setText(MessageManager.getString("label.show_annotations"));
956 annotations.setBounds(new Rectangle(169, 12, 200, 23));
957 annotations.addActionListener(new ActionListener()
959 public void actionPerformed(ActionEvent e)
961 annotations_actionPerformed(e);
964 identity.addActionListener(new ActionListener()
966 public void actionPerformed(ActionEvent e)
968 annotations_actionPerformed(e);
971 showGroupConsensus.addActionListener(new ActionListener()
973 public void actionPerformed(ActionEvent e)
975 annotations_actionPerformed(e);
978 showUnconserved.setFont(verdana11);
979 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
980 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
981 showUnconserved.setSelected(true);
982 showUnconserved.setText(MessageManager
983 .getString("action.show_unconserved"));
984 showUnconserved.addActionListener(new ActionListener()
986 public void actionPerformed(ActionEvent e)
988 showunconserved_actionPerformed(e);
992 // TODO these are not yet added to / action from Preferences
993 // JCheckBox shareSelections = new JCheckBox();
994 // shareSelections.setFont(verdana11);
995 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
996 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
997 // shareSelections.setSelected(true);
998 // shareSelections.setText(MessageManager
999 // .getString("label.share_selection_across_views"));
1000 // JCheckBox followHighlight = new JCheckBox();
1001 // followHighlight.setFont(verdana11);
1002 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1003 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1004 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1005 // followHighlight.setSelected(true);
1006 // followHighlight.setText(MessageManager
1007 // .getString("label.scroll_highlighted_regions"));
1009 seqLimit.setFont(verdana11);
1010 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1011 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1012 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1013 smoothFont.setFont(verdana11);
1014 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1015 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1016 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1017 JLabel gapLabel = new JLabel();
1018 gapLabel.setFont(verdana11);
1019 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1020 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1021 JLabel fontLabel = new JLabel();
1022 fontLabel.setFont(verdana11);
1023 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1024 fontLabel.setText(MessageManager.getString("label.font"));
1025 fontSizeCB.setFont(verdana11);
1026 fontSizeCB.setBounds(new Rectangle(320, 104, 65, 23));
1027 fontStyleCB.setFont(verdana11);
1028 fontStyleCB.setBounds(new Rectangle(382, 104, 80, 23));
1029 fontNameCB.setFont(verdana11);
1030 fontNameCB.setBounds(new Rectangle(172, 104, 147, 23));
1031 gapSymbolCB.setFont(verdana11);
1032 gapSymbolCB.setBounds(new Rectangle(172, 196, 69, 23));
1033 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1034 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1035 gapSymbolCB.setRenderer(dlcr);
1037 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1038 startupCheckbox.setFont(verdana11);
1039 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1040 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1041 startupCheckbox.setSelected(true);
1042 startupFileTextfield.setFont(verdana11);
1043 startupFileTextfield.setBounds(new Rectangle(172, 290, 270, 20));
1044 startupFileTextfield.addMouseListener(new MouseAdapter()
1046 public void mouseClicked(MouseEvent e)
1048 if (e.getClickCount() > 1)
1050 startupFileTextfield_mouseClicked();
1055 sortby.setFont(verdana11);
1056 sortby.setBounds(new Rectangle(172, 240, 155, 21));
1057 JLabel sortLabel = new JLabel();
1058 sortLabel.setFont(verdana11);
1059 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1060 sortLabel.setText(MessageManager.getString("label.sort_by"));
1061 sortAnnBy.setFont(verdana11);
1062 sortAnnBy.setBounds(new Rectangle(172, 265, 110, 21));
1063 JLabel sortAnnLabel = new JLabel();
1064 sortAnnLabel.setFont(verdana11);
1065 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1066 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1067 sortAutocalc.setFont(verdana11);
1068 sortAutocalc.setBounds(new Rectangle(290, 265, 165, 21));
1069 JPanel annsettingsPanel = new JPanel();
1070 annsettingsPanel.setBounds(new Rectangle(173, 34, 300, 61));
1071 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1072 JPanel autoAnnotSettings1 = new JPanel();
1073 autoAnnotSettings1.setLayout(new GridLayout(3, 1, 0, 0));
1074 annsettingsPanel.add(autoAnnotSettings1);
1075 JPanel autoAnnotSettings2 = new JPanel();
1076 autoAnnotSettings2.setLayout(new GridLayout(3, 1, 0, 0));
1077 annsettingsPanel.add(autoAnnotSettings2);
1078 JPanel autoAnnotSettings3 = new JPanel();
1079 autoAnnotSettings3.setLayout(new GridLayout(3, 1, 0, 0));
1080 annsettingsPanel.add(autoAnnotSettings3);
1081 visualTab.add(annsettingsPanel);
1082 Border jb = new EmptyBorder(1, 1, 4, 5);
1083 quality.setBorder(jb);
1084 conservation.setBorder(jb);
1085 identity.setBorder(jb);
1086 showConsensbits.setBorder(jb);
1087 showGroupbits.setBorder(jb);
1088 showGroupConsensus.setBorder(jb);
1089 showGroupConservation.setBorder(jb);
1090 showConsensHistogram.setBorder(jb);
1091 showConsensLogo.setBorder(jb);
1093 autoAnnotSettings2.add(conservation);
1094 autoAnnotSettings1.add(quality);
1095 autoAnnotSettings3.add(identity);
1096 autoAnnotSettings1.add(showGroupbits);
1097 autoAnnotSettings3.add(showGroupConsensus);
1098 autoAnnotSettings2.add(showGroupConservation);
1099 autoAnnotSettings1.add(showConsensbits);
1100 autoAnnotSettings2.add(showConsensHistogram);
1101 autoAnnotSettings3.add(showConsensLogo);
1103 JPanel tooltipSettings = new JPanel();
1104 tooltipSettings.setBorder(new TitledBorder(MessageManager
1105 .getString("label.sequence_id_tooltip")));
1106 tooltipSettings.setBounds(173, 130, 200, 62);
1107 tooltipSettings.setLayout(new GridLayout(2, 1));
1108 tooltipSettings.add(showDbRefTooltip);
1109 tooltipSettings.add(showNpTooltip);
1110 visualTab.add(tooltipSettings);
1112 wrap.setFont(verdana11);
1113 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1114 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1115 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1116 rightAlign.setFont(verdana11);
1117 rightAlign.setForeground(Color.black);
1118 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1119 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1120 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1121 idItalics.setFont(verdana11);
1122 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1123 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1124 idItalics.setText(MessageManager
1125 .getString("label.sequence_name_italics"));
1126 openoverv.setFont(verdana11);
1127 openoverv.setActionCommand(MessageManager
1128 .getString("label.open_overview"));
1129 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1130 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1131 openoverv.setText(MessageManager.getString(("label.open_overview")));
1132 JPanel jPanel2 = new JPanel();
1133 jPanel2.setBounds(new Rectangle(7, 17, 158, 297));
1134 GridLayout gridLayout2 = new GridLayout();
1135 jPanel2.setLayout(gridLayout2);
1136 gridLayout2.setRows(13);
1137 jPanel2.add(fullScreen);
1138 jPanel2.add(openoverv);
1139 jPanel2.add(seqLimit);
1140 jPanel2.add(rightAlign);
1141 jPanel2.add(fontLabel);
1142 jPanel2.add(showUnconserved);
1143 jPanel2.add(idItalics);
1144 jPanel2.add(smoothFont);
1145 jPanel2.add(gapLabel);
1147 jPanel2.add(sortLabel);
1148 jPanel2.add(sortAnnLabel);
1149 jPanel2.add(startupCheckbox);
1150 visualTab.add(jPanel2);
1151 visualTab.add(annotations);
1152 visualTab.add(startupFileTextfield);
1153 visualTab.add(sortby);
1154 visualTab.add(sortAnnBy);
1155 visualTab.add(sortAutocalc);
1156 visualTab.add(gapSymbolCB);
1157 visualTab.add(fontNameCB);
1158 visualTab.add(fontSizeCB);
1159 visualTab.add(fontStyleCB);
1163 protected void autoIdWidth_actionPerformed()
1165 // TODO Auto-generated method stub
1169 protected void userIdWidth_actionPerformed()
1171 // TODO Auto-generated method stub
1175 protected void maxColour_actionPerformed(JPanel panel)
1179 protected void minColour_actionPerformed(JPanel panel)
1183 protected void showunconserved_actionPerformed(ActionEvent e)
1185 // TODO Auto-generated method stub
1195 public void ok_actionPerformed(ActionEvent e)
1205 public void cancel_actionPerformed(ActionEvent e)
1215 public void annotations_actionPerformed(ActionEvent e)
1222 public void startupFileTextfield_mouseClicked()
1226 public void newLink_actionPerformed(ActionEvent e)
1231 public void editLink_actionPerformed(ActionEvent e)
1236 public void deleteLink_actionPerformed(ActionEvent e)
1241 public void defaultBrowser_mouseClicked(MouseEvent e)
1246 public void linkURLList_keyTyped(KeyEvent e)
1251 public void useProxy_actionPerformed()
1253 proxyServerTB.setEnabled(useProxy.isSelected());
1254 proxyPortTB.setEnabled(useProxy.isSelected());