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 structViewer.addActionListener(new ActionListener()
788 public void actionPerformed(ActionEvent e)
790 structureViewer_actionPerformed((String) structViewer
794 structureTab.add(structViewer);
797 JLabel pathLabel = new JLabel();
798 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
799 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
800 pathLabel.setText(MessageManager.getString("label.chimera_path"));
801 final String tooltip = JvSwingUtils.wrapTooltip(true,
802 MessageManager.getString("label.chimera_path_tip"));
803 pathLabel.setToolTipText(tooltip);
804 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
805 structureTab.add(pathLabel);
807 chimeraPath.setFont(verdana11);
808 chimeraPath.setText("");
809 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
810 chimeraPath.addMouseListener(new MouseAdapter()
813 public void mouseClicked(MouseEvent e)
815 if (e.getClickCount() == 2)
817 String chosen = openFileChooser();
820 chimeraPath.setText(chosen);
825 structureTab.add(chimeraPath);
831 * Action on choosing a structure viewer from combobox options.
833 * @param selectedItem
835 protected void structureViewer_actionPerformed(String selectedItem)
840 * Show a dialog for the user to choose a file. Returns the chosen path, or
845 protected String openFileChooser()
847 String choice = null;
848 JFileChooser chooser = new JFileChooser();
850 // chooser.setFileView(new JalviewFileView());
851 chooser.setDialogTitle(MessageManager
852 .getString("label.open_local_file"));
853 chooser.setToolTipText(MessageManager.getString("action.open"));
855 int value = chooser.showOpenDialog(this);
857 if (value == JFileChooser.APPROVE_OPTION)
859 choice = chooser.getSelectedFile().getPath();
865 * Validate the structure tab preferences; if invalid, set focus on this tab.
869 protected boolean validateStructure(FocusEvent e)
871 if (!validateStructure())
873 e.getComponent().requestFocusInWindow();
879 protected boolean validateStructure()
885 * Initialises the Visual tabbed panel.
889 private JPanel initVisualTab()
891 JPanel visualTab = new JPanel();
892 visualTab.setBorder(new TitledBorder(MessageManager
893 .getString("action.open_new_alignment")));
894 visualTab.setLayout(null);
895 fullScreen.setFont(verdana11);
896 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
897 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
898 fullScreen.setText(MessageManager.getString("label.maximize_window"));
899 quality.setEnabled(false);
900 quality.setFont(verdana11);
901 quality.setHorizontalAlignment(SwingConstants.RIGHT);
902 quality.setHorizontalTextPosition(SwingConstants.LEFT);
903 quality.setSelected(true);
904 quality.setText(MessageManager.getString("label.quality"));
905 conservation.setEnabled(false);
906 conservation.setFont(verdana11);
907 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
908 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
909 conservation.setSelected(true);
910 conservation.setText(MessageManager.getString("label.conservation"));
911 identity.setEnabled(false);
912 identity.setFont(verdana11);
913 identity.setHorizontalAlignment(SwingConstants.RIGHT);
914 identity.setHorizontalTextPosition(SwingConstants.LEFT);
915 identity.setSelected(true);
916 identity.setText(MessageManager.getString("label.consensus"));
917 JLabel showGroupbits = new JLabel();
918 showGroupbits.setFont(verdana11);
919 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
920 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
921 showGroupbits.setText(MessageManager.getString("action.show_group")
923 JLabel showConsensbits = new JLabel();
924 showConsensbits.setFont(verdana11);
925 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
926 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
927 showConsensbits.setText(MessageManager.getString("label.consensus")
929 showConsensHistogram.setEnabled(false);
930 showConsensHistogram.setFont(verdana11);
931 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
932 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
933 showConsensHistogram.setSelected(true);
934 showConsensHistogram.setText(MessageManager
935 .getString("label.histogram"));
936 showConsensLogo.setEnabled(false);
937 showConsensLogo.setFont(verdana11);
938 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
939 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
940 showConsensLogo.setSelected(true);
941 showConsensLogo.setText(MessageManager.getString("label.logo"));
942 showGroupConsensus.setEnabled(false);
943 showGroupConsensus.setFont(verdana11);
944 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
945 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
946 showGroupConsensus.setSelected(true);
947 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
948 showGroupConservation.setEnabled(false);
949 showGroupConservation.setFont(verdana11);
950 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
951 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
952 showGroupConservation.setSelected(true);
953 showGroupConservation.setText(MessageManager
954 .getString("label.conservation"));
955 showNpTooltip.setEnabled(true);
956 showNpTooltip.setFont(verdana11);
957 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
958 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
959 showNpTooltip.setSelected(true);
960 showNpTooltip.setText(MessageManager
961 .getString("label.non_positional_features"));
962 showDbRefTooltip.setEnabled(true);
963 showDbRefTooltip.setFont(verdana11);
964 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
965 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
966 showDbRefTooltip.setSelected(true);
967 showDbRefTooltip.setText(MessageManager
968 .getString("label.database_references"));
969 annotations.setFont(verdana11);
970 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
971 annotations.setHorizontalTextPosition(SwingConstants.LEADING);
972 annotations.setSelected(true);
973 annotations.setText(MessageManager.getString("label.show_annotations"));
974 annotations.setBounds(new Rectangle(169, 12, 200, 23));
975 annotations.addActionListener(new ActionListener()
977 public void actionPerformed(ActionEvent e)
979 annotations_actionPerformed(e);
982 identity.addActionListener(new ActionListener()
984 public void actionPerformed(ActionEvent e)
986 annotations_actionPerformed(e);
989 showGroupConsensus.addActionListener(new ActionListener()
991 public void actionPerformed(ActionEvent e)
993 annotations_actionPerformed(e);
996 showUnconserved.setFont(verdana11);
997 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
998 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
999 showUnconserved.setSelected(true);
1000 showUnconserved.setText(MessageManager
1001 .getString("action.show_unconserved"));
1002 showUnconserved.addActionListener(new ActionListener()
1004 public void actionPerformed(ActionEvent e)
1006 showunconserved_actionPerformed(e);
1010 // TODO these are not yet added to / action from Preferences
1011 // JCheckBox shareSelections = new JCheckBox();
1012 // shareSelections.setFont(verdana11);
1013 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1014 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1015 // shareSelections.setSelected(true);
1016 // shareSelections.setText(MessageManager
1017 // .getString("label.share_selection_across_views"));
1018 // JCheckBox followHighlight = new JCheckBox();
1019 // followHighlight.setFont(verdana11);
1020 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1021 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1022 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1023 // followHighlight.setSelected(true);
1024 // followHighlight.setText(MessageManager
1025 // .getString("label.scroll_highlighted_regions"));
1027 seqLimit.setFont(verdana11);
1028 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1029 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1030 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1031 smoothFont.setFont(verdana11);
1032 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1033 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1034 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1035 JLabel gapLabel = new JLabel();
1036 gapLabel.setFont(verdana11);
1037 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1038 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1039 JLabel fontLabel = new JLabel();
1040 fontLabel.setFont(verdana11);
1041 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1042 fontLabel.setText(MessageManager.getString("label.font"));
1043 fontSizeCB.setFont(verdana11);
1044 fontSizeCB.setBounds(new Rectangle(320, 104, 65, 23));
1045 fontStyleCB.setFont(verdana11);
1046 fontStyleCB.setBounds(new Rectangle(382, 104, 80, 23));
1047 fontNameCB.setFont(verdana11);
1048 fontNameCB.setBounds(new Rectangle(172, 104, 147, 23));
1049 gapSymbolCB.setFont(verdana11);
1050 gapSymbolCB.setBounds(new Rectangle(172, 196, 69, 23));
1051 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1052 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1053 gapSymbolCB.setRenderer(dlcr);
1055 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1056 startupCheckbox.setFont(verdana11);
1057 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1058 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1059 startupCheckbox.setSelected(true);
1060 startupFileTextfield.setFont(verdana11);
1061 startupFileTextfield.setBounds(new Rectangle(172, 290, 270, 20));
1062 startupFileTextfield.addMouseListener(new MouseAdapter()
1064 public void mouseClicked(MouseEvent e)
1066 if (e.getClickCount() > 1)
1068 startupFileTextfield_mouseClicked();
1073 sortby.setFont(verdana11);
1074 sortby.setBounds(new Rectangle(172, 240, 155, 21));
1075 JLabel sortLabel = new JLabel();
1076 sortLabel.setFont(verdana11);
1077 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1078 sortLabel.setText(MessageManager.getString("label.sort_by"));
1079 sortAnnBy.setFont(verdana11);
1080 sortAnnBy.setBounds(new Rectangle(172, 265, 110, 21));
1081 JLabel sortAnnLabel = new JLabel();
1082 sortAnnLabel.setFont(verdana11);
1083 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1084 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1085 sortAutocalc.setFont(verdana11);
1086 sortAutocalc.setBounds(new Rectangle(290, 265, 165, 21));
1087 JPanel annsettingsPanel = new JPanel();
1088 annsettingsPanel.setBounds(new Rectangle(173, 34, 300, 61));
1089 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1090 JPanel autoAnnotSettings1 = new JPanel();
1091 autoAnnotSettings1.setLayout(new GridLayout(3, 1, 0, 0));
1092 annsettingsPanel.add(autoAnnotSettings1);
1093 JPanel autoAnnotSettings2 = new JPanel();
1094 autoAnnotSettings2.setLayout(new GridLayout(3, 1, 0, 0));
1095 annsettingsPanel.add(autoAnnotSettings2);
1096 JPanel autoAnnotSettings3 = new JPanel();
1097 autoAnnotSettings3.setLayout(new GridLayout(3, 1, 0, 0));
1098 annsettingsPanel.add(autoAnnotSettings3);
1099 visualTab.add(annsettingsPanel);
1100 Border jb = new EmptyBorder(1, 1, 4, 5);
1101 quality.setBorder(jb);
1102 conservation.setBorder(jb);
1103 identity.setBorder(jb);
1104 showConsensbits.setBorder(jb);
1105 showGroupbits.setBorder(jb);
1106 showGroupConsensus.setBorder(jb);
1107 showGroupConservation.setBorder(jb);
1108 showConsensHistogram.setBorder(jb);
1109 showConsensLogo.setBorder(jb);
1111 autoAnnotSettings2.add(conservation);
1112 autoAnnotSettings1.add(quality);
1113 autoAnnotSettings3.add(identity);
1114 autoAnnotSettings1.add(showGroupbits);
1115 autoAnnotSettings3.add(showGroupConsensus);
1116 autoAnnotSettings2.add(showGroupConservation);
1117 autoAnnotSettings1.add(showConsensbits);
1118 autoAnnotSettings2.add(showConsensHistogram);
1119 autoAnnotSettings3.add(showConsensLogo);
1121 JPanel tooltipSettings = new JPanel();
1122 tooltipSettings.setBorder(new TitledBorder(MessageManager
1123 .getString("label.sequence_id_tooltip")));
1124 tooltipSettings.setBounds(173, 130, 200, 62);
1125 tooltipSettings.setLayout(new GridLayout(2, 1));
1126 tooltipSettings.add(showDbRefTooltip);
1127 tooltipSettings.add(showNpTooltip);
1128 visualTab.add(tooltipSettings);
1130 wrap.setFont(verdana11);
1131 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1132 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1133 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1134 rightAlign.setFont(verdana11);
1135 rightAlign.setForeground(Color.black);
1136 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1137 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1138 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1139 idItalics.setFont(verdana11);
1140 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1141 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1142 idItalics.setText(MessageManager
1143 .getString("label.sequence_name_italics"));
1144 openoverv.setFont(verdana11);
1145 openoverv.setActionCommand(MessageManager
1146 .getString("label.open_overview"));
1147 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1148 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1149 openoverv.setText(MessageManager.getString(("label.open_overview")));
1150 JPanel jPanel2 = new JPanel();
1151 jPanel2.setBounds(new Rectangle(7, 17, 158, 297));
1152 GridLayout gridLayout2 = new GridLayout();
1153 jPanel2.setLayout(gridLayout2);
1154 gridLayout2.setRows(13);
1155 jPanel2.add(fullScreen);
1156 jPanel2.add(openoverv);
1157 jPanel2.add(seqLimit);
1158 jPanel2.add(rightAlign);
1159 jPanel2.add(fontLabel);
1160 jPanel2.add(showUnconserved);
1161 jPanel2.add(idItalics);
1162 jPanel2.add(smoothFont);
1163 jPanel2.add(gapLabel);
1165 jPanel2.add(sortLabel);
1166 jPanel2.add(sortAnnLabel);
1167 jPanel2.add(startupCheckbox);
1168 visualTab.add(jPanel2);
1169 visualTab.add(annotations);
1170 visualTab.add(startupFileTextfield);
1171 visualTab.add(sortby);
1172 visualTab.add(sortAnnBy);
1173 visualTab.add(sortAutocalc);
1174 visualTab.add(gapSymbolCB);
1175 visualTab.add(fontNameCB);
1176 visualTab.add(fontSizeCB);
1177 visualTab.add(fontStyleCB);
1181 protected void autoIdWidth_actionPerformed()
1183 // TODO Auto-generated method stub
1187 protected void userIdWidth_actionPerformed()
1189 // TODO Auto-generated method stub
1193 protected void maxColour_actionPerformed(JPanel panel)
1197 protected void minColour_actionPerformed(JPanel panel)
1201 protected void showunconserved_actionPerformed(ActionEvent e)
1203 // TODO Auto-generated method stub
1213 public void ok_actionPerformed(ActionEvent e)
1223 public void cancel_actionPerformed(ActionEvent e)
1233 public void annotations_actionPerformed(ActionEvent e)
1240 public void startupFileTextfield_mouseClicked()
1244 public void newLink_actionPerformed(ActionEvent e)
1249 public void editLink_actionPerformed(ActionEvent e)
1254 public void deleteLink_actionPerformed(ActionEvent e)
1259 public void defaultBrowser_mouseClicked(MouseEvent e)
1264 public void linkURLList_keyTyped(KeyEvent e)
1269 public void useProxy_actionPerformed()
1271 proxyServerTB.setEnabled(useProxy.isSelected());
1272 proxyPortTB.setEnabled(useProxy.isSelected());