2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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.jbgui.PDBDocFieldPreferences.PreferenceSource;
26 import jalview.util.MessageManager;
28 import java.awt.BorderLayout;
29 import java.awt.Color;
30 import java.awt.Component;
31 import java.awt.Dimension;
32 import java.awt.FlowLayout;
34 import java.awt.GridBagConstraints;
35 import java.awt.GridBagLayout;
36 import java.awt.GridLayout;
37 import java.awt.Insets;
38 import java.awt.Rectangle;
39 import java.awt.event.ActionEvent;
40 import java.awt.event.ActionListener;
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();
155 * Colours tab components
157 protected JPanel minColour = new JPanel();
159 protected JPanel maxColour = new JPanel();
161 protected JComboBox<String> protColour = new JComboBox<String>();
163 protected JComboBox<String> nucColour = new JComboBox<String>();
166 * Connections tab components
168 protected JList linkURLList = new JList();
170 protected JTextField proxyServerTB = new JTextField();
172 protected JTextField proxyPortTB = new JTextField();
174 protected JTextField defaultBrowser = new JTextField();
176 protected JList linkNameList = new JList();
178 protected JCheckBox useProxy = new JCheckBox();
180 protected JCheckBox usagestats = new JCheckBox();
182 protected JCheckBox questionnaire = new JCheckBox();
184 protected JCheckBox versioncheck = new JCheckBox();
187 * Output tab components
189 protected JComboBox<String> epsRendering = new JComboBox<String>();
191 protected JLabel userIdWidthlabel = new JLabel();
193 protected JCheckBox autoIdWidth = new JCheckBox();
195 protected JTextField userIdWidth = new JTextField();
197 protected JCheckBox blcjv = new JCheckBox();
199 protected JCheckBox pileupjv = new JCheckBox();
201 protected JCheckBox clustaljv = new JCheckBox();
203 protected JCheckBox msfjv = new JCheckBox();
205 protected JCheckBox fastajv = new JCheckBox();
207 protected JCheckBox pfamjv = new JCheckBox();
209 protected JCheckBox pirjv = new JCheckBox();
211 protected JCheckBox modellerOutput = new JCheckBox();
214 * Editing tab components
216 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
218 protected JCheckBox padGaps = new JCheckBox();
220 protected JCheckBox sortByTree = new JCheckBox();
225 protected JPanel dasTab = new JPanel();
230 protected JPanel wsTab = new JPanel();
233 * Creates a new GPreferences object.
235 public GPreferences()
240 } catch (Exception ex)
242 ex.printStackTrace();
247 * Construct the panel and its tabbed sub-panels.
251 private void jbInit() throws Exception
253 final JTabbedPane tabbedPane = new JTabbedPane();
254 this.setLayout(new BorderLayout());
255 JPanel okCancelPanel = initOkCancelPanel();
256 this.add(tabbedPane, BorderLayout.CENTER);
257 this.add(okCancelPanel, BorderLayout.SOUTH);
259 tabbedPane.add(initVisualTab(),
260 MessageManager.getString("label.visual"));
262 tabbedPane.add(initColoursTab(),
263 MessageManager.getString("label.colours"));
265 tabbedPane.add(initStructureTab(),
266 MessageManager.getString("label.structure"));
268 tabbedPane.add(initConnectionsTab(),
269 MessageManager.getString("label.connections"));
271 tabbedPane.add(initOutputTab(), MessageManager.getString("label.output"));
273 tabbedPane.add(initEditingTab(), MessageManager.getString("label.editing"));
276 * See DasSourceBrowser for the real work of configuring this tab.
278 dasTab.setLayout(new BorderLayout());
280 .add(dasTab, MessageManager.getString("label.das_settings"));
283 * See WsPreferences for the real work of configuring this tab.
285 wsTab.setLayout(new BorderLayout());
286 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
289 * Handler to validate a tab before leaving it - currently only for
292 tabbedPane.addChangeListener(new ChangeListener()
294 private Component lastTab;
297 public void stateChanged(ChangeEvent e)
299 if (lastTab == structureTab
300 && tabbedPane.getSelectedComponent() != structureTab)
302 if (!validateStructure())
304 tabbedPane.setSelectedComponent(structureTab);
308 lastTab = tabbedPane.getSelectedComponent();
315 * Initialises the Editing tabbed panel.
319 private JPanel initEditingTab()
321 JPanel editingTab = new JPanel();
322 editingTab.setLayout(null);
323 autoCalculateConsCheck.setFont(verdana11);
324 autoCalculateConsCheck.setText(MessageManager
325 .getString("label.autocalculate_consensus"));
326 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
327 padGaps.setFont(verdana11);
328 padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
329 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
330 sortByTree.setFont(verdana11);
332 .setText(MessageManager.getString("label.sort_with_new_tree"));
334 .setToolTipText(MessageManager
335 .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
336 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
337 editingTab.add(autoCalculateConsCheck);
338 editingTab.add(padGaps);
339 editingTab.add(sortByTree);
344 * Initialises the Output tabbed panel.
348 private JPanel initOutputTab()
350 JPanel outputTab = new JPanel();
351 outputTab.setLayout(null);
352 JLabel epsLabel = new JLabel();
353 epsLabel.setFont(verdana11);
354 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
355 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
356 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
357 epsRendering.setFont(verdana11);
358 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
359 JLabel jLabel1 = new JLabel();
360 jLabel1.setFont(verdana11);
361 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
362 jLabel1.setText(MessageManager.getString("label.append_start_end"));
363 jLabel1.setFont(verdana11);
364 fastajv.setFont(verdana11);
365 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
366 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
367 blcjv.setText(MessageManager.getString("label.blc") + " ");
368 fastajv.setText(MessageManager.getString("label.fasta") + " ");
369 msfjv.setText(MessageManager.getString("label.msf") + " ");
370 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
371 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
372 msfjv.setFont(verdana11);
373 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
374 pirjv.setText(MessageManager.getString("label.pir") + " ");
375 JPanel jPanel11 = new JPanel();
376 jPanel11.setFont(verdana11);
377 TitledBorder titledBorder2 = new TitledBorder(
378 MessageManager.getString("label.file_output"));
379 jPanel11.setBorder(titledBorder2);
380 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
381 GridLayout gridLayout3 = new GridLayout();
382 jPanel11.setLayout(gridLayout3);
383 gridLayout3.setRows(8);
384 blcjv.setFont(verdana11);
385 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
386 clustaljv.setFont(verdana11);
387 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
388 pfamjv.setFont(verdana11);
389 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
390 pileupjv.setFont(verdana11);
391 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
392 pirjv.setFont(verdana11);
393 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
394 autoIdWidth.setFont(verdana11);
395 autoIdWidth.setText(MessageManager
396 .getString("label.automatically_set_id_width"));
398 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.adjusts_width_generated_eps_png")));
399 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
400 autoIdWidth.addActionListener(new ActionListener()
404 public void actionPerformed(ActionEvent e)
406 autoIdWidth_actionPerformed();
409 userIdWidthlabel.setFont(verdana11);
410 userIdWidthlabel.setText(MessageManager
411 .getString("label.figure_id_column_width"));
413 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
415 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
416 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
417 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
418 userIdWidth.setText("");
419 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
420 userIdWidth.addActionListener(new ActionListener()
424 public void actionPerformed(ActionEvent e)
426 userIdWidth_actionPerformed();
429 jPanel11.add(jLabel1);
431 jPanel11.add(clustaljv);
432 jPanel11.add(fastajv);
434 jPanel11.add(pfamjv);
435 jPanel11.add(pileupjv);
437 outputTab.add(autoIdWidth);
438 outputTab.add(userIdWidth);
439 outputTab.add(userIdWidthlabel);
440 outputTab.add(modellerOutput);
441 outputTab.add(epsLabel);
442 outputTab.add(epsRendering);
443 outputTab.add(jPanel11);
444 modellerOutput.setFont(verdana11);
445 modellerOutput.setText(MessageManager
446 .getString("label.use_modeller_output"));
447 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
452 * Initialises the Connections tabbed panel.
456 private JPanel initConnectionsTab()
458 JPanel connectTab = new JPanel();
459 connectTab.setLayout(new GridBagLayout());
460 JLabel serverLabel = new JLabel();
461 serverLabel.setText(MessageManager.getString("label.address"));
462 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
463 serverLabel.setFont(verdana11);
464 proxyServerTB.setFont(verdana11);
465 proxyPortTB.setFont(verdana11);
466 JLabel portLabel = new JLabel();
467 portLabel.setFont(verdana11);
468 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
469 portLabel.setText(MessageManager.getString("label.port"));
470 JLabel browserLabel = new JLabel();
471 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
472 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
473 browserLabel.setText(MessageManager
474 .getString("label.default_browser_unix"));
475 defaultBrowser.setFont(verdana11);
476 defaultBrowser.setText("");
477 usagestats.setText(MessageManager
478 .getString("label.send_usage_statistics"));
479 usagestats.setFont(verdana11);
480 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
481 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
482 questionnaire.setText(MessageManager
483 .getString("label.check_for_questionnaires"));
484 questionnaire.setFont(verdana11);
485 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
486 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
487 versioncheck.setText(MessageManager
488 .getString("label.check_for_latest_version"));
489 versioncheck.setFont(verdana11);
490 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
491 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
492 JButton newLink = new JButton();
493 newLink.setText(MessageManager.getString("action.new"));
494 newLink.addActionListener(new java.awt.event.ActionListener()
496 public void actionPerformed(ActionEvent e)
498 newLink_actionPerformed(e);
501 JButton editLink = new JButton();
502 editLink.setText(MessageManager.getString("action.edit"));
503 editLink.addActionListener(new java.awt.event.ActionListener()
505 public void actionPerformed(ActionEvent e)
507 editLink_actionPerformed(e);
510 JButton deleteLink = new JButton();
511 deleteLink.setText(MessageManager.getString("action.delete"));
512 deleteLink.addActionListener(new java.awt.event.ActionListener()
514 public void actionPerformed(ActionEvent e)
516 deleteLink_actionPerformed(e);
520 linkURLList.addListSelectionListener(new ListSelectionListener()
522 public void valueChanged(ListSelectionEvent e)
524 int index = linkURLList.getSelectedIndex();
525 linkNameList.setSelectedIndex(index);
529 linkNameList.addListSelectionListener(new ListSelectionListener()
531 public void valueChanged(ListSelectionEvent e)
533 int index = linkNameList.getSelectedIndex();
534 linkURLList.setSelectedIndex(index);
538 JScrollPane linkScrollPane = new JScrollPane();
539 linkScrollPane.setBorder(null);
540 JPanel linkPanel = new JPanel();
541 linkPanel.setBorder(new TitledBorder(MessageManager
542 .getString("label.url_linkfrom_sequence_id")));
543 linkPanel.setLayout(new BorderLayout());
544 GridLayout gridLayout1 = new GridLayout();
545 JPanel editLinkButtons = new JPanel();
546 editLinkButtons.setLayout(gridLayout1);
547 gridLayout1.setRows(3);
548 linkNameList.setFont(verdana11);
549 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
550 BorderLayout borderLayout3 = new BorderLayout();
551 JPanel linkPanel2 = new JPanel();
552 linkPanel2.setLayout(borderLayout3);
553 linkURLList.setFont(verdana11);
554 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
556 defaultBrowser.addMouseListener(new MouseAdapter()
558 public void mouseClicked(MouseEvent e)
560 if (e.getClickCount() > 1)
562 defaultBrowser_mouseClicked(e);
566 useProxy.setFont(verdana11);
567 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
568 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
569 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
570 useProxy.addActionListener(new ActionListener()
572 public void actionPerformed(ActionEvent e)
574 useProxy_actionPerformed();
577 linkPanel.add(editLinkButtons, BorderLayout.EAST);
578 editLinkButtons.add(newLink, null);
579 editLinkButtons.add(editLink, null);
580 editLinkButtons.add(deleteLink, null);
581 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
582 linkScrollPane.getViewport().add(linkPanel2, null);
583 linkPanel2.add(linkURLList, BorderLayout.CENTER);
584 linkPanel2.add(linkNameList, BorderLayout.WEST);
585 JPanel jPanel1 = new JPanel();
586 TitledBorder titledBorder1 = new TitledBorder(
587 MessageManager.getString("label.proxy_server"));
588 jPanel1.setBorder(titledBorder1);
589 jPanel1.setLayout(new GridBagLayout());
590 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
591 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
593 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
594 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
596 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
597 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
598 16, 0, 0, 12), 359, -17));
599 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0,
600 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
601 21, 0, 35, 12), 4, 6));
602 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
603 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
604 new Insets(16, 0, 0, 0), 5, 1));
605 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
606 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
608 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
609 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
610 new Insets(0, 2, 4, 2), 54, 1));
611 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
612 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
613 new Insets(0, 2, 4, 0), 263, 1));
614 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
615 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
616 new Insets(15, 0, 0, 15), 307, 1));
617 connectTab.add(usagestats, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0,
618 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
619 new Insets(0, 2, 4, 2), 70, 1));
620 connectTab.add(questionnaire, new GridBagConstraints(1, 4, 1, 1, 1.0,
621 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
622 new Insets(0, 2, 4, 2), 70, 1));
623 connectTab.add(versioncheck, new GridBagConstraints(0, 5, 1, 1, 1.0,
624 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
625 new Insets(0, 2, 4, 2), 70, 1));
630 * Initialises the parent panel which contains the tabbed sections.
634 private JPanel initOkCancelPanel()
636 JButton ok = new JButton();
637 ok.setText(MessageManager.getString("action.ok"));
638 ok.addActionListener(new ActionListener()
640 public void actionPerformed(ActionEvent e)
642 ok_actionPerformed(e);
645 JButton cancel = new JButton();
646 cancel.setText(MessageManager.getString("action.cancel"));
647 cancel.addActionListener(new ActionListener()
649 public void actionPerformed(ActionEvent e)
651 cancel_actionPerformed(e);
654 JPanel okCancelPanel = new JPanel();
655 okCancelPanel.add(ok);
656 okCancelPanel.add(cancel);
657 return okCancelPanel;
661 * Initialises the Colours tabbed panel.
665 private JPanel initColoursTab()
667 JPanel coloursTab = new JPanel();
668 coloursTab.setBorder(new TitledBorder(MessageManager
669 .getString("action.open_new_alignment")));
670 coloursTab.setLayout(new FlowLayout());
671 JLabel mincolourLabel = new JLabel();
672 mincolourLabel.setFont(verdana11);
673 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
674 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
675 minColour.setFont(verdana11);
676 minColour.setBorder(BorderFactory.createEtchedBorder());
677 minColour.setPreferredSize(new Dimension(40, 20));
678 minColour.addMouseListener(new MouseAdapter()
680 public void mousePressed(MouseEvent e)
682 minColour_actionPerformed(minColour);
685 JLabel maxcolourLabel = new JLabel();
686 maxcolourLabel.setFont(verdana11);
687 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
688 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
689 maxColour.setFont(verdana11);
690 maxColour.setBorder(BorderFactory.createEtchedBorder());
691 maxColour.setPreferredSize(new Dimension(40, 20));
692 maxColour.addMouseListener(new MouseAdapter()
694 public void mousePressed(MouseEvent e)
696 maxColour_actionPerformed(maxColour);
700 protColour.setFont(verdana11);
701 protColour.setBounds(new Rectangle(172, 225, 155, 21));
702 JLabel protColourLabel = new JLabel();
703 protColourLabel.setFont(verdana11);
704 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
705 protColourLabel.setText(MessageManager
706 .getString("label.prot_alignment_colour") + " ");
707 JvSwingUtils.addtoLayout(coloursTab, MessageManager
708 .getString("label.default_colour_scheme_for_alignment"),
709 protColourLabel, protColour);
711 nucColour.setFont(verdana11);
712 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
713 JLabel nucColourLabel = new JLabel();
714 nucColourLabel.setFont(verdana11);
715 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
716 nucColourLabel.setText(MessageManager
717 .getString("label.nuc_alignment_colour")
719 JvSwingUtils.addtoLayout(coloursTab, MessageManager
720 .getString("label.default_colour_scheme_for_alignment"),
721 nucColourLabel, nucColour);
723 JPanel annotationShding = new JPanel();
724 annotationShding.setBorder(new TitledBorder(MessageManager
725 .getString("label.annotation_shading_default")));
726 annotationShding.setLayout(new GridLayout(1, 2));
727 JvSwingUtils.addtoLayout(annotationShding, MessageManager
728 .getString("label.default_minimum_colour_annotation_shading"),
729 mincolourLabel, minColour);
730 JvSwingUtils.addtoLayout(annotationShding, MessageManager
731 .getString("label.default_maximum_colour_annotation_shading"),
732 maxcolourLabel, maxColour);
733 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
738 * Initialises the Structure tabbed panel.
742 private JPanel initStructureTab()
744 structureTab = new JPanel();
746 structureTab.setBorder(new TitledBorder(MessageManager
747 .getString("label.structure_options")));
748 structureTab.setLayout(null);
749 final int width = 400;
750 final int height = 22;
751 final int lineSpacing = 25;
754 structFromPdb.setFont(verdana11);
755 structFromPdb.setText(MessageManager.getString("label.struct_from_pdb"));
756 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
757 structFromPdb.addActionListener(new ActionListener()
760 public void actionPerformed(ActionEvent e)
762 boolean selected = structFromPdb.isSelected();
763 // enable other options only when the first is checked
764 useRnaView.setEnabled(selected);
765 addSecondaryStructure.setEnabled(selected);
766 addTempFactor.setEnabled(selected);
769 structureTab.add(structFromPdb);
771 // indent checkboxes that are conditional on the first one
773 useRnaView.setFont(verdana11);
774 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
775 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
776 structureTab.add(useRnaView);
779 addSecondaryStructure.setFont(verdana11);
780 addSecondaryStructure.setText(MessageManager
781 .getString("label.autoadd_secstr"));
782 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
783 structureTab.add(addSecondaryStructure);
786 addTempFactor.setFont(verdana11);
787 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
788 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
789 structureTab.add(addTempFactor);
792 JLabel viewerLabel = new JLabel();
793 viewerLabel.setFont(verdana11);
794 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
795 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
796 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
797 structureTab.add(viewerLabel);
799 structViewer.setFont(verdana11);
800 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
801 structViewer.addItem(ViewerType.JMOL.name());
802 structViewer.addItem(ViewerType.CHIMERA.name());
803 structViewer.addActionListener(new ActionListener()
806 public void actionPerformed(ActionEvent e)
808 structureViewer_actionPerformed((String) structViewer
812 structureTab.add(structViewer);
815 JLabel pathLabel = new JLabel();
816 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
817 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
818 pathLabel.setText(MessageManager.getString("label.chimera_path"));
819 final String tooltip = JvSwingUtils.wrapTooltip(true,
820 MessageManager.getString("label.chimera_path_tip"));
821 pathLabel.setToolTipText(tooltip);
822 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
823 structureTab.add(pathLabel);
825 chimeraPath.setFont(verdana11);
826 chimeraPath.setText("");
827 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
828 chimeraPath.addMouseListener(new MouseAdapter()
831 public void mouseClicked(MouseEvent e)
833 if (e.getClickCount() == 2)
835 String chosen = openFileChooser();
838 chimeraPath.setText(chosen);
843 structureTab.add(chimeraPath);
846 // scrl_pdbDocFieldConfig.setPreferredSize(new Dimension(450, 100));
847 // scrl_pdbDocFieldConfig
848 // .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
849 // scrl_pdbDocFieldConfig.setBounds();
850 PDBDocFieldPreferences docFieldPref = new PDBDocFieldPreferences(
851 PreferenceSource.PREFERENCES);
852 docFieldPref.setBounds(new Rectangle(10, ypos + 5, 450, 120));
853 structureTab.add(docFieldPref);
863 * Action on choosing a structure viewer from combobox options.
865 * @param selectedItem
867 protected void structureViewer_actionPerformed(String selectedItem)
872 * Show a dialog for the user to choose a file. Returns the chosen path, or
877 protected String openFileChooser()
879 String choice = null;
880 JFileChooser chooser = new JFileChooser();
882 // chooser.setFileView(new JalviewFileView());
883 chooser.setDialogTitle(MessageManager
884 .getString("label.open_local_file"));
885 chooser.setToolTipText(MessageManager.getString("action.open"));
887 int value = chooser.showOpenDialog(this);
889 if (value == JFileChooser.APPROVE_OPTION)
891 choice = chooser.getSelectedFile().getPath();
897 * Validate the structure tab preferences; if invalid, set focus on this tab.
901 protected boolean validateStructure(FocusEvent e)
903 if (!validateStructure())
905 e.getComponent().requestFocusInWindow();
911 protected boolean validateStructure()
917 * Initialises the Visual tabbed panel.
921 private JPanel initVisualTab()
923 JPanel visualTab = new JPanel();
924 visualTab.setBorder(new TitledBorder(MessageManager
925 .getString("action.open_new_alignment")));
926 visualTab.setLayout(null);
927 fullScreen.setFont(verdana11);
928 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
929 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
930 fullScreen.setText(MessageManager.getString("label.maximize_window"));
931 quality.setEnabled(false);
932 quality.setFont(verdana11);
933 quality.setHorizontalAlignment(SwingConstants.RIGHT);
934 quality.setHorizontalTextPosition(SwingConstants.LEFT);
935 quality.setSelected(true);
936 quality.setText(MessageManager.getString("label.quality"));
937 conservation.setEnabled(false);
938 conservation.setFont(verdana11);
939 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
940 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
941 conservation.setSelected(true);
942 conservation.setText(MessageManager.getString("label.conservation"));
943 identity.setEnabled(false);
944 identity.setFont(verdana11);
945 identity.setHorizontalAlignment(SwingConstants.RIGHT);
946 identity.setHorizontalTextPosition(SwingConstants.LEFT);
947 identity.setSelected(true);
948 identity.setText(MessageManager.getString("label.consensus"));
949 JLabel showGroupbits = new JLabel();
950 showGroupbits.setFont(verdana11);
951 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
952 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
953 showGroupbits.setText(MessageManager.getString("action.show_group")
955 JLabel showConsensbits = new JLabel();
956 showConsensbits.setFont(verdana11);
957 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
958 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
959 showConsensbits.setText(MessageManager.getString("label.consensus")
961 showConsensHistogram.setEnabled(false);
962 showConsensHistogram.setFont(verdana11);
963 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
964 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
965 showConsensHistogram.setSelected(true);
966 showConsensHistogram.setText(MessageManager
967 .getString("label.histogram"));
968 showConsensLogo.setEnabled(false);
969 showConsensLogo.setFont(verdana11);
970 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
971 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
972 showConsensLogo.setSelected(true);
973 showConsensLogo.setText(MessageManager.getString("label.logo"));
974 showGroupConsensus.setEnabled(false);
975 showGroupConsensus.setFont(verdana11);
976 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
977 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
978 showGroupConsensus.setSelected(true);
979 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
980 showGroupConservation.setEnabled(false);
981 showGroupConservation.setFont(verdana11);
982 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
983 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
984 showGroupConservation.setSelected(true);
985 showGroupConservation.setText(MessageManager
986 .getString("label.conservation"));
987 showNpTooltip.setEnabled(true);
988 showNpTooltip.setFont(verdana11);
989 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
990 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
991 showNpTooltip.setSelected(true);
992 showNpTooltip.setText(MessageManager
993 .getString("label.non_positional_features"));
994 showDbRefTooltip.setEnabled(true);
995 showDbRefTooltip.setFont(verdana11);
996 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
997 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
998 showDbRefTooltip.setSelected(true);
999 showDbRefTooltip.setText(MessageManager
1000 .getString("label.database_references"));
1001 annotations.setFont(verdana11);
1002 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1003 annotations.setHorizontalTextPosition(SwingConstants.LEADING);
1004 annotations.setSelected(true);
1005 annotations.setText(MessageManager.getString("label.show_annotations"));
1006 annotations.setBounds(new Rectangle(169, 12, 200, 23));
1007 annotations.addActionListener(new ActionListener()
1009 public void actionPerformed(ActionEvent e)
1011 annotations_actionPerformed(e);
1014 identity.addActionListener(new ActionListener()
1016 public void actionPerformed(ActionEvent e)
1018 annotations_actionPerformed(e);
1021 showGroupConsensus.addActionListener(new ActionListener()
1023 public void actionPerformed(ActionEvent e)
1025 annotations_actionPerformed(e);
1028 showUnconserved.setFont(verdana11);
1029 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1030 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1031 showUnconserved.setSelected(true);
1032 showUnconserved.setText(MessageManager
1033 .getString("action.show_unconserved"));
1034 showUnconserved.addActionListener(new ActionListener()
1036 public void actionPerformed(ActionEvent e)
1038 showunconserved_actionPerformed(e);
1042 // TODO these are not yet added to / action from Preferences
1043 // JCheckBox shareSelections = new JCheckBox();
1044 // shareSelections.setFont(verdana11);
1045 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1046 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1047 // shareSelections.setSelected(true);
1048 // shareSelections.setText(MessageManager
1049 // .getString("label.share_selection_across_views"));
1050 // JCheckBox followHighlight = new JCheckBox();
1051 // followHighlight.setFont(verdana11);
1052 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1053 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1054 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1055 // followHighlight.setSelected(true);
1056 // followHighlight.setText(MessageManager
1057 // .getString("label.scroll_highlighted_regions"));
1059 seqLimit.setFont(verdana11);
1060 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1061 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1062 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1063 smoothFont.setFont(verdana11);
1064 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1065 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1066 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1067 JLabel gapLabel = new JLabel();
1068 gapLabel.setFont(verdana11);
1069 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1070 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1071 JLabel fontLabel = new JLabel();
1072 fontLabel.setFont(verdana11);
1073 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1074 fontLabel.setText(MessageManager.getString("label.font"));
1075 fontSizeCB.setFont(verdana11);
1076 fontSizeCB.setBounds(new Rectangle(320, 104, 65, 23));
1077 fontStyleCB.setFont(verdana11);
1078 fontStyleCB.setBounds(new Rectangle(382, 104, 80, 23));
1079 fontNameCB.setFont(verdana11);
1080 fontNameCB.setBounds(new Rectangle(172, 104, 147, 23));
1081 gapSymbolCB.setFont(verdana11);
1082 gapSymbolCB.setBounds(new Rectangle(172, 196, 69, 23));
1083 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1084 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1085 gapSymbolCB.setRenderer(dlcr);
1087 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1088 startupCheckbox.setFont(verdana11);
1089 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1090 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1091 startupCheckbox.setSelected(true);
1092 startupFileTextfield.setFont(verdana11);
1093 startupFileTextfield.setBounds(new Rectangle(172, 290, 270, 20));
1094 startupFileTextfield.addMouseListener(new MouseAdapter()
1096 public void mouseClicked(MouseEvent e)
1098 if (e.getClickCount() > 1)
1100 startupFileTextfield_mouseClicked();
1105 sortby.setFont(verdana11);
1106 sortby.setBounds(new Rectangle(172, 240, 155, 21));
1107 JLabel sortLabel = new JLabel();
1108 sortLabel.setFont(verdana11);
1109 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1110 sortLabel.setText(MessageManager.getString("label.sort_by"));
1111 sortAnnBy.setFont(verdana11);
1112 sortAnnBy.setBounds(new Rectangle(172, 265, 110, 21));
1113 JLabel sortAnnLabel = new JLabel();
1114 sortAnnLabel.setFont(verdana11);
1115 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1116 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1117 sortAutocalc.setFont(verdana11);
1118 sortAutocalc.setBounds(new Rectangle(290, 265, 165, 21));
1119 JPanel annsettingsPanel = new JPanel();
1120 annsettingsPanel.setBounds(new Rectangle(173, 34, 300, 61));
1121 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1122 JPanel autoAnnotSettings1 = new JPanel();
1123 autoAnnotSettings1.setLayout(new GridLayout(3, 1, 0, 0));
1124 annsettingsPanel.add(autoAnnotSettings1);
1125 JPanel autoAnnotSettings2 = new JPanel();
1126 autoAnnotSettings2.setLayout(new GridLayout(3, 1, 0, 0));
1127 annsettingsPanel.add(autoAnnotSettings2);
1128 JPanel autoAnnotSettings3 = new JPanel();
1129 autoAnnotSettings3.setLayout(new GridLayout(3, 1, 0, 0));
1130 annsettingsPanel.add(autoAnnotSettings3);
1131 visualTab.add(annsettingsPanel);
1132 Border jb = new EmptyBorder(1, 1, 4, 5);
1133 quality.setBorder(jb);
1134 conservation.setBorder(jb);
1135 identity.setBorder(jb);
1136 showConsensbits.setBorder(jb);
1137 showGroupbits.setBorder(jb);
1138 showGroupConsensus.setBorder(jb);
1139 showGroupConservation.setBorder(jb);
1140 showConsensHistogram.setBorder(jb);
1141 showConsensLogo.setBorder(jb);
1143 autoAnnotSettings2.add(conservation);
1144 autoAnnotSettings1.add(quality);
1145 autoAnnotSettings3.add(identity);
1146 autoAnnotSettings1.add(showGroupbits);
1147 autoAnnotSettings3.add(showGroupConsensus);
1148 autoAnnotSettings2.add(showGroupConservation);
1149 autoAnnotSettings1.add(showConsensbits);
1150 autoAnnotSettings2.add(showConsensHistogram);
1151 autoAnnotSettings3.add(showConsensLogo);
1153 JPanel tooltipSettings = new JPanel();
1154 tooltipSettings.setBorder(new TitledBorder(MessageManager
1155 .getString("label.sequence_id_tooltip")));
1156 tooltipSettings.setBounds(173, 130, 200, 62);
1157 tooltipSettings.setLayout(new GridLayout(2, 1));
1158 tooltipSettings.add(showDbRefTooltip);
1159 tooltipSettings.add(showNpTooltip);
1160 visualTab.add(tooltipSettings);
1162 wrap.setFont(verdana11);
1163 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1164 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1165 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1166 rightAlign.setFont(verdana11);
1167 rightAlign.setForeground(Color.black);
1168 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1169 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1170 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1171 idItalics.setFont(verdana11);
1172 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1173 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1174 idItalics.setText(MessageManager
1175 .getString("label.sequence_name_italics"));
1176 openoverv.setFont(verdana11);
1177 openoverv.setActionCommand(MessageManager
1178 .getString("label.open_overview"));
1179 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1180 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1181 openoverv.setText(MessageManager.getString(("label.open_overview")));
1182 JPanel jPanel2 = new JPanel();
1183 jPanel2.setBounds(new Rectangle(7, 17, 158, 297));
1184 GridLayout gridLayout2 = new GridLayout();
1185 jPanel2.setLayout(gridLayout2);
1186 gridLayout2.setRows(13);
1187 jPanel2.add(fullScreen);
1188 jPanel2.add(openoverv);
1189 jPanel2.add(seqLimit);
1190 jPanel2.add(rightAlign);
1191 jPanel2.add(fontLabel);
1192 jPanel2.add(showUnconserved);
1193 jPanel2.add(idItalics);
1194 jPanel2.add(smoothFont);
1195 jPanel2.add(gapLabel);
1197 jPanel2.add(sortLabel);
1198 jPanel2.add(sortAnnLabel);
1199 jPanel2.add(startupCheckbox);
1200 visualTab.add(jPanel2);
1201 visualTab.add(annotations);
1202 visualTab.add(startupFileTextfield);
1203 visualTab.add(sortby);
1204 visualTab.add(sortAnnBy);
1205 visualTab.add(sortAutocalc);
1206 visualTab.add(gapSymbolCB);
1207 visualTab.add(fontNameCB);
1208 visualTab.add(fontSizeCB);
1209 visualTab.add(fontStyleCB);
1213 protected void autoIdWidth_actionPerformed()
1215 // TODO Auto-generated method stub
1219 protected void userIdWidth_actionPerformed()
1221 // TODO Auto-generated method stub
1225 protected void maxColour_actionPerformed(JPanel panel)
1229 protected void minColour_actionPerformed(JPanel panel)
1233 protected void showunconserved_actionPerformed(ActionEvent e)
1235 // TODO Auto-generated method stub
1245 public void ok_actionPerformed(ActionEvent e)
1255 public void cancel_actionPerformed(ActionEvent e)
1265 public void annotations_actionPerformed(ActionEvent e)
1272 public void startupFileTextfield_mouseClicked()
1276 public void newLink_actionPerformed(ActionEvent e)
1281 public void editLink_actionPerformed(ActionEvent e)
1286 public void deleteLink_actionPerformed(ActionEvent e)
1291 public void defaultBrowser_mouseClicked(MouseEvent e)
1296 public void linkURLList_keyTyped(KeyEvent e)
1301 public void useProxy_actionPerformed()
1303 proxyServerTB.setEnabled(useProxy.isSelected());
1304 proxyPortTB.setEnabled(useProxy.isSelected());