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;
30 import java.awt.BorderLayout;
31 import java.awt.Color;
32 import java.awt.Component;
33 import java.awt.Dimension;
34 import java.awt.FlowLayout;
36 import java.awt.GridBagConstraints;
37 import java.awt.GridBagLayout;
38 import java.awt.GridLayout;
39 import java.awt.Insets;
40 import java.awt.Rectangle;
41 import java.awt.event.ActionEvent;
42 import java.awt.event.ActionListener;
43 import java.awt.event.KeyEvent;
44 import java.awt.event.MouseAdapter;
45 import java.awt.event.MouseEvent;
47 import javax.swing.AbstractButton;
48 import javax.swing.AbstractCellEditor;
49 import javax.swing.BorderFactory;
50 import javax.swing.ButtonGroup;
51 import javax.swing.DefaultListCellRenderer;
52 import javax.swing.JButton;
53 import javax.swing.JCheckBox;
54 import javax.swing.JComboBox;
55 import javax.swing.JFileChooser;
56 import javax.swing.JLabel;
57 import javax.swing.JPanel;
58 import javax.swing.JRadioButton;
59 import javax.swing.JScrollPane;
60 import javax.swing.JTabbedPane;
61 import javax.swing.JTable;
62 import javax.swing.JTextField;
63 import javax.swing.ListSelectionModel;
64 import javax.swing.SwingConstants;
65 import javax.swing.border.Border;
66 import javax.swing.border.EmptyBorder;
67 import javax.swing.border.EtchedBorder;
68 import javax.swing.border.TitledBorder;
69 import javax.swing.event.ChangeEvent;
70 import javax.swing.event.ChangeListener;
71 import javax.swing.table.TableCellEditor;
72 import javax.swing.table.TableCellRenderer;
75 * Base class for the Preferences panel.
80 public class GPreferences extends JPanel
82 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
84 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
85 .getLabelFont(false, true);
88 * Visual tab components
90 protected JCheckBox fullScreen = new JCheckBox();
92 protected JCheckBox openoverv = new JCheckBox();
94 protected JCheckBox seqLimit = new JCheckBox();
96 protected JCheckBox rightAlign = new JCheckBox();
98 protected JComboBox<String> fontSizeCB = new JComboBox<>();
100 protected JComboBox<String> fontStyleCB = new JComboBox<>();
102 protected JComboBox<String> fontNameCB = new JComboBox<>();
104 protected JCheckBox showOccupancy = new JCheckBox();
106 protected JCheckBox showUnconserved = new JCheckBox();
108 protected JCheckBox idItalics = new JCheckBox();
110 protected JCheckBox smoothFont = new JCheckBox();
112 protected JCheckBox scaleProteinToCdna = new JCheckBox();
114 protected JComboBox<String> gapSymbolCB = new JComboBox<>();
116 protected JCheckBox wrap = new JCheckBox();
118 protected JComboBox<String> sortby = new JComboBox<>();
120 protected JComboBox<String> sortAnnBy = new JComboBox<>();
122 protected JComboBox<String> sortAutocalc = new JComboBox<>();
124 protected JCheckBox startupCheckbox = new JCheckBox();
126 protected JTextField startupFileTextfield = new JTextField();
128 // below are in the 'second column'
129 protected JCheckBox annotations = new JCheckBox();
131 protected JCheckBox quality = new JCheckBox();
133 protected JCheckBox conservation = new JCheckBox();
135 protected JCheckBox identity = new JCheckBox();
137 protected JCheckBox showGroupConsensus = new JCheckBox();
139 protected JCheckBox showGroupConservation = new JCheckBox();
141 protected JCheckBox showConsensHistogram = new JCheckBox();
143 protected JCheckBox showConsensLogo = new JCheckBox();
145 protected JCheckBox showInformationHistogram = new JCheckBox();
147 protected JCheckBox showHMMLogo = new JCheckBox();
149 protected JCheckBox showDbRefTooltip = new JCheckBox();
151 protected JCheckBox showNpTooltip = new JCheckBox();
155 * Structure tab and components
157 protected JPanel structureTab;
159 protected JCheckBox structFromPdb = new JCheckBox();
161 protected JCheckBox useRnaView = new JCheckBox();
163 protected JCheckBox addSecondaryStructure = new JCheckBox();
165 protected JCheckBox addTempFactor = new JCheckBox();
167 protected JComboBox<String> structViewer = new JComboBox<>();
169 protected JTextField chimeraPath = new JTextField();
171 protected ButtonGroup mappingMethod = new ButtonGroup();
173 protected JRadioButton siftsMapping = new JRadioButton();
175 protected JRadioButton nwMapping = new JRadioButton();
178 * Colours tab components
180 protected JPanel minColour = new JPanel();
182 protected JPanel maxColour = new JPanel();
184 protected JComboBox<String> protColour = new JComboBox<>();
186 protected JComboBox<String> nucColour = new JComboBox<>();
189 * Overview tab components
191 protected JPanel gapColour = new JPanel();
193 protected JPanel hiddenColour = new JPanel();
195 protected JCheckBox useLegacyGap;
197 protected JCheckBox showHiddenAtStart;
199 protected JLabel gapLabel;
202 * Connections tab components
204 protected JTable linkUrlTable = new JTable();
206 protected JButton editLink = new JButton();
208 protected JButton deleteLink = new JButton();
210 protected JTextField filterTB = new JTextField();
212 protected JButton doReset = new JButton();
214 protected JButton userOnly = new JButton();
216 protected JLabel portLabel = new JLabel();
218 protected JLabel serverLabel = new JLabel();
220 protected JTextField proxyServerTB = new JTextField();
222 protected JTextField proxyPortTB = new JTextField();
224 protected JTextField defaultBrowser = new JTextField();
226 protected JCheckBox useProxy = new JCheckBox();
228 protected JCheckBox usagestats = new JCheckBox();
230 protected JCheckBox questionnaire = new JCheckBox();
232 protected JCheckBox versioncheck = new JCheckBox();
235 * Output tab components
237 protected JComboBox<Object> epsRendering = new JComboBox<>();
239 protected JLabel userIdWidthlabel = new JLabel();
241 protected JCheckBox autoIdWidth = new JCheckBox();
243 protected JTextField userIdWidth = new JTextField();
245 protected JCheckBox blcjv = new JCheckBox();
247 protected JCheckBox pileupjv = new JCheckBox();
249 protected JCheckBox clustaljv = new JCheckBox();
251 protected JCheckBox msfjv = new JCheckBox();
253 protected JCheckBox fastajv = new JCheckBox();
255 protected JCheckBox pfamjv = new JCheckBox();
257 protected JCheckBox pirjv = new JCheckBox();
259 protected JCheckBox modellerOutput = new JCheckBox();
261 protected JCheckBox embbedBioJSON = new JCheckBox();
264 * Editing tab components
266 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
268 protected JCheckBox padGaps = new JCheckBox();
270 protected JCheckBox sortByTree = new JCheckBox();
273 * hmmer tab and components
275 protected JPanel hmmerTab = new JPanel();
277 protected JCheckBox hmmrTrimTermini = new JCheckBox();
279 protected AbstractButton hmmerBackgroundUniprot = new JCheckBox();
281 protected AbstractButton hmmerBackgroundAlignment = new JCheckBox();
283 protected JTextField hmmerSequenceCount = new JTextField();
285 protected JTextField hmmerPath = new JTextField();
290 protected JPanel dasTab = new JPanel();
295 protected JPanel wsTab = new JPanel();
300 * Creates a new GPreferences object.
302 public GPreferences()
307 } catch (Exception ex)
309 ex.printStackTrace();
314 * Construct the panel and its tabbed sub-panels.
318 private void jbInit() throws Exception
320 final JTabbedPane tabbedPane = new JTabbedPane();
321 this.setLayout(new BorderLayout());
322 JPanel okCancelPanel = initOkCancelPanel();
323 this.add(tabbedPane, BorderLayout.CENTER);
324 this.add(okCancelPanel, BorderLayout.SOUTH);
326 tabbedPane.add(initVisualTab(),
327 MessageManager.getString("label.visual"));
329 tabbedPane.add(initColoursTab(),
330 MessageManager.getString("label.colours"));
332 tabbedPane.add(initOverviewTab(),
333 MessageManager.getString("label.overview"));
335 tabbedPane.add(initStructureTab(),
336 MessageManager.getString("label.structure"));
338 tabbedPane.add(initConnectionsTab(),
339 MessageManager.getString("label.connections"));
341 tabbedPane.add(initLinksTab(),
342 MessageManager.getString("label.urllinks"));
344 tabbedPane.add(initOutputTab(),
345 MessageManager.getString("label.output"));
347 tabbedPane.add(initEditingTab(),
348 MessageManager.getString("label.editing"));
350 tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
353 * See DasSourceBrowser for the real work of configuring this tab.
355 dasTab.setLayout(new BorderLayout());
356 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
359 * See WsPreferences for the real work of configuring this tab.
361 wsTab.setLayout(new BorderLayout());
362 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
365 * Handler to validate a tab before leaving it - currently only for
368 tabbedPane.addChangeListener(new ChangeListener()
370 private Component lastTab;
373 public void stateChanged(ChangeEvent e)
375 if (lastTab == structureTab
376 && tabbedPane.getSelectedComponent() != structureTab)
378 if (!validateStructure())
380 tabbedPane.setSelectedComponent(structureTab);
384 lastTab = tabbedPane.getSelectedComponent();
391 * Initialises the Editing tabbed panel.
395 private JPanel initEditingTab()
397 JPanel editingTab = new JPanel();
398 editingTab.setLayout(null);
399 autoCalculateConsCheck.setFont(LABEL_FONT);
400 autoCalculateConsCheck.setText(
401 MessageManager.getString("label.autocalculate_consensus"));
402 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
403 padGaps.setFont(LABEL_FONT);
405 MessageManager.getString("label.pad_gaps_when_editing"));
406 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
407 sortByTree.setFont(LABEL_FONT);
409 .setText(MessageManager.getString("label.sort_with_new_tree"));
410 sortByTree.setToolTipText(MessageManager.getString(
411 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
412 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
413 editingTab.add(autoCalculateConsCheck);
414 editingTab.add(padGaps);
415 editingTab.add(sortByTree);
420 * Initialises the hmmer tabbed panel
424 private JPanel initHMMERTab()
426 hmmerTab.setLayout(null);
428 JLabel installationLocation = new JLabel(
429 MessageManager.getString("label.hmmer_location"));
430 installationLocation.setFont(LABEL_FONT);
431 installationLocation.setBounds(new Rectangle(22, 10, 250, 23));
432 hmmerPath.setBounds(new Rectangle(22, 30, 300, 23));
433 hmmerPath.addMouseListener(new MouseAdapter()
436 public void mouseClicked(MouseEvent e)
438 if (e.getClickCount() == 2)
440 String chosen = openFileChooser(true);
443 hmmerPath.setText(chosen);
449 JLabel hmmalign = new JLabel(
450 MessageManager.getString("label.hmmalign_label"));
451 hmmalign.setFont(LABEL_FONT);
452 hmmalign.setBounds(new Rectangle(22, 50, 200, 23));
454 hmmrTrimTermini.setFont(LABEL_FONT);
455 hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
456 hmmrTrimTermini.setBounds(new Rectangle(22, 70, 200, 23));
458 JLabel hmmsearch = new JLabel(
459 MessageManager.getString("label.hmmsearch_label"));
460 hmmsearch.setFont(LABEL_FONT);
461 hmmsearch.setBounds(new Rectangle(22, 90, 200, 23));
463 JLabel sequencesToKeep = new JLabel(
464 MessageManager.getString("label.no_of_sequences"));
465 sequencesToKeep.setFont(LABEL_FONT);
466 sequencesToKeep.setBounds(new Rectangle(22, 110, 125, 23));
467 hmmerSequenceCount.setBounds(new Rectangle(150, 110, 40, 23));
469 ButtonGroup backgroundFreqSource = new ButtonGroup();
470 backgroundFreqSource.add(hmmerBackgroundUniprot);
471 backgroundFreqSource.add(hmmerBackgroundAlignment);
472 backgroundFreqSource.setSelected(hmmerBackgroundUniprot.getModel(), true);
474 hmmerBackgroundUniprot.setText(MessageManager.getString("label.freq_uniprot"));
475 hmmerBackgroundUniprot.setFont(LABEL_FONT);
476 hmmerBackgroundUniprot.setBounds(new Rectangle(22, 130, 255, 23));
478 hmmerBackgroundAlignment.setText(MessageManager.getString("label.freq_alignment"));
479 hmmerBackgroundAlignment.setFont(LABEL_FONT);
480 hmmerBackgroundAlignment.setBounds(new Rectangle(22, 150, 300, 23));
482 hmmerTab.add(hmmerBackgroundUniprot);
483 hmmerTab.add(hmmerBackgroundAlignment);
484 hmmerTab.add(hmmalign);
485 hmmerTab.add(hmmsearch);
486 hmmerTab.add(installationLocation);
487 hmmerTab.add(hmmerPath);
488 hmmerTab.add(hmmrTrimTermini);
489 hmmerTab.add(sequencesToKeep);
490 hmmerTab.add(sequencesToKeep);
491 hmmerTab.add(hmmerSequenceCount);
497 * Initialises the Output tabbed panel.
501 private JPanel initOutputTab()
503 JPanel outputTab = new JPanel();
504 outputTab.setLayout(null);
505 JLabel epsLabel = new JLabel();
506 epsLabel.setFont(LABEL_FONT);
507 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
508 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
509 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
510 epsRendering.setFont(LABEL_FONT);
511 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
512 JLabel jLabel1 = new JLabel();
513 jLabel1.setFont(LABEL_FONT);
514 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
515 jLabel1.setText(MessageManager.getString("label.append_start_end"));
516 jLabel1.setFont(LABEL_FONT);
517 fastajv.setFont(LABEL_FONT);
518 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
519 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
520 blcjv.setText(MessageManager.getString("label.blc") + " ");
521 fastajv.setText(MessageManager.getString("label.fasta") + " ");
522 msfjv.setText(MessageManager.getString("label.msf") + " ");
523 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
524 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
525 msfjv.setFont(LABEL_FONT);
526 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
527 pirjv.setText(MessageManager.getString("label.pir") + " ");
528 JPanel jPanel11 = new JPanel();
529 jPanel11.setFont(LABEL_FONT);
530 TitledBorder titledBorder2 = new TitledBorder(
531 MessageManager.getString("label.file_output"));
532 jPanel11.setBorder(titledBorder2);
533 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
534 GridLayout gridLayout3 = new GridLayout();
535 jPanel11.setLayout(gridLayout3);
536 gridLayout3.setRows(8);
537 blcjv.setFont(LABEL_FONT);
538 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
539 clustaljv.setFont(LABEL_FONT);
540 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
541 pfamjv.setFont(LABEL_FONT);
542 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
543 pileupjv.setFont(LABEL_FONT);
544 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
545 pirjv.setFont(LABEL_FONT);
546 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
547 autoIdWidth.setFont(LABEL_FONT);
549 MessageManager.getString("label.automatically_set_id_width"));
550 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
551 .getString("label.adjusts_width_generated_eps_png")));
552 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
553 autoIdWidth.addActionListener(new ActionListener()
557 public void actionPerformed(ActionEvent e)
559 autoIdWidth_actionPerformed();
562 userIdWidthlabel.setFont(LABEL_FONT);
563 userIdWidthlabel.setText(
564 MessageManager.getString("label.figure_id_column_width"));
565 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
566 .getString("label.manually_specify_width_left_column")));
567 userIdWidthlabel.setToolTipText(
568 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
569 "label.manually_specify_width_left_column")));
570 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
571 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
572 userIdWidth.setText("");
573 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
574 userIdWidth.addActionListener(new ActionListener()
578 public void actionPerformed(ActionEvent e)
580 userIdWidth_actionPerformed();
583 modellerOutput.setFont(LABEL_FONT);
585 .setText(MessageManager.getString("label.use_modeller_output"));
586 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
587 embbedBioJSON.setFont(LABEL_FONT);
588 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
589 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
591 jPanel11.add(jLabel1);
593 jPanel11.add(clustaljv);
594 jPanel11.add(fastajv);
596 jPanel11.add(pfamjv);
597 jPanel11.add(pileupjv);
599 outputTab.add(autoIdWidth);
600 outputTab.add(userIdWidth);
601 outputTab.add(userIdWidthlabel);
602 outputTab.add(modellerOutput);
603 outputTab.add(embbedBioJSON);
604 outputTab.add(epsLabel);
605 outputTab.add(epsRendering);
606 outputTab.add(jPanel11);
611 * Initialises the Connections tabbed panel.
615 private JPanel initConnectionsTab()
617 JPanel connectTab = new JPanel();
618 connectTab.setLayout(new GridBagLayout());
620 // Label for browser text box
621 JLabel browserLabel = new JLabel();
622 browserLabel.setFont(LABEL_FONT);
623 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
624 browserLabel.setText(
625 MessageManager.getString("label.default_browser_unix"));
626 defaultBrowser.setFont(LABEL_FONT);
627 defaultBrowser.setText("");
629 defaultBrowser.addMouseListener(new MouseAdapter()
632 public void mouseClicked(MouseEvent e)
634 if (e.getClickCount() > 1)
636 defaultBrowser_mouseClicked(e);
641 JPanel proxyPanel = initConnTabProxyPanel();
642 initConnTabCheckboxes();
644 // Add default Browser text box
645 connectTab.add(browserLabel,
646 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
647 GridBagConstraints.WEST, GridBagConstraints.NONE,
648 new Insets(10, 0, 5, 5), 5, 1));
649 defaultBrowser.setFont(LABEL_FONT);
650 defaultBrowser.setText("");
652 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
653 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
654 new Insets(10, 0, 5, 10), 30, 1));
656 // Add proxy server panel
657 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
658 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
659 new Insets(10, 0, 5, 12), 4, 10));
661 // Add usage stats, version check and questionnaire checkboxes
662 connectTab.add(usagestats,
663 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
664 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
665 new Insets(0, 2, 5, 5), 70, 1));
666 connectTab.add(questionnaire,
667 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
668 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
669 new Insets(0, 2, 5, 10), 70, 1));
670 connectTab.add(versioncheck,
671 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
672 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
673 new Insets(0, 2, 5, 5), 70, 1));
675 // Add padding so the panel doesn't look ridiculous
676 JPanel spacePanel = new JPanel();
677 connectTab.add(spacePanel,
678 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
679 GridBagConstraints.WEST, GridBagConstraints.BOTH,
680 new Insets(0, 0, 0, 5), 70, 1));
686 * Initialises the Links tabbed panel.
690 private JPanel initLinksTab()
692 JPanel linkTab = new JPanel();
693 linkTab.setLayout(new GridBagLayout());
695 // Set up table for Url links
696 linkUrlTable.setFillsViewportHeight(true);
697 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
698 linkUrlTable.setAutoCreateRowSorter(true);
699 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
701 // adjust row height so radio buttons actually fit
702 // don't do this in the renderer, it causes the awt thread to activate
704 JRadioButton temp = new JRadioButton();
705 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
707 // Table in scrollpane so that the table is given a scrollbar
708 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
709 linkScrollPane.setBorder(null);
711 // Panel for links functionality
712 JPanel linkPanel = new JPanel(new GridBagLayout());
713 linkPanel.setBorder(new TitledBorder(
714 MessageManager.getString("label.url_linkfrom_sequence_id")));
716 // Put the Url links panel together
718 // Buttons go at top right, resizing only resizes the blank space vertically
719 JPanel buttonPanel = initLinkTabUrlButtons();
720 GridBagConstraints linkConstraints1 = new GridBagConstraints();
721 linkConstraints1.insets = new Insets(0, 0, 5, 0);
722 linkConstraints1.gridx = 0;
723 linkConstraints1.gridy = 0;
724 linkConstraints1.weightx = 1.0;
725 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
726 linkTab.add(buttonPanel, linkConstraints1);
728 // Links table goes at top left, resizing resizes the table
729 GridBagConstraints linkConstraints2 = new GridBagConstraints();
730 linkConstraints2.insets = new Insets(0, 0, 5, 5);
731 linkConstraints2.gridx = 0;
732 linkConstraints2.gridy = 1;
733 linkConstraints2.weightx = 1.0;
734 linkConstraints2.weighty = 1.0;
735 linkConstraints2.fill = GridBagConstraints.BOTH;
736 linkTab.add(linkScrollPane, linkConstraints2);
738 // Filter box and buttons goes at bottom left, resizing resizes the text box
739 JPanel filterPanel = initLinkTabFilterPanel();
740 GridBagConstraints linkConstraints3 = new GridBagConstraints();
741 linkConstraints3.insets = new Insets(0, 0, 0, 5);
742 linkConstraints3.gridx = 0;
743 linkConstraints3.gridy = 2;
744 linkConstraints3.weightx = 1.0;
745 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
746 linkTab.add(filterPanel, linkConstraints3);
751 private JPanel initLinkTabFilterPanel()
753 // Filter textbox and reset button
754 JLabel filterLabel = new JLabel(
755 MessageManager.getString("label.filter"));
756 filterLabel.setFont(LABEL_FONT);
757 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
758 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
760 filterTB.setFont(LABEL_FONT);
761 filterTB.setText("");
763 doReset.setText(MessageManager.getString("action.showall"));
764 userOnly.setText(MessageManager.getString("action.customfilter"));
766 // Panel for filter functionality
767 JPanel filterPanel = new JPanel(new GridBagLayout());
768 filterPanel.setBorder(new TitledBorder("Filter"));
769 GridBagConstraints gbc = new GridBagConstraints();
772 gbc.fill = GridBagConstraints.NONE;
773 gbc.anchor = GridBagConstraints.WEST;
775 filterPanel.add(filterLabel, gbc);
777 GridBagConstraints gbc1 = new GridBagConstraints();
780 gbc1.fill = GridBagConstraints.HORIZONTAL;
781 gbc1.anchor = GridBagConstraints.WEST;
783 filterPanel.add(filterTB, gbc1);
785 GridBagConstraints gbc2 = new GridBagConstraints();
787 gbc2.fill = GridBagConstraints.NONE;
788 gbc2.anchor = GridBagConstraints.WEST;
789 filterPanel.add(doReset, gbc2);
791 GridBagConstraints gbc3 = new GridBagConstraints();
793 gbc3.fill = GridBagConstraints.NONE;
794 gbc3.anchor = GridBagConstraints.WEST;
795 filterPanel.add(userOnly, gbc3);
800 private JPanel initLinkTabUrlButtons()
802 // Buttons for new / edit / delete Url links
803 JButton newLink = new JButton();
804 newLink.setText(MessageManager.getString("action.new"));
806 editLink.setText(MessageManager.getString("action.edit"));
808 deleteLink.setText(MessageManager.getString("action.delete"));
810 // no current selection, so initially disable delete/edit buttons
811 editLink.setEnabled(false);
812 deleteLink.setEnabled(false);
814 newLink.addActionListener(new java.awt.event.ActionListener()
817 public void actionPerformed(ActionEvent e)
819 newLink_actionPerformed(e);
823 editLink.setText(MessageManager.getString("action.edit"));
824 editLink.addActionListener(new java.awt.event.ActionListener()
827 public void actionPerformed(ActionEvent e)
829 editLink_actionPerformed(e);
833 deleteLink.setText(MessageManager.getString("action.delete"));
834 deleteLink.addActionListener(new java.awt.event.ActionListener()
837 public void actionPerformed(ActionEvent e)
839 deleteLink_actionPerformed(e);
843 JPanel buttonPanel = new JPanel(new GridBagLayout());
844 buttonPanel.setBorder(new TitledBorder("Edit links"));
845 GridBagConstraints gbc = new GridBagConstraints();
848 gbc.fill = GridBagConstraints.NONE;
849 buttonPanel.add(newLink, gbc);
851 GridBagConstraints gbc1 = new GridBagConstraints();
854 gbc1.fill = GridBagConstraints.NONE;
855 buttonPanel.add(editLink, gbc1);
857 GridBagConstraints gbc2 = new GridBagConstraints();
860 gbc2.fill = GridBagConstraints.NONE;
861 buttonPanel.add(deleteLink, gbc2);
863 GridBagConstraints gbc3 = new GridBagConstraints();
866 gbc3.fill = GridBagConstraints.HORIZONTAL;
868 JPanel spacePanel = new JPanel();
869 spacePanel.setBorder(null);
870 buttonPanel.add(spacePanel, gbc3);
876 * Initialises the proxy server panel in the Connections tab
878 * @return the proxy server panel
880 private JPanel initConnTabProxyPanel()
882 // Label for server text box
883 serverLabel.setText(MessageManager.getString("label.address"));
884 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
885 serverLabel.setFont(LABEL_FONT);
887 // Proxy server and port text boxes
888 proxyServerTB.setFont(LABEL_FONT);
889 proxyPortTB.setFont(LABEL_FONT);
891 // Label for Port text box
892 portLabel.setFont(LABEL_FONT);
893 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
894 portLabel.setText(MessageManager.getString("label.port"));
896 // Use proxy server checkbox
897 useProxy.setFont(LABEL_FONT);
898 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
899 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
900 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
901 useProxy.addActionListener(new ActionListener()
904 public void actionPerformed(ActionEvent e)
906 useProxy_actionPerformed();
910 // Make proxy server panel
911 JPanel proxyPanel = new JPanel();
912 TitledBorder titledBorder1 = new TitledBorder(
913 MessageManager.getString("label.proxy_server"));
914 proxyPanel.setBorder(titledBorder1);
915 proxyPanel.setLayout(new GridBagLayout());
916 proxyPanel.add(serverLabel,
917 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
918 GridBagConstraints.WEST, GridBagConstraints.NONE,
919 new Insets(0, 2, 2, 0), 5, 0));
920 proxyPanel.add(portLabel,
921 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
922 GridBagConstraints.WEST, GridBagConstraints.NONE,
923 new Insets(0, 0, 2, 0), 11, 0));
924 proxyPanel.add(useProxy,
925 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
926 GridBagConstraints.WEST, GridBagConstraints.NONE,
927 new Insets(0, 2, 5, 185), 2, -4));
928 proxyPanel.add(proxyPortTB,
929 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
930 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
931 new Insets(0, 2, 2, 2), 54, 1));
932 proxyPanel.add(proxyServerTB,
933 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
934 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
935 new Insets(0, 2, 2, 0), 263, 1));
941 * Initialises the checkboxes in the Connections tab
943 private void initConnTabCheckboxes()
945 // Usage stats checkbox label
947 MessageManager.getString("label.send_usage_statistics"));
948 usagestats.setFont(LABEL_FONT);
949 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
950 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
952 // Questionnaire checkbox label
953 questionnaire.setText(
954 MessageManager.getString("label.check_for_questionnaires"));
955 questionnaire.setFont(LABEL_FONT);
956 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
957 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
959 // Check for latest version checkbox label
960 versioncheck.setText(
961 MessageManager.getString("label.check_for_latest_version"));
962 versioncheck.setFont(LABEL_FONT);
963 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
964 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
968 * Initialises the parent panel which contains the tabbed sections.
972 private JPanel initOkCancelPanel()
974 JButton ok = new JButton();
975 ok.setText(MessageManager.getString("action.ok"));
976 ok.addActionListener(new ActionListener()
979 public void actionPerformed(ActionEvent e)
981 ok_actionPerformed(e);
984 JButton cancel = new JButton();
985 cancel.setText(MessageManager.getString("action.cancel"));
986 cancel.addActionListener(new ActionListener()
989 public void actionPerformed(ActionEvent e)
991 cancel_actionPerformed(e);
994 JPanel okCancelPanel = new JPanel();
995 okCancelPanel.add(ok);
996 okCancelPanel.add(cancel);
997 return okCancelPanel;
1001 * Initialises the Colours tabbed panel.
1005 private JPanel initColoursTab()
1007 JPanel coloursTab = new JPanel();
1008 coloursTab.setBorder(new TitledBorder(
1009 MessageManager.getString("action.open_new_alignment")));
1010 coloursTab.setLayout(new FlowLayout());
1011 JLabel mincolourLabel = new JLabel();
1012 mincolourLabel.setFont(LABEL_FONT);
1013 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1014 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1015 minColour.setFont(LABEL_FONT);
1016 minColour.setBorder(BorderFactory.createEtchedBorder());
1017 minColour.setPreferredSize(new Dimension(40, 20));
1018 minColour.addMouseListener(new MouseAdapter()
1021 public void mousePressed(MouseEvent e)
1023 minColour_actionPerformed(minColour);
1026 JLabel maxcolourLabel = new JLabel();
1027 maxcolourLabel.setFont(LABEL_FONT);
1028 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1029 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1030 maxColour.setFont(LABEL_FONT);
1031 maxColour.setBorder(BorderFactory.createEtchedBorder());
1032 maxColour.setPreferredSize(new Dimension(40, 20));
1033 maxColour.addMouseListener(new MouseAdapter()
1036 public void mousePressed(MouseEvent e)
1038 maxColour_actionPerformed(maxColour);
1042 protColour.setFont(LABEL_FONT);
1043 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1044 JLabel protColourLabel = new JLabel();
1045 protColourLabel.setFont(LABEL_FONT);
1046 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1047 protColourLabel.setText(
1048 MessageManager.getString("label.prot_alignment_colour") + " ");
1049 JvSwingUtils.addtoLayout(coloursTab,
1051 .getString("label.default_colour_scheme_for_alignment"),
1052 protColourLabel, protColour);
1054 nucColour.setFont(LABEL_FONT);
1055 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1056 JLabel nucColourLabel = new JLabel();
1057 nucColourLabel.setFont(LABEL_FONT);
1058 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1059 nucColourLabel.setText(
1060 MessageManager.getString("label.nuc_alignment_colour") + " ");
1061 JvSwingUtils.addtoLayout(coloursTab,
1063 .getString("label.default_colour_scheme_for_alignment"),
1064 nucColourLabel, nucColour);
1066 JPanel annotationShding = new JPanel();
1067 annotationShding.setBorder(new TitledBorder(
1068 MessageManager.getString("label.annotation_shading_default")));
1069 annotationShding.setLayout(new GridLayout(1, 2));
1070 JvSwingUtils.addtoLayout(annotationShding,
1071 MessageManager.getString(
1072 "label.default_minimum_colour_annotation_shading"),
1073 mincolourLabel, minColour);
1074 JvSwingUtils.addtoLayout(annotationShding,
1075 MessageManager.getString(
1076 "label.default_maximum_colour_annotation_shading"),
1077 maxcolourLabel, maxColour);
1078 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1083 * Initialises the Overview tabbed panel.
1087 private JPanel initOverviewTab()
1089 JPanel overviewPanel = new JPanel();
1090 overviewPanel.setBorder(new TitledBorder(
1091 MessageManager.getString("label.overview_settings")));
1093 gapColour.setFont(LABEL_FONT);
1094 // fixing the border colours stops apparent colour bleed from the panel
1095 gapColour.setBorder(
1096 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1097 gapColour.setPreferredSize(new Dimension(40, 20));
1098 gapColour.addMouseListener(new MouseAdapter()
1101 public void mousePressed(MouseEvent e)
1103 gapColour_actionPerformed(gapColour);
1107 hiddenColour.setFont(LABEL_FONT);
1108 // fixing the border colours stops apparent colour bleed from the panel
1109 hiddenColour.setBorder(
1110 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1111 hiddenColour.setPreferredSize(new Dimension(40, 20));
1112 hiddenColour.addMouseListener(new MouseAdapter()
1115 public void mousePressed(MouseEvent e)
1117 hiddenColour_actionPerformed(hiddenColour);
1121 useLegacyGap = new JCheckBox(
1122 MessageManager.getString("label.ov_legacy_gap"));
1123 useLegacyGap.setFont(LABEL_FONT);
1124 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1125 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1126 gapLabel = new JLabel(
1127 MessageManager.getString("label.gap_colour"));
1128 gapLabel.setFont(LABEL_FONT);
1129 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1130 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1131 showHiddenAtStart = new JCheckBox(
1132 MessageManager.getString("label.ov_show_hide_default"));
1133 showHiddenAtStart.setFont(LABEL_FONT);
1134 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1135 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1136 JLabel hiddenLabel = new JLabel(
1137 MessageManager.getString("label.hidden_colour"));
1138 hiddenLabel.setFont(LABEL_FONT);
1139 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1140 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1142 useLegacyGap.addActionListener(new ActionListener()
1145 public void actionPerformed(ActionEvent e)
1147 useLegacyGaps_actionPerformed(e);
1151 overviewPanel.setLayout(new GridBagLayout());
1152 GridBagConstraints c1 = new GridBagConstraints();
1154 c1.fill = GridBagConstraints.HORIZONTAL;
1159 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1160 overviewPanel.add(useLegacyGap, c1);
1162 GridBagConstraints c2 = new GridBagConstraints();
1163 c2.fill = GridBagConstraints.HORIZONTAL;
1166 c2.insets = new Insets(0, 15, 0, 10);
1167 overviewPanel.add(gapLabel, c2);
1169 GridBagConstraints c3 = new GridBagConstraints();
1170 c3.fill = GridBagConstraints.HORIZONTAL;
1173 c3.insets = new Insets(0, 0, 0, 15);
1174 overviewPanel.add(gapColour, c3);
1176 GridBagConstraints c4 = new GridBagConstraints();
1177 c4.fill = GridBagConstraints.HORIZONTAL;
1181 overviewPanel.add(showHiddenAtStart, c4);
1183 GridBagConstraints c5 = new GridBagConstraints();
1184 c5.fill = GridBagConstraints.HORIZONTAL;
1187 c5.insets = new Insets(0, 15, 0, 10);
1188 overviewPanel.add(hiddenLabel, c5);
1190 GridBagConstraints c6 = new GridBagConstraints();
1191 c6.fill = GridBagConstraints.HORIZONTAL;
1194 c6.insets = new Insets(0, 0, 0, 15);
1195 overviewPanel.add(hiddenColour, c6);
1197 JButton resetButton = new JButton(
1198 MessageManager.getString("label.reset_to_defaults"));
1200 resetButton.addActionListener(new ActionListener()
1203 public void actionPerformed(ActionEvent e)
1205 resetOvDefaults_actionPerformed(e);
1209 GridBagConstraints c7 = new GridBagConstraints();
1210 c7.fill = GridBagConstraints.NONE;
1213 c7.insets = new Insets(10, 0, 0, 0);
1214 c7.anchor = GridBagConstraints.WEST;
1215 overviewPanel.add(resetButton, c7);
1217 // Add padding so the panel doesn't look ridiculous
1218 JPanel spacePanel = new JPanel();
1219 overviewPanel.add(spacePanel,
1220 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1221 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1222 new Insets(0, 0, 0, 5), 0, 0));
1224 return overviewPanel;
1228 * Initialises the Structure tabbed panel.
1232 private JPanel initStructureTab()
1234 structureTab = new JPanel();
1236 structureTab.setBorder(new TitledBorder(
1237 MessageManager.getString("label.structure_options")));
1238 structureTab.setLayout(null);
1239 final int width = 400;
1240 final int height = 22;
1241 final int lineSpacing = 25;
1244 structFromPdb.setFont(LABEL_FONT);
1246 .setText(MessageManager.getString("label.struct_from_pdb"));
1247 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1248 structFromPdb.addActionListener(new ActionListener()
1251 public void actionPerformed(ActionEvent e)
1253 boolean selected = structFromPdb.isSelected();
1254 // enable other options only when the first is checked
1255 useRnaView.setEnabled(selected);
1256 addSecondaryStructure.setEnabled(selected);
1257 addTempFactor.setEnabled(selected);
1260 structureTab.add(structFromPdb);
1262 // indent checkboxes that are conditional on the first one
1263 ypos += lineSpacing;
1264 useRnaView.setFont(LABEL_FONT);
1265 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1266 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1267 structureTab.add(useRnaView);
1269 ypos += lineSpacing;
1270 addSecondaryStructure.setFont(LABEL_FONT);
1271 addSecondaryStructure
1272 .setText(MessageManager.getString("label.autoadd_secstr"));
1273 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1274 structureTab.add(addSecondaryStructure);
1276 ypos += lineSpacing;
1277 addTempFactor.setFont(LABEL_FONT);
1278 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1279 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1280 structureTab.add(addTempFactor);
1282 ypos += lineSpacing;
1283 JLabel viewerLabel = new JLabel();
1284 viewerLabel.setFont(LABEL_FONT);
1285 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1286 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1287 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1288 structureTab.add(viewerLabel);
1290 structViewer.setFont(LABEL_FONT);
1291 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1292 structViewer.addItem(ViewerType.JMOL.name());
1293 structViewer.addItem(ViewerType.CHIMERA.name());
1294 structViewer.addActionListener(new ActionListener()
1297 public void actionPerformed(ActionEvent e)
1299 structureViewer_actionPerformed(
1300 (String) structViewer.getSelectedItem());
1303 structureTab.add(structViewer);
1305 ypos += lineSpacing;
1306 JLabel pathLabel = new JLabel();
1307 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1308 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1309 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1310 final String tooltip = JvSwingUtils.wrapTooltip(true,
1311 MessageManager.getString("label.chimera_path_tip"));
1312 pathLabel.setToolTipText(tooltip);
1313 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1314 structureTab.add(pathLabel);
1316 chimeraPath.setFont(LABEL_FONT);
1317 chimeraPath.setText("");
1318 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1319 chimeraPath.addMouseListener(new MouseAdapter()
1322 public void mouseClicked(MouseEvent e)
1324 if (e.getClickCount() == 2)
1326 String chosen = openFileChooser(false);
1329 chimeraPath.setText(chosen);
1334 structureTab.add(chimeraPath);
1336 ypos += lineSpacing;
1337 nwMapping.setFont(LABEL_FONT);
1338 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1339 siftsMapping.setFont(LABEL_FONT);
1340 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1341 mappingMethod.add(nwMapping);
1342 mappingMethod.add(siftsMapping);
1343 JPanel mappingPanel = new JPanel();
1344 mappingPanel.setFont(LABEL_FONT);
1345 TitledBorder mmTitledBorder = new TitledBorder(
1346 MessageManager.getString("label.mapping_method"));
1347 mmTitledBorder.setTitleFont(LABEL_FONT);
1348 mappingPanel.setBorder(mmTitledBorder);
1349 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1350 // GridLayout mappingLayout = new GridLayout();
1351 mappingPanel.setLayout(new GridLayout());
1352 mappingPanel.add(nwMapping);
1353 mappingPanel.add(siftsMapping);
1354 structureTab.add(mappingPanel);
1356 ypos += lineSpacing;
1357 ypos += lineSpacing;
1358 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1359 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1360 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1361 structureTab.add(docFieldPref);
1363 return structureTab;
1367 * Action on choosing a structure viewer from combobox options.
1369 * @param selectedItem
1371 protected void structureViewer_actionPerformed(String selectedItem)
1376 * Show a dialog for the user to choose a file. Returns the chosen path, or
1381 protected String openFileChooser(boolean forFolder)
1383 String choice = null;
1384 JFileChooser chooser = new JFileChooser();
1387 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1390 // chooser.setFileView(new JalviewFileView());
1391 chooser.setDialogTitle(
1392 MessageManager.getString("label.open_local_file"));
1393 chooser.setToolTipText(MessageManager.getString("action.open"));
1395 int value = chooser.showOpenDialog(this);
1397 if (value == JFileChooser.APPROVE_OPTION)
1399 choice = chooser.getSelectedFile().getPath();
1404 protected boolean validateStructure()
1409 protected boolean validateHMMERPath(boolean showWarning)
1415 * Initialises the Visual tabbed panel.
1419 private JPanel initVisualTab()
1421 JPanel visualTab = new JPanel();
1422 visualTab.setBorder(new TitledBorder(
1423 MessageManager.getString("action.open_new_alignment")));
1424 visualTab.setLayout(null);
1425 fullScreen.setFont(LABEL_FONT);
1426 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1427 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1428 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1429 quality.setEnabled(false);
1430 quality.setFont(LABEL_FONT);
1431 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1432 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1433 quality.setSelected(true);
1434 quality.setText(MessageManager.getString("label.quality"));
1435 conservation.setEnabled(false);
1436 conservation.setFont(LABEL_FONT);
1437 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1438 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1439 conservation.setSelected(true);
1440 conservation.setText(MessageManager.getString("label.conservation"));
1441 identity.setEnabled(false);
1442 identity.setFont(LABEL_FONT);
1443 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1444 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1445 identity.setSelected(true);
1446 identity.setText(MessageManager.getString("label.consensus"));
1447 showOccupancy.setFont(LABEL_FONT);
1448 showOccupancy.setEnabled(false);
1449 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1450 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1451 showOccupancy.setSelected(true);
1452 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1454 JLabel showGroupbits = new JLabel();
1455 showGroupbits.setFont(LABEL_FONT);
1456 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1457 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1459 .setText(MessageManager.getString("action.show_group") + ":");
1460 JLabel showConsensbits = new JLabel();
1461 showConsensbits.setFont(LABEL_FONT);
1462 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1463 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1465 .setText(MessageManager.getString("label.consensus") + ":");
1466 showConsensHistogram.setEnabled(false);
1467 showConsensHistogram.setFont(LABEL_FONT);
1468 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1469 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1470 showConsensHistogram.setSelected(true);
1471 showConsensHistogram
1472 .setText(MessageManager.getString("label.histogram"));
1473 showConsensLogo.setEnabled(false);
1474 showConsensLogo.setFont(LABEL_FONT);
1475 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1476 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1477 showConsensLogo.setSelected(true);
1478 showConsensLogo.setText(MessageManager.getString("label.logo"));
1479 showGroupConsensus.setEnabled(false);
1480 showGroupConsensus.setFont(LABEL_FONT);
1481 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1482 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1483 showGroupConsensus.setSelected(true);
1484 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1485 showGroupConservation.setEnabled(false);
1486 showGroupConservation.setFont(LABEL_FONT);
1487 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1488 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1489 showGroupConservation.setSelected(true);
1490 showGroupConservation
1491 .setText(MessageManager.getString("label.conservation"));
1492 showNpTooltip.setEnabled(true);
1493 showNpTooltip.setFont(LABEL_FONT);
1494 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1495 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1496 showNpTooltip.setSelected(true);
1497 showNpTooltip.setText(
1498 MessageManager.getString("label.non_positional_features"));
1499 showDbRefTooltip.setEnabled(true);
1500 showDbRefTooltip.setFont(LABEL_FONT);
1501 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1502 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1503 showDbRefTooltip.setSelected(true);
1505 .setText(MessageManager.getString("label.database_references"));
1506 annotations.setFont(LABEL_FONT);
1507 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1508 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1509 annotations.setSelected(true);
1510 annotations.setText(MessageManager.getString("label.show_annotations"));
1511 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1512 annotations.addActionListener(new ActionListener()
1515 public void actionPerformed(ActionEvent e)
1517 annotations_actionPerformed(e);
1520 identity.addActionListener(new ActionListener()
1523 public void actionPerformed(ActionEvent e)
1525 annotations_actionPerformed(e);
1528 showGroupConsensus.addActionListener(new ActionListener()
1531 public void actionPerformed(ActionEvent e)
1533 annotations_actionPerformed(e);
1536 showUnconserved.setFont(LABEL_FONT);
1537 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1538 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1539 showUnconserved.setSelected(true);
1541 .setText(MessageManager.getString("action.show_unconserved"));
1542 showUnconserved.addActionListener(new ActionListener()
1545 public void actionPerformed(ActionEvent e)
1547 showunconserved_actionPerformed(e);
1551 // TODO these are not yet added to / action from Preferences
1552 // JCheckBox shareSelections = new JCheckBox();
1553 // shareSelections.setFont(verdana11);
1554 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1555 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1556 // shareSelections.setSelected(true);
1557 // shareSelections.setText(MessageManager
1558 // .getString("label.share_selection_across_views"));
1559 // JCheckBox followHighlight = new JCheckBox();
1560 // followHighlight.setFont(verdana11);
1561 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1562 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1563 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1564 // followHighlight.setSelected(true);
1565 // followHighlight.setText(MessageManager
1566 // .getString("label.scroll_highlighted_regions"));
1568 seqLimit.setFont(LABEL_FONT);
1569 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1570 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1571 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1572 smoothFont.setFont(LABEL_FONT);
1573 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1574 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1575 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1576 scaleProteinToCdna.setFont(LABEL_FONT);
1577 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1578 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1579 scaleProteinToCdna.setText(
1580 MessageManager.getString("label.scale_protein_to_cdna"));
1581 scaleProteinToCdna.setToolTipText(
1582 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1583 JLabel gapLabel = new JLabel();
1584 gapLabel.setFont(LABEL_FONT);
1585 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1586 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1587 JLabel fontLabel = new JLabel();
1588 fontLabel.setFont(LABEL_FONT);
1589 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1590 fontLabel.setText(MessageManager.getString("label.font"));
1591 fontSizeCB.setFont(LABEL_FONT);
1592 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1593 fontStyleCB.setFont(LABEL_FONT);
1594 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1595 fontNameCB.setFont(LABEL_FONT);
1596 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1597 gapSymbolCB.setFont(LABEL_FONT);
1598 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1599 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1600 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1601 gapSymbolCB.setRenderer(dlcr);
1603 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1604 startupCheckbox.setFont(LABEL_FONT);
1605 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1606 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1607 startupCheckbox.setSelected(true);
1608 startupFileTextfield.setFont(LABEL_FONT);
1609 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1610 startupFileTextfield.addMouseListener(new MouseAdapter()
1613 public void mouseClicked(MouseEvent e)
1615 if (e.getClickCount() > 1)
1617 startupFileTextfield_mouseClicked();
1622 sortby.setFont(LABEL_FONT);
1623 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1624 JLabel sortLabel = new JLabel();
1625 sortLabel.setFont(LABEL_FONT);
1626 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1627 sortLabel.setText(MessageManager.getString("label.sort_by"));
1628 sortAnnBy.setFont(LABEL_FONT);
1629 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1630 JLabel sortAnnLabel = new JLabel();
1631 sortAnnLabel.setFont(LABEL_FONT);
1632 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1633 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1634 sortAutocalc.setFont(LABEL_FONT);
1635 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1637 JPanel annsettingsPanel = new JPanel();
1638 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1639 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1640 annsettingsPanel.setBorder(new EtchedBorder());
1641 visualTab.add(annsettingsPanel);
1642 Border jb = new EmptyBorder(1, 1, 4, 5);
1643 annotations.setBorder(jb);
1644 showOccupancy.setBorder(jb);
1645 quality.setBorder(jb);
1646 conservation.setBorder(jb);
1647 identity.setBorder(jb);
1648 showConsensbits.setBorder(jb);
1649 showGroupbits.setBorder(jb);
1650 showGroupConsensus.setBorder(jb);
1651 showGroupConservation.setBorder(jb);
1652 showConsensHistogram.setBorder(jb);
1653 showConsensLogo.setBorder(jb);
1655 JPanel autoAnnotSettings = new JPanel();
1656 annsettingsPanel.add(autoAnnotSettings);
1657 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1658 autoAnnotSettings.add(annotations);
1659 autoAnnotSettings.add(quality);
1660 // second row of autoannotation box
1661 autoAnnotSettings = new JPanel();
1662 annsettingsPanel.add(autoAnnotSettings);
1664 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1665 autoAnnotSettings.add(conservation);
1666 autoAnnotSettings.add(identity);
1667 autoAnnotSettings.add(showOccupancy);
1668 autoAnnotSettings.add(showGroupbits);
1669 autoAnnotSettings.add(showGroupConservation);
1670 autoAnnotSettings.add(showGroupConsensus);
1671 autoAnnotSettings.add(showConsensbits);
1672 autoAnnotSettings.add(showConsensHistogram);
1673 autoAnnotSettings.add(showConsensLogo);
1675 JPanel tooltipSettings = new JPanel();
1676 tooltipSettings.setBorder(new TitledBorder(
1677 MessageManager.getString("label.sequence_id_tooltip")));
1678 tooltipSettings.setBounds(173, 140, 220, 62);
1679 tooltipSettings.setLayout(new GridLayout(2, 1));
1680 tooltipSettings.add(showDbRefTooltip);
1681 tooltipSettings.add(showNpTooltip);
1682 visualTab.add(tooltipSettings);
1684 wrap.setFont(LABEL_FONT);
1685 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1686 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1687 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1688 rightAlign.setFont(LABEL_FONT);
1689 rightAlign.setForeground(Color.black);
1690 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1691 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1692 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1693 idItalics.setFont(LABEL_FONT_ITALIC);
1694 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1695 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1697 MessageManager.getString("label.sequence_name_italics"));
1698 openoverv.setFont(LABEL_FONT);
1699 openoverv.setActionCommand(
1700 MessageManager.getString("label.open_overview"));
1701 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1702 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1703 openoverv.setText(MessageManager.getString("label.open_overview"));
1704 JPanel jPanel2 = new JPanel();
1705 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1706 jPanel2.setLayout(new GridLayout(14, 1));
1707 jPanel2.add(fullScreen);
1708 jPanel2.add(openoverv);
1709 jPanel2.add(seqLimit);
1710 jPanel2.add(rightAlign);
1711 jPanel2.add(fontLabel);
1712 jPanel2.add(showUnconserved);
1713 jPanel2.add(idItalics);
1714 jPanel2.add(smoothFont);
1715 jPanel2.add(scaleProteinToCdna);
1716 jPanel2.add(gapLabel);
1718 jPanel2.add(sortLabel);
1719 jPanel2.add(sortAnnLabel);
1720 jPanel2.add(startupCheckbox);
1721 visualTab.add(jPanel2);
1722 visualTab.add(startupFileTextfield);
1723 visualTab.add(sortby);
1724 visualTab.add(sortAnnBy);
1725 visualTab.add(sortAutocalc);
1726 visualTab.add(gapSymbolCB);
1727 visualTab.add(fontNameCB);
1728 visualTab.add(fontSizeCB);
1729 visualTab.add(fontStyleCB);
1733 protected void autoIdWidth_actionPerformed()
1735 // TODO Auto-generated method stub
1739 protected void userIdWidth_actionPerformed()
1741 // TODO Auto-generated method stub
1745 protected void maxColour_actionPerformed(JPanel panel)
1749 protected void minColour_actionPerformed(JPanel panel)
1753 protected void gapColour_actionPerformed(JPanel panel)
1757 protected void hiddenColour_actionPerformed(JPanel panel)
1761 protected void showunconserved_actionPerformed(ActionEvent e)
1763 // TODO Auto-generated method stub
1767 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1771 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1781 public void ok_actionPerformed(ActionEvent e)
1791 public void cancel_actionPerformed(ActionEvent e)
1801 public void annotations_actionPerformed(ActionEvent e)
1808 public void startupFileTextfield_mouseClicked()
1812 public void newLink_actionPerformed(ActionEvent e)
1817 public void editLink_actionPerformed(ActionEvent e)
1822 public void deleteLink_actionPerformed(ActionEvent e)
1827 public void defaultBrowser_mouseClicked(MouseEvent e)
1832 public void linkURLList_keyTyped(KeyEvent e)
1837 public void useProxy_actionPerformed()
1839 boolean enabled = useProxy.isSelected();
1840 portLabel.setEnabled(enabled);
1841 serverLabel.setEnabled(enabled);
1842 proxyServerTB.setEnabled(enabled);
1843 proxyPortTB.setEnabled(enabled);
1847 * Customer renderer for JTable: supports column of radio buttons
1849 public class RadioButtonRenderer extends JRadioButton
1850 implements TableCellRenderer
1852 public RadioButtonRenderer()
1854 setHorizontalAlignment(CENTER);
1855 setToolTipText(MessageManager.getString("label.urltooltip"));
1859 public Component getTableCellRendererComponent(JTable table,
1860 Object value, boolean isSelected, boolean hasFocus, int row,
1863 setSelected((boolean) value);
1865 // set colours to match rest of table
1868 setBackground(table.getSelectionBackground());
1869 setForeground(table.getSelectionForeground());
1873 setBackground(table.getBackground());
1874 setForeground(table.getForeground());
1881 * Customer cell editor for JTable: supports column of radio buttons in
1882 * conjunction with renderer
1884 public class RadioButtonEditor extends AbstractCellEditor
1885 implements TableCellEditor
1887 private JRadioButton button = new JRadioButton();
1889 public RadioButtonEditor()
1891 button.setHorizontalAlignment(SwingConstants.CENTER);
1892 this.button.addActionListener(new ActionListener()
1895 public void actionPerformed(ActionEvent e)
1897 fireEditingStopped();
1903 public Component getTableCellEditorComponent(JTable table, Object value,
1904 boolean isSelected, int row, int column)
1906 button.setSelected((boolean) value);
1911 public Object getCellEditorValue()
1913 return button.isSelected();
1918 public void hmmerPath_actionPerformed(ActionEvent e)