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.FocusEvent;
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.getLabelFont(
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 * Connections tab components
192 protected JTable linkUrlTable = new JTable();
194 protected JButton editLink = new JButton();
196 protected JButton deleteLink = new JButton();
198 protected JTextField filterTB = new JTextField();
200 protected JButton doReset = new JButton();
202 protected JButton userOnly = new JButton();
204 protected JLabel portLabel = new JLabel();
206 protected JLabel serverLabel = new JLabel();
208 protected JTextField proxyServerTB = new JTextField();
210 protected JTextField proxyPortTB = new JTextField();
212 protected JTextField defaultBrowser = new JTextField();
214 protected JCheckBox useProxy = new JCheckBox();
216 protected JCheckBox usagestats = new JCheckBox();
218 protected JCheckBox questionnaire = new JCheckBox();
220 protected JCheckBox versioncheck = new JCheckBox();
223 * Output tab components
225 protected JComboBox<Object> epsRendering = new JComboBox<>();
227 protected JLabel userIdWidthlabel = new JLabel();
229 protected JCheckBox autoIdWidth = new JCheckBox();
231 protected JTextField userIdWidth = new JTextField();
233 protected JCheckBox blcjv = new JCheckBox();
235 protected JCheckBox pileupjv = new JCheckBox();
237 protected JCheckBox clustaljv = new JCheckBox();
239 protected JCheckBox msfjv = new JCheckBox();
241 protected JCheckBox fastajv = new JCheckBox();
243 protected JCheckBox pfamjv = new JCheckBox();
245 protected JCheckBox pirjv = new JCheckBox();
247 protected JCheckBox modellerOutput = new JCheckBox();
249 protected JCheckBox embbedBioJSON = new JCheckBox();
252 * Editing tab components
254 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
256 protected JCheckBox padGaps = new JCheckBox();
258 protected JCheckBox sortByTree = new JCheckBox();
261 * hmmer tab and components
263 protected JPanel hmmerTab = new JPanel();
265 protected JCheckBox trimTermini = new JCheckBox();
267 protected ButtonGroup backgroundFreqSource = new ButtonGroup();
269 protected AbstractButton uniprot = new JCheckBox();
271 protected AbstractButton alignment = new JCheckBox();
273 protected JLabel sequencesToKeep = new JLabel();
275 protected JTextField numberOfSequencesToKeepField = new JTextField();
277 protected JLabel installationLocation = new JLabel();
279 protected JTextField hmmerPath = new JTextField();
281 protected JLabel hmmsearch = new JLabel();
283 protected JLabel hmmalign = new JLabel();
288 protected JPanel dasTab = new JPanel();
293 protected JPanel wsTab = new JPanel();
298 * Creates a new GPreferences object.
300 public GPreferences()
305 } catch (Exception ex)
307 ex.printStackTrace();
312 * Construct the panel and its tabbed sub-panels.
316 private void jbInit() throws Exception
318 final JTabbedPane tabbedPane = new JTabbedPane();
319 this.setLayout(new BorderLayout());
320 JPanel okCancelPanel = initOkCancelPanel();
321 this.add(tabbedPane, BorderLayout.CENTER);
322 this.add(okCancelPanel, BorderLayout.SOUTH);
324 tabbedPane.add(initVisualTab(),
325 MessageManager.getString("label.visual"));
327 tabbedPane.add(initColoursTab(),
328 MessageManager.getString("label.colours"));
330 tabbedPane.add(initStructureTab(),
331 MessageManager.getString("label.structure"));
333 tabbedPane.add(initConnectionsTab(),
334 MessageManager.getString("label.connections"));
336 tabbedPane.add(initLinksTab(),
337 MessageManager.getString("label.urllinks"));
339 tabbedPane.add(initOutputTab(),
340 MessageManager.getString("label.output"));
342 tabbedPane.add(initEditingTab(),
343 MessageManager.getString("label.editing"));
345 tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
348 * See DasSourceBrowser for the real work of configuring this tab.
350 dasTab.setLayout(new BorderLayout());
351 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
354 * See WsPreferences for the real work of configuring this tab.
356 wsTab.setLayout(new BorderLayout());
357 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
360 * Handler to validate a tab before leaving it - currently only for
363 tabbedPane.addChangeListener(new ChangeListener()
365 private Component lastTab;
368 public void stateChanged(ChangeEvent e)
370 if (lastTab == structureTab
371 && tabbedPane.getSelectedComponent() != structureTab)
373 if (!validateStructure())
375 tabbedPane.setSelectedComponent(structureTab);
379 else if (lastTab == hmmerTab
380 && tabbedPane.getSelectedComponent() != hmmerTab)
382 if (!validateHMMER())
384 tabbedPane.setSelectedComponent(hmmerTab);
388 lastTab = tabbedPane.getSelectedComponent();
395 * Initialises the Editing tabbed panel.
399 private JPanel initEditingTab()
401 JPanel editingTab = new JPanel();
402 editingTab.setLayout(null);
403 autoCalculateConsCheck.setFont(LABEL_FONT);
404 autoCalculateConsCheck.setText(MessageManager
405 .getString("label.autocalculate_consensus"));
406 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
407 padGaps.setFont(LABEL_FONT);
408 padGaps.setText(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"));
414 .setToolTipText(MessageManager
415 .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
416 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
417 editingTab.add(autoCalculateConsCheck);
418 editingTab.add(padGaps);
419 editingTab.add(sortByTree);
424 * Initialises the hmmer tabbed panel.
428 private JPanel initHMMERTab()
430 JPanel hmmerTab = new JPanel();
431 hmmerTab.setLayout(null);
433 hmmalign.setFont(LABEL_FONT);
434 hmmalign.setText(MessageManager.getString("label.hmmalign_label"));
435 hmmalign.setBounds(new Rectangle(22, 10, 200, 23));
437 trimTermini.setFont(LABEL_FONT);
438 trimTermini.setText(MessageManager.getString("label.trim_termini"));
439 trimTermini.setBounds(new Rectangle(22, 30, 200, 23));
441 hmmsearch.setFont(LABEL_FONT);
442 hmmsearch.setText(MessageManager.getString("label.hmmsearch_label"));
443 hmmsearch.setBounds(new Rectangle(250, 10, 200, 23));
445 sequencesToKeep.setFont(LABEL_FONT);
447 .setText(MessageManager.getString("label.no_of_sequences"));
448 sequencesToKeep.setBounds(new Rectangle(250, 30, 125, 23));
449 numberOfSequencesToKeepField.setBounds(new Rectangle(375, 30, 40, 23));
451 installationLocation.setFont(LABEL_FONT);
452 installationLocation.setText(
453 MessageManager.getString("label.change_hmmer_location"));
454 installationLocation.setBounds(new Rectangle(22, 200, 200, 23));
455 hmmerPath.setBounds(new Rectangle(22, 220, 200, 23));
456 hmmerPath.addMouseListener(new MouseAdapter()
459 public void mouseClicked(MouseEvent e)
461 if (e.getClickCount() == 2)
463 String chosen = openFileChooser();
466 hmmerPath.setText(chosen);
472 backgroundFreqSource.add(uniprot);
473 backgroundFreqSource.add(alignment);
474 backgroundFreqSource.setSelected(uniprot.getModel(), true);
476 uniprot.setText(MessageManager.getString("label.freq_uniprot"));
477 uniprot.setFont(LABEL_FONT);
478 uniprot.setBounds(new Rectangle(22, 260, 255, 23));
480 alignment.setText(MessageManager.getString("label.freq_alignment"));
481 alignment.setFont(LABEL_FONT);
482 alignment.setBounds(new Rectangle(22, 280, 255, 23));
484 hmmerTab.add(uniprot);
485 hmmerTab.add(alignment);
486 hmmerTab.add(hmmalign);
487 hmmerTab.add(hmmsearch);
488 hmmerTab.add(installationLocation);
489 hmmerTab.add(hmmerPath);
490 hmmerTab.add(trimTermini);
491 hmmerTab.add(sequencesToKeep);
492 hmmerTab.add(sequencesToKeep);
493 hmmerTab.add(numberOfSequencesToKeepField);
498 * Initialises the Output tabbed panel.
502 private JPanel initOutputTab()
504 JPanel outputTab = new JPanel();
505 outputTab.setLayout(null);
506 JLabel epsLabel = new JLabel();
507 epsLabel.setFont(LABEL_FONT);
508 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
509 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
510 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
511 epsRendering.setFont(LABEL_FONT);
512 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
513 JLabel jLabel1 = new JLabel();
514 jLabel1.setFont(LABEL_FONT);
515 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
516 jLabel1.setText(MessageManager.getString("label.append_start_end"));
517 jLabel1.setFont(LABEL_FONT);
518 fastajv.setFont(LABEL_FONT);
519 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
520 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
521 blcjv.setText(MessageManager.getString("label.blc") + " ");
522 fastajv.setText(MessageManager.getString("label.fasta") + " ");
523 msfjv.setText(MessageManager.getString("label.msf") + " ");
524 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
525 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
526 msfjv.setFont(LABEL_FONT);
527 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
528 pirjv.setText(MessageManager.getString("label.pir") + " ");
529 JPanel jPanel11 = new JPanel();
530 jPanel11.setFont(LABEL_FONT);
531 TitledBorder titledBorder2 = new TitledBorder(
532 MessageManager.getString("label.file_output"));
533 jPanel11.setBorder(titledBorder2);
534 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
535 GridLayout gridLayout3 = new GridLayout();
536 jPanel11.setLayout(gridLayout3);
537 gridLayout3.setRows(8);
538 blcjv.setFont(LABEL_FONT);
539 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
540 clustaljv.setFont(LABEL_FONT);
541 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
542 pfamjv.setFont(LABEL_FONT);
543 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
544 pileupjv.setFont(LABEL_FONT);
545 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
546 pirjv.setFont(LABEL_FONT);
547 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
548 autoIdWidth.setFont(LABEL_FONT);
549 autoIdWidth.setText(MessageManager
550 .getString("label.automatically_set_id_width"));
551 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true,
553 .getString("label.adjusts_width_generated_eps_png")));
554 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
555 autoIdWidth.addActionListener(new ActionListener()
559 public void actionPerformed(ActionEvent e)
561 autoIdWidth_actionPerformed();
564 userIdWidthlabel.setFont(LABEL_FONT);
565 userIdWidthlabel.setText(MessageManager
566 .getString("label.figure_id_column_width"));
568 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
569 .getString("label.manually_specify_width_left_column")));
571 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
572 .getString("label.manually_specify_width_left_column")));
573 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
574 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
575 userIdWidth.setText("");
576 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
577 userIdWidth.addActionListener(new ActionListener()
581 public void actionPerformed(ActionEvent e)
583 userIdWidth_actionPerformed();
586 modellerOutput.setFont(LABEL_FONT);
587 modellerOutput.setText(MessageManager
588 .getString("label.use_modeller_output"));
589 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
590 embbedBioJSON.setFont(LABEL_FONT);
591 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
592 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
594 jPanel11.add(jLabel1);
596 jPanel11.add(clustaljv);
597 jPanel11.add(fastajv);
599 jPanel11.add(pfamjv);
600 jPanel11.add(pileupjv);
602 outputTab.add(autoIdWidth);
603 outputTab.add(userIdWidth);
604 outputTab.add(userIdWidthlabel);
605 outputTab.add(modellerOutput);
606 outputTab.add(embbedBioJSON);
607 outputTab.add(epsLabel);
608 outputTab.add(epsRendering);
609 outputTab.add(jPanel11);
614 * Initialises the Connections tabbed panel.
618 private JPanel initConnectionsTab()
620 JPanel connectTab = new JPanel();
621 connectTab.setLayout(new GridBagLayout());
623 // Label for browser text box
624 JLabel browserLabel = new JLabel();
625 browserLabel.setFont(LABEL_FONT);
626 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
627 browserLabel.setText(MessageManager
628 .getString("label.default_browser_unix"));
629 defaultBrowser.setFont(LABEL_FONT);
630 defaultBrowser.setText("");
632 defaultBrowser.addMouseListener(new MouseAdapter()
635 public void mouseClicked(MouseEvent e)
637 if (e.getClickCount() > 1)
639 defaultBrowser_mouseClicked(e);
644 JPanel proxyPanel = initConnTabProxyPanel();
645 initConnTabCheckboxes();
647 // Add default Browser text box
648 connectTab.add(browserLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,
649 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
650 new Insets(10, 0, 5, 5), 5, 1));
651 defaultBrowser.setFont(LABEL_FONT);
652 defaultBrowser.setText("");
654 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
655 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
656 new Insets(10, 0, 5, 10), 30, 1));
658 // Add proxy server panel
659 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
660 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
661 new Insets(10, 0, 5, 12), 4, 10));
663 // Add usage stats, version check and questionnaire checkboxes
664 connectTab.add(usagestats, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
665 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
666 new Insets(0, 2, 5, 5), 70, 1));
667 connectTab.add(questionnaire, new GridBagConstraints(1, 2, 1, 1, 1.0,
668 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
669 new Insets(0, 2, 5, 10), 70, 1));
670 connectTab.add(versioncheck, new GridBagConstraints(0, 3, 1, 1, 1.0,
671 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
672 new Insets(0, 2, 5, 5), 70, 1));
674 // Add padding so the panel doesn't look ridiculous
675 JPanel spacePanel = new JPanel();
676 connectTab.add(spacePanel, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
677 GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0,
684 * Initialises the Links tabbed panel.
688 private JPanel initLinksTab()
690 JPanel linkTab = new JPanel();
691 linkTab.setLayout(new GridBagLayout());
693 // Set up table for Url links
694 linkUrlTable.setFillsViewportHeight(true);
695 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
696 linkUrlTable.setAutoCreateRowSorter(true);
697 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
699 // adjust row height so radio buttons actually fit
700 // don't do this in the renderer, it causes the awt thread to activate
702 JRadioButton temp = new JRadioButton();
703 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
705 // Table in scrollpane so that the table is given a scrollbar
706 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
707 linkScrollPane.setBorder(null);
709 // Panel for links functionality
710 JPanel linkPanel = new JPanel(new GridBagLayout());
711 linkPanel.setBorder(new TitledBorder(MessageManager
712 .getString("label.url_linkfrom_sequence_id")));
714 // Put the Url links panel together
716 // Buttons go at top right, resizing only resizes the blank space vertically
717 JPanel buttonPanel = initLinkTabUrlButtons();
718 GridBagConstraints linkConstraints1 = new GridBagConstraints();
719 linkConstraints1.insets = new Insets(0, 0, 5, 0);
720 linkConstraints1.gridx = 0;
721 linkConstraints1.gridy = 0;
722 linkConstraints1.weightx = 1.0;
723 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
724 linkTab.add(buttonPanel, linkConstraints1);
726 // Links table goes at top left, resizing resizes the table
727 GridBagConstraints linkConstraints2 = new GridBagConstraints();
728 linkConstraints2.insets = new Insets(0, 0, 5, 5);
729 linkConstraints2.gridx = 0;
730 linkConstraints2.gridy = 1;
731 linkConstraints2.weightx = 1.0;
732 linkConstraints2.weighty = 1.0;
733 linkConstraints2.fill = GridBagConstraints.BOTH;
734 linkTab.add(linkScrollPane, linkConstraints2);
736 // Filter box and buttons goes at bottom left, resizing resizes the text box
737 JPanel filterPanel = initLinkTabFilterPanel();
738 GridBagConstraints linkConstraints3 = new GridBagConstraints();
739 linkConstraints3.insets = new Insets(0, 0, 0, 5);
740 linkConstraints3.gridx = 0;
741 linkConstraints3.gridy = 2;
742 linkConstraints3.weightx = 1.0;
743 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
744 linkTab.add(filterPanel, linkConstraints3);
749 private JPanel initLinkTabFilterPanel()
751 // Filter textbox and reset button
752 JLabel filterLabel = new JLabel(
753 MessageManager.getString("label.filter"));
754 filterLabel.setFont(LABEL_FONT);
755 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
756 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
758 filterTB.setFont(LABEL_FONT);
759 filterTB.setText("");
761 doReset.setText(MessageManager.getString("action.showall"));
762 userOnly.setText(MessageManager.getString("action.customfilter"));
764 // Panel for filter functionality
765 JPanel filterPanel = new JPanel(new GridBagLayout());
766 filterPanel.setBorder(new TitledBorder("Filter"));
767 GridBagConstraints gbc = new GridBagConstraints();
770 gbc.fill = GridBagConstraints.NONE;
771 gbc.anchor = GridBagConstraints.WEST;
773 filterPanel.add(filterLabel, gbc);
775 GridBagConstraints gbc1 = new GridBagConstraints();
778 gbc1.fill = GridBagConstraints.HORIZONTAL;
779 gbc1.anchor = GridBagConstraints.WEST;
781 filterPanel.add(filterTB, gbc1);
783 GridBagConstraints gbc2 = new GridBagConstraints();
785 gbc2.fill = GridBagConstraints.NONE;
786 gbc2.anchor = GridBagConstraints.WEST;
787 filterPanel.add(doReset, gbc2);
789 GridBagConstraints gbc3 = new GridBagConstraints();
791 gbc3.fill = GridBagConstraints.NONE;
792 gbc3.anchor = GridBagConstraints.WEST;
793 filterPanel.add(userOnly, gbc3);
798 private JPanel initLinkTabUrlButtons()
800 // Buttons for new / edit / delete Url links
801 JButton newLink = new JButton();
802 newLink.setText(MessageManager.getString("action.new"));
804 editLink.setText(MessageManager.getString("action.edit"));
806 deleteLink.setText(MessageManager.getString("action.delete"));
808 // no current selection, so initially disable delete/edit buttons
809 editLink.setEnabled(false);
810 deleteLink.setEnabled(false);
812 newLink.addActionListener(new java.awt.event.ActionListener()
815 public void actionPerformed(ActionEvent e)
817 newLink_actionPerformed(e);
821 editLink.setText(MessageManager.getString("action.edit"));
822 editLink.addActionListener(new java.awt.event.ActionListener()
825 public void actionPerformed(ActionEvent e)
827 editLink_actionPerformed(e);
831 deleteLink.setText(MessageManager.getString("action.delete"));
832 deleteLink.addActionListener(new java.awt.event.ActionListener()
835 public void actionPerformed(ActionEvent e)
837 deleteLink_actionPerformed(e);
841 JPanel buttonPanel = new JPanel(new GridBagLayout());
842 buttonPanel.setBorder(new TitledBorder("Edit links"));
843 GridBagConstraints gbc = new GridBagConstraints();
846 gbc.fill = GridBagConstraints.NONE;
847 buttonPanel.add(newLink, gbc);
849 GridBagConstraints gbc1 = new GridBagConstraints();
852 gbc1.fill = GridBagConstraints.NONE;
853 buttonPanel.add(editLink, gbc1);
855 GridBagConstraints gbc2 = new GridBagConstraints();
858 gbc2.fill = GridBagConstraints.NONE;
859 buttonPanel.add(deleteLink, gbc2);
861 GridBagConstraints gbc3 = new GridBagConstraints();
864 gbc3.fill = GridBagConstraints.HORIZONTAL;
866 JPanel spacePanel = new JPanel();
867 spacePanel.setBorder(null);
868 buttonPanel.add(spacePanel, gbc3);
874 * Initialises the proxy server panel in the Connections tab
876 * @return the proxy server panel
878 private JPanel initConnTabProxyPanel()
880 // Label for server text box
881 serverLabel.setText(MessageManager.getString("label.address"));
882 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
883 serverLabel.setFont(LABEL_FONT);
885 // Proxy server and port text boxes
886 proxyServerTB.setFont(LABEL_FONT);
887 proxyPortTB.setFont(LABEL_FONT);
889 // Label for Port text box
890 portLabel.setFont(LABEL_FONT);
891 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
892 portLabel.setText(MessageManager.getString("label.port"));
894 // Use proxy server checkbox
895 useProxy.setFont(LABEL_FONT);
896 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
897 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
898 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
899 useProxy.addActionListener(new ActionListener()
902 public void actionPerformed(ActionEvent e)
904 useProxy_actionPerformed();
908 // Make proxy server panel
909 JPanel proxyPanel = new JPanel();
910 TitledBorder titledBorder1 = new TitledBorder(
911 MessageManager.getString("label.proxy_server"));
912 proxyPanel.setBorder(titledBorder1);
913 proxyPanel.setLayout(new GridBagLayout());
914 proxyPanel.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
915 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
916 new Insets(0, 2, 2, 0), 5, 0));
917 proxyPanel.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
918 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
920 proxyPanel.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
921 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
923 proxyPanel.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0,
924 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
925 new Insets(0, 2, 2, 2), 54, 1));
926 proxyPanel.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0,
927 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
928 new Insets(0, 2, 2, 0), 263, 1));
934 * Initialises the checkboxes in the Connections tab
936 private void initConnTabCheckboxes()
938 // Usage stats checkbox label
939 usagestats.setText(MessageManager
940 .getString("label.send_usage_statistics"));
941 usagestats.setFont(LABEL_FONT);
942 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
943 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
945 // Questionnaire checkbox label
946 questionnaire.setText(MessageManager
947 .getString("label.check_for_questionnaires"));
948 questionnaire.setFont(LABEL_FONT);
949 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
950 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
952 // Check for latest version checkbox label
953 versioncheck.setText(MessageManager
954 .getString("label.check_for_latest_version"));
955 versioncheck.setFont(LABEL_FONT);
956 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
957 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
961 * Initialises the parent panel which contains the tabbed sections.
965 private JPanel initOkCancelPanel()
967 JButton ok = new JButton();
968 ok.setText(MessageManager.getString("action.ok"));
969 ok.addActionListener(new ActionListener()
972 public void actionPerformed(ActionEvent e)
974 ok_actionPerformed(e);
977 JButton cancel = new JButton();
978 cancel.setText(MessageManager.getString("action.cancel"));
979 cancel.addActionListener(new ActionListener()
982 public void actionPerformed(ActionEvent e)
984 cancel_actionPerformed(e);
987 JPanel okCancelPanel = new JPanel();
988 okCancelPanel.add(ok);
989 okCancelPanel.add(cancel);
990 return okCancelPanel;
994 * Initialises the Colours tabbed panel.
998 private JPanel initColoursTab()
1000 JPanel coloursTab = new JPanel();
1001 coloursTab.setBorder(new TitledBorder(MessageManager
1002 .getString("action.open_new_alignment")));
1003 coloursTab.setLayout(new FlowLayout());
1004 JLabel mincolourLabel = new JLabel();
1005 mincolourLabel.setFont(LABEL_FONT);
1006 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1007 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1008 minColour.setFont(LABEL_FONT);
1009 minColour.setBorder(BorderFactory.createEtchedBorder());
1010 minColour.setPreferredSize(new Dimension(40, 20));
1011 minColour.addMouseListener(new MouseAdapter()
1014 public void mousePressed(MouseEvent e)
1016 minColour_actionPerformed(minColour);
1019 JLabel maxcolourLabel = new JLabel();
1020 maxcolourLabel.setFont(LABEL_FONT);
1021 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1022 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1023 maxColour.setFont(LABEL_FONT);
1024 maxColour.setBorder(BorderFactory.createEtchedBorder());
1025 maxColour.setPreferredSize(new Dimension(40, 20));
1026 maxColour.addMouseListener(new MouseAdapter()
1029 public void mousePressed(MouseEvent e)
1031 maxColour_actionPerformed(maxColour);
1035 protColour.setFont(LABEL_FONT);
1036 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1037 JLabel protColourLabel = new JLabel();
1038 protColourLabel.setFont(LABEL_FONT);
1039 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1040 protColourLabel.setText(MessageManager
1041 .getString("label.prot_alignment_colour") + " ");
1042 JvSwingUtils.addtoLayout(coloursTab, MessageManager
1043 .getString("label.default_colour_scheme_for_alignment"),
1044 protColourLabel, protColour);
1046 nucColour.setFont(LABEL_FONT);
1047 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1048 JLabel nucColourLabel = new JLabel();
1049 nucColourLabel.setFont(LABEL_FONT);
1050 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1051 nucColourLabel.setText(MessageManager
1052 .getString("label.nuc_alignment_colour") + " ");
1053 JvSwingUtils.addtoLayout(coloursTab, MessageManager
1054 .getString("label.default_colour_scheme_for_alignment"),
1055 nucColourLabel, nucColour);
1057 JPanel annotationShding = new JPanel();
1058 annotationShding.setBorder(new TitledBorder(MessageManager
1059 .getString("label.annotation_shading_default")));
1060 annotationShding.setLayout(new GridLayout(1, 2));
1061 JvSwingUtils.addtoLayout(annotationShding, MessageManager
1062 .getString("label.default_minimum_colour_annotation_shading"),
1063 mincolourLabel, minColour);
1064 JvSwingUtils.addtoLayout(annotationShding, MessageManager
1065 .getString("label.default_maximum_colour_annotation_shading"),
1066 maxcolourLabel, maxColour);
1067 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1072 * Initialises the Structure tabbed panel.
1076 private JPanel initStructureTab()
1078 structureTab = new JPanel();
1080 structureTab.setBorder(new TitledBorder(MessageManager
1081 .getString("label.structure_options")));
1082 structureTab.setLayout(null);
1083 final int width = 400;
1084 final int height = 22;
1085 final int lineSpacing = 25;
1088 structFromPdb.setFont(LABEL_FONT);
1090 .setText(MessageManager.getString("label.struct_from_pdb"));
1091 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1092 structFromPdb.addActionListener(new ActionListener()
1095 public void actionPerformed(ActionEvent e)
1097 boolean selected = structFromPdb.isSelected();
1098 // enable other options only when the first is checked
1099 useRnaView.setEnabled(selected);
1100 addSecondaryStructure.setEnabled(selected);
1101 addTempFactor.setEnabled(selected);
1104 structureTab.add(structFromPdb);
1106 // indent checkboxes that are conditional on the first one
1107 ypos += lineSpacing;
1108 useRnaView.setFont(LABEL_FONT);
1109 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1110 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1111 structureTab.add(useRnaView);
1113 ypos += lineSpacing;
1114 addSecondaryStructure.setFont(LABEL_FONT);
1115 addSecondaryStructure.setText(MessageManager
1116 .getString("label.autoadd_secstr"));
1117 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1118 structureTab.add(addSecondaryStructure);
1120 ypos += lineSpacing;
1121 addTempFactor.setFont(LABEL_FONT);
1122 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1123 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1124 structureTab.add(addTempFactor);
1126 ypos += lineSpacing;
1127 JLabel viewerLabel = new JLabel();
1128 viewerLabel.setFont(LABEL_FONT);
1129 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1130 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1131 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1132 structureTab.add(viewerLabel);
1134 structViewer.setFont(LABEL_FONT);
1135 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1136 structViewer.addItem(ViewerType.JMOL.name());
1137 structViewer.addItem(ViewerType.CHIMERA.name());
1138 structViewer.addActionListener(new ActionListener()
1141 public void actionPerformed(ActionEvent e)
1143 structureViewer_actionPerformed((String) structViewer
1144 .getSelectedItem());
1147 structureTab.add(structViewer);
1149 ypos += lineSpacing;
1150 JLabel pathLabel = new JLabel();
1151 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1152 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1153 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1154 final String tooltip = JvSwingUtils.wrapTooltip(true,
1155 MessageManager.getString("label.chimera_path_tip"));
1156 pathLabel.setToolTipText(tooltip);
1157 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1158 structureTab.add(pathLabel);
1160 chimeraPath.setFont(LABEL_FONT);
1161 chimeraPath.setText("");
1162 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1163 chimeraPath.addMouseListener(new MouseAdapter()
1166 public void mouseClicked(MouseEvent e)
1168 if (e.getClickCount() == 2)
1170 String chosen = openFileChooser();
1173 chimeraPath.setText(chosen);
1178 structureTab.add(chimeraPath);
1180 ypos += lineSpacing;
1181 nwMapping.setFont(LABEL_FONT);
1182 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1183 siftsMapping.setFont(LABEL_FONT);
1184 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1185 mappingMethod.add(nwMapping);
1186 mappingMethod.add(siftsMapping);
1187 JPanel mappingPanel = new JPanel();
1188 mappingPanel.setFont(LABEL_FONT);
1189 TitledBorder mmTitledBorder = new TitledBorder(
1190 MessageManager.getString("label.mapping_method"));
1191 mmTitledBorder.setTitleFont(LABEL_FONT);
1192 mappingPanel.setBorder(mmTitledBorder);
1193 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1194 // GridLayout mappingLayout = new GridLayout();
1195 mappingPanel.setLayout(new GridLayout());
1196 mappingPanel.add(nwMapping);
1197 mappingPanel.add(siftsMapping);
1198 structureTab.add(mappingPanel);
1200 ypos += lineSpacing;
1201 ypos += lineSpacing;
1202 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1203 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1204 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1205 structureTab.add(docFieldPref);
1207 return structureTab;
1211 * Action on choosing a structure viewer from combobox options.
1213 * @param selectedItem
1215 protected void structureViewer_actionPerformed(String selectedItem)
1220 * Show a dialog for the user to choose a file. Returns the chosen path, or
1225 protected String openFileChooser()
1227 String choice = null;
1228 JFileChooser chooser = new JFileChooser();
1230 // chooser.setFileView(new JalviewFileView());
1231 chooser.setDialogTitle(MessageManager
1232 .getString("label.open_local_file"));
1233 chooser.setToolTipText(MessageManager.getString("action.open"));
1235 int value = chooser.showOpenDialog(this);
1237 if (value == JFileChooser.APPROVE_OPTION)
1239 choice = chooser.getSelectedFile().getPath();
1245 * Validate the structure tab preferences; if invalid, set focus on this tab.
1249 protected boolean validateStructure(FocusEvent e)
1251 if (!validateStructure())
1253 e.getComponent().requestFocusInWindow();
1260 * Validate the hmmer tab preferences; if invalid, set focus on this tab.
1264 protected boolean validateHMMER(FocusEvent e)
1266 if (!validateHMMER())
1268 e.getComponent().requestFocusInWindow();
1274 protected boolean validateStructure()
1279 protected boolean validateHMMER()
1285 * Initialises the Visual tabbed panel.
1289 private JPanel initVisualTab()
1291 JPanel visualTab = new JPanel();
1292 visualTab.setBorder(new TitledBorder(MessageManager
1293 .getString("action.open_new_alignment")));
1294 visualTab.setLayout(null);
1295 fullScreen.setFont(LABEL_FONT);
1296 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1297 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1298 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1299 quality.setEnabled(false);
1300 quality.setFont(LABEL_FONT);
1301 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1302 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1303 quality.setSelected(true);
1304 quality.setText(MessageManager.getString("label.quality"));
1305 conservation.setEnabled(false);
1306 conservation.setFont(LABEL_FONT);
1307 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1308 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1309 conservation.setSelected(true);
1310 conservation.setText(MessageManager.getString("label.conservation"));
1311 identity.setEnabled(false);
1312 identity.setFont(LABEL_FONT);
1313 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1314 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1315 identity.setSelected(true);
1316 identity.setText(MessageManager.getString("label.consensus"));
1317 showOccupancy.setFont(LABEL_FONT);
1318 showOccupancy.setEnabled(false);
1319 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1320 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1321 showOccupancy.setSelected(true);
1322 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1324 JLabel showGroupbits = new JLabel();
1325 showGroupbits.setFont(LABEL_FONT);
1326 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1327 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1328 showGroupbits.setText(MessageManager.getString("action.show_group")
1330 JLabel showConsensbits = new JLabel();
1331 showConsensbits.setFont(LABEL_FONT);
1332 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1333 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1334 showConsensbits.setText(MessageManager.getString("label.consensus")
1336 showConsensHistogram.setEnabled(false);
1337 showConsensHistogram.setFont(LABEL_FONT);
1338 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1339 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1340 showConsensHistogram.setSelected(true);
1341 showConsensHistogram.setText(MessageManager
1342 .getString("label.histogram"));
1343 showConsensLogo.setEnabled(false);
1344 showConsensLogo.setFont(LABEL_FONT);
1345 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1346 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1347 showConsensLogo.setSelected(true);
1348 showConsensLogo.setText(MessageManager.getString("label.logo"));
1349 showGroupConsensus.setEnabled(false);
1350 showGroupConsensus.setFont(LABEL_FONT);
1351 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1352 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1353 showGroupConsensus.setSelected(true);
1354 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1355 showGroupConservation.setEnabled(false);
1356 showGroupConservation.setFont(LABEL_FONT);
1357 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1358 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1359 showGroupConservation.setSelected(true);
1360 showGroupConservation.setText(MessageManager
1361 .getString("label.conservation"));
1362 showNpTooltip.setEnabled(true);
1363 showNpTooltip.setFont(LABEL_FONT);
1364 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1365 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1366 showNpTooltip.setSelected(true);
1367 showNpTooltip.setText(MessageManager
1368 .getString("label.non_positional_features"));
1369 showDbRefTooltip.setEnabled(true);
1370 showDbRefTooltip.setFont(LABEL_FONT);
1371 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1372 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1373 showDbRefTooltip.setSelected(true);
1374 showDbRefTooltip.setText(MessageManager
1375 .getString("label.database_references"));
1376 annotations.setFont(LABEL_FONT);
1377 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1378 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1379 annotations.setSelected(true);
1380 annotations.setText(MessageManager.getString("label.show_annotations"));
1381 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1382 annotations.addActionListener(new ActionListener()
1385 public void actionPerformed(ActionEvent e)
1387 annotations_actionPerformed(e);
1390 identity.addActionListener(new ActionListener()
1393 public void actionPerformed(ActionEvent e)
1395 annotations_actionPerformed(e);
1398 showGroupConsensus.addActionListener(new ActionListener()
1401 public void actionPerformed(ActionEvent e)
1403 annotations_actionPerformed(e);
1406 showUnconserved.setFont(LABEL_FONT);
1407 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1408 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1409 showUnconserved.setSelected(true);
1410 showUnconserved.setText(MessageManager
1411 .getString("action.show_unconserved"));
1412 showUnconserved.addActionListener(new ActionListener()
1415 public void actionPerformed(ActionEvent e)
1417 showunconserved_actionPerformed(e);
1421 // TODO these are not yet added to / action from Preferences
1422 // JCheckBox shareSelections = new JCheckBox();
1423 // shareSelections.setFont(verdana11);
1424 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1425 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1426 // shareSelections.setSelected(true);
1427 // shareSelections.setText(MessageManager
1428 // .getString("label.share_selection_across_views"));
1429 // JCheckBox followHighlight = new JCheckBox();
1430 // followHighlight.setFont(verdana11);
1431 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1432 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1433 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1434 // followHighlight.setSelected(true);
1435 // followHighlight.setText(MessageManager
1436 // .getString("label.scroll_highlighted_regions"));
1438 seqLimit.setFont(LABEL_FONT);
1439 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1440 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1441 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1442 smoothFont.setFont(LABEL_FONT);
1443 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1444 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1445 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1446 scaleProteinToCdna.setFont(LABEL_FONT);
1447 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1448 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1449 scaleProteinToCdna.setText(MessageManager
1450 .getString("label.scale_protein_to_cdna"));
1451 scaleProteinToCdna.setToolTipText(MessageManager
1452 .getString("label.scale_protein_to_cdna_tip"));
1453 JLabel gapLabel = new JLabel();
1454 gapLabel.setFont(LABEL_FONT);
1455 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1456 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1457 JLabel fontLabel = new JLabel();
1458 fontLabel.setFont(LABEL_FONT);
1459 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1460 fontLabel.setText(MessageManager.getString("label.font"));
1461 fontSizeCB.setFont(LABEL_FONT);
1462 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1463 fontStyleCB.setFont(LABEL_FONT);
1464 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1465 fontNameCB.setFont(LABEL_FONT);
1466 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1467 gapSymbolCB.setFont(LABEL_FONT);
1468 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1469 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1470 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1471 gapSymbolCB.setRenderer(dlcr);
1473 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1474 startupCheckbox.setFont(LABEL_FONT);
1475 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1476 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1477 startupCheckbox.setSelected(true);
1478 startupFileTextfield.setFont(LABEL_FONT);
1479 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1480 startupFileTextfield.addMouseListener(new MouseAdapter()
1483 public void mouseClicked(MouseEvent e)
1485 if (e.getClickCount() > 1)
1487 startupFileTextfield_mouseClicked();
1492 sortby.setFont(LABEL_FONT);
1493 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1494 JLabel sortLabel = new JLabel();
1495 sortLabel.setFont(LABEL_FONT);
1496 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1497 sortLabel.setText(MessageManager.getString("label.sort_by"));
1498 sortAnnBy.setFont(LABEL_FONT);
1499 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1500 JLabel sortAnnLabel = new JLabel();
1501 sortAnnLabel.setFont(LABEL_FONT);
1502 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1503 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1504 sortAutocalc.setFont(LABEL_FONT);
1505 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1507 JPanel annsettingsPanel = new JPanel();
1508 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1509 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1510 annsettingsPanel.setBorder(new EtchedBorder());
1511 visualTab.add(annsettingsPanel);
1512 Border jb = new EmptyBorder(1, 1, 4, 5);
1513 annotations.setBorder(jb);
1514 showOccupancy.setBorder(jb);
1515 quality.setBorder(jb);
1516 conservation.setBorder(jb);
1517 identity.setBorder(jb);
1518 showConsensbits.setBorder(jb);
1519 showGroupbits.setBorder(jb);
1520 showGroupConsensus.setBorder(jb);
1521 showGroupConservation.setBorder(jb);
1522 showConsensHistogram.setBorder(jb);
1523 showConsensLogo.setBorder(jb);
1525 JPanel autoAnnotSettings = new JPanel();
1526 annsettingsPanel.add(autoAnnotSettings);
1527 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1528 autoAnnotSettings.add(annotations);
1529 autoAnnotSettings.add(quality);
1530 // second row of autoannotation box
1531 autoAnnotSettings = new JPanel();
1532 annsettingsPanel.add(autoAnnotSettings);
1534 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1535 autoAnnotSettings.add(conservation);
1536 autoAnnotSettings.add(identity);
1537 autoAnnotSettings.add(showOccupancy);
1538 autoAnnotSettings.add(showGroupbits);
1539 autoAnnotSettings.add(showGroupConservation);
1540 autoAnnotSettings.add(showGroupConsensus);
1541 autoAnnotSettings.add(showConsensbits);
1542 autoAnnotSettings.add(showConsensHistogram);
1543 autoAnnotSettings.add(showConsensLogo);
1547 JPanel tooltipSettings = new JPanel();
1548 tooltipSettings.setBorder(new TitledBorder(MessageManager
1549 .getString("label.sequence_id_tooltip")));
1550 tooltipSettings.setBounds(173, 140, 220, 62);
1551 tooltipSettings.setLayout(new GridLayout(2, 1));
1552 tooltipSettings.add(showDbRefTooltip);
1553 tooltipSettings.add(showNpTooltip);
1554 visualTab.add(tooltipSettings);
1556 wrap.setFont(LABEL_FONT);
1557 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1558 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1559 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1560 rightAlign.setFont(LABEL_FONT);
1561 rightAlign.setForeground(Color.black);
1562 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1563 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1564 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1565 idItalics.setFont(LABEL_FONT_ITALIC);
1566 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1567 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1568 idItalics.setText(MessageManager
1569 .getString("label.sequence_name_italics"));
1570 openoverv.setFont(LABEL_FONT);
1571 openoverv.setActionCommand(MessageManager
1572 .getString("label.open_overview"));
1573 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1574 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1575 openoverv.setText(MessageManager.getString("label.open_overview"));
1576 JPanel jPanel2 = new JPanel();
1577 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1578 jPanel2.setLayout(new GridLayout(14, 1));
1579 jPanel2.add(fullScreen);
1580 jPanel2.add(openoverv);
1581 jPanel2.add(seqLimit);
1582 jPanel2.add(rightAlign);
1583 jPanel2.add(fontLabel);
1584 jPanel2.add(showUnconserved);
1585 jPanel2.add(idItalics);
1586 jPanel2.add(smoothFont);
1587 jPanel2.add(scaleProteinToCdna);
1588 jPanel2.add(gapLabel);
1590 jPanel2.add(sortLabel);
1591 jPanel2.add(sortAnnLabel);
1592 jPanel2.add(startupCheckbox);
1593 visualTab.add(jPanel2);
1594 visualTab.add(startupFileTextfield);
1595 visualTab.add(sortby);
1596 visualTab.add(sortAnnBy);
1597 visualTab.add(sortAutocalc);
1598 visualTab.add(gapSymbolCB);
1599 visualTab.add(fontNameCB);
1600 visualTab.add(fontSizeCB);
1601 visualTab.add(fontStyleCB);
1605 protected void autoIdWidth_actionPerformed()
1607 // TODO Auto-generated method stub
1611 protected void userIdWidth_actionPerformed()
1613 // TODO Auto-generated method stub
1617 protected void maxColour_actionPerformed(JPanel panel)
1621 protected void minColour_actionPerformed(JPanel panel)
1625 protected void showunconserved_actionPerformed(ActionEvent e)
1627 // TODO Auto-generated method stub
1637 public void ok_actionPerformed(ActionEvent e)
1647 public void cancel_actionPerformed(ActionEvent e)
1657 public void annotations_actionPerformed(ActionEvent e)
1664 public void startupFileTextfield_mouseClicked()
1668 public void newLink_actionPerformed(ActionEvent e)
1673 public void editLink_actionPerformed(ActionEvent e)
1678 public void deleteLink_actionPerformed(ActionEvent e)
1683 public void defaultBrowser_mouseClicked(MouseEvent e)
1688 public void linkURLList_keyTyped(KeyEvent e)
1693 public void useProxy_actionPerformed()
1695 boolean enabled = useProxy.isSelected();
1696 portLabel.setEnabled(enabled);
1697 serverLabel.setEnabled(enabled);
1698 proxyServerTB.setEnabled(enabled);
1699 proxyPortTB.setEnabled(enabled);
1703 * Customer renderer for JTable: supports column of radio buttons
1705 public class RadioButtonRenderer extends JRadioButton implements
1708 public RadioButtonRenderer()
1710 setHorizontalAlignment(CENTER);
1711 setToolTipText(MessageManager.getString("label.urltooltip"));
1715 public Component getTableCellRendererComponent(JTable table,
1716 Object value, boolean isSelected, boolean hasFocus, int row,
1719 setSelected((boolean) value);
1721 // set colours to match rest of table
1724 setBackground(table.getSelectionBackground());
1725 setForeground(table.getSelectionForeground());
1729 setBackground(table.getBackground());
1730 setForeground(table.getForeground());
1737 * Customer cell editor for JTable: supports column of radio buttons in
1738 * conjunction with renderer
1740 public class RadioButtonEditor extends AbstractCellEditor implements
1743 private JRadioButton button = new JRadioButton();
1745 public RadioButtonEditor()
1747 button.setHorizontalAlignment(SwingConstants.CENTER);
1748 this.button.addActionListener(new ActionListener()
1751 public void actionPerformed(ActionEvent e)
1753 fireEditingStopped();
1759 public Component getTableCellEditorComponent(JTable table,
1760 Object value, boolean isSelected, int row, int column)
1762 button.setSelected((boolean) value);
1767 public Object getCellEditorValue()
1769 return button.isSelected();
1774 public void hmmerPath_actionPerformed(ActionEvent e)