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.fts.core.FTSDataColumnPreferences;
24 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
25 import jalview.fts.service.pdb.PDBFTSRestClient;
26 import jalview.gui.JvSwingUtils;
27 import jalview.gui.StructureViewer.ViewerType;
28 import jalview.util.MessageManager;
29 import jalview.util.Platform;
31 import java.awt.BorderLayout;
32 import java.awt.Color;
33 import java.awt.Component;
34 import java.awt.Dimension;
35 import java.awt.FlowLayout;
37 import java.awt.GridBagConstraints;
38 import java.awt.GridBagLayout;
39 import java.awt.GridLayout;
40 import java.awt.Insets;
41 import java.awt.Rectangle;
42 import java.awt.event.ActionEvent;
43 import java.awt.event.ActionListener;
44 import java.awt.event.KeyEvent;
45 import java.awt.event.MouseAdapter;
46 import java.awt.event.MouseEvent;
48 import javax.swing.AbstractButton;
49 import javax.swing.AbstractCellEditor;
50 import javax.swing.BorderFactory;
51 import javax.swing.BoxLayout;
52 import javax.swing.ButtonGroup;
53 import javax.swing.DefaultListCellRenderer;
54 import javax.swing.JButton;
55 import javax.swing.JCheckBox;
56 import javax.swing.JComboBox;
57 import javax.swing.JFileChooser;
58 import javax.swing.JLabel;
59 import javax.swing.JPanel;
60 import javax.swing.JRadioButton;
61 import javax.swing.JScrollPane;
62 import javax.swing.JTabbedPane;
63 import javax.swing.JTable;
64 import javax.swing.JTextField;
65 import javax.swing.ListSelectionModel;
66 import javax.swing.SwingConstants;
67 import javax.swing.border.Border;
68 import javax.swing.border.EmptyBorder;
69 import javax.swing.border.EtchedBorder;
70 import javax.swing.border.TitledBorder;
71 import javax.swing.event.ChangeEvent;
72 import javax.swing.event.ChangeListener;
73 import javax.swing.table.TableCellEditor;
74 import javax.swing.table.TableCellRenderer;
76 import net.miginfocom.swing.MigLayout;
79 * Base class for the Preferences panel.
84 public class GPreferences extends JPanel
86 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
88 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
89 .getLabelFont(false, true);
92 * Visual tab components
94 protected JCheckBox fullScreen = new JCheckBox();
96 protected JCheckBox openoverv = new JCheckBox();
98 protected JCheckBox seqLimit = new JCheckBox();
100 protected JCheckBox rightAlign = new JCheckBox();
102 protected JComboBox<String> fontSizeCB = new JComboBox<>();
104 protected JComboBox<String> fontStyleCB = new JComboBox<>();
106 protected JComboBox<String> fontNameCB = new JComboBox<>();
108 protected JCheckBox showOccupancy = new JCheckBox();
110 protected JCheckBox showUnconserved = new JCheckBox();
112 protected JCheckBox idItalics = new JCheckBox();
114 protected JCheckBox smoothFont = new JCheckBox();
116 protected JCheckBox scaleProteinToCdna = new JCheckBox();
118 protected JComboBox<String> gapSymbolCB = new JComboBox<>();
120 protected JCheckBox wrap = new JCheckBox();
122 protected JComboBox<String> sortby = new JComboBox<>();
124 protected JComboBox<String> sortAnnBy = new JComboBox<>();
126 protected JComboBox<String> sortAutocalc = new JComboBox<>();
128 protected JCheckBox startupCheckbox = new JCheckBox();
130 protected JTextField startupFileTextfield = new JTextField();
132 // below are in the 'second column'
133 protected JCheckBox annotations = new JCheckBox();
135 protected JCheckBox quality = new JCheckBox();
137 protected JCheckBox conservation = new JCheckBox();
139 protected JCheckBox identity = new JCheckBox();
141 protected JCheckBox showGroupConsensus = new JCheckBox();
143 protected JCheckBox showGroupConservation = new JCheckBox();
145 protected JCheckBox showConsensHistogram = new JCheckBox();
147 protected JCheckBox showConsensLogo = new JCheckBox();
149 protected JCheckBox showInformationHistogram = new JCheckBox();
151 protected JCheckBox showHMMLogo = new JCheckBox();
153 protected JCheckBox showDbRefTooltip = new JCheckBox();
155 protected JCheckBox showNpTooltip = new JCheckBox();
159 * Structure tab and components
161 protected JPanel structureTab;
163 protected JCheckBox structFromPdb = new JCheckBox();
165 protected JCheckBox useRnaView = new JCheckBox();
167 protected JCheckBox addSecondaryStructure = new JCheckBox();
169 protected JCheckBox addTempFactor = new JCheckBox();
171 protected JComboBox<String> structViewer = new JComboBox<>();
173 protected JTextField chimeraPath = new JTextField();
175 protected ButtonGroup mappingMethod = new ButtonGroup();
177 protected JRadioButton siftsMapping = new JRadioButton();
179 protected JRadioButton nwMapping = new JRadioButton();
182 * Colours tab components
184 protected JPanel minColour = new JPanel();
186 protected JPanel maxColour = new JPanel();
188 protected JComboBox<String> protColour = new JComboBox<>();
190 protected JComboBox<String> nucColour = new JComboBox<>();
193 * Overview tab components
195 protected JPanel gapColour = new JPanel();
197 protected JPanel hiddenColour = new JPanel();
199 protected JCheckBox useLegacyGap;
201 protected JCheckBox showHiddenAtStart;
203 protected JLabel gapLabel;
206 * Connections tab components
208 protected JTable linkUrlTable = new JTable();
210 protected JButton editLink = new JButton();
212 protected JButton deleteLink = new JButton();
214 protected JTextField filterTB = new JTextField();
216 protected JButton doReset = new JButton();
218 protected JButton userOnly = new JButton();
220 protected JLabel portLabel = new JLabel();
222 protected JLabel serverLabel = new JLabel();
224 protected JTextField proxyServerTB = new JTextField();
226 protected JTextField proxyPortTB = new JTextField();
228 protected JTextField defaultBrowser = new JTextField();
230 protected JCheckBox useProxy = new JCheckBox();
232 protected JCheckBox usagestats = new JCheckBox();
234 protected JCheckBox questionnaire = new JCheckBox();
236 protected JCheckBox versioncheck = new JCheckBox();
239 * Output tab components
241 protected JComboBox<Object> epsRendering = new JComboBox<>();
243 protected JLabel userIdWidthlabel = new JLabel();
245 protected JCheckBox autoIdWidth = new JCheckBox();
247 protected JTextField userIdWidth = new JTextField();
249 protected JCheckBox blcjv = new JCheckBox();
251 protected JCheckBox pileupjv = new JCheckBox();
253 protected JCheckBox clustaljv = new JCheckBox();
255 protected JCheckBox msfjv = new JCheckBox();
257 protected JCheckBox fastajv = new JCheckBox();
259 protected JCheckBox pfamjv = new JCheckBox();
261 protected JCheckBox pirjv = new JCheckBox();
263 protected JCheckBox modellerOutput = new JCheckBox();
265 protected JCheckBox embbedBioJSON = new JCheckBox();
268 * Editing tab components
270 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
272 protected JCheckBox padGaps = new JCheckBox();
274 protected JCheckBox sortByTree = new JCheckBox();
277 * hmmer tab and components
279 protected JPanel hmmerTab;
281 protected JCheckBox hmmrTrimTermini;
283 protected AbstractButton hmmerBackgroundUniprot;
285 protected AbstractButton hmmerBackgroundAlignment;
287 protected JTextField hmmerSequenceCount;
289 protected JTextField hmmerPath;
291 protected JTextField cygwinPath;
296 protected JPanel dasTab = new JPanel();
301 protected JPanel wsTab = new JPanel();
306 * Creates a new GPreferences object.
308 public GPreferences()
313 } catch (Exception ex)
315 ex.printStackTrace();
320 * Construct the panel and its tabbed sub-panels.
324 private void jbInit() throws Exception
326 final JTabbedPane tabbedPane = new JTabbedPane();
327 this.setLayout(new BorderLayout());
328 JPanel okCancelPanel = initOkCancelPanel();
329 this.add(tabbedPane, BorderLayout.CENTER);
330 this.add(okCancelPanel, BorderLayout.SOUTH);
332 tabbedPane.add(initVisualTab(),
333 MessageManager.getString("label.visual"));
335 tabbedPane.add(initColoursTab(),
336 MessageManager.getString("label.colours"));
338 tabbedPane.add(initOverviewTab(),
339 MessageManager.getString("label.overview"));
341 tabbedPane.add(initStructureTab(),
342 MessageManager.getString("label.structure"));
344 tabbedPane.add(initConnectionsTab(),
345 MessageManager.getString("label.connections"));
347 tabbedPane.add(initLinksTab(),
348 MessageManager.getString("label.urllinks"));
350 tabbedPane.add(initOutputTab(),
351 MessageManager.getString("label.output"));
353 tabbedPane.add(initEditingTab(),
354 MessageManager.getString("label.editing"));
356 tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
359 * See DasSourceBrowser for the real work of configuring this tab.
361 dasTab.setLayout(new BorderLayout());
362 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
365 * See WsPreferences for the real work of configuring this tab.
367 wsTab.setLayout(new BorderLayout());
368 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
371 * Handler to validate a tab before leaving it - currently only for
374 tabbedPane.addChangeListener(new ChangeListener()
376 private Component lastTab;
379 public void stateChanged(ChangeEvent e)
381 if (lastTab == structureTab
382 && tabbedPane.getSelectedComponent() != structureTab)
384 if (!validateStructure())
386 tabbedPane.setSelectedComponent(structureTab);
390 lastTab = tabbedPane.getSelectedComponent();
397 * Initialises the Editing tabbed panel.
401 private JPanel initEditingTab()
403 JPanel editingTab = new JPanel();
404 editingTab.setLayout(null);
405 autoCalculateConsCheck.setFont(LABEL_FONT);
406 autoCalculateConsCheck.setText(
407 MessageManager.getString("label.autocalculate_consensus"));
408 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
409 padGaps.setFont(LABEL_FONT);
411 MessageManager.getString("label.pad_gaps_when_editing"));
412 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
413 sortByTree.setFont(LABEL_FONT);
415 .setText(MessageManager.getString("label.sort_with_new_tree"));
416 sortByTree.setToolTipText(MessageManager.getString(
417 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
418 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
419 editingTab.add(autoCalculateConsCheck);
420 editingTab.add(padGaps);
421 editingTab.add(sortByTree);
426 * Initialises the hmmer tabbed panel
430 private JPanel initHMMERTab()
432 hmmerTab = new JPanel();
433 hmmerTab.setLayout(new BoxLayout(hmmerTab, BoxLayout.Y_AXIS));
434 hmmerTab.setLayout(new MigLayout("flowy"));
437 * path to hmmer binaries folder
439 JPanel installationPanel = new JPanel(new MigLayout("flowy"));
440 // new FlowLayout(FlowLayout.LEFT));
441 JvSwingUtils.createTitledBorder(installationPanel,
442 MessageManager.getString("label.installation"), true);
443 hmmerTab.add(installationPanel);
444 JLabel hmmerLocation = new JLabel(
445 MessageManager.getString("label.hmmer_location"));
446 hmmerLocation.setFont(LABEL_FONT);
447 final int pathFieldLength = 40;
448 hmmerPath = new JTextField(pathFieldLength);
449 hmmerPath.addMouseListener(new MouseAdapter()
452 public void mouseClicked(MouseEvent e)
454 if (e.getClickCount() == 2)
456 String chosen = openFileChooser(true);
459 hmmerPath.setText(chosen);
465 installationPanel.add(hmmerLocation);
466 installationPanel.add(hmmerPath);
469 * path to Cygwin binaries folder (for Windows)
471 if (Platform.isWindows())
473 JLabel cygwinLocation = new JLabel(
474 MessageManager.getString("label.cygwin_location"));
475 cygwinLocation.setFont(LABEL_FONT);
476 cygwinPath = new JTextField(pathFieldLength);
477 cygwinPath.addMouseListener(new MouseAdapter()
480 public void mouseClicked(MouseEvent e)
482 if (e.getClickCount() == 2)
484 String chosen = openFileChooser(true);
487 cygwinPath.setText(chosen);
488 validateCygwinPath();
493 installationPanel.add(cygwinLocation);
494 installationPanel.add(cygwinPath);
498 * preferences for hmmalign
500 JPanel alignOptionsPanel = new JPanel(new MigLayout());
501 // new FlowLayout(FlowLayout.LEFT));
502 JvSwingUtils.createTitledBorder(alignOptionsPanel,
503 MessageManager.getString("label.hmmalign_label"), true);
504 hmmerTab.add(alignOptionsPanel);
505 hmmrTrimTermini = new JCheckBox();
506 hmmrTrimTermini.setFont(LABEL_FONT);
507 hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
508 alignOptionsPanel.add(hmmrTrimTermini);
511 * preferences for hmmsearch
513 JPanel searchOptions = new JPanel(new MigLayout());
514 // FlowLayout(FlowLayout.LEFT));
515 JvSwingUtils.createTitledBorder(searchOptions,
516 MessageManager.getString("label.hmmsearch_label"), true);
517 hmmerTab.add(searchOptions);
518 JLabel sequencesToKeep = new JLabel(
519 MessageManager.getString("label.no_of_sequences"));
520 sequencesToKeep.setFont(LABEL_FONT);
521 searchOptions.add(sequencesToKeep);
522 hmmerSequenceCount = new JTextField(5);
523 searchOptions.add(hmmerSequenceCount);
526 * preferences for Information Content annotation
528 // JPanel dummy = new JPanel(new FlowLayout(FlowLayout.LEFT));
529 JPanel annotationOptions = new JPanel(new MigLayout("left"));
530 JvSwingUtils.createTitledBorder(annotationOptions,
531 MessageManager.getString("label.information_annotation"), true);
532 // dummy.add(annotationOptions);
533 hmmerTab.add(annotationOptions);
534 ButtonGroup backgroundOptions = new ButtonGroup();
535 hmmerBackgroundUniprot = new JRadioButton(
536 MessageManager.getString("label.freq_uniprot"));
537 hmmerBackgroundUniprot.setFont(LABEL_FONT);
538 hmmerBackgroundAlignment = new JRadioButton(
539 MessageManager.getString("label.freq_alignment"));
540 hmmerBackgroundAlignment.setFont(LABEL_FONT);
541 backgroundOptions.add(hmmerBackgroundUniprot);
542 backgroundOptions.add(hmmerBackgroundAlignment);
543 backgroundOptions.setSelected(hmmerBackgroundUniprot.getModel(), true);
544 // disable buttons for now as annotation only uses Uniprot background
545 hmmerBackgroundAlignment.setEnabled(false);
546 hmmerBackgroundUniprot.setEnabled(false);
547 annotationOptions.add(hmmerBackgroundUniprot, "wrap");
548 annotationOptions.add(hmmerBackgroundAlignment);
554 * Initialises the Output tabbed panel.
558 private JPanel initOutputTab()
560 JPanel outputTab = new JPanel();
561 outputTab.setLayout(null);
562 JLabel epsLabel = new JLabel();
563 epsLabel.setFont(LABEL_FONT);
564 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
565 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
566 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
567 epsRendering.setFont(LABEL_FONT);
568 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
569 JLabel jLabel1 = new JLabel();
570 jLabel1.setFont(LABEL_FONT);
571 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
572 jLabel1.setText(MessageManager.getString("label.append_start_end"));
573 jLabel1.setFont(LABEL_FONT);
574 fastajv.setFont(LABEL_FONT);
575 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
576 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
577 blcjv.setText(MessageManager.getString("label.blc") + " ");
578 fastajv.setText(MessageManager.getString("label.fasta") + " ");
579 msfjv.setText(MessageManager.getString("label.msf") + " ");
580 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
581 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
582 msfjv.setFont(LABEL_FONT);
583 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
584 pirjv.setText(MessageManager.getString("label.pir") + " ");
585 JPanel jPanel11 = new JPanel();
586 jPanel11.setFont(LABEL_FONT);
587 TitledBorder titledBorder2 = new TitledBorder(
588 MessageManager.getString("label.file_output"));
589 jPanel11.setBorder(titledBorder2);
590 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
591 GridLayout gridLayout3 = new GridLayout();
592 jPanel11.setLayout(gridLayout3);
593 gridLayout3.setRows(8);
594 blcjv.setFont(LABEL_FONT);
595 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
596 clustaljv.setFont(LABEL_FONT);
597 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
598 pfamjv.setFont(LABEL_FONT);
599 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
600 pileupjv.setFont(LABEL_FONT);
601 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
602 pirjv.setFont(LABEL_FONT);
603 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
604 autoIdWidth.setFont(LABEL_FONT);
606 MessageManager.getString("label.automatically_set_id_width"));
607 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
608 .getString("label.adjusts_width_generated_eps_png")));
609 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
610 autoIdWidth.addActionListener(new ActionListener()
614 public void actionPerformed(ActionEvent e)
616 autoIdWidth_actionPerformed();
619 userIdWidthlabel.setFont(LABEL_FONT);
620 userIdWidthlabel.setText(
621 MessageManager.getString("label.figure_id_column_width"));
622 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
623 .getString("label.manually_specify_width_left_column")));
624 userIdWidthlabel.setToolTipText(
625 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
626 "label.manually_specify_width_left_column")));
627 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
628 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
629 userIdWidth.setText("");
630 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
631 userIdWidth.addActionListener(new ActionListener()
635 public void actionPerformed(ActionEvent e)
637 userIdWidth_actionPerformed();
640 modellerOutput.setFont(LABEL_FONT);
642 .setText(MessageManager.getString("label.use_modeller_output"));
643 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
644 embbedBioJSON.setFont(LABEL_FONT);
645 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
646 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
648 jPanel11.add(jLabel1);
650 jPanel11.add(clustaljv);
651 jPanel11.add(fastajv);
653 jPanel11.add(pfamjv);
654 jPanel11.add(pileupjv);
656 outputTab.add(autoIdWidth);
657 outputTab.add(userIdWidth);
658 outputTab.add(userIdWidthlabel);
659 outputTab.add(modellerOutput);
660 outputTab.add(embbedBioJSON);
661 outputTab.add(epsLabel);
662 outputTab.add(epsRendering);
663 outputTab.add(jPanel11);
668 * Initialises the Connections tabbed panel.
672 private JPanel initConnectionsTab()
674 JPanel connectTab = new JPanel();
675 connectTab.setLayout(new GridBagLayout());
677 // Label for browser text box
678 JLabel browserLabel = new JLabel();
679 browserLabel.setFont(LABEL_FONT);
680 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
681 browserLabel.setText(
682 MessageManager.getString("label.default_browser_unix"));
683 defaultBrowser.setFont(LABEL_FONT);
684 defaultBrowser.setText("");
686 defaultBrowser.addMouseListener(new MouseAdapter()
689 public void mouseClicked(MouseEvent e)
691 if (e.getClickCount() > 1)
693 defaultBrowser_mouseClicked(e);
698 JPanel proxyPanel = initConnTabProxyPanel();
699 initConnTabCheckboxes();
701 // Add default Browser text box
702 connectTab.add(browserLabel,
703 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
704 GridBagConstraints.WEST, GridBagConstraints.NONE,
705 new Insets(10, 0, 5, 5), 5, 1));
706 defaultBrowser.setFont(LABEL_FONT);
707 defaultBrowser.setText("");
709 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
710 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
711 new Insets(10, 0, 5, 10), 30, 1));
713 // Add proxy server panel
714 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
715 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
716 new Insets(10, 0, 5, 12), 4, 10));
718 // Add usage stats, version check and questionnaire checkboxes
719 connectTab.add(usagestats,
720 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
721 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
722 new Insets(0, 2, 5, 5), 70, 1));
723 connectTab.add(questionnaire,
724 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
725 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
726 new Insets(0, 2, 5, 10), 70, 1));
727 connectTab.add(versioncheck,
728 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
729 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
730 new Insets(0, 2, 5, 5), 70, 1));
732 // Add padding so the panel doesn't look ridiculous
733 JPanel spacePanel = new JPanel();
734 connectTab.add(spacePanel,
735 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
736 GridBagConstraints.WEST, GridBagConstraints.BOTH,
737 new Insets(0, 0, 0, 5), 70, 1));
743 * Initialises the Links tabbed panel.
747 private JPanel initLinksTab()
749 JPanel linkTab = new JPanel();
750 linkTab.setLayout(new GridBagLayout());
752 // Set up table for Url links
753 linkUrlTable.setFillsViewportHeight(true);
754 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
755 linkUrlTable.setAutoCreateRowSorter(true);
756 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
758 // adjust row height so radio buttons actually fit
759 // don't do this in the renderer, it causes the awt thread to activate
761 JRadioButton temp = new JRadioButton();
762 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
764 // Table in scrollpane so that the table is given a scrollbar
765 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
766 linkScrollPane.setBorder(null);
768 // Panel for links functionality
769 JPanel linkPanel = new JPanel(new GridBagLayout());
770 linkPanel.setBorder(new TitledBorder(
771 MessageManager.getString("label.url_linkfrom_sequence_id")));
773 // Put the Url links panel together
775 // Buttons go at top right, resizing only resizes the blank space vertically
776 JPanel buttonPanel = initLinkTabUrlButtons();
777 GridBagConstraints linkConstraints1 = new GridBagConstraints();
778 linkConstraints1.insets = new Insets(0, 0, 5, 0);
779 linkConstraints1.gridx = 0;
780 linkConstraints1.gridy = 0;
781 linkConstraints1.weightx = 1.0;
782 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
783 linkTab.add(buttonPanel, linkConstraints1);
785 // Links table goes at top left, resizing resizes the table
786 GridBagConstraints linkConstraints2 = new GridBagConstraints();
787 linkConstraints2.insets = new Insets(0, 0, 5, 5);
788 linkConstraints2.gridx = 0;
789 linkConstraints2.gridy = 1;
790 linkConstraints2.weightx = 1.0;
791 linkConstraints2.weighty = 1.0;
792 linkConstraints2.fill = GridBagConstraints.BOTH;
793 linkTab.add(linkScrollPane, linkConstraints2);
795 // Filter box and buttons goes at bottom left, resizing resizes the text box
796 JPanel filterPanel = initLinkTabFilterPanel();
797 GridBagConstraints linkConstraints3 = new GridBagConstraints();
798 linkConstraints3.insets = new Insets(0, 0, 0, 5);
799 linkConstraints3.gridx = 0;
800 linkConstraints3.gridy = 2;
801 linkConstraints3.weightx = 1.0;
802 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
803 linkTab.add(filterPanel, linkConstraints3);
808 private JPanel initLinkTabFilterPanel()
810 // Filter textbox and reset button
811 JLabel filterLabel = new JLabel(
812 MessageManager.getString("label.filter"));
813 filterLabel.setFont(LABEL_FONT);
814 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
815 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
817 filterTB.setFont(LABEL_FONT);
818 filterTB.setText("");
820 doReset.setText(MessageManager.getString("action.showall"));
821 userOnly.setText(MessageManager.getString("action.customfilter"));
823 // Panel for filter functionality
824 JPanel filterPanel = new JPanel(new GridBagLayout());
825 filterPanel.setBorder(new TitledBorder("Filter"));
826 GridBagConstraints gbc = new GridBagConstraints();
829 gbc.fill = GridBagConstraints.NONE;
830 gbc.anchor = GridBagConstraints.WEST;
832 filterPanel.add(filterLabel, gbc);
834 GridBagConstraints gbc1 = new GridBagConstraints();
837 gbc1.fill = GridBagConstraints.HORIZONTAL;
838 gbc1.anchor = GridBagConstraints.WEST;
840 filterPanel.add(filterTB, gbc1);
842 GridBagConstraints gbc2 = new GridBagConstraints();
844 gbc2.fill = GridBagConstraints.NONE;
845 gbc2.anchor = GridBagConstraints.WEST;
846 filterPanel.add(doReset, gbc2);
848 GridBagConstraints gbc3 = new GridBagConstraints();
850 gbc3.fill = GridBagConstraints.NONE;
851 gbc3.anchor = GridBagConstraints.WEST;
852 filterPanel.add(userOnly, gbc3);
857 private JPanel initLinkTabUrlButtons()
859 // Buttons for new / edit / delete Url links
860 JButton newLink = new JButton();
861 newLink.setText(MessageManager.getString("action.new"));
863 editLink.setText(MessageManager.getString("action.edit"));
865 deleteLink.setText(MessageManager.getString("action.delete"));
867 // no current selection, so initially disable delete/edit buttons
868 editLink.setEnabled(false);
869 deleteLink.setEnabled(false);
871 newLink.addActionListener(new java.awt.event.ActionListener()
874 public void actionPerformed(ActionEvent e)
876 newLink_actionPerformed(e);
880 editLink.setText(MessageManager.getString("action.edit"));
881 editLink.addActionListener(new java.awt.event.ActionListener()
884 public void actionPerformed(ActionEvent e)
886 editLink_actionPerformed(e);
890 deleteLink.setText(MessageManager.getString("action.delete"));
891 deleteLink.addActionListener(new java.awt.event.ActionListener()
894 public void actionPerformed(ActionEvent e)
896 deleteLink_actionPerformed(e);
900 JPanel buttonPanel = new JPanel(new GridBagLayout());
901 buttonPanel.setBorder(new TitledBorder("Edit links"));
902 GridBagConstraints gbc = new GridBagConstraints();
905 gbc.fill = GridBagConstraints.NONE;
906 buttonPanel.add(newLink, gbc);
908 GridBagConstraints gbc1 = new GridBagConstraints();
911 gbc1.fill = GridBagConstraints.NONE;
912 buttonPanel.add(editLink, gbc1);
914 GridBagConstraints gbc2 = new GridBagConstraints();
917 gbc2.fill = GridBagConstraints.NONE;
918 buttonPanel.add(deleteLink, gbc2);
920 GridBagConstraints gbc3 = new GridBagConstraints();
923 gbc3.fill = GridBagConstraints.HORIZONTAL;
925 JPanel spacePanel = new JPanel();
926 spacePanel.setBorder(null);
927 buttonPanel.add(spacePanel, gbc3);
933 * Initialises the proxy server panel in the Connections tab
935 * @return the proxy server panel
937 private JPanel initConnTabProxyPanel()
939 // Label for server text box
940 serverLabel.setText(MessageManager.getString("label.address"));
941 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
942 serverLabel.setFont(LABEL_FONT);
944 // Proxy server and port text boxes
945 proxyServerTB.setFont(LABEL_FONT);
946 proxyPortTB.setFont(LABEL_FONT);
948 // Label for Port text box
949 portLabel.setFont(LABEL_FONT);
950 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
951 portLabel.setText(MessageManager.getString("label.port"));
953 // Use proxy server checkbox
954 useProxy.setFont(LABEL_FONT);
955 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
956 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
957 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
958 useProxy.addActionListener(new ActionListener()
961 public void actionPerformed(ActionEvent e)
963 useProxy_actionPerformed();
967 // Make proxy server panel
968 JPanel proxyPanel = new JPanel();
969 TitledBorder titledBorder1 = new TitledBorder(
970 MessageManager.getString("label.proxy_server"));
971 proxyPanel.setBorder(titledBorder1);
972 proxyPanel.setLayout(new GridBagLayout());
973 proxyPanel.add(serverLabel,
974 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
975 GridBagConstraints.WEST, GridBagConstraints.NONE,
976 new Insets(0, 2, 2, 0), 5, 0));
977 proxyPanel.add(portLabel,
978 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
979 GridBagConstraints.WEST, GridBagConstraints.NONE,
980 new Insets(0, 0, 2, 0), 11, 0));
981 proxyPanel.add(useProxy,
982 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
983 GridBagConstraints.WEST, GridBagConstraints.NONE,
984 new Insets(0, 2, 5, 185), 2, -4));
985 proxyPanel.add(proxyPortTB,
986 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
987 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
988 new Insets(0, 2, 2, 2), 54, 1));
989 proxyPanel.add(proxyServerTB,
990 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
991 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
992 new Insets(0, 2, 2, 0), 263, 1));
998 * Initialises the checkboxes in the Connections tab
1000 private void initConnTabCheckboxes()
1002 // Usage stats checkbox label
1004 MessageManager.getString("label.send_usage_statistics"));
1005 usagestats.setFont(LABEL_FONT);
1006 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
1007 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
1009 // Questionnaire checkbox label
1010 questionnaire.setText(
1011 MessageManager.getString("label.check_for_questionnaires"));
1012 questionnaire.setFont(LABEL_FONT);
1013 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
1014 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
1016 // Check for latest version checkbox label
1017 versioncheck.setText(
1018 MessageManager.getString("label.check_for_latest_version"));
1019 versioncheck.setFont(LABEL_FONT);
1020 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
1021 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
1025 * Initialises the parent panel which contains the tabbed sections.
1029 private JPanel initOkCancelPanel()
1031 JButton ok = new JButton();
1032 ok.setText(MessageManager.getString("action.ok"));
1033 ok.addActionListener(new ActionListener()
1036 public void actionPerformed(ActionEvent e)
1038 ok_actionPerformed(e);
1041 JButton cancel = new JButton();
1042 cancel.setText(MessageManager.getString("action.cancel"));
1043 cancel.addActionListener(new ActionListener()
1046 public void actionPerformed(ActionEvent e)
1048 cancel_actionPerformed(e);
1051 JPanel okCancelPanel = new JPanel();
1052 okCancelPanel.add(ok);
1053 okCancelPanel.add(cancel);
1054 return okCancelPanel;
1058 * Initialises the Colours tabbed panel.
1062 private JPanel initColoursTab()
1064 JPanel coloursTab = new JPanel();
1065 coloursTab.setBorder(new TitledBorder(
1066 MessageManager.getString("action.open_new_alignment")));
1067 coloursTab.setLayout(new FlowLayout());
1068 JLabel mincolourLabel = new JLabel();
1069 mincolourLabel.setFont(LABEL_FONT);
1070 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1071 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1072 minColour.setFont(LABEL_FONT);
1073 minColour.setBorder(BorderFactory.createEtchedBorder());
1074 minColour.setPreferredSize(new Dimension(40, 20));
1075 minColour.addMouseListener(new MouseAdapter()
1078 public void mousePressed(MouseEvent e)
1080 minColour_actionPerformed(minColour);
1083 JLabel maxcolourLabel = new JLabel();
1084 maxcolourLabel.setFont(LABEL_FONT);
1085 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1086 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1087 maxColour.setFont(LABEL_FONT);
1088 maxColour.setBorder(BorderFactory.createEtchedBorder());
1089 maxColour.setPreferredSize(new Dimension(40, 20));
1090 maxColour.addMouseListener(new MouseAdapter()
1093 public void mousePressed(MouseEvent e)
1095 maxColour_actionPerformed(maxColour);
1099 protColour.setFont(LABEL_FONT);
1100 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1101 JLabel protColourLabel = new JLabel();
1102 protColourLabel.setFont(LABEL_FONT);
1103 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1104 protColourLabel.setText(
1105 MessageManager.getString("label.prot_alignment_colour") + " ");
1106 JvSwingUtils.addtoLayout(coloursTab,
1108 .getString("label.default_colour_scheme_for_alignment"),
1109 protColourLabel, protColour);
1111 nucColour.setFont(LABEL_FONT);
1112 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1113 JLabel nucColourLabel = new JLabel();
1114 nucColourLabel.setFont(LABEL_FONT);
1115 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1116 nucColourLabel.setText(
1117 MessageManager.getString("label.nuc_alignment_colour") + " ");
1118 JvSwingUtils.addtoLayout(coloursTab,
1120 .getString("label.default_colour_scheme_for_alignment"),
1121 nucColourLabel, nucColour);
1123 JPanel annotationShding = new JPanel();
1124 annotationShding.setBorder(new TitledBorder(
1125 MessageManager.getString("label.annotation_shading_default")));
1126 annotationShding.setLayout(new GridLayout(1, 2));
1127 JvSwingUtils.addtoLayout(annotationShding,
1128 MessageManager.getString(
1129 "label.default_minimum_colour_annotation_shading"),
1130 mincolourLabel, minColour);
1131 JvSwingUtils.addtoLayout(annotationShding,
1132 MessageManager.getString(
1133 "label.default_maximum_colour_annotation_shading"),
1134 maxcolourLabel, maxColour);
1135 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1140 * Initialises the Overview tabbed panel.
1144 private JPanel initOverviewTab()
1146 JPanel overviewPanel = new JPanel();
1147 overviewPanel.setBorder(new TitledBorder(
1148 MessageManager.getString("label.overview_settings")));
1150 gapColour.setFont(LABEL_FONT);
1151 // fixing the border colours stops apparent colour bleed from the panel
1152 gapColour.setBorder(
1153 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1154 gapColour.setPreferredSize(new Dimension(40, 20));
1155 gapColour.addMouseListener(new MouseAdapter()
1158 public void mousePressed(MouseEvent e)
1160 gapColour_actionPerformed(gapColour);
1164 hiddenColour.setFont(LABEL_FONT);
1165 // fixing the border colours stops apparent colour bleed from the panel
1166 hiddenColour.setBorder(
1167 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1168 hiddenColour.setPreferredSize(new Dimension(40, 20));
1169 hiddenColour.addMouseListener(new MouseAdapter()
1172 public void mousePressed(MouseEvent e)
1174 hiddenColour_actionPerformed(hiddenColour);
1178 useLegacyGap = new JCheckBox(
1179 MessageManager.getString("label.ov_legacy_gap"));
1180 useLegacyGap.setFont(LABEL_FONT);
1181 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1182 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1183 gapLabel = new JLabel(
1184 MessageManager.getString("label.gap_colour"));
1185 gapLabel.setFont(LABEL_FONT);
1186 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1187 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1188 showHiddenAtStart = new JCheckBox(
1189 MessageManager.getString("label.ov_show_hide_default"));
1190 showHiddenAtStart.setFont(LABEL_FONT);
1191 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1192 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1193 JLabel hiddenLabel = new JLabel(
1194 MessageManager.getString("label.hidden_colour"));
1195 hiddenLabel.setFont(LABEL_FONT);
1196 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1197 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1199 useLegacyGap.addActionListener(new ActionListener()
1202 public void actionPerformed(ActionEvent e)
1204 useLegacyGaps_actionPerformed(e);
1208 overviewPanel.setLayout(new GridBagLayout());
1209 GridBagConstraints c1 = new GridBagConstraints();
1211 c1.fill = GridBagConstraints.HORIZONTAL;
1216 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1217 overviewPanel.add(useLegacyGap, c1);
1219 GridBagConstraints c2 = new GridBagConstraints();
1220 c2.fill = GridBagConstraints.HORIZONTAL;
1223 c2.insets = new Insets(0, 15, 0, 10);
1224 overviewPanel.add(gapLabel, c2);
1226 GridBagConstraints c3 = new GridBagConstraints();
1227 c3.fill = GridBagConstraints.HORIZONTAL;
1230 c3.insets = new Insets(0, 0, 0, 15);
1231 overviewPanel.add(gapColour, c3);
1233 GridBagConstraints c4 = new GridBagConstraints();
1234 c4.fill = GridBagConstraints.HORIZONTAL;
1238 overviewPanel.add(showHiddenAtStart, c4);
1240 GridBagConstraints c5 = new GridBagConstraints();
1241 c5.fill = GridBagConstraints.HORIZONTAL;
1244 c5.insets = new Insets(0, 15, 0, 10);
1245 overviewPanel.add(hiddenLabel, c5);
1247 GridBagConstraints c6 = new GridBagConstraints();
1248 c6.fill = GridBagConstraints.HORIZONTAL;
1251 c6.insets = new Insets(0, 0, 0, 15);
1252 overviewPanel.add(hiddenColour, c6);
1254 JButton resetButton = new JButton(
1255 MessageManager.getString("label.reset_to_defaults"));
1257 resetButton.addActionListener(new ActionListener()
1260 public void actionPerformed(ActionEvent e)
1262 resetOvDefaults_actionPerformed(e);
1266 GridBagConstraints c7 = new GridBagConstraints();
1267 c7.fill = GridBagConstraints.NONE;
1270 c7.insets = new Insets(10, 0, 0, 0);
1271 c7.anchor = GridBagConstraints.WEST;
1272 overviewPanel.add(resetButton, c7);
1274 // Add padding so the panel doesn't look ridiculous
1275 JPanel spacePanel = new JPanel();
1276 overviewPanel.add(spacePanel,
1277 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1278 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1279 new Insets(0, 0, 0, 5), 0, 0));
1281 return overviewPanel;
1285 * Initialises the Structure tabbed panel.
1289 private JPanel initStructureTab()
1291 structureTab = new JPanel();
1293 structureTab.setBorder(new TitledBorder(
1294 MessageManager.getString("label.structure_options")));
1295 structureTab.setLayout(null);
1296 final int width = 400;
1297 final int height = 22;
1298 final int lineSpacing = 25;
1301 structFromPdb.setFont(LABEL_FONT);
1303 .setText(MessageManager.getString("label.struct_from_pdb"));
1304 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1305 structFromPdb.addActionListener(new ActionListener()
1308 public void actionPerformed(ActionEvent e)
1310 boolean selected = structFromPdb.isSelected();
1311 // enable other options only when the first is checked
1312 useRnaView.setEnabled(selected);
1313 addSecondaryStructure.setEnabled(selected);
1314 addTempFactor.setEnabled(selected);
1317 structureTab.add(structFromPdb);
1319 // indent checkboxes that are conditional on the first one
1320 ypos += lineSpacing;
1321 useRnaView.setFont(LABEL_FONT);
1322 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1323 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1324 structureTab.add(useRnaView);
1326 ypos += lineSpacing;
1327 addSecondaryStructure.setFont(LABEL_FONT);
1328 addSecondaryStructure
1329 .setText(MessageManager.getString("label.autoadd_secstr"));
1330 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1331 structureTab.add(addSecondaryStructure);
1333 ypos += lineSpacing;
1334 addTempFactor.setFont(LABEL_FONT);
1335 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1336 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1337 structureTab.add(addTempFactor);
1339 ypos += lineSpacing;
1340 JLabel viewerLabel = new JLabel();
1341 viewerLabel.setFont(LABEL_FONT);
1342 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1343 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1344 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1345 structureTab.add(viewerLabel);
1347 structViewer.setFont(LABEL_FONT);
1348 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1349 structViewer.addItem(ViewerType.JMOL.name());
1350 structViewer.addItem(ViewerType.CHIMERA.name());
1351 structViewer.addActionListener(new ActionListener()
1354 public void actionPerformed(ActionEvent e)
1356 structureViewer_actionPerformed(
1357 (String) structViewer.getSelectedItem());
1360 structureTab.add(structViewer);
1362 ypos += lineSpacing;
1363 JLabel pathLabel = new JLabel();
1364 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1365 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1366 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1367 final String tooltip = JvSwingUtils.wrapTooltip(true,
1368 MessageManager.getString("label.chimera_path_tip"));
1369 pathLabel.setToolTipText(tooltip);
1370 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1371 structureTab.add(pathLabel);
1373 chimeraPath.setFont(LABEL_FONT);
1374 chimeraPath.setText("");
1375 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1376 chimeraPath.addMouseListener(new MouseAdapter()
1379 public void mouseClicked(MouseEvent e)
1381 if (e.getClickCount() == 2)
1383 String chosen = openFileChooser(false);
1386 chimeraPath.setText(chosen);
1391 structureTab.add(chimeraPath);
1393 ypos += lineSpacing;
1394 nwMapping.setFont(LABEL_FONT);
1395 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1396 siftsMapping.setFont(LABEL_FONT);
1397 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1398 mappingMethod.add(nwMapping);
1399 mappingMethod.add(siftsMapping);
1400 JPanel mappingPanel = new JPanel();
1401 mappingPanel.setFont(LABEL_FONT);
1402 TitledBorder mmTitledBorder = new TitledBorder(
1403 MessageManager.getString("label.mapping_method"));
1404 mmTitledBorder.setTitleFont(LABEL_FONT);
1405 mappingPanel.setBorder(mmTitledBorder);
1406 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1407 // GridLayout mappingLayout = new GridLayout();
1408 mappingPanel.setLayout(new GridLayout());
1409 mappingPanel.add(nwMapping);
1410 mappingPanel.add(siftsMapping);
1411 structureTab.add(mappingPanel);
1413 ypos += lineSpacing;
1414 ypos += lineSpacing;
1415 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1416 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1417 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1418 structureTab.add(docFieldPref);
1420 return structureTab;
1424 * Action on choosing a structure viewer from combobox options.
1426 * @param selectedItem
1428 protected void structureViewer_actionPerformed(String selectedItem)
1433 * Show a dialog for the user to choose a file. Returns the chosen path, or
1438 protected String openFileChooser(boolean forFolder)
1440 String choice = null;
1441 JFileChooser chooser = new JFileChooser();
1444 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1447 // chooser.setFileView(new JalviewFileView());
1448 chooser.setDialogTitle(
1449 MessageManager.getString("label.open_local_file"));
1450 chooser.setToolTipText(MessageManager.getString("action.open"));
1452 int value = chooser.showOpenDialog(this);
1454 if (value == JFileChooser.APPROVE_OPTION)
1456 choice = chooser.getSelectedFile().getPath();
1461 protected boolean validateStructure()
1467 * Initialises the Visual tabbed panel.
1471 private JPanel initVisualTab()
1473 JPanel visualTab = new JPanel();
1474 visualTab.setBorder(new TitledBorder(
1475 MessageManager.getString("action.open_new_alignment")));
1476 visualTab.setLayout(null);
1477 fullScreen.setFont(LABEL_FONT);
1478 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1479 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1480 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1481 quality.setEnabled(false);
1482 quality.setFont(LABEL_FONT);
1483 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1484 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1485 quality.setSelected(true);
1486 quality.setText(MessageManager.getString("label.quality"));
1487 conservation.setEnabled(false);
1488 conservation.setFont(LABEL_FONT);
1489 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1490 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1491 conservation.setSelected(true);
1492 conservation.setText(MessageManager.getString("label.conservation"));
1493 identity.setEnabled(false);
1494 identity.setFont(LABEL_FONT);
1495 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1496 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1497 identity.setSelected(true);
1498 identity.setText(MessageManager.getString("label.consensus"));
1499 showOccupancy.setFont(LABEL_FONT);
1500 showOccupancy.setEnabled(false);
1501 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1502 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1503 showOccupancy.setSelected(true);
1504 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1506 JLabel showGroupbits = new JLabel();
1507 showGroupbits.setFont(LABEL_FONT);
1508 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1509 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1511 .setText(MessageManager.getString("action.show_group") + ":");
1512 JLabel showConsensbits = new JLabel();
1513 showConsensbits.setFont(LABEL_FONT);
1514 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1515 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1517 .setText(MessageManager.getString("label.consensus") + ":");
1518 showConsensHistogram.setEnabled(false);
1519 showConsensHistogram.setFont(LABEL_FONT);
1520 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1521 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1522 showConsensHistogram.setSelected(true);
1523 showConsensHistogram
1524 .setText(MessageManager.getString("label.histogram"));
1525 showConsensLogo.setEnabled(false);
1526 showConsensLogo.setFont(LABEL_FONT);
1527 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1528 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1529 showConsensLogo.setSelected(true);
1530 showConsensLogo.setText(MessageManager.getString("label.logo"));
1531 showGroupConsensus.setEnabled(false);
1532 showGroupConsensus.setFont(LABEL_FONT);
1533 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1534 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1535 showGroupConsensus.setSelected(true);
1536 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1537 showGroupConservation.setEnabled(false);
1538 showGroupConservation.setFont(LABEL_FONT);
1539 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1540 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1541 showGroupConservation.setSelected(true);
1542 showGroupConservation
1543 .setText(MessageManager.getString("label.conservation"));
1544 showNpTooltip.setEnabled(true);
1545 showNpTooltip.setFont(LABEL_FONT);
1546 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1547 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1548 showNpTooltip.setSelected(true);
1549 showNpTooltip.setText(
1550 MessageManager.getString("label.non_positional_features"));
1551 showDbRefTooltip.setEnabled(true);
1552 showDbRefTooltip.setFont(LABEL_FONT);
1553 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1554 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1555 showDbRefTooltip.setSelected(true);
1557 .setText(MessageManager.getString("label.database_references"));
1558 annotations.setFont(LABEL_FONT);
1559 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1560 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1561 annotations.setSelected(true);
1562 annotations.setText(MessageManager.getString("label.show_annotations"));
1563 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1564 annotations.addActionListener(new ActionListener()
1567 public void actionPerformed(ActionEvent e)
1569 annotations_actionPerformed(e);
1572 identity.addActionListener(new ActionListener()
1575 public void actionPerformed(ActionEvent e)
1577 annotations_actionPerformed(e);
1580 showGroupConsensus.addActionListener(new ActionListener()
1583 public void actionPerformed(ActionEvent e)
1585 annotations_actionPerformed(e);
1588 showUnconserved.setFont(LABEL_FONT);
1589 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1590 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1591 showUnconserved.setSelected(true);
1593 .setText(MessageManager.getString("action.show_unconserved"));
1594 showUnconserved.addActionListener(new ActionListener()
1597 public void actionPerformed(ActionEvent e)
1599 showunconserved_actionPerformed(e);
1603 // TODO these are not yet added to / action from Preferences
1604 // JCheckBox shareSelections = new JCheckBox();
1605 // shareSelections.setFont(verdana11);
1606 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1607 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1608 // shareSelections.setSelected(true);
1609 // shareSelections.setText(MessageManager
1610 // .getString("label.share_selection_across_views"));
1611 // JCheckBox followHighlight = new JCheckBox();
1612 // followHighlight.setFont(verdana11);
1613 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1614 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1615 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1616 // followHighlight.setSelected(true);
1617 // followHighlight.setText(MessageManager
1618 // .getString("label.scroll_highlighted_regions"));
1620 seqLimit.setFont(LABEL_FONT);
1621 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1622 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1623 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1624 smoothFont.setFont(LABEL_FONT);
1625 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1626 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1627 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1628 scaleProteinToCdna.setFont(LABEL_FONT);
1629 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1630 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1631 scaleProteinToCdna.setText(
1632 MessageManager.getString("label.scale_protein_to_cdna"));
1633 scaleProteinToCdna.setToolTipText(
1634 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1635 JLabel gapLabel = new JLabel();
1636 gapLabel.setFont(LABEL_FONT);
1637 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1638 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1639 JLabel fontLabel = new JLabel();
1640 fontLabel.setFont(LABEL_FONT);
1641 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1642 fontLabel.setText(MessageManager.getString("label.font"));
1643 fontSizeCB.setFont(LABEL_FONT);
1644 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1645 fontStyleCB.setFont(LABEL_FONT);
1646 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1647 fontNameCB.setFont(LABEL_FONT);
1648 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1649 gapSymbolCB.setFont(LABEL_FONT);
1650 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1651 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1652 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1653 gapSymbolCB.setRenderer(dlcr);
1655 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1656 startupCheckbox.setFont(LABEL_FONT);
1657 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1658 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1659 startupCheckbox.setSelected(true);
1660 startupFileTextfield.setFont(LABEL_FONT);
1661 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1662 startupFileTextfield.addMouseListener(new MouseAdapter()
1665 public void mouseClicked(MouseEvent e)
1667 if (e.getClickCount() > 1)
1669 startupFileTextfield_mouseClicked();
1674 sortby.setFont(LABEL_FONT);
1675 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1676 JLabel sortLabel = new JLabel();
1677 sortLabel.setFont(LABEL_FONT);
1678 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1679 sortLabel.setText(MessageManager.getString("label.sort_by"));
1680 sortAnnBy.setFont(LABEL_FONT);
1681 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1682 JLabel sortAnnLabel = new JLabel();
1683 sortAnnLabel.setFont(LABEL_FONT);
1684 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1685 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1686 sortAutocalc.setFont(LABEL_FONT);
1687 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1689 JPanel annsettingsPanel = new JPanel();
1690 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1691 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1692 annsettingsPanel.setBorder(new EtchedBorder());
1693 visualTab.add(annsettingsPanel);
1694 Border jb = new EmptyBorder(1, 1, 4, 5);
1695 annotations.setBorder(jb);
1696 showOccupancy.setBorder(jb);
1697 quality.setBorder(jb);
1698 conservation.setBorder(jb);
1699 identity.setBorder(jb);
1700 showConsensbits.setBorder(jb);
1701 showGroupbits.setBorder(jb);
1702 showGroupConsensus.setBorder(jb);
1703 showGroupConservation.setBorder(jb);
1704 showConsensHistogram.setBorder(jb);
1705 showConsensLogo.setBorder(jb);
1707 JPanel autoAnnotSettings = new JPanel();
1708 annsettingsPanel.add(autoAnnotSettings);
1709 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1710 autoAnnotSettings.add(annotations);
1711 autoAnnotSettings.add(quality);
1712 // second row of autoannotation box
1713 autoAnnotSettings = new JPanel();
1714 annsettingsPanel.add(autoAnnotSettings);
1716 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1717 autoAnnotSettings.add(conservation);
1718 autoAnnotSettings.add(identity);
1719 autoAnnotSettings.add(showOccupancy);
1720 autoAnnotSettings.add(showGroupbits);
1721 autoAnnotSettings.add(showGroupConservation);
1722 autoAnnotSettings.add(showGroupConsensus);
1723 autoAnnotSettings.add(showConsensbits);
1724 autoAnnotSettings.add(showConsensHistogram);
1725 autoAnnotSettings.add(showConsensLogo);
1727 JPanel tooltipSettings = new JPanel();
1728 tooltipSettings.setBorder(new TitledBorder(
1729 MessageManager.getString("label.sequence_id_tooltip")));
1730 tooltipSettings.setBounds(173, 140, 220, 62);
1731 tooltipSettings.setLayout(new GridLayout(2, 1));
1732 tooltipSettings.add(showDbRefTooltip);
1733 tooltipSettings.add(showNpTooltip);
1734 visualTab.add(tooltipSettings);
1736 wrap.setFont(LABEL_FONT);
1737 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1738 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1739 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1740 rightAlign.setFont(LABEL_FONT);
1741 rightAlign.setForeground(Color.black);
1742 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1743 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1744 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1745 idItalics.setFont(LABEL_FONT_ITALIC);
1746 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1747 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1749 MessageManager.getString("label.sequence_name_italics"));
1750 openoverv.setFont(LABEL_FONT);
1751 openoverv.setActionCommand(
1752 MessageManager.getString("label.open_overview"));
1753 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1754 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1755 openoverv.setText(MessageManager.getString("label.open_overview"));
1756 JPanel jPanel2 = new JPanel();
1757 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1758 jPanel2.setLayout(new GridLayout(14, 1));
1759 jPanel2.add(fullScreen);
1760 jPanel2.add(openoverv);
1761 jPanel2.add(seqLimit);
1762 jPanel2.add(rightAlign);
1763 jPanel2.add(fontLabel);
1764 jPanel2.add(showUnconserved);
1765 jPanel2.add(idItalics);
1766 jPanel2.add(smoothFont);
1767 jPanel2.add(scaleProteinToCdna);
1768 jPanel2.add(gapLabel);
1770 jPanel2.add(sortLabel);
1771 jPanel2.add(sortAnnLabel);
1772 jPanel2.add(startupCheckbox);
1773 visualTab.add(jPanel2);
1774 visualTab.add(startupFileTextfield);
1775 visualTab.add(sortby);
1776 visualTab.add(sortAnnBy);
1777 visualTab.add(sortAutocalc);
1778 visualTab.add(gapSymbolCB);
1779 visualTab.add(fontNameCB);
1780 visualTab.add(fontSizeCB);
1781 visualTab.add(fontStyleCB);
1785 protected void autoIdWidth_actionPerformed()
1787 // TODO Auto-generated method stub
1791 protected void userIdWidth_actionPerformed()
1793 // TODO Auto-generated method stub
1797 protected void maxColour_actionPerformed(JPanel panel)
1801 protected void minColour_actionPerformed(JPanel panel)
1805 protected void gapColour_actionPerformed(JPanel panel)
1809 protected void hiddenColour_actionPerformed(JPanel panel)
1813 protected void showunconserved_actionPerformed(ActionEvent e)
1815 // TODO Auto-generated method stub
1819 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1823 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1833 public void ok_actionPerformed(ActionEvent e)
1843 public void cancel_actionPerformed(ActionEvent e)
1853 public void annotations_actionPerformed(ActionEvent e)
1860 public void startupFileTextfield_mouseClicked()
1864 public void newLink_actionPerformed(ActionEvent e)
1869 public void editLink_actionPerformed(ActionEvent e)
1874 public void deleteLink_actionPerformed(ActionEvent e)
1879 public void defaultBrowser_mouseClicked(MouseEvent e)
1884 public void linkURLList_keyTyped(KeyEvent e)
1889 public void useProxy_actionPerformed()
1891 boolean enabled = useProxy.isSelected();
1892 portLabel.setEnabled(enabled);
1893 serverLabel.setEnabled(enabled);
1894 proxyServerTB.setEnabled(enabled);
1895 proxyPortTB.setEnabled(enabled);
1899 * Customer renderer for JTable: supports column of radio buttons
1901 public class RadioButtonRenderer extends JRadioButton
1902 implements TableCellRenderer
1904 public RadioButtonRenderer()
1906 setHorizontalAlignment(CENTER);
1907 setToolTipText(MessageManager.getString("label.urltooltip"));
1911 public Component getTableCellRendererComponent(JTable table,
1912 Object value, boolean isSelected, boolean hasFocus, int row,
1915 setSelected((boolean) value);
1917 // set colours to match rest of table
1920 setBackground(table.getSelectionBackground());
1921 setForeground(table.getSelectionForeground());
1925 setBackground(table.getBackground());
1926 setForeground(table.getForeground());
1933 * Customer cell editor for JTable: supports column of radio buttons in
1934 * conjunction with renderer
1936 public class RadioButtonEditor extends AbstractCellEditor
1937 implements TableCellEditor
1939 private JRadioButton button = new JRadioButton();
1941 public RadioButtonEditor()
1943 button.setHorizontalAlignment(SwingConstants.CENTER);
1944 this.button.addActionListener(new ActionListener()
1947 public void actionPerformed(ActionEvent e)
1949 fireEditingStopped();
1955 public Component getTableCellEditorComponent(JTable table, Object value,
1956 boolean isSelected, int row, int column)
1958 button.setSelected((boolean) value);
1963 public Object getCellEditorValue()
1965 return button.isSelected();
1970 protected void validateHmmerPath()
1974 protected void validateCygwinPath()