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.ButtonGroup;
52 import javax.swing.DefaultListCellRenderer;
53 import javax.swing.JButton;
54 import javax.swing.JCheckBox;
55 import javax.swing.JComboBox;
56 import javax.swing.JFileChooser;
57 import javax.swing.JLabel;
58 import javax.swing.JPanel;
59 import javax.swing.JRadioButton;
60 import javax.swing.JScrollPane;
61 import javax.swing.JTabbedPane;
62 import javax.swing.JTable;
63 import javax.swing.JTextField;
64 import javax.swing.ListSelectionModel;
65 import javax.swing.SwingConstants;
66 import javax.swing.border.Border;
67 import javax.swing.border.EmptyBorder;
68 import javax.swing.border.EtchedBorder;
69 import javax.swing.border.TitledBorder;
70 import javax.swing.event.ChangeEvent;
71 import javax.swing.event.ChangeListener;
72 import javax.swing.table.TableCellEditor;
73 import javax.swing.table.TableCellRenderer;
76 * Base class for the Preferences panel.
81 public class GPreferences extends JPanel
83 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
85 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
86 .getLabelFont(false, true);
89 * Visual tab components
91 protected JCheckBox fullScreen = new JCheckBox();
93 protected JCheckBox openoverv = new JCheckBox();
95 protected JCheckBox seqLimit = new JCheckBox();
97 protected JCheckBox rightAlign = new JCheckBox();
99 protected JComboBox<String> fontSizeCB = new JComboBox<>();
101 protected JComboBox<String> fontStyleCB = new JComboBox<>();
103 protected JComboBox<String> fontNameCB = new JComboBox<>();
105 protected JCheckBox showOccupancy = new JCheckBox();
107 protected JCheckBox showUnconserved = new JCheckBox();
109 protected JCheckBox idItalics = new JCheckBox();
111 protected JCheckBox smoothFont = new JCheckBox();
113 protected JCheckBox scaleProteinToCdna = new JCheckBox();
115 protected JComboBox<String> gapSymbolCB = new JComboBox<>();
117 protected JCheckBox wrap = new JCheckBox();
119 protected JComboBox<String> sortby = new JComboBox<>();
121 protected JComboBox<String> sortAnnBy = new JComboBox<>();
123 protected JComboBox<String> sortAutocalc = new JComboBox<>();
125 protected JCheckBox startupCheckbox = new JCheckBox();
127 protected JTextField startupFileTextfield = new JTextField();
129 // below are in the 'second column'
130 protected JCheckBox annotations = new JCheckBox();
132 protected JCheckBox quality = new JCheckBox();
134 protected JCheckBox conservation = new JCheckBox();
136 protected JCheckBox identity = new JCheckBox();
138 protected JCheckBox showGroupConsensus = new JCheckBox();
140 protected JCheckBox showGroupConservation = new JCheckBox();
142 protected JCheckBox showConsensHistogram = new JCheckBox();
144 protected JCheckBox showConsensLogo = new JCheckBox();
146 protected JCheckBox showInformationHistogram = new JCheckBox();
148 protected JCheckBox showHMMLogo = new JCheckBox();
150 protected JCheckBox showDbRefTooltip = new JCheckBox();
152 protected JCheckBox showNpTooltip = new JCheckBox();
156 * Structure tab and components
158 protected JPanel structureTab;
160 protected JCheckBox structFromPdb = new JCheckBox();
162 protected JCheckBox useRnaView = new JCheckBox();
164 protected JCheckBox addSecondaryStructure = new JCheckBox();
166 protected JCheckBox addTempFactor = new JCheckBox();
168 protected JComboBox<String> structViewer = new JComboBox<>();
170 protected JTextField chimeraPath = new JTextField();
172 protected ButtonGroup mappingMethod = new ButtonGroup();
174 protected JRadioButton siftsMapping = new JRadioButton();
176 protected JRadioButton nwMapping = new JRadioButton();
179 * Colours tab components
181 protected JPanel minColour = new JPanel();
183 protected JPanel maxColour = new JPanel();
185 protected JComboBox<String> protColour = new JComboBox<>();
187 protected JComboBox<String> nucColour = new JComboBox<>();
190 * Overview tab components
192 protected JPanel gapColour = new JPanel();
194 protected JPanel hiddenColour = new JPanel();
196 protected JCheckBox useLegacyGap;
198 protected JCheckBox showHiddenAtStart;
200 protected JLabel gapLabel;
203 * Connections tab components
205 protected JTable linkUrlTable = new JTable();
207 protected JButton editLink = new JButton();
209 protected JButton deleteLink = new JButton();
211 protected JTextField filterTB = new JTextField();
213 protected JButton doReset = new JButton();
215 protected JButton userOnly = new JButton();
217 protected JLabel portLabel = new JLabel();
219 protected JLabel serverLabel = new JLabel();
221 protected JTextField proxyServerTB = new JTextField();
223 protected JTextField proxyPortTB = new JTextField();
225 protected JTextField defaultBrowser = new JTextField();
227 protected JCheckBox useProxy = new JCheckBox();
229 protected JCheckBox usagestats = new JCheckBox();
231 protected JCheckBox questionnaire = new JCheckBox();
233 protected JCheckBox versioncheck = new JCheckBox();
236 * Output tab components
238 protected JComboBox<Object> epsRendering = new JComboBox<>();
240 protected JLabel userIdWidthlabel = new JLabel();
242 protected JCheckBox autoIdWidth = new JCheckBox();
244 protected JTextField userIdWidth = new JTextField();
246 protected JCheckBox blcjv = new JCheckBox();
248 protected JCheckBox pileupjv = new JCheckBox();
250 protected JCheckBox clustaljv = new JCheckBox();
252 protected JCheckBox msfjv = new JCheckBox();
254 protected JCheckBox fastajv = new JCheckBox();
256 protected JCheckBox pfamjv = new JCheckBox();
258 protected JCheckBox pirjv = new JCheckBox();
260 protected JCheckBox modellerOutput = new JCheckBox();
262 protected JCheckBox embbedBioJSON = new JCheckBox();
265 * Editing tab components
267 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
269 protected JCheckBox padGaps = new JCheckBox();
271 protected JCheckBox sortByTree = new JCheckBox();
274 * hmmer tab and components
276 protected JPanel hmmerTab = new JPanel();
278 protected JCheckBox hmmrTrimTermini = new JCheckBox();
280 protected AbstractButton hmmerBackgroundUniprot = new JCheckBox();
282 protected AbstractButton hmmerBackgroundAlignment = new JCheckBox();
284 protected JTextField hmmerSequenceCount = new JTextField();
286 protected JTextField hmmerPath = new JTextField();
288 protected JTextField cygwinPath = new JTextField();
293 protected JPanel dasTab = new JPanel();
298 protected JPanel wsTab = new JPanel();
303 * Creates a new GPreferences object.
305 public GPreferences()
310 } catch (Exception ex)
312 ex.printStackTrace();
317 * Construct the panel and its tabbed sub-panels.
321 private void jbInit() throws Exception
323 final JTabbedPane tabbedPane = new JTabbedPane();
324 this.setLayout(new BorderLayout());
325 JPanel okCancelPanel = initOkCancelPanel();
326 this.add(tabbedPane, BorderLayout.CENTER);
327 this.add(okCancelPanel, BorderLayout.SOUTH);
329 tabbedPane.add(initVisualTab(),
330 MessageManager.getString("label.visual"));
332 tabbedPane.add(initColoursTab(),
333 MessageManager.getString("label.colours"));
335 tabbedPane.add(initOverviewTab(),
336 MessageManager.getString("label.overview"));
338 tabbedPane.add(initStructureTab(),
339 MessageManager.getString("label.structure"));
341 tabbedPane.add(initConnectionsTab(),
342 MessageManager.getString("label.connections"));
344 tabbedPane.add(initLinksTab(),
345 MessageManager.getString("label.urllinks"));
347 tabbedPane.add(initOutputTab(),
348 MessageManager.getString("label.output"));
350 tabbedPane.add(initEditingTab(),
351 MessageManager.getString("label.editing"));
353 tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
356 * See DasSourceBrowser for the real work of configuring this tab.
358 dasTab.setLayout(new BorderLayout());
359 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
362 * See WsPreferences for the real work of configuring this tab.
364 wsTab.setLayout(new BorderLayout());
365 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
368 * Handler to validate a tab before leaving it - currently only for
371 tabbedPane.addChangeListener(new ChangeListener()
373 private Component lastTab;
376 public void stateChanged(ChangeEvent e)
378 if (lastTab == structureTab
379 && tabbedPane.getSelectedComponent() != structureTab)
381 if (!validateStructure())
383 tabbedPane.setSelectedComponent(structureTab);
387 lastTab = tabbedPane.getSelectedComponent();
394 * Initialises the Editing tabbed panel.
398 private JPanel initEditingTab()
400 JPanel editingTab = new JPanel();
401 editingTab.setLayout(null);
402 autoCalculateConsCheck.setFont(LABEL_FONT);
403 autoCalculateConsCheck.setText(
404 MessageManager.getString("label.autocalculate_consensus"));
405 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
406 padGaps.setFont(LABEL_FONT);
408 MessageManager.getString("label.pad_gaps_when_editing"));
409 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
410 sortByTree.setFont(LABEL_FONT);
412 .setText(MessageManager.getString("label.sort_with_new_tree"));
413 sortByTree.setToolTipText(MessageManager.getString(
414 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
415 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
416 editingTab.add(autoCalculateConsCheck);
417 editingTab.add(padGaps);
418 editingTab.add(sortByTree);
423 * Initialises the hmmer tabbed panel
427 private JPanel initHMMERTab()
429 hmmerTab.setLayout(null);
430 final int lineSpacing = 20;
433 * path to hmmer binaries folder
435 JLabel hmmerLocation = new JLabel(
436 MessageManager.getString("label.hmmer_location"));
437 hmmerLocation.setFont(LABEL_FONT);
440 hmmerLocation.setBounds(new Rectangle(xPos, yPos, 250, 23));
442 hmmerPath.setBounds(new Rectangle(xPos, yPos, 300, 23));
443 hmmerPath.addMouseListener(new MouseAdapter()
446 public void mouseClicked(MouseEvent e)
448 if (e.getClickCount() == 2)
450 String chosen = openFileChooser(true);
453 hmmerPath.setText(chosen);
459 hmmerTab.add(hmmerLocation);
460 hmmerTab.add(hmmerPath);
463 * path to Cygwin binaries folder (for Windows)
465 if (Platform.isWindows())
467 JLabel cygwinLocation = new JLabel(
468 MessageManager.getString("label.cygwin_location"));
469 cygwinLocation.setFont(LABEL_FONT);
470 yPos += lineSpacing * 2;
471 cygwinLocation.setBounds(new Rectangle(xPos, yPos, 250, 23));
473 cygwinPath.setBounds(new Rectangle(xPos, yPos, 300, 23));
474 cygwinPath.addMouseListener(new MouseAdapter()
477 public void mouseClicked(MouseEvent e)
479 if (e.getClickCount() == 2)
481 String chosen = openFileChooser(true);
484 cygwinPath.setText(chosen);
485 validateCygwinPath();
490 hmmerTab.add(cygwinLocation);
491 hmmerTab.add(cygwinPath);
495 * preferences for hmmalign
497 yPos += lineSpacing * 2;
498 JPanel alignOptions = new JPanel(new FlowLayout(FlowLayout.LEFT));
499 JvSwingUtils.createTitledBorder(alignOptions,
500 MessageManager.getString("label.hmmalign_label"), true);
502 hmmrTrimTermini.setFont(LABEL_FONT);
503 hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
504 alignOptions.add(hmmrTrimTermini);
505 hmmerTab.add(alignOptions);
506 alignOptions.setBounds(new Rectangle(xPos, yPos, 300, 43));
509 * preferences for hmmsearch
511 yPos += lineSpacing * 3;
512 JPanel searchOptions = new JPanel(new FlowLayout(FlowLayout.LEFT));
513 JvSwingUtils.createTitledBorder(searchOptions,
514 MessageManager.getString("label.hmmsearch_label"), true);
515 searchOptions.setBounds(new Rectangle(xPos, yPos, 300, 43));
516 JLabel sequencesToKeep = new JLabel(
517 MessageManager.getString("label.no_of_sequences"));
518 sequencesToKeep.setFont(LABEL_FONT);
519 // hmmerSequenceCount.setBounds(new Rectangle(xPos + 250, yPos, 60, 23));
520 searchOptions.add(sequencesToKeep);
521 searchOptions.add(hmmerSequenceCount);
522 hmmerTab.add(searchOptions);
524 ButtonGroup backgroundFreqSource = new ButtonGroup();
525 backgroundFreqSource.add(hmmerBackgroundUniprot);
526 backgroundFreqSource.add(hmmerBackgroundAlignment);
527 backgroundFreqSource.setSelected(hmmerBackgroundUniprot.getModel(), true);
530 * preferences for Information Content annotation
532 yPos += lineSpacing * 3;
533 hmmerBackgroundUniprot.setText(MessageManager.getString("label.freq_uniprot"));
534 hmmerBackgroundUniprot.setFont(LABEL_FONT);
535 hmmerBackgroundUniprot.setBounds(new Rectangle(xPos, yPos, 255, 23));
538 hmmerBackgroundAlignment.setText(MessageManager.getString("label.freq_alignment"));
539 hmmerBackgroundAlignment.setFont(LABEL_FONT);
540 hmmerBackgroundAlignment.setBounds(new Rectangle(xPos, yPos, 300, 23));
542 hmmerTab.add(hmmerBackgroundUniprot);
543 hmmerTab.add(hmmerBackgroundAlignment);
549 * Initialises the Output tabbed panel.
553 private JPanel initOutputTab()
555 JPanel outputTab = new JPanel();
556 outputTab.setLayout(null);
557 JLabel epsLabel = new JLabel();
558 epsLabel.setFont(LABEL_FONT);
559 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
560 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
561 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
562 epsRendering.setFont(LABEL_FONT);
563 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
564 JLabel jLabel1 = new JLabel();
565 jLabel1.setFont(LABEL_FONT);
566 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
567 jLabel1.setText(MessageManager.getString("label.append_start_end"));
568 jLabel1.setFont(LABEL_FONT);
569 fastajv.setFont(LABEL_FONT);
570 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
571 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
572 blcjv.setText(MessageManager.getString("label.blc") + " ");
573 fastajv.setText(MessageManager.getString("label.fasta") + " ");
574 msfjv.setText(MessageManager.getString("label.msf") + " ");
575 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
576 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
577 msfjv.setFont(LABEL_FONT);
578 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
579 pirjv.setText(MessageManager.getString("label.pir") + " ");
580 JPanel jPanel11 = new JPanel();
581 jPanel11.setFont(LABEL_FONT);
582 TitledBorder titledBorder2 = new TitledBorder(
583 MessageManager.getString("label.file_output"));
584 jPanel11.setBorder(titledBorder2);
585 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
586 GridLayout gridLayout3 = new GridLayout();
587 jPanel11.setLayout(gridLayout3);
588 gridLayout3.setRows(8);
589 blcjv.setFont(LABEL_FONT);
590 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
591 clustaljv.setFont(LABEL_FONT);
592 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
593 pfamjv.setFont(LABEL_FONT);
594 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
595 pileupjv.setFont(LABEL_FONT);
596 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
597 pirjv.setFont(LABEL_FONT);
598 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
599 autoIdWidth.setFont(LABEL_FONT);
601 MessageManager.getString("label.automatically_set_id_width"));
602 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
603 .getString("label.adjusts_width_generated_eps_png")));
604 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
605 autoIdWidth.addActionListener(new ActionListener()
609 public void actionPerformed(ActionEvent e)
611 autoIdWidth_actionPerformed();
614 userIdWidthlabel.setFont(LABEL_FONT);
615 userIdWidthlabel.setText(
616 MessageManager.getString("label.figure_id_column_width"));
617 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
618 .getString("label.manually_specify_width_left_column")));
619 userIdWidthlabel.setToolTipText(
620 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
621 "label.manually_specify_width_left_column")));
622 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
623 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
624 userIdWidth.setText("");
625 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
626 userIdWidth.addActionListener(new ActionListener()
630 public void actionPerformed(ActionEvent e)
632 userIdWidth_actionPerformed();
635 modellerOutput.setFont(LABEL_FONT);
637 .setText(MessageManager.getString("label.use_modeller_output"));
638 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
639 embbedBioJSON.setFont(LABEL_FONT);
640 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
641 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
643 jPanel11.add(jLabel1);
645 jPanel11.add(clustaljv);
646 jPanel11.add(fastajv);
648 jPanel11.add(pfamjv);
649 jPanel11.add(pileupjv);
651 outputTab.add(autoIdWidth);
652 outputTab.add(userIdWidth);
653 outputTab.add(userIdWidthlabel);
654 outputTab.add(modellerOutput);
655 outputTab.add(embbedBioJSON);
656 outputTab.add(epsLabel);
657 outputTab.add(epsRendering);
658 outputTab.add(jPanel11);
663 * Initialises the Connections tabbed panel.
667 private JPanel initConnectionsTab()
669 JPanel connectTab = new JPanel();
670 connectTab.setLayout(new GridBagLayout());
672 // Label for browser text box
673 JLabel browserLabel = new JLabel();
674 browserLabel.setFont(LABEL_FONT);
675 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
676 browserLabel.setText(
677 MessageManager.getString("label.default_browser_unix"));
678 defaultBrowser.setFont(LABEL_FONT);
679 defaultBrowser.setText("");
681 defaultBrowser.addMouseListener(new MouseAdapter()
684 public void mouseClicked(MouseEvent e)
686 if (e.getClickCount() > 1)
688 defaultBrowser_mouseClicked(e);
693 JPanel proxyPanel = initConnTabProxyPanel();
694 initConnTabCheckboxes();
696 // Add default Browser text box
697 connectTab.add(browserLabel,
698 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
699 GridBagConstraints.WEST, GridBagConstraints.NONE,
700 new Insets(10, 0, 5, 5), 5, 1));
701 defaultBrowser.setFont(LABEL_FONT);
702 defaultBrowser.setText("");
704 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
705 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
706 new Insets(10, 0, 5, 10), 30, 1));
708 // Add proxy server panel
709 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
710 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
711 new Insets(10, 0, 5, 12), 4, 10));
713 // Add usage stats, version check and questionnaire checkboxes
714 connectTab.add(usagestats,
715 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
716 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
717 new Insets(0, 2, 5, 5), 70, 1));
718 connectTab.add(questionnaire,
719 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
720 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
721 new Insets(0, 2, 5, 10), 70, 1));
722 connectTab.add(versioncheck,
723 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
724 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
725 new Insets(0, 2, 5, 5), 70, 1));
727 // Add padding so the panel doesn't look ridiculous
728 JPanel spacePanel = new JPanel();
729 connectTab.add(spacePanel,
730 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
731 GridBagConstraints.WEST, GridBagConstraints.BOTH,
732 new Insets(0, 0, 0, 5), 70, 1));
738 * Initialises the Links tabbed panel.
742 private JPanel initLinksTab()
744 JPanel linkTab = new JPanel();
745 linkTab.setLayout(new GridBagLayout());
747 // Set up table for Url links
748 linkUrlTable.setFillsViewportHeight(true);
749 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
750 linkUrlTable.setAutoCreateRowSorter(true);
751 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
753 // adjust row height so radio buttons actually fit
754 // don't do this in the renderer, it causes the awt thread to activate
756 JRadioButton temp = new JRadioButton();
757 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
759 // Table in scrollpane so that the table is given a scrollbar
760 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
761 linkScrollPane.setBorder(null);
763 // Panel for links functionality
764 JPanel linkPanel = new JPanel(new GridBagLayout());
765 linkPanel.setBorder(new TitledBorder(
766 MessageManager.getString("label.url_linkfrom_sequence_id")));
768 // Put the Url links panel together
770 // Buttons go at top right, resizing only resizes the blank space vertically
771 JPanel buttonPanel = initLinkTabUrlButtons();
772 GridBagConstraints linkConstraints1 = new GridBagConstraints();
773 linkConstraints1.insets = new Insets(0, 0, 5, 0);
774 linkConstraints1.gridx = 0;
775 linkConstraints1.gridy = 0;
776 linkConstraints1.weightx = 1.0;
777 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
778 linkTab.add(buttonPanel, linkConstraints1);
780 // Links table goes at top left, resizing resizes the table
781 GridBagConstraints linkConstraints2 = new GridBagConstraints();
782 linkConstraints2.insets = new Insets(0, 0, 5, 5);
783 linkConstraints2.gridx = 0;
784 linkConstraints2.gridy = 1;
785 linkConstraints2.weightx = 1.0;
786 linkConstraints2.weighty = 1.0;
787 linkConstraints2.fill = GridBagConstraints.BOTH;
788 linkTab.add(linkScrollPane, linkConstraints2);
790 // Filter box and buttons goes at bottom left, resizing resizes the text box
791 JPanel filterPanel = initLinkTabFilterPanel();
792 GridBagConstraints linkConstraints3 = new GridBagConstraints();
793 linkConstraints3.insets = new Insets(0, 0, 0, 5);
794 linkConstraints3.gridx = 0;
795 linkConstraints3.gridy = 2;
796 linkConstraints3.weightx = 1.0;
797 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
798 linkTab.add(filterPanel, linkConstraints3);
803 private JPanel initLinkTabFilterPanel()
805 // Filter textbox and reset button
806 JLabel filterLabel = new JLabel(
807 MessageManager.getString("label.filter"));
808 filterLabel.setFont(LABEL_FONT);
809 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
810 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
812 filterTB.setFont(LABEL_FONT);
813 filterTB.setText("");
815 doReset.setText(MessageManager.getString("action.showall"));
816 userOnly.setText(MessageManager.getString("action.customfilter"));
818 // Panel for filter functionality
819 JPanel filterPanel = new JPanel(new GridBagLayout());
820 filterPanel.setBorder(new TitledBorder("Filter"));
821 GridBagConstraints gbc = new GridBagConstraints();
824 gbc.fill = GridBagConstraints.NONE;
825 gbc.anchor = GridBagConstraints.WEST;
827 filterPanel.add(filterLabel, gbc);
829 GridBagConstraints gbc1 = new GridBagConstraints();
832 gbc1.fill = GridBagConstraints.HORIZONTAL;
833 gbc1.anchor = GridBagConstraints.WEST;
835 filterPanel.add(filterTB, gbc1);
837 GridBagConstraints gbc2 = new GridBagConstraints();
839 gbc2.fill = GridBagConstraints.NONE;
840 gbc2.anchor = GridBagConstraints.WEST;
841 filterPanel.add(doReset, gbc2);
843 GridBagConstraints gbc3 = new GridBagConstraints();
845 gbc3.fill = GridBagConstraints.NONE;
846 gbc3.anchor = GridBagConstraints.WEST;
847 filterPanel.add(userOnly, gbc3);
852 private JPanel initLinkTabUrlButtons()
854 // Buttons for new / edit / delete Url links
855 JButton newLink = new JButton();
856 newLink.setText(MessageManager.getString("action.new"));
858 editLink.setText(MessageManager.getString("action.edit"));
860 deleteLink.setText(MessageManager.getString("action.delete"));
862 // no current selection, so initially disable delete/edit buttons
863 editLink.setEnabled(false);
864 deleteLink.setEnabled(false);
866 newLink.addActionListener(new java.awt.event.ActionListener()
869 public void actionPerformed(ActionEvent e)
871 newLink_actionPerformed(e);
875 editLink.setText(MessageManager.getString("action.edit"));
876 editLink.addActionListener(new java.awt.event.ActionListener()
879 public void actionPerformed(ActionEvent e)
881 editLink_actionPerformed(e);
885 deleteLink.setText(MessageManager.getString("action.delete"));
886 deleteLink.addActionListener(new java.awt.event.ActionListener()
889 public void actionPerformed(ActionEvent e)
891 deleteLink_actionPerformed(e);
895 JPanel buttonPanel = new JPanel(new GridBagLayout());
896 buttonPanel.setBorder(new TitledBorder("Edit links"));
897 GridBagConstraints gbc = new GridBagConstraints();
900 gbc.fill = GridBagConstraints.NONE;
901 buttonPanel.add(newLink, gbc);
903 GridBagConstraints gbc1 = new GridBagConstraints();
906 gbc1.fill = GridBagConstraints.NONE;
907 buttonPanel.add(editLink, gbc1);
909 GridBagConstraints gbc2 = new GridBagConstraints();
912 gbc2.fill = GridBagConstraints.NONE;
913 buttonPanel.add(deleteLink, gbc2);
915 GridBagConstraints gbc3 = new GridBagConstraints();
918 gbc3.fill = GridBagConstraints.HORIZONTAL;
920 JPanel spacePanel = new JPanel();
921 spacePanel.setBorder(null);
922 buttonPanel.add(spacePanel, gbc3);
928 * Initialises the proxy server panel in the Connections tab
930 * @return the proxy server panel
932 private JPanel initConnTabProxyPanel()
934 // Label for server text box
935 serverLabel.setText(MessageManager.getString("label.address"));
936 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
937 serverLabel.setFont(LABEL_FONT);
939 // Proxy server and port text boxes
940 proxyServerTB.setFont(LABEL_FONT);
941 proxyPortTB.setFont(LABEL_FONT);
943 // Label for Port text box
944 portLabel.setFont(LABEL_FONT);
945 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
946 portLabel.setText(MessageManager.getString("label.port"));
948 // Use proxy server checkbox
949 useProxy.setFont(LABEL_FONT);
950 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
951 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
952 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
953 useProxy.addActionListener(new ActionListener()
956 public void actionPerformed(ActionEvent e)
958 useProxy_actionPerformed();
962 // Make proxy server panel
963 JPanel proxyPanel = new JPanel();
964 TitledBorder titledBorder1 = new TitledBorder(
965 MessageManager.getString("label.proxy_server"));
966 proxyPanel.setBorder(titledBorder1);
967 proxyPanel.setLayout(new GridBagLayout());
968 proxyPanel.add(serverLabel,
969 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
970 GridBagConstraints.WEST, GridBagConstraints.NONE,
971 new Insets(0, 2, 2, 0), 5, 0));
972 proxyPanel.add(portLabel,
973 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
974 GridBagConstraints.WEST, GridBagConstraints.NONE,
975 new Insets(0, 0, 2, 0), 11, 0));
976 proxyPanel.add(useProxy,
977 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
978 GridBagConstraints.WEST, GridBagConstraints.NONE,
979 new Insets(0, 2, 5, 185), 2, -4));
980 proxyPanel.add(proxyPortTB,
981 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
982 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
983 new Insets(0, 2, 2, 2), 54, 1));
984 proxyPanel.add(proxyServerTB,
985 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
986 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
987 new Insets(0, 2, 2, 0), 263, 1));
993 * Initialises the checkboxes in the Connections tab
995 private void initConnTabCheckboxes()
997 // Usage stats checkbox label
999 MessageManager.getString("label.send_usage_statistics"));
1000 usagestats.setFont(LABEL_FONT);
1001 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
1002 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
1004 // Questionnaire checkbox label
1005 questionnaire.setText(
1006 MessageManager.getString("label.check_for_questionnaires"));
1007 questionnaire.setFont(LABEL_FONT);
1008 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
1009 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
1011 // Check for latest version checkbox label
1012 versioncheck.setText(
1013 MessageManager.getString("label.check_for_latest_version"));
1014 versioncheck.setFont(LABEL_FONT);
1015 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
1016 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
1020 * Initialises the parent panel which contains the tabbed sections.
1024 private JPanel initOkCancelPanel()
1026 JButton ok = new JButton();
1027 ok.setText(MessageManager.getString("action.ok"));
1028 ok.addActionListener(new ActionListener()
1031 public void actionPerformed(ActionEvent e)
1033 ok_actionPerformed(e);
1036 JButton cancel = new JButton();
1037 cancel.setText(MessageManager.getString("action.cancel"));
1038 cancel.addActionListener(new ActionListener()
1041 public void actionPerformed(ActionEvent e)
1043 cancel_actionPerformed(e);
1046 JPanel okCancelPanel = new JPanel();
1047 okCancelPanel.add(ok);
1048 okCancelPanel.add(cancel);
1049 return okCancelPanel;
1053 * Initialises the Colours tabbed panel.
1057 private JPanel initColoursTab()
1059 JPanel coloursTab = new JPanel();
1060 coloursTab.setBorder(new TitledBorder(
1061 MessageManager.getString("action.open_new_alignment")));
1062 coloursTab.setLayout(new FlowLayout());
1063 JLabel mincolourLabel = new JLabel();
1064 mincolourLabel.setFont(LABEL_FONT);
1065 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1066 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1067 minColour.setFont(LABEL_FONT);
1068 minColour.setBorder(BorderFactory.createEtchedBorder());
1069 minColour.setPreferredSize(new Dimension(40, 20));
1070 minColour.addMouseListener(new MouseAdapter()
1073 public void mousePressed(MouseEvent e)
1075 minColour_actionPerformed(minColour);
1078 JLabel maxcolourLabel = new JLabel();
1079 maxcolourLabel.setFont(LABEL_FONT);
1080 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1081 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1082 maxColour.setFont(LABEL_FONT);
1083 maxColour.setBorder(BorderFactory.createEtchedBorder());
1084 maxColour.setPreferredSize(new Dimension(40, 20));
1085 maxColour.addMouseListener(new MouseAdapter()
1088 public void mousePressed(MouseEvent e)
1090 maxColour_actionPerformed(maxColour);
1094 protColour.setFont(LABEL_FONT);
1095 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1096 JLabel protColourLabel = new JLabel();
1097 protColourLabel.setFont(LABEL_FONT);
1098 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1099 protColourLabel.setText(
1100 MessageManager.getString("label.prot_alignment_colour") + " ");
1101 JvSwingUtils.addtoLayout(coloursTab,
1103 .getString("label.default_colour_scheme_for_alignment"),
1104 protColourLabel, protColour);
1106 nucColour.setFont(LABEL_FONT);
1107 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1108 JLabel nucColourLabel = new JLabel();
1109 nucColourLabel.setFont(LABEL_FONT);
1110 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1111 nucColourLabel.setText(
1112 MessageManager.getString("label.nuc_alignment_colour") + " ");
1113 JvSwingUtils.addtoLayout(coloursTab,
1115 .getString("label.default_colour_scheme_for_alignment"),
1116 nucColourLabel, nucColour);
1118 JPanel annotationShding = new JPanel();
1119 annotationShding.setBorder(new TitledBorder(
1120 MessageManager.getString("label.annotation_shading_default")));
1121 annotationShding.setLayout(new GridLayout(1, 2));
1122 JvSwingUtils.addtoLayout(annotationShding,
1123 MessageManager.getString(
1124 "label.default_minimum_colour_annotation_shading"),
1125 mincolourLabel, minColour);
1126 JvSwingUtils.addtoLayout(annotationShding,
1127 MessageManager.getString(
1128 "label.default_maximum_colour_annotation_shading"),
1129 maxcolourLabel, maxColour);
1130 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1135 * Initialises the Overview tabbed panel.
1139 private JPanel initOverviewTab()
1141 JPanel overviewPanel = new JPanel();
1142 overviewPanel.setBorder(new TitledBorder(
1143 MessageManager.getString("label.overview_settings")));
1145 gapColour.setFont(LABEL_FONT);
1146 // fixing the border colours stops apparent colour bleed from the panel
1147 gapColour.setBorder(
1148 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1149 gapColour.setPreferredSize(new Dimension(40, 20));
1150 gapColour.addMouseListener(new MouseAdapter()
1153 public void mousePressed(MouseEvent e)
1155 gapColour_actionPerformed(gapColour);
1159 hiddenColour.setFont(LABEL_FONT);
1160 // fixing the border colours stops apparent colour bleed from the panel
1161 hiddenColour.setBorder(
1162 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1163 hiddenColour.setPreferredSize(new Dimension(40, 20));
1164 hiddenColour.addMouseListener(new MouseAdapter()
1167 public void mousePressed(MouseEvent e)
1169 hiddenColour_actionPerformed(hiddenColour);
1173 useLegacyGap = new JCheckBox(
1174 MessageManager.getString("label.ov_legacy_gap"));
1175 useLegacyGap.setFont(LABEL_FONT);
1176 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1177 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1178 gapLabel = new JLabel(
1179 MessageManager.getString("label.gap_colour"));
1180 gapLabel.setFont(LABEL_FONT);
1181 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1182 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1183 showHiddenAtStart = new JCheckBox(
1184 MessageManager.getString("label.ov_show_hide_default"));
1185 showHiddenAtStart.setFont(LABEL_FONT);
1186 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1187 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1188 JLabel hiddenLabel = new JLabel(
1189 MessageManager.getString("label.hidden_colour"));
1190 hiddenLabel.setFont(LABEL_FONT);
1191 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1192 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1194 useLegacyGap.addActionListener(new ActionListener()
1197 public void actionPerformed(ActionEvent e)
1199 useLegacyGaps_actionPerformed(e);
1203 overviewPanel.setLayout(new GridBagLayout());
1204 GridBagConstraints c1 = new GridBagConstraints();
1206 c1.fill = GridBagConstraints.HORIZONTAL;
1211 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1212 overviewPanel.add(useLegacyGap, c1);
1214 GridBagConstraints c2 = new GridBagConstraints();
1215 c2.fill = GridBagConstraints.HORIZONTAL;
1218 c2.insets = new Insets(0, 15, 0, 10);
1219 overviewPanel.add(gapLabel, c2);
1221 GridBagConstraints c3 = new GridBagConstraints();
1222 c3.fill = GridBagConstraints.HORIZONTAL;
1225 c3.insets = new Insets(0, 0, 0, 15);
1226 overviewPanel.add(gapColour, c3);
1228 GridBagConstraints c4 = new GridBagConstraints();
1229 c4.fill = GridBagConstraints.HORIZONTAL;
1233 overviewPanel.add(showHiddenAtStart, c4);
1235 GridBagConstraints c5 = new GridBagConstraints();
1236 c5.fill = GridBagConstraints.HORIZONTAL;
1239 c5.insets = new Insets(0, 15, 0, 10);
1240 overviewPanel.add(hiddenLabel, c5);
1242 GridBagConstraints c6 = new GridBagConstraints();
1243 c6.fill = GridBagConstraints.HORIZONTAL;
1246 c6.insets = new Insets(0, 0, 0, 15);
1247 overviewPanel.add(hiddenColour, c6);
1249 JButton resetButton = new JButton(
1250 MessageManager.getString("label.reset_to_defaults"));
1252 resetButton.addActionListener(new ActionListener()
1255 public void actionPerformed(ActionEvent e)
1257 resetOvDefaults_actionPerformed(e);
1261 GridBagConstraints c7 = new GridBagConstraints();
1262 c7.fill = GridBagConstraints.NONE;
1265 c7.insets = new Insets(10, 0, 0, 0);
1266 c7.anchor = GridBagConstraints.WEST;
1267 overviewPanel.add(resetButton, c7);
1269 // Add padding so the panel doesn't look ridiculous
1270 JPanel spacePanel = new JPanel();
1271 overviewPanel.add(spacePanel,
1272 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1273 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1274 new Insets(0, 0, 0, 5), 0, 0));
1276 return overviewPanel;
1280 * Initialises the Structure tabbed panel.
1284 private JPanel initStructureTab()
1286 structureTab = new JPanel();
1288 structureTab.setBorder(new TitledBorder(
1289 MessageManager.getString("label.structure_options")));
1290 structureTab.setLayout(null);
1291 final int width = 400;
1292 final int height = 22;
1293 final int lineSpacing = 25;
1296 structFromPdb.setFont(LABEL_FONT);
1298 .setText(MessageManager.getString("label.struct_from_pdb"));
1299 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1300 structFromPdb.addActionListener(new ActionListener()
1303 public void actionPerformed(ActionEvent e)
1305 boolean selected = structFromPdb.isSelected();
1306 // enable other options only when the first is checked
1307 useRnaView.setEnabled(selected);
1308 addSecondaryStructure.setEnabled(selected);
1309 addTempFactor.setEnabled(selected);
1312 structureTab.add(structFromPdb);
1314 // indent checkboxes that are conditional on the first one
1315 ypos += lineSpacing;
1316 useRnaView.setFont(LABEL_FONT);
1317 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1318 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1319 structureTab.add(useRnaView);
1321 ypos += lineSpacing;
1322 addSecondaryStructure.setFont(LABEL_FONT);
1323 addSecondaryStructure
1324 .setText(MessageManager.getString("label.autoadd_secstr"));
1325 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1326 structureTab.add(addSecondaryStructure);
1328 ypos += lineSpacing;
1329 addTempFactor.setFont(LABEL_FONT);
1330 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1331 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1332 structureTab.add(addTempFactor);
1334 ypos += lineSpacing;
1335 JLabel viewerLabel = new JLabel();
1336 viewerLabel.setFont(LABEL_FONT);
1337 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1338 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1339 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1340 structureTab.add(viewerLabel);
1342 structViewer.setFont(LABEL_FONT);
1343 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1344 structViewer.addItem(ViewerType.JMOL.name());
1345 structViewer.addItem(ViewerType.CHIMERA.name());
1346 structViewer.addActionListener(new ActionListener()
1349 public void actionPerformed(ActionEvent e)
1351 structureViewer_actionPerformed(
1352 (String) structViewer.getSelectedItem());
1355 structureTab.add(structViewer);
1357 ypos += lineSpacing;
1358 JLabel pathLabel = new JLabel();
1359 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1360 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1361 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1362 final String tooltip = JvSwingUtils.wrapTooltip(true,
1363 MessageManager.getString("label.chimera_path_tip"));
1364 pathLabel.setToolTipText(tooltip);
1365 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1366 structureTab.add(pathLabel);
1368 chimeraPath.setFont(LABEL_FONT);
1369 chimeraPath.setText("");
1370 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1371 chimeraPath.addMouseListener(new MouseAdapter()
1374 public void mouseClicked(MouseEvent e)
1376 if (e.getClickCount() == 2)
1378 String chosen = openFileChooser(false);
1381 chimeraPath.setText(chosen);
1386 structureTab.add(chimeraPath);
1388 ypos += lineSpacing;
1389 nwMapping.setFont(LABEL_FONT);
1390 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1391 siftsMapping.setFont(LABEL_FONT);
1392 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1393 mappingMethod.add(nwMapping);
1394 mappingMethod.add(siftsMapping);
1395 JPanel mappingPanel = new JPanel();
1396 mappingPanel.setFont(LABEL_FONT);
1397 TitledBorder mmTitledBorder = new TitledBorder(
1398 MessageManager.getString("label.mapping_method"));
1399 mmTitledBorder.setTitleFont(LABEL_FONT);
1400 mappingPanel.setBorder(mmTitledBorder);
1401 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1402 // GridLayout mappingLayout = new GridLayout();
1403 mappingPanel.setLayout(new GridLayout());
1404 mappingPanel.add(nwMapping);
1405 mappingPanel.add(siftsMapping);
1406 structureTab.add(mappingPanel);
1408 ypos += lineSpacing;
1409 ypos += lineSpacing;
1410 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1411 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1412 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1413 structureTab.add(docFieldPref);
1415 return structureTab;
1419 * Action on choosing a structure viewer from combobox options.
1421 * @param selectedItem
1423 protected void structureViewer_actionPerformed(String selectedItem)
1428 * Show a dialog for the user to choose a file. Returns the chosen path, or
1433 protected String openFileChooser(boolean forFolder)
1435 String choice = null;
1436 JFileChooser chooser = new JFileChooser();
1439 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1442 // chooser.setFileView(new JalviewFileView());
1443 chooser.setDialogTitle(
1444 MessageManager.getString("label.open_local_file"));
1445 chooser.setToolTipText(MessageManager.getString("action.open"));
1447 int value = chooser.showOpenDialog(this);
1449 if (value == JFileChooser.APPROVE_OPTION)
1451 choice = chooser.getSelectedFile().getPath();
1456 protected boolean validateStructure()
1462 * Initialises the Visual tabbed panel.
1466 private JPanel initVisualTab()
1468 JPanel visualTab = new JPanel();
1469 visualTab.setBorder(new TitledBorder(
1470 MessageManager.getString("action.open_new_alignment")));
1471 visualTab.setLayout(null);
1472 fullScreen.setFont(LABEL_FONT);
1473 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1474 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1475 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1476 quality.setEnabled(false);
1477 quality.setFont(LABEL_FONT);
1478 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1479 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1480 quality.setSelected(true);
1481 quality.setText(MessageManager.getString("label.quality"));
1482 conservation.setEnabled(false);
1483 conservation.setFont(LABEL_FONT);
1484 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1485 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1486 conservation.setSelected(true);
1487 conservation.setText(MessageManager.getString("label.conservation"));
1488 identity.setEnabled(false);
1489 identity.setFont(LABEL_FONT);
1490 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1491 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1492 identity.setSelected(true);
1493 identity.setText(MessageManager.getString("label.consensus"));
1494 showOccupancy.setFont(LABEL_FONT);
1495 showOccupancy.setEnabled(false);
1496 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1497 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1498 showOccupancy.setSelected(true);
1499 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1501 JLabel showGroupbits = new JLabel();
1502 showGroupbits.setFont(LABEL_FONT);
1503 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1504 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1506 .setText(MessageManager.getString("action.show_group") + ":");
1507 JLabel showConsensbits = new JLabel();
1508 showConsensbits.setFont(LABEL_FONT);
1509 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1510 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1512 .setText(MessageManager.getString("label.consensus") + ":");
1513 showConsensHistogram.setEnabled(false);
1514 showConsensHistogram.setFont(LABEL_FONT);
1515 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1516 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1517 showConsensHistogram.setSelected(true);
1518 showConsensHistogram
1519 .setText(MessageManager.getString("label.histogram"));
1520 showConsensLogo.setEnabled(false);
1521 showConsensLogo.setFont(LABEL_FONT);
1522 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1523 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1524 showConsensLogo.setSelected(true);
1525 showConsensLogo.setText(MessageManager.getString("label.logo"));
1526 showGroupConsensus.setEnabled(false);
1527 showGroupConsensus.setFont(LABEL_FONT);
1528 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1529 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1530 showGroupConsensus.setSelected(true);
1531 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1532 showGroupConservation.setEnabled(false);
1533 showGroupConservation.setFont(LABEL_FONT);
1534 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1535 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1536 showGroupConservation.setSelected(true);
1537 showGroupConservation
1538 .setText(MessageManager.getString("label.conservation"));
1539 showNpTooltip.setEnabled(true);
1540 showNpTooltip.setFont(LABEL_FONT);
1541 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1542 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1543 showNpTooltip.setSelected(true);
1544 showNpTooltip.setText(
1545 MessageManager.getString("label.non_positional_features"));
1546 showDbRefTooltip.setEnabled(true);
1547 showDbRefTooltip.setFont(LABEL_FONT);
1548 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1549 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1550 showDbRefTooltip.setSelected(true);
1552 .setText(MessageManager.getString("label.database_references"));
1553 annotations.setFont(LABEL_FONT);
1554 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1555 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1556 annotations.setSelected(true);
1557 annotations.setText(MessageManager.getString("label.show_annotations"));
1558 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1559 annotations.addActionListener(new ActionListener()
1562 public void actionPerformed(ActionEvent e)
1564 annotations_actionPerformed(e);
1567 identity.addActionListener(new ActionListener()
1570 public void actionPerformed(ActionEvent e)
1572 annotations_actionPerformed(e);
1575 showGroupConsensus.addActionListener(new ActionListener()
1578 public void actionPerformed(ActionEvent e)
1580 annotations_actionPerformed(e);
1583 showUnconserved.setFont(LABEL_FONT);
1584 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1585 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1586 showUnconserved.setSelected(true);
1588 .setText(MessageManager.getString("action.show_unconserved"));
1589 showUnconserved.addActionListener(new ActionListener()
1592 public void actionPerformed(ActionEvent e)
1594 showunconserved_actionPerformed(e);
1598 // TODO these are not yet added to / action from Preferences
1599 // JCheckBox shareSelections = new JCheckBox();
1600 // shareSelections.setFont(verdana11);
1601 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1602 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1603 // shareSelections.setSelected(true);
1604 // shareSelections.setText(MessageManager
1605 // .getString("label.share_selection_across_views"));
1606 // JCheckBox followHighlight = new JCheckBox();
1607 // followHighlight.setFont(verdana11);
1608 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1609 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1610 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1611 // followHighlight.setSelected(true);
1612 // followHighlight.setText(MessageManager
1613 // .getString("label.scroll_highlighted_regions"));
1615 seqLimit.setFont(LABEL_FONT);
1616 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1617 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1618 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1619 smoothFont.setFont(LABEL_FONT);
1620 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1621 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1622 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1623 scaleProteinToCdna.setFont(LABEL_FONT);
1624 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1625 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1626 scaleProteinToCdna.setText(
1627 MessageManager.getString("label.scale_protein_to_cdna"));
1628 scaleProteinToCdna.setToolTipText(
1629 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1630 JLabel gapLabel = new JLabel();
1631 gapLabel.setFont(LABEL_FONT);
1632 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1633 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1634 JLabel fontLabel = new JLabel();
1635 fontLabel.setFont(LABEL_FONT);
1636 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1637 fontLabel.setText(MessageManager.getString("label.font"));
1638 fontSizeCB.setFont(LABEL_FONT);
1639 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1640 fontStyleCB.setFont(LABEL_FONT);
1641 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1642 fontNameCB.setFont(LABEL_FONT);
1643 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1644 gapSymbolCB.setFont(LABEL_FONT);
1645 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1646 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1647 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1648 gapSymbolCB.setRenderer(dlcr);
1650 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1651 startupCheckbox.setFont(LABEL_FONT);
1652 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1653 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1654 startupCheckbox.setSelected(true);
1655 startupFileTextfield.setFont(LABEL_FONT);
1656 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1657 startupFileTextfield.addMouseListener(new MouseAdapter()
1660 public void mouseClicked(MouseEvent e)
1662 if (e.getClickCount() > 1)
1664 startupFileTextfield_mouseClicked();
1669 sortby.setFont(LABEL_FONT);
1670 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1671 JLabel sortLabel = new JLabel();
1672 sortLabel.setFont(LABEL_FONT);
1673 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1674 sortLabel.setText(MessageManager.getString("label.sort_by"));
1675 sortAnnBy.setFont(LABEL_FONT);
1676 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1677 JLabel sortAnnLabel = new JLabel();
1678 sortAnnLabel.setFont(LABEL_FONT);
1679 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1680 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1681 sortAutocalc.setFont(LABEL_FONT);
1682 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1684 JPanel annsettingsPanel = new JPanel();
1685 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1686 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1687 annsettingsPanel.setBorder(new EtchedBorder());
1688 visualTab.add(annsettingsPanel);
1689 Border jb = new EmptyBorder(1, 1, 4, 5);
1690 annotations.setBorder(jb);
1691 showOccupancy.setBorder(jb);
1692 quality.setBorder(jb);
1693 conservation.setBorder(jb);
1694 identity.setBorder(jb);
1695 showConsensbits.setBorder(jb);
1696 showGroupbits.setBorder(jb);
1697 showGroupConsensus.setBorder(jb);
1698 showGroupConservation.setBorder(jb);
1699 showConsensHistogram.setBorder(jb);
1700 showConsensLogo.setBorder(jb);
1702 JPanel autoAnnotSettings = new JPanel();
1703 annsettingsPanel.add(autoAnnotSettings);
1704 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1705 autoAnnotSettings.add(annotations);
1706 autoAnnotSettings.add(quality);
1707 // second row of autoannotation box
1708 autoAnnotSettings = new JPanel();
1709 annsettingsPanel.add(autoAnnotSettings);
1711 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1712 autoAnnotSettings.add(conservation);
1713 autoAnnotSettings.add(identity);
1714 autoAnnotSettings.add(showOccupancy);
1715 autoAnnotSettings.add(showGroupbits);
1716 autoAnnotSettings.add(showGroupConservation);
1717 autoAnnotSettings.add(showGroupConsensus);
1718 autoAnnotSettings.add(showConsensbits);
1719 autoAnnotSettings.add(showConsensHistogram);
1720 autoAnnotSettings.add(showConsensLogo);
1722 JPanel tooltipSettings = new JPanel();
1723 tooltipSettings.setBorder(new TitledBorder(
1724 MessageManager.getString("label.sequence_id_tooltip")));
1725 tooltipSettings.setBounds(173, 140, 220, 62);
1726 tooltipSettings.setLayout(new GridLayout(2, 1));
1727 tooltipSettings.add(showDbRefTooltip);
1728 tooltipSettings.add(showNpTooltip);
1729 visualTab.add(tooltipSettings);
1731 wrap.setFont(LABEL_FONT);
1732 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1733 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1734 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1735 rightAlign.setFont(LABEL_FONT);
1736 rightAlign.setForeground(Color.black);
1737 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1738 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1739 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1740 idItalics.setFont(LABEL_FONT_ITALIC);
1741 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1742 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1744 MessageManager.getString("label.sequence_name_italics"));
1745 openoverv.setFont(LABEL_FONT);
1746 openoverv.setActionCommand(
1747 MessageManager.getString("label.open_overview"));
1748 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1749 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1750 openoverv.setText(MessageManager.getString("label.open_overview"));
1751 JPanel jPanel2 = new JPanel();
1752 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1753 jPanel2.setLayout(new GridLayout(14, 1));
1754 jPanel2.add(fullScreen);
1755 jPanel2.add(openoverv);
1756 jPanel2.add(seqLimit);
1757 jPanel2.add(rightAlign);
1758 jPanel2.add(fontLabel);
1759 jPanel2.add(showUnconserved);
1760 jPanel2.add(idItalics);
1761 jPanel2.add(smoothFont);
1762 jPanel2.add(scaleProteinToCdna);
1763 jPanel2.add(gapLabel);
1765 jPanel2.add(sortLabel);
1766 jPanel2.add(sortAnnLabel);
1767 jPanel2.add(startupCheckbox);
1768 visualTab.add(jPanel2);
1769 visualTab.add(startupFileTextfield);
1770 visualTab.add(sortby);
1771 visualTab.add(sortAnnBy);
1772 visualTab.add(sortAutocalc);
1773 visualTab.add(gapSymbolCB);
1774 visualTab.add(fontNameCB);
1775 visualTab.add(fontSizeCB);
1776 visualTab.add(fontStyleCB);
1780 protected void autoIdWidth_actionPerformed()
1782 // TODO Auto-generated method stub
1786 protected void userIdWidth_actionPerformed()
1788 // TODO Auto-generated method stub
1792 protected void maxColour_actionPerformed(JPanel panel)
1796 protected void minColour_actionPerformed(JPanel panel)
1800 protected void gapColour_actionPerformed(JPanel panel)
1804 protected void hiddenColour_actionPerformed(JPanel panel)
1808 protected void showunconserved_actionPerformed(ActionEvent e)
1810 // TODO Auto-generated method stub
1814 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1818 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1828 public void ok_actionPerformed(ActionEvent e)
1838 public void cancel_actionPerformed(ActionEvent e)
1848 public void annotations_actionPerformed(ActionEvent e)
1855 public void startupFileTextfield_mouseClicked()
1859 public void newLink_actionPerformed(ActionEvent e)
1864 public void editLink_actionPerformed(ActionEvent e)
1869 public void deleteLink_actionPerformed(ActionEvent e)
1874 public void defaultBrowser_mouseClicked(MouseEvent e)
1879 public void linkURLList_keyTyped(KeyEvent e)
1884 public void useProxy_actionPerformed()
1886 boolean enabled = useProxy.isSelected();
1887 portLabel.setEnabled(enabled);
1888 serverLabel.setEnabled(enabled);
1889 proxyServerTB.setEnabled(enabled);
1890 proxyPortTB.setEnabled(enabled);
1894 * Customer renderer for JTable: supports column of radio buttons
1896 public class RadioButtonRenderer extends JRadioButton
1897 implements TableCellRenderer
1899 public RadioButtonRenderer()
1901 setHorizontalAlignment(CENTER);
1902 setToolTipText(MessageManager.getString("label.urltooltip"));
1906 public Component getTableCellRendererComponent(JTable table,
1907 Object value, boolean isSelected, boolean hasFocus, int row,
1910 setSelected((boolean) value);
1912 // set colours to match rest of table
1915 setBackground(table.getSelectionBackground());
1916 setForeground(table.getSelectionForeground());
1920 setBackground(table.getBackground());
1921 setForeground(table.getForeground());
1928 * Customer cell editor for JTable: supports column of radio buttons in
1929 * conjunction with renderer
1931 public class RadioButtonEditor extends AbstractCellEditor
1932 implements TableCellEditor
1934 private JRadioButton button = new JRadioButton();
1936 public RadioButtonEditor()
1938 button.setHorizontalAlignment(SwingConstants.CENTER);
1939 this.button.addActionListener(new ActionListener()
1942 public void actionPerformed(ActionEvent e)
1944 fireEditingStopped();
1950 public Component getTableCellEditorComponent(JTable table, Object value,
1951 boolean isSelected, int row, int column)
1953 button.setSelected((boolean) value);
1958 public Object getCellEditorValue()
1960 return button.isSelected();
1965 protected void validateHmmerPath()
1969 protected void validateCygwinPath()