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.ViewerType;
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();
154 * Colours tab components
156 protected JPanel minColour = new JPanel();
158 protected JPanel maxColour = new JPanel();
160 protected JComboBox<String> colour = new JComboBox<String>();
163 * Connections tab components
165 protected JList linkURLList = new JList();
167 protected JTextField proxyServerTB = new JTextField();
169 protected JTextField proxyPortTB = new JTextField();
171 protected JTextField defaultBrowser = new JTextField();
173 protected JList linkNameList = new JList();
175 protected JCheckBox useProxy = new JCheckBox();
177 protected JCheckBox usagestats = new JCheckBox();
179 protected JCheckBox questionnaire = new JCheckBox();
181 protected JCheckBox versioncheck = new JCheckBox();
184 * Output tab components
186 protected JComboBox<String> epsRendering = new JComboBox<String>();
188 protected JLabel userIdWidthlabel = new JLabel();
190 protected JCheckBox autoIdWidth = new JCheckBox();
192 protected JTextField userIdWidth = new JTextField();
194 protected JCheckBox blcjv = new JCheckBox();
196 protected JCheckBox pileupjv = new JCheckBox();
198 protected JCheckBox clustaljv = new JCheckBox();
200 protected JCheckBox msfjv = new JCheckBox();
202 protected JCheckBox fastajv = new JCheckBox();
204 protected JCheckBox pfamjv = new JCheckBox();
206 protected JCheckBox pirjv = new JCheckBox();
208 protected JCheckBox modellerOutput = new JCheckBox();
211 * Editing tab components
213 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
215 protected JCheckBox padGaps = new JCheckBox();
217 protected JCheckBox sortByTree = new JCheckBox();
222 protected JPanel dasTab = new JPanel();
227 protected JPanel wsTab = new JPanel();
230 * Creates a new GPreferences object.
232 public GPreferences()
237 } catch (Exception ex)
239 ex.printStackTrace();
244 * Construct the panel and its tabbed sub-panels.
248 private void jbInit() throws Exception
250 final JTabbedPane tabbedPane = new JTabbedPane();
251 this.setLayout(new BorderLayout());
252 JPanel okCancelPanel = initOkCancelPanel();
253 this.add(tabbedPane, BorderLayout.CENTER);
254 this.add(okCancelPanel, BorderLayout.SOUTH);
256 tabbedPane.add(initVisualTab(),
257 MessageManager.getString("label.visual"));
259 tabbedPane.add(initColoursTab(),
260 MessageManager.getString("label.colours"));
262 tabbedPane.add(initStructureTab(),
263 MessageManager.getString("label.structure"));
265 tabbedPane.add(initConnectionsTab(),
266 MessageManager.getString("label.connections"));
268 tabbedPane.add(initOutputTab(), MessageManager.getString("label.output"));
270 tabbedPane.add(initEditingTab(), MessageManager.getString("label.editing"));
273 * See DasSourceBrowser for the real work of configuring this tab.
275 dasTab.setLayout(new BorderLayout());
277 .add(dasTab, MessageManager.getString("label.das_settings"));
280 * See WsPreferences for the real work of configuring this tab.
282 wsTab.setLayout(new BorderLayout());
283 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
286 * Handler to validate a tab before leaving it - currently only for
289 tabbedPane.addChangeListener(new ChangeListener()
291 private Component lastTab;
294 public void stateChanged(ChangeEvent e)
296 if (lastTab == structureTab
297 && tabbedPane.getSelectedComponent() != structureTab)
299 if (!validateStructure())
301 tabbedPane.setSelectedComponent(structureTab);
305 lastTab = tabbedPane.getSelectedComponent();
312 * Initialises the Editing tabbed panel.
316 private JPanel initEditingTab()
318 JPanel editingTab = new JPanel();
319 editingTab.setLayout(null);
320 autoCalculateConsCheck.setFont(verdana11);
321 autoCalculateConsCheck.setText(MessageManager
322 .getString("label.autocalculate_consensus"));
323 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
324 padGaps.setFont(verdana11);
325 padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
326 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
327 sortByTree.setFont(verdana11);
329 .setText(MessageManager.getString("label.sort_with_new_tree"));
331 .setToolTipText(MessageManager
332 .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
333 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
334 editingTab.add(autoCalculateConsCheck);
335 editingTab.add(padGaps);
336 editingTab.add(sortByTree);
341 * Initialises the Output tabbed panel.
345 private JPanel initOutputTab()
347 JPanel outputTab = new JPanel();
348 outputTab.setLayout(null);
349 JLabel epsLabel = new JLabel();
350 epsLabel.setFont(verdana11);
351 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
352 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
353 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
354 epsRendering.setFont(verdana11);
355 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
356 JLabel jLabel1 = new JLabel();
357 jLabel1.setFont(verdana11);
358 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
359 jLabel1.setText(MessageManager.getString("label.append_start_end"));
360 jLabel1.setFont(verdana11);
361 fastajv.setFont(verdana11);
362 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
363 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
364 blcjv.setText(MessageManager.getString("label.blc") + " ");
365 fastajv.setText(MessageManager.getString("label.fasta") + " ");
366 msfjv.setText(MessageManager.getString("label.msf") + " ");
367 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
368 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
369 msfjv.setFont(verdana11);
370 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
371 pirjv.setText(MessageManager.getString("label.pir") + " ");
372 JPanel jPanel11 = new JPanel();
373 jPanel11.setFont(verdana11);
374 TitledBorder titledBorder2 = new TitledBorder(
375 MessageManager.getString("label.file_output"));
376 jPanel11.setBorder(titledBorder2);
377 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
378 GridLayout gridLayout3 = new GridLayout();
379 jPanel11.setLayout(gridLayout3);
380 gridLayout3.setRows(8);
381 blcjv.setFont(verdana11);
382 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
383 clustaljv.setFont(verdana11);
384 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
385 pfamjv.setFont(verdana11);
386 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
387 pileupjv.setFont(verdana11);
388 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
389 pirjv.setFont(verdana11);
390 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
391 autoIdWidth.setFont(verdana11);
392 autoIdWidth.setText(MessageManager
393 .getString("label.automatically_set_id_width"));
395 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.adjusts_width_generated_eps_png")));
396 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
397 autoIdWidth.addActionListener(new ActionListener()
401 public void actionPerformed(ActionEvent e)
403 autoIdWidth_actionPerformed();
406 userIdWidthlabel.setFont(verdana11);
407 userIdWidthlabel.setText(MessageManager
408 .getString("label.figure_id_column_width"));
410 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
412 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
413 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
414 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
415 userIdWidth.setText("");
416 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
417 userIdWidth.addActionListener(new ActionListener()
421 public void actionPerformed(ActionEvent e)
423 userIdWidth_actionPerformed();
426 jPanel11.add(jLabel1);
428 jPanel11.add(clustaljv);
429 jPanel11.add(fastajv);
431 jPanel11.add(pfamjv);
432 jPanel11.add(pileupjv);
434 outputTab.add(autoIdWidth);
435 outputTab.add(userIdWidth);
436 outputTab.add(userIdWidthlabel);
437 outputTab.add(modellerOutput);
438 outputTab.add(epsLabel);
439 outputTab.add(epsRendering);
440 outputTab.add(jPanel11);
441 modellerOutput.setFont(verdana11);
442 modellerOutput.setText(MessageManager
443 .getString("label.use_modeller_output"));
444 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
449 * Initialises the Connections tabbed panel.
453 private JPanel initConnectionsTab()
455 JPanel connectTab = new JPanel();
456 connectTab.setLayout(new GridBagLayout());
457 JLabel serverLabel = new JLabel();
458 serverLabel.setText(MessageManager.getString("label.address"));
459 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
460 serverLabel.setFont(verdana11);
461 proxyServerTB.setFont(verdana11);
462 proxyPortTB.setFont(verdana11);
463 JLabel portLabel = new JLabel();
464 portLabel.setFont(verdana11);
465 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
466 portLabel.setText(MessageManager.getString("label.port"));
467 JLabel browserLabel = new JLabel();
468 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
469 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
470 browserLabel.setText(MessageManager
471 .getString("label.default_browser_unix"));
472 defaultBrowser.setFont(verdana11);
473 defaultBrowser.setText("");
474 usagestats.setText(MessageManager
475 .getString("label.send_usage_statistics"));
476 usagestats.setFont(verdana11);
477 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
478 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
479 questionnaire.setText(MessageManager
480 .getString("label.check_for_questionnaires"));
481 questionnaire.setFont(verdana11);
482 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
483 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
484 versioncheck.setText(MessageManager
485 .getString("label.check_for_latest_version"));
486 versioncheck.setFont(verdana11);
487 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
488 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
489 JButton newLink = new JButton();
490 newLink.setText(MessageManager.getString("action.new"));
491 newLink.addActionListener(new java.awt.event.ActionListener()
493 public void actionPerformed(ActionEvent e)
495 newLink_actionPerformed(e);
498 JButton editLink = new JButton();
499 editLink.setText(MessageManager.getString("action.edit"));
500 editLink.addActionListener(new java.awt.event.ActionListener()
502 public void actionPerformed(ActionEvent e)
504 editLink_actionPerformed(e);
507 JButton deleteLink = new JButton();
508 deleteLink.setText(MessageManager.getString("action.delete"));
509 deleteLink.addActionListener(new java.awt.event.ActionListener()
511 public void actionPerformed(ActionEvent e)
513 deleteLink_actionPerformed(e);
517 linkURLList.addListSelectionListener(new ListSelectionListener()
519 public void valueChanged(ListSelectionEvent e)
521 int index = linkURLList.getSelectedIndex();
522 linkNameList.setSelectedIndex(index);
526 linkNameList.addListSelectionListener(new ListSelectionListener()
528 public void valueChanged(ListSelectionEvent e)
530 int index = linkNameList.getSelectedIndex();
531 linkURLList.setSelectedIndex(index);
535 JScrollPane linkScrollPane = new JScrollPane();
536 linkScrollPane.setBorder(null);
537 JPanel linkPanel = new JPanel();
538 linkPanel.setBorder(new TitledBorder(MessageManager
539 .getString("label.url_linkfrom_sequence_id")));
540 linkPanel.setLayout(new BorderLayout());
541 GridLayout gridLayout1 = new GridLayout();
542 JPanel editLinkButtons = new JPanel();
543 editLinkButtons.setLayout(gridLayout1);
544 gridLayout1.setRows(3);
545 linkNameList.setFont(verdana11);
546 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
547 BorderLayout borderLayout3 = new BorderLayout();
548 JPanel linkPanel2 = new JPanel();
549 linkPanel2.setLayout(borderLayout3);
550 linkURLList.setFont(verdana11);
551 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
553 defaultBrowser.addMouseListener(new MouseAdapter()
555 public void mouseClicked(MouseEvent e)
557 if (e.getClickCount() > 1)
559 defaultBrowser_mouseClicked(e);
563 useProxy.setFont(verdana11);
564 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
565 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
566 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
567 useProxy.addActionListener(new ActionListener()
569 public void actionPerformed(ActionEvent e)
571 useProxy_actionPerformed();
574 linkPanel.add(editLinkButtons, BorderLayout.EAST);
575 editLinkButtons.add(newLink, null);
576 editLinkButtons.add(editLink, null);
577 editLinkButtons.add(deleteLink, null);
578 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
579 linkScrollPane.getViewport().add(linkPanel2, null);
580 linkPanel2.add(linkURLList, BorderLayout.CENTER);
581 linkPanel2.add(linkNameList, BorderLayout.WEST);
582 JPanel jPanel1 = new JPanel();
583 TitledBorder titledBorder1 = new TitledBorder(
584 MessageManager.getString("label.proxy_server"));
585 jPanel1.setBorder(titledBorder1);
586 jPanel1.setLayout(new GridBagLayout());
587 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
588 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
590 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
591 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
593 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
594 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
595 16, 0, 0, 12), 359, -17));
596 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0,
597 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
598 21, 0, 35, 12), 4, 6));
599 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
600 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
601 new Insets(16, 0, 0, 0), 5, 1));
602 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
603 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
605 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
606 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
607 new Insets(0, 2, 4, 2), 54, 1));
608 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
609 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
610 new Insets(0, 2, 4, 0), 263, 1));
611 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
612 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
613 new Insets(15, 0, 0, 15), 307, 1));
614 connectTab.add(usagestats, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0,
615 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
616 new Insets(0, 2, 4, 2), 70, 1));
617 connectTab.add(questionnaire, new GridBagConstraints(1, 4, 1, 1, 1.0,
618 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
619 new Insets(0, 2, 4, 2), 70, 1));
620 connectTab.add(versioncheck, new GridBagConstraints(0, 5, 1, 1, 1.0,
621 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
622 new Insets(0, 2, 4, 2), 70, 1));
627 * Initialises the parent panel which contains the tabbed sections.
631 private JPanel initOkCancelPanel()
633 JButton ok = new JButton();
634 ok.setText(MessageManager.getString("action.ok"));
635 ok.addActionListener(new ActionListener()
637 public void actionPerformed(ActionEvent e)
639 ok_actionPerformed(e);
642 JButton cancel = new JButton();
643 cancel.setText(MessageManager.getString("action.cancel"));
644 cancel.addActionListener(new ActionListener()
646 public void actionPerformed(ActionEvent e)
648 cancel_actionPerformed(e);
651 JPanel okCancelPanel = new JPanel();
652 okCancelPanel.add(ok);
653 okCancelPanel.add(cancel);
654 return okCancelPanel;
658 * Initialises the Colours tabbed panel.
662 private JPanel initColoursTab()
664 JPanel coloursTab = new JPanel();
665 coloursTab.setBorder(new TitledBorder(MessageManager
666 .getString("action.open_new_alignment")));
667 coloursTab.setLayout(new FlowLayout());
668 JLabel mincolourLabel = new JLabel();
669 mincolourLabel.setFont(verdana11);
670 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
671 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
672 minColour.setFont(verdana11);
673 minColour.setBorder(BorderFactory.createEtchedBorder());
674 minColour.setPreferredSize(new Dimension(40, 20));
675 minColour.addMouseListener(new MouseAdapter()
677 public void mousePressed(MouseEvent e)
679 minColour_actionPerformed(minColour);
682 JLabel maxcolourLabel = new JLabel();
683 maxcolourLabel.setFont(verdana11);
684 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
685 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
686 maxColour.setFont(verdana11);
687 maxColour.setBorder(BorderFactory.createEtchedBorder());
688 maxColour.setPreferredSize(new Dimension(40, 20));
689 maxColour.addMouseListener(new MouseAdapter()
691 public void mousePressed(MouseEvent e)
693 maxColour_actionPerformed(maxColour);
696 colour.setFont(verdana11);
697 colour.setBounds(new Rectangle(172, 225, 155, 21));
698 JLabel colourLabel = new JLabel();
699 colourLabel.setFont(verdana11);
700 colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
701 colourLabel.setText(MessageManager.getString("label.alignment_colour")
703 JvSwingUtils.addtoLayout(coloursTab, MessageManager
704 .getString("label.default_colour_scheme_for_alignment"),
705 colourLabel, colour);
706 JPanel annotationShding = new JPanel();
707 annotationShding.setBorder(new TitledBorder(MessageManager
708 .getString("label.annotation_shading_default")));
709 annotationShding.setLayout(new GridLayout(1, 2));
710 JvSwingUtils.addtoLayout(annotationShding, MessageManager
711 .getString("label.default_minimum_colour_annotation_shading"),
712 mincolourLabel, minColour);
713 JvSwingUtils.addtoLayout(annotationShding, MessageManager
714 .getString("label.default_maximum_colour_annotation_shading"),
715 maxcolourLabel, maxColour);
716 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
721 * Initialises the Structure tabbed panel.
725 private JPanel initStructureTab()
727 structureTab = new JPanel();
729 structureTab.setBorder(new TitledBorder(MessageManager
730 .getString("label.structure_options")));
731 structureTab.setLayout(null);
732 final int width = 400;
733 final int height = 22;
734 final int lineSpacing = 25;
737 structFromPdb.setFont(verdana11);
738 structFromPdb.setText(MessageManager.getString("label.struct_from_pdb"));
739 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
740 structFromPdb.addActionListener(new ActionListener()
743 public void actionPerformed(ActionEvent e)
745 boolean selected = structFromPdb.isSelected();
746 // enable other options only when the first is checked
747 useRnaView.setEnabled(selected);
748 addSecondaryStructure.setEnabled(selected);
749 addTempFactor.setEnabled(selected);
752 structureTab.add(structFromPdb);
754 // indent checkboxes that are conditional on the first one
756 useRnaView.setFont(verdana11);
757 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
758 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
759 structureTab.add(useRnaView);
762 addSecondaryStructure.setFont(verdana11);
763 addSecondaryStructure.setText(MessageManager
764 .getString("label.autoadd_secstr"));
765 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
766 structureTab.add(addSecondaryStructure);
769 addTempFactor.setFont(verdana11);
770 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
771 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
772 structureTab.add(addTempFactor);
775 JLabel viewerLabel = new JLabel();
776 viewerLabel.setFont(verdana11);
777 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
778 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
779 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
780 structureTab.add(viewerLabel);
782 structViewer.setFont(verdana11);
783 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
784 structViewer.addItem(ViewerType.JMOL.name());
785 structViewer.addItem(ViewerType.CHIMERA.name());
786 structViewer.addActionListener(new ActionListener()
789 public void actionPerformed(ActionEvent e)
791 structureViewer_actionPerformed((String) structViewer
795 structureTab.add(structViewer);
798 JLabel pathLabel = new JLabel();
799 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
800 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
801 pathLabel.setText(MessageManager.getString("label.chimera_path"));
802 final String tooltip = JvSwingUtils.wrapTooltip(true,
803 MessageManager.getString("label.chimera_path_tip"));
804 pathLabel.setToolTipText(tooltip);
805 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
806 structureTab.add(pathLabel);
808 chimeraPath.setFont(verdana11);
809 chimeraPath.setText("");
810 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
811 chimeraPath.addMouseListener(new MouseAdapter()
814 public void mouseClicked(MouseEvent e)
816 if (e.getClickCount() == 2)
818 String chosen = openFileChooser();
821 chimeraPath.setText(chosen);
826 structureTab.add(chimeraPath);
829 // scrl_pdbDocFieldConfig.setPreferredSize(new Dimension(450, 100));
830 // scrl_pdbDocFieldConfig
831 // .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
832 // scrl_pdbDocFieldConfig.setBounds();
833 PDBDocFieldPreferences docFieldPref = new PDBDocFieldPreferences(
834 new Rectangle(10, ypos + 5, 450, 120));
835 structureTab.add(docFieldPref);
845 * Action on choosing a structure viewer from combobox options.
847 * @param selectedItem
849 protected void structureViewer_actionPerformed(String selectedItem)
854 * Show a dialog for the user to choose a file. Returns the chosen path, or
859 protected String openFileChooser()
861 String choice = null;
862 JFileChooser chooser = new JFileChooser();
864 // chooser.setFileView(new JalviewFileView());
865 chooser.setDialogTitle(MessageManager
866 .getString("label.open_local_file"));
867 chooser.setToolTipText(MessageManager.getString("action.open"));
869 int value = chooser.showOpenDialog(this);
871 if (value == JFileChooser.APPROVE_OPTION)
873 choice = chooser.getSelectedFile().getPath();
879 * Validate the structure tab preferences; if invalid, set focus on this tab.
883 protected boolean validateStructure(FocusEvent e)
885 if (!validateStructure())
887 e.getComponent().requestFocusInWindow();
893 protected boolean validateStructure()
899 * Initialises the Visual tabbed panel.
903 private JPanel initVisualTab()
905 JPanel visualTab = new JPanel();
906 visualTab.setBorder(new TitledBorder(MessageManager
907 .getString("action.open_new_alignment")));
908 visualTab.setLayout(null);
909 fullScreen.setFont(verdana11);
910 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
911 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
912 fullScreen.setText(MessageManager.getString("label.maximize_window"));
913 quality.setEnabled(false);
914 quality.setFont(verdana11);
915 quality.setHorizontalAlignment(SwingConstants.RIGHT);
916 quality.setHorizontalTextPosition(SwingConstants.LEFT);
917 quality.setSelected(true);
918 quality.setText(MessageManager.getString("label.quality"));
919 conservation.setEnabled(false);
920 conservation.setFont(verdana11);
921 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
922 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
923 conservation.setSelected(true);
924 conservation.setText(MessageManager.getString("label.conservation"));
925 identity.setEnabled(false);
926 identity.setFont(verdana11);
927 identity.setHorizontalAlignment(SwingConstants.RIGHT);
928 identity.setHorizontalTextPosition(SwingConstants.LEFT);
929 identity.setSelected(true);
930 identity.setText(MessageManager.getString("label.consensus"));
931 JLabel showGroupbits = new JLabel();
932 showGroupbits.setFont(verdana11);
933 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
934 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
935 showGroupbits.setText(MessageManager.getString("action.show_group")
937 JLabel showConsensbits = new JLabel();
938 showConsensbits.setFont(verdana11);
939 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
940 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
941 showConsensbits.setText(MessageManager.getString("label.consensus")
943 showConsensHistogram.setEnabled(false);
944 showConsensHistogram.setFont(verdana11);
945 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
946 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
947 showConsensHistogram.setSelected(true);
948 showConsensHistogram.setText(MessageManager
949 .getString("label.histogram"));
950 showConsensLogo.setEnabled(false);
951 showConsensLogo.setFont(verdana11);
952 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
953 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
954 showConsensLogo.setSelected(true);
955 showConsensLogo.setText(MessageManager.getString("label.logo"));
956 showGroupConsensus.setEnabled(false);
957 showGroupConsensus.setFont(verdana11);
958 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
959 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
960 showGroupConsensus.setSelected(true);
961 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
962 showGroupConservation.setEnabled(false);
963 showGroupConservation.setFont(verdana11);
964 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
965 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
966 showGroupConservation.setSelected(true);
967 showGroupConservation.setText(MessageManager
968 .getString("label.conservation"));
969 showNpTooltip.setEnabled(true);
970 showNpTooltip.setFont(verdana11);
971 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
972 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
973 showNpTooltip.setSelected(true);
974 showNpTooltip.setText(MessageManager
975 .getString("label.non_positional_features"));
976 showDbRefTooltip.setEnabled(true);
977 showDbRefTooltip.setFont(verdana11);
978 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
979 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
980 showDbRefTooltip.setSelected(true);
981 showDbRefTooltip.setText(MessageManager
982 .getString("label.database_references"));
983 annotations.setFont(verdana11);
984 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
985 annotations.setHorizontalTextPosition(SwingConstants.LEADING);
986 annotations.setSelected(true);
987 annotations.setText(MessageManager.getString("label.show_annotations"));
988 annotations.setBounds(new Rectangle(169, 12, 200, 23));
989 annotations.addActionListener(new ActionListener()
991 public void actionPerformed(ActionEvent e)
993 annotations_actionPerformed(e);
996 identity.addActionListener(new ActionListener()
998 public void actionPerformed(ActionEvent e)
1000 annotations_actionPerformed(e);
1003 showGroupConsensus.addActionListener(new ActionListener()
1005 public void actionPerformed(ActionEvent e)
1007 annotations_actionPerformed(e);
1010 showUnconserved.setFont(verdana11);
1011 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1012 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1013 showUnconserved.setSelected(true);
1014 showUnconserved.setText(MessageManager
1015 .getString("action.show_unconserved"));
1016 showUnconserved.addActionListener(new ActionListener()
1018 public void actionPerformed(ActionEvent e)
1020 showunconserved_actionPerformed(e);
1024 // TODO these are not yet added to / action from Preferences
1025 // JCheckBox shareSelections = new JCheckBox();
1026 // shareSelections.setFont(verdana11);
1027 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1028 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1029 // shareSelections.setSelected(true);
1030 // shareSelections.setText(MessageManager
1031 // .getString("label.share_selection_across_views"));
1032 // JCheckBox followHighlight = new JCheckBox();
1033 // followHighlight.setFont(verdana11);
1034 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1035 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1036 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1037 // followHighlight.setSelected(true);
1038 // followHighlight.setText(MessageManager
1039 // .getString("label.scroll_highlighted_regions"));
1041 seqLimit.setFont(verdana11);
1042 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1043 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1044 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1045 smoothFont.setFont(verdana11);
1046 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1047 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1048 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1049 JLabel gapLabel = new JLabel();
1050 gapLabel.setFont(verdana11);
1051 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1052 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1053 JLabel fontLabel = new JLabel();
1054 fontLabel.setFont(verdana11);
1055 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1056 fontLabel.setText(MessageManager.getString("label.font"));
1057 fontSizeCB.setFont(verdana11);
1058 fontSizeCB.setBounds(new Rectangle(320, 104, 65, 23));
1059 fontStyleCB.setFont(verdana11);
1060 fontStyleCB.setBounds(new Rectangle(382, 104, 80, 23));
1061 fontNameCB.setFont(verdana11);
1062 fontNameCB.setBounds(new Rectangle(172, 104, 147, 23));
1063 gapSymbolCB.setFont(verdana11);
1064 gapSymbolCB.setBounds(new Rectangle(172, 196, 69, 23));
1065 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1066 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1067 gapSymbolCB.setRenderer(dlcr);
1069 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1070 startupCheckbox.setFont(verdana11);
1071 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1072 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1073 startupCheckbox.setSelected(true);
1074 startupFileTextfield.setFont(verdana11);
1075 startupFileTextfield.setBounds(new Rectangle(172, 290, 270, 20));
1076 startupFileTextfield.addMouseListener(new MouseAdapter()
1078 public void mouseClicked(MouseEvent e)
1080 if (e.getClickCount() > 1)
1082 startupFileTextfield_mouseClicked();
1087 sortby.setFont(verdana11);
1088 sortby.setBounds(new Rectangle(172, 240, 155, 21));
1089 JLabel sortLabel = new JLabel();
1090 sortLabel.setFont(verdana11);
1091 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1092 sortLabel.setText(MessageManager.getString("label.sort_by"));
1093 sortAnnBy.setFont(verdana11);
1094 sortAnnBy.setBounds(new Rectangle(172, 265, 110, 21));
1095 JLabel sortAnnLabel = new JLabel();
1096 sortAnnLabel.setFont(verdana11);
1097 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1098 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1099 sortAutocalc.setFont(verdana11);
1100 sortAutocalc.setBounds(new Rectangle(290, 265, 165, 21));
1101 JPanel annsettingsPanel = new JPanel();
1102 annsettingsPanel.setBounds(new Rectangle(173, 34, 300, 61));
1103 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1104 JPanel autoAnnotSettings1 = new JPanel();
1105 autoAnnotSettings1.setLayout(new GridLayout(3, 1, 0, 0));
1106 annsettingsPanel.add(autoAnnotSettings1);
1107 JPanel autoAnnotSettings2 = new JPanel();
1108 autoAnnotSettings2.setLayout(new GridLayout(3, 1, 0, 0));
1109 annsettingsPanel.add(autoAnnotSettings2);
1110 JPanel autoAnnotSettings3 = new JPanel();
1111 autoAnnotSettings3.setLayout(new GridLayout(3, 1, 0, 0));
1112 annsettingsPanel.add(autoAnnotSettings3);
1113 visualTab.add(annsettingsPanel);
1114 Border jb = new EmptyBorder(1, 1, 4, 5);
1115 quality.setBorder(jb);
1116 conservation.setBorder(jb);
1117 identity.setBorder(jb);
1118 showConsensbits.setBorder(jb);
1119 showGroupbits.setBorder(jb);
1120 showGroupConsensus.setBorder(jb);
1121 showGroupConservation.setBorder(jb);
1122 showConsensHistogram.setBorder(jb);
1123 showConsensLogo.setBorder(jb);
1125 autoAnnotSettings2.add(conservation);
1126 autoAnnotSettings1.add(quality);
1127 autoAnnotSettings3.add(identity);
1128 autoAnnotSettings1.add(showGroupbits);
1129 autoAnnotSettings3.add(showGroupConsensus);
1130 autoAnnotSettings2.add(showGroupConservation);
1131 autoAnnotSettings1.add(showConsensbits);
1132 autoAnnotSettings2.add(showConsensHistogram);
1133 autoAnnotSettings3.add(showConsensLogo);
1135 JPanel tooltipSettings = new JPanel();
1136 tooltipSettings.setBorder(new TitledBorder(MessageManager
1137 .getString("label.sequence_id_tooltip")));
1138 tooltipSettings.setBounds(173, 130, 200, 62);
1139 tooltipSettings.setLayout(new GridLayout(2, 1));
1140 tooltipSettings.add(showDbRefTooltip);
1141 tooltipSettings.add(showNpTooltip);
1142 visualTab.add(tooltipSettings);
1144 wrap.setFont(verdana11);
1145 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1146 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1147 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1148 rightAlign.setFont(verdana11);
1149 rightAlign.setForeground(Color.black);
1150 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1151 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1152 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1153 idItalics.setFont(verdana11);
1154 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1155 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1156 idItalics.setText(MessageManager
1157 .getString("label.sequence_name_italics"));
1158 openoverv.setFont(verdana11);
1159 openoverv.setActionCommand(MessageManager
1160 .getString("label.open_overview"));
1161 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1162 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1163 openoverv.setText(MessageManager.getString(("label.open_overview")));
1164 JPanel jPanel2 = new JPanel();
1165 jPanel2.setBounds(new Rectangle(7, 17, 158, 297));
1166 GridLayout gridLayout2 = new GridLayout();
1167 jPanel2.setLayout(gridLayout2);
1168 gridLayout2.setRows(13);
1169 jPanel2.add(fullScreen);
1170 jPanel2.add(openoverv);
1171 jPanel2.add(seqLimit);
1172 jPanel2.add(rightAlign);
1173 jPanel2.add(fontLabel);
1174 jPanel2.add(showUnconserved);
1175 jPanel2.add(idItalics);
1176 jPanel2.add(smoothFont);
1177 jPanel2.add(gapLabel);
1179 jPanel2.add(sortLabel);
1180 jPanel2.add(sortAnnLabel);
1181 jPanel2.add(startupCheckbox);
1182 visualTab.add(jPanel2);
1183 visualTab.add(annotations);
1184 visualTab.add(startupFileTextfield);
1185 visualTab.add(sortby);
1186 visualTab.add(sortAnnBy);
1187 visualTab.add(sortAutocalc);
1188 visualTab.add(gapSymbolCB);
1189 visualTab.add(fontNameCB);
1190 visualTab.add(fontSizeCB);
1191 visualTab.add(fontStyleCB);
1195 protected void autoIdWidth_actionPerformed()
1197 // TODO Auto-generated method stub
1201 protected void userIdWidth_actionPerformed()
1203 // TODO Auto-generated method stub
1207 protected void maxColour_actionPerformed(JPanel panel)
1211 protected void minColour_actionPerformed(JPanel panel)
1215 protected void showunconserved_actionPerformed(ActionEvent e)
1217 // TODO Auto-generated method stub
1227 public void ok_actionPerformed(ActionEvent e)
1237 public void cancel_actionPerformed(ActionEvent e)
1247 public void annotations_actionPerformed(ActionEvent e)
1254 public void startupFileTextfield_mouseClicked()
1258 public void newLink_actionPerformed(ActionEvent e)
1263 public void editLink_actionPerformed(ActionEvent e)
1268 public void deleteLink_actionPerformed(ActionEvent e)
1273 public void defaultBrowser_mouseClicked(MouseEvent e)
1278 public void linkURLList_keyTyped(KeyEvent e)
1283 public void useProxy_actionPerformed()
1285 proxyServerTB.setEnabled(useProxy.isSelected());
1286 proxyPortTB.setEnabled(useProxy.isSelected());