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.FocusAdapter;
41 import java.awt.event.FocusEvent;
42 import java.awt.event.KeyEvent;
43 import java.awt.event.MouseAdapter;
44 import java.awt.event.MouseEvent;
46 import javax.swing.BorderFactory;
47 import javax.swing.DefaultListCellRenderer;
48 import javax.swing.JButton;
49 import javax.swing.JCheckBox;
50 import javax.swing.JComboBox;
51 import javax.swing.JFileChooser;
52 import javax.swing.JLabel;
53 import javax.swing.JList;
54 import javax.swing.JPanel;
55 import javax.swing.JScrollPane;
56 import javax.swing.JTabbedPane;
57 import javax.swing.JTextField;
58 import javax.swing.ListSelectionModel;
59 import javax.swing.SwingConstants;
60 import javax.swing.border.Border;
61 import javax.swing.border.EmptyBorder;
62 import javax.swing.border.TitledBorder;
63 import javax.swing.event.ChangeEvent;
64 import javax.swing.event.ChangeListener;
65 import javax.swing.event.ListSelectionEvent;
66 import javax.swing.event.ListSelectionListener;
69 * Base class for the Preferences panel.
74 public class GPreferences extends JPanel
76 private static final Font verdana11 = JvSwingUtils.getLabelFont();
79 * Visual tab components
81 protected JCheckBox fullScreen = new JCheckBox();
83 protected JCheckBox openoverv = new JCheckBox();
85 protected JCheckBox seqLimit = new JCheckBox();
87 protected JCheckBox rightAlign = new JCheckBox();
89 protected JComboBox<String> fontSizeCB = new JComboBox<String>();
91 protected JComboBox<String> fontStyleCB = new JComboBox<String>();
93 protected JComboBox<String> fontNameCB = new JComboBox<String>();
95 protected JCheckBox showUnconserved = new JCheckBox();
97 protected JCheckBox idItalics = new JCheckBox();
99 protected JCheckBox smoothFont = new JCheckBox();
101 protected JComboBox<String> gapSymbolCB = new JComboBox<String>();
103 protected JCheckBox wrap = new JCheckBox();
105 protected JComboBox<String> sortby = new JComboBox<String>();
107 protected JComboBox<String> sortAnnBy = new JComboBox<String>();
109 protected JComboBox<String> sortAutocalc = new JComboBox<String>();
111 protected JCheckBox startupCheckbox = new JCheckBox();
113 protected JTextField startupFileTextfield = new JTextField();
115 // below are in the 'second column'
116 protected JCheckBox annotations = new JCheckBox();
118 protected JCheckBox quality = new JCheckBox();
120 protected JCheckBox conservation = new JCheckBox();
122 protected JCheckBox identity = new JCheckBox();
124 protected JCheckBox showGroupConsensus = new JCheckBox();
126 protected JCheckBox showGroupConservation = new JCheckBox();
128 protected JCheckBox showConsensHistogram = new JCheckBox();
130 protected JCheckBox showConsensLogo = new JCheckBox();
132 protected JCheckBox showDbRefTooltip = new JCheckBox();
134 protected JCheckBox showNpTooltip = new JCheckBox();
137 * Structure tab and components
139 protected JPanel structureTab;
141 protected JCheckBox structFromPdb = new JCheckBox();
143 protected JCheckBox useRnaView = new JCheckBox();
145 protected JCheckBox addSecondaryStructure = new JCheckBox();
147 protected JCheckBox addTempFactor = new JCheckBox();
149 protected JComboBox<String> structViewer = new JComboBox<String>();
151 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 = 23;
734 final int lineSpacing = 30;
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(Viewer.JMOL.name());
785 structViewer.addItem(Viewer.CHIMERA.name());
786 structureTab.add(structViewer);
789 JLabel pathLabel = new JLabel();
790 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
791 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
792 pathLabel.setText(MessageManager.getString("label.chimera_path"));
793 pathLabel.setToolTipText(MessageManager
794 .getString("label.chimera_path_tip"));
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);
818 structureTab.addFocusListener(new FocusAdapter()
821 public void focusLost(FocusEvent e)
823 validateStructure(e);
831 * Show a dialog for the user to choose a file. Returns the chosen path, or
836 protected String openFileChooser()
838 String choice = null;
839 JFileChooser chooser = new JFileChooser();
841 // chooser.setFileView(new JalviewFileView());
842 chooser.setDialogTitle(MessageManager
843 .getString("label.open_local_file"));
844 chooser.setToolTipText(MessageManager.getString("action.open"));
846 int value = chooser.showOpenDialog(this);
848 if (value == JFileChooser.APPROVE_OPTION)
850 choice = chooser.getSelectedFile().getPath();
856 * Validate the structure tab preferences; if invalid, set focus on this tab.
860 protected boolean validateStructure(FocusEvent e)
862 if (!validateStructure())
864 e.getComponent().requestFocusInWindow();
870 protected boolean validateStructure()
876 * Initialises the Visual tabbed panel.
880 private JPanel initVisualTab()
882 JPanel visualTab = new JPanel();
883 visualTab.setBorder(new TitledBorder(MessageManager
884 .getString("action.open_new_alignment")));
885 visualTab.setLayout(null);
886 fullScreen.setFont(verdana11);
887 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
888 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
889 fullScreen.setText(MessageManager.getString("label.maximize_window"));
890 quality.setEnabled(false);
891 quality.setFont(verdana11);
892 quality.setHorizontalAlignment(SwingConstants.RIGHT);
893 quality.setHorizontalTextPosition(SwingConstants.LEFT);
894 quality.setSelected(true);
895 quality.setText(MessageManager.getString("label.quality"));
896 conservation.setEnabled(false);
897 conservation.setFont(verdana11);
898 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
899 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
900 conservation.setSelected(true);
901 conservation.setText(MessageManager.getString("label.conservation"));
902 identity.setEnabled(false);
903 identity.setFont(verdana11);
904 identity.setHorizontalAlignment(SwingConstants.RIGHT);
905 identity.setHorizontalTextPosition(SwingConstants.LEFT);
906 identity.setSelected(true);
907 identity.setText(MessageManager.getString("label.consensus"));
908 JLabel showGroupbits = new JLabel();
909 showGroupbits.setFont(verdana11);
910 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
911 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
912 showGroupbits.setText(MessageManager.getString("action.show_group")
914 JLabel showConsensbits = new JLabel();
915 showConsensbits.setFont(verdana11);
916 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
917 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
918 showConsensbits.setText(MessageManager.getString("label.consensus")
920 showConsensHistogram.setEnabled(false);
921 showConsensHistogram.setFont(verdana11);
922 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
923 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
924 showConsensHistogram.setSelected(true);
925 showConsensHistogram.setText(MessageManager
926 .getString("label.histogram"));
927 showConsensLogo.setEnabled(false);
928 showConsensLogo.setFont(verdana11);
929 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
930 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
931 showConsensLogo.setSelected(true);
932 showConsensLogo.setText(MessageManager.getString("label.logo"));
933 showGroupConsensus.setEnabled(false);
934 showGroupConsensus.setFont(verdana11);
935 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
936 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
937 showGroupConsensus.setSelected(true);
938 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
939 showGroupConservation.setEnabled(false);
940 showGroupConservation.setFont(verdana11);
941 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
942 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
943 showGroupConservation.setSelected(true);
944 showGroupConservation.setText(MessageManager
945 .getString("label.conservation"));
946 showNpTooltip.setEnabled(true);
947 showNpTooltip.setFont(verdana11);
948 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
949 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
950 showNpTooltip.setSelected(true);
951 showNpTooltip.setText(MessageManager
952 .getString("label.non_positional_features"));
953 showDbRefTooltip.setEnabled(true);
954 showDbRefTooltip.setFont(verdana11);
955 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
956 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
957 showDbRefTooltip.setSelected(true);
958 showDbRefTooltip.setText(MessageManager
959 .getString("label.database_references"));
960 annotations.setFont(verdana11);
961 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
962 annotations.setHorizontalTextPosition(SwingConstants.LEADING);
963 annotations.setSelected(true);
964 annotations.setText(MessageManager.getString("label.show_annotations"));
965 annotations.setBounds(new Rectangle(169, 12, 200, 23));
966 annotations.addActionListener(new ActionListener()
968 public void actionPerformed(ActionEvent e)
970 annotations_actionPerformed(e);
973 identity.addActionListener(new ActionListener()
975 public void actionPerformed(ActionEvent e)
977 annotations_actionPerformed(e);
980 showGroupConsensus.addActionListener(new ActionListener()
982 public void actionPerformed(ActionEvent e)
984 annotations_actionPerformed(e);
987 showUnconserved.setFont(verdana11);
988 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
989 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
990 showUnconserved.setSelected(true);
991 showUnconserved.setText(MessageManager
992 .getString("action.show_unconserved"));
993 showUnconserved.addActionListener(new ActionListener()
995 public void actionPerformed(ActionEvent e)
997 showunconserved_actionPerformed(e);
1001 // TODO these are not yet added to / action from Preferences
1002 // JCheckBox shareSelections = new JCheckBox();
1003 // shareSelections.setFont(verdana11);
1004 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1005 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1006 // shareSelections.setSelected(true);
1007 // shareSelections.setText(MessageManager
1008 // .getString("label.share_selection_across_views"));
1009 // JCheckBox followHighlight = new JCheckBox();
1010 // followHighlight.setFont(verdana11);
1011 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1012 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1013 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1014 // followHighlight.setSelected(true);
1015 // followHighlight.setText(MessageManager
1016 // .getString("label.scroll_highlighted_regions"));
1018 seqLimit.setFont(verdana11);
1019 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1020 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1021 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1022 smoothFont.setFont(verdana11);
1023 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1024 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1025 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1026 JLabel gapLabel = new JLabel();
1027 gapLabel.setFont(verdana11);
1028 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1029 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1030 JLabel fontLabel = new JLabel();
1031 fontLabel.setFont(verdana11);
1032 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1033 fontLabel.setText(MessageManager.getString("label.font"));
1034 fontSizeCB.setFont(verdana11);
1035 fontSizeCB.setBounds(new Rectangle(320, 104, 65, 23));
1036 fontStyleCB.setFont(verdana11);
1037 fontStyleCB.setBounds(new Rectangle(382, 104, 80, 23));
1038 fontNameCB.setFont(verdana11);
1039 fontNameCB.setBounds(new Rectangle(172, 104, 147, 23));
1040 gapSymbolCB.setFont(verdana11);
1041 gapSymbolCB.setBounds(new Rectangle(172, 196, 69, 23));
1042 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1043 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1044 gapSymbolCB.setRenderer(dlcr);
1046 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1047 startupCheckbox.setFont(verdana11);
1048 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1049 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1050 startupCheckbox.setSelected(true);
1051 startupFileTextfield.setFont(verdana11);
1052 startupFileTextfield.setBounds(new Rectangle(172, 290, 270, 20));
1053 startupFileTextfield.addMouseListener(new MouseAdapter()
1055 public void mouseClicked(MouseEvent e)
1057 if (e.getClickCount() > 1)
1059 startupFileTextfield_mouseClicked();
1064 sortby.setFont(verdana11);
1065 sortby.setBounds(new Rectangle(172, 240, 155, 21));
1066 JLabel sortLabel = new JLabel();
1067 sortLabel.setFont(verdana11);
1068 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1069 sortLabel.setText(MessageManager.getString("label.sort_by"));
1070 sortAnnBy.setFont(verdana11);
1071 sortAnnBy.setBounds(new Rectangle(172, 265, 110, 21));
1072 JLabel sortAnnLabel = new JLabel();
1073 sortAnnLabel.setFont(verdana11);
1074 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1075 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1076 sortAutocalc.setFont(verdana11);
1077 sortAutocalc.setBounds(new Rectangle(290, 265, 165, 21));
1078 JPanel annsettingsPanel = new JPanel();
1079 annsettingsPanel.setBounds(new Rectangle(173, 34, 300, 61));
1080 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1081 JPanel autoAnnotSettings1 = new JPanel();
1082 autoAnnotSettings1.setLayout(new GridLayout(3, 1, 0, 0));
1083 annsettingsPanel.add(autoAnnotSettings1);
1084 JPanel autoAnnotSettings2 = new JPanel();
1085 autoAnnotSettings2.setLayout(new GridLayout(3, 1, 0, 0));
1086 annsettingsPanel.add(autoAnnotSettings2);
1087 JPanel autoAnnotSettings3 = new JPanel();
1088 autoAnnotSettings3.setLayout(new GridLayout(3, 1, 0, 0));
1089 annsettingsPanel.add(autoAnnotSettings3);
1090 visualTab.add(annsettingsPanel);
1091 Border jb = new EmptyBorder(1, 1, 4, 5);
1092 quality.setBorder(jb);
1093 conservation.setBorder(jb);
1094 identity.setBorder(jb);
1095 showConsensbits.setBorder(jb);
1096 showGroupbits.setBorder(jb);
1097 showGroupConsensus.setBorder(jb);
1098 showGroupConservation.setBorder(jb);
1099 showConsensHistogram.setBorder(jb);
1100 showConsensLogo.setBorder(jb);
1102 autoAnnotSettings2.add(conservation);
1103 autoAnnotSettings1.add(quality);
1104 autoAnnotSettings3.add(identity);
1105 autoAnnotSettings1.add(showGroupbits);
1106 autoAnnotSettings3.add(showGroupConsensus);
1107 autoAnnotSettings2.add(showGroupConservation);
1108 autoAnnotSettings1.add(showConsensbits);
1109 autoAnnotSettings2.add(showConsensHistogram);
1110 autoAnnotSettings3.add(showConsensLogo);
1112 JPanel tooltipSettings = new JPanel();
1113 tooltipSettings.setBorder(new TitledBorder(MessageManager
1114 .getString("label.sequence_id_tooltip")));
1115 tooltipSettings.setBounds(173, 130, 200, 62);
1116 tooltipSettings.setLayout(new GridLayout(2, 1));
1117 tooltipSettings.add(showDbRefTooltip);
1118 tooltipSettings.add(showNpTooltip);
1119 visualTab.add(tooltipSettings);
1121 wrap.setFont(verdana11);
1122 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1123 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1124 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1125 rightAlign.setFont(verdana11);
1126 rightAlign.setForeground(Color.black);
1127 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1128 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1129 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1130 idItalics.setFont(verdana11);
1131 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1132 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1133 idItalics.setText(MessageManager
1134 .getString("label.sequence_name_italics"));
1135 openoverv.setFont(verdana11);
1136 openoverv.setActionCommand(MessageManager
1137 .getString("label.open_overview"));
1138 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1139 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1140 openoverv.setText(MessageManager.getString(("label.open_overview")));
1141 JPanel jPanel2 = new JPanel();
1142 jPanel2.setBounds(new Rectangle(7, 17, 158, 297));
1143 GridLayout gridLayout2 = new GridLayout();
1144 jPanel2.setLayout(gridLayout2);
1145 gridLayout2.setRows(13);
1146 jPanel2.add(fullScreen);
1147 jPanel2.add(openoverv);
1148 jPanel2.add(seqLimit);
1149 jPanel2.add(rightAlign);
1150 jPanel2.add(fontLabel);
1151 jPanel2.add(showUnconserved);
1152 jPanel2.add(idItalics);
1153 jPanel2.add(smoothFont);
1154 jPanel2.add(gapLabel);
1156 jPanel2.add(sortLabel);
1157 jPanel2.add(sortAnnLabel);
1158 jPanel2.add(startupCheckbox);
1159 visualTab.add(jPanel2);
1160 visualTab.add(annotations);
1161 visualTab.add(startupFileTextfield);
1162 visualTab.add(sortby);
1163 visualTab.add(sortAnnBy);
1164 visualTab.add(sortAutocalc);
1165 visualTab.add(gapSymbolCB);
1166 visualTab.add(fontNameCB);
1167 visualTab.add(fontSizeCB);
1168 visualTab.add(fontStyleCB);
1172 protected void autoIdWidth_actionPerformed()
1174 // TODO Auto-generated method stub
1178 protected void userIdWidth_actionPerformed()
1180 // TODO Auto-generated method stub
1184 protected void maxColour_actionPerformed(JPanel panel)
1188 protected void minColour_actionPerformed(JPanel panel)
1192 protected void showunconserved_actionPerformed(ActionEvent e)
1194 // TODO Auto-generated method stub
1204 public void ok_actionPerformed(ActionEvent e)
1214 public void cancel_actionPerformed(ActionEvent e)
1224 public void annotations_actionPerformed(ActionEvent e)
1231 public void startupFileTextfield_mouseClicked()
1235 public void newLink_actionPerformed(ActionEvent e)
1240 public void editLink_actionPerformed(ActionEvent e)
1245 public void deleteLink_actionPerformed(ActionEvent e)
1250 public void defaultBrowser_mouseClicked(MouseEvent e)
1255 public void linkURLList_keyTyped(KeyEvent e)
1260 public void useProxy_actionPerformed()
1262 proxyServerTB.setEnabled(useProxy.isSelected());
1263 proxyPortTB.setEnabled(useProxy.isSelected());