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 * Connections tab components
191 protected JTable linkUrlTable = new JTable();
193 protected JButton editLink = new JButton();
195 protected JButton deleteLink = new JButton();
197 protected JTextField filterTB = new JTextField();
199 protected JButton doReset = new JButton();
201 protected JButton userOnly = new JButton();
203 protected JLabel portLabel = new JLabel();
205 protected JLabel serverLabel = new JLabel();
207 protected JTextField proxyServerTB = new JTextField();
209 protected JTextField proxyPortTB = new JTextField();
211 protected JTextField defaultBrowser = new JTextField();
213 protected JCheckBox useProxy = new JCheckBox();
215 protected JCheckBox usagestats = new JCheckBox();
217 protected JCheckBox questionnaire = new JCheckBox();
219 protected JCheckBox versioncheck = new JCheckBox();
222 * Output tab components
224 protected JComboBox<Object> epsRendering = new JComboBox<>();
226 protected JLabel userIdWidthlabel = new JLabel();
228 protected JCheckBox autoIdWidth = new JCheckBox();
230 protected JTextField userIdWidth = new JTextField();
232 protected JCheckBox blcjv = new JCheckBox();
234 protected JCheckBox pileupjv = new JCheckBox();
236 protected JCheckBox clustaljv = new JCheckBox();
238 protected JCheckBox msfjv = new JCheckBox();
240 protected JCheckBox fastajv = new JCheckBox();
242 protected JCheckBox pfamjv = new JCheckBox();
244 protected JCheckBox pirjv = new JCheckBox();
246 protected JCheckBox modellerOutput = new JCheckBox();
248 protected JCheckBox embbedBioJSON = new JCheckBox();
251 * Editing tab components
253 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
255 protected JCheckBox padGaps = new JCheckBox();
257 protected JCheckBox sortByTree = new JCheckBox();
260 * hmmer tab and components
262 protected JPanel hmmerTab = new JPanel();
264 protected JCheckBox hmmrTrimTermini = new JCheckBox();
266 protected AbstractButton hmmerBackgroundUniprot = new JCheckBox();
268 protected AbstractButton hmmerBackgroundAlignment = new JCheckBox();
270 protected JTextField hmmerSequenceCount = new JTextField();
272 protected JTextField hmmerPath = new JTextField();
277 protected JPanel dasTab = new JPanel();
282 protected JPanel wsTab = new JPanel();
287 * Creates a new GPreferences object.
289 public GPreferences()
294 } catch (Exception ex)
296 ex.printStackTrace();
301 * Construct the panel and its tabbed sub-panels.
305 private void jbInit() throws Exception
307 final JTabbedPane tabbedPane = new JTabbedPane();
308 this.setLayout(new BorderLayout());
309 JPanel okCancelPanel = initOkCancelPanel();
310 this.add(tabbedPane, BorderLayout.CENTER);
311 this.add(okCancelPanel, BorderLayout.SOUTH);
313 tabbedPane.add(initVisualTab(),
314 MessageManager.getString("label.visual"));
316 tabbedPane.add(initColoursTab(),
317 MessageManager.getString("label.colours"));
319 tabbedPane.add(initStructureTab(),
320 MessageManager.getString("label.structure"));
322 tabbedPane.add(initConnectionsTab(),
323 MessageManager.getString("label.connections"));
325 tabbedPane.add(initLinksTab(),
326 MessageManager.getString("label.urllinks"));
328 tabbedPane.add(initOutputTab(),
329 MessageManager.getString("label.output"));
331 tabbedPane.add(initEditingTab(),
332 MessageManager.getString("label.editing"));
334 tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
337 * See DasSourceBrowser for the real work of configuring this tab.
339 dasTab.setLayout(new BorderLayout());
340 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
343 * See WsPreferences for the real work of configuring this tab.
345 wsTab.setLayout(new BorderLayout());
346 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
349 * Handler to validate a tab before leaving it - currently only for
352 tabbedPane.addChangeListener(new ChangeListener()
354 private Component lastTab;
357 public void stateChanged(ChangeEvent e)
359 if (lastTab == structureTab
360 && tabbedPane.getSelectedComponent() != structureTab)
362 if (!validateStructure())
364 tabbedPane.setSelectedComponent(structureTab);
368 lastTab = tabbedPane.getSelectedComponent();
375 * Initialises the Editing tabbed panel.
379 private JPanel initEditingTab()
381 JPanel editingTab = new JPanel();
382 editingTab.setLayout(null);
383 autoCalculateConsCheck.setFont(LABEL_FONT);
384 autoCalculateConsCheck.setText(
385 MessageManager.getString("label.autocalculate_consensus"));
386 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
387 padGaps.setFont(LABEL_FONT);
389 MessageManager.getString("label.pad_gaps_when_editing"));
390 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
391 sortByTree.setFont(LABEL_FONT);
393 .setText(MessageManager.getString("label.sort_with_new_tree"));
394 sortByTree.setToolTipText(MessageManager.getString(
395 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
396 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
397 editingTab.add(autoCalculateConsCheck);
398 editingTab.add(padGaps);
399 editingTab.add(sortByTree);
404 * Initialises the hmmer tabbed panel
408 private JPanel initHMMERTab()
410 hmmerTab.setLayout(null);
412 JLabel installationLocation = new JLabel(
413 MessageManager.getString("label.hmmer_location"));
414 installationLocation.setFont(LABEL_FONT);
415 installationLocation.setBounds(new Rectangle(22, 10, 250, 23));
416 hmmerPath.setBounds(new Rectangle(22, 30, 300, 23));
417 hmmerPath.addMouseListener(new MouseAdapter()
420 public void mouseClicked(MouseEvent e)
422 if (e.getClickCount() == 2)
424 String chosen = openFileChooser(true);
427 hmmerPath.setText(chosen);
433 JLabel hmmalign = new JLabel(
434 MessageManager.getString("label.hmmalign_label"));
435 hmmalign.setFont(LABEL_FONT);
436 hmmalign.setBounds(new Rectangle(22, 50, 200, 23));
438 hmmrTrimTermini.setFont(LABEL_FONT);
439 hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
440 hmmrTrimTermini.setBounds(new Rectangle(22, 70, 200, 23));
442 JLabel hmmsearch = new JLabel(
443 MessageManager.getString("label.hmmsearch_label"));
444 hmmsearch.setFont(LABEL_FONT);
445 hmmsearch.setBounds(new Rectangle(22, 90, 200, 23));
447 JLabel sequencesToKeep = new JLabel(
448 MessageManager.getString("label.no_of_sequences"));
449 sequencesToKeep.setFont(LABEL_FONT);
450 sequencesToKeep.setBounds(new Rectangle(22, 110, 125, 23));
451 hmmerSequenceCount.setBounds(new Rectangle(150, 110, 40, 23));
453 ButtonGroup backgroundFreqSource = new ButtonGroup();
454 backgroundFreqSource.add(hmmerBackgroundUniprot);
455 backgroundFreqSource.add(hmmerBackgroundAlignment);
456 backgroundFreqSource.setSelected(hmmerBackgroundUniprot.getModel(), true);
458 hmmerBackgroundUniprot.setText(MessageManager.getString("label.freq_uniprot"));
459 hmmerBackgroundUniprot.setFont(LABEL_FONT);
460 hmmerBackgroundUniprot.setBounds(new Rectangle(22, 130, 255, 23));
462 hmmerBackgroundAlignment.setText(MessageManager.getString("label.freq_alignment"));
463 hmmerBackgroundAlignment.setFont(LABEL_FONT);
464 hmmerBackgroundAlignment.setBounds(new Rectangle(22, 150, 300, 23));
466 hmmerTab.add(hmmerBackgroundUniprot);
467 hmmerTab.add(hmmerBackgroundAlignment);
468 hmmerTab.add(hmmalign);
469 hmmerTab.add(hmmsearch);
470 hmmerTab.add(installationLocation);
471 hmmerTab.add(hmmerPath);
472 hmmerTab.add(hmmrTrimTermini);
473 hmmerTab.add(sequencesToKeep);
474 hmmerTab.add(sequencesToKeep);
475 hmmerTab.add(hmmerSequenceCount);
481 * Initialises the Output tabbed panel.
485 private JPanel initOutputTab()
487 JPanel outputTab = new JPanel();
488 outputTab.setLayout(null);
489 JLabel epsLabel = new JLabel();
490 epsLabel.setFont(LABEL_FONT);
491 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
492 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
493 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
494 epsRendering.setFont(LABEL_FONT);
495 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
496 JLabel jLabel1 = new JLabel();
497 jLabel1.setFont(LABEL_FONT);
498 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
499 jLabel1.setText(MessageManager.getString("label.append_start_end"));
500 jLabel1.setFont(LABEL_FONT);
501 fastajv.setFont(LABEL_FONT);
502 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
503 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
504 blcjv.setText(MessageManager.getString("label.blc") + " ");
505 fastajv.setText(MessageManager.getString("label.fasta") + " ");
506 msfjv.setText(MessageManager.getString("label.msf") + " ");
507 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
508 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
509 msfjv.setFont(LABEL_FONT);
510 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
511 pirjv.setText(MessageManager.getString("label.pir") + " ");
512 JPanel jPanel11 = new JPanel();
513 jPanel11.setFont(LABEL_FONT);
514 TitledBorder titledBorder2 = new TitledBorder(
515 MessageManager.getString("label.file_output"));
516 jPanel11.setBorder(titledBorder2);
517 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
518 GridLayout gridLayout3 = new GridLayout();
519 jPanel11.setLayout(gridLayout3);
520 gridLayout3.setRows(8);
521 blcjv.setFont(LABEL_FONT);
522 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
523 clustaljv.setFont(LABEL_FONT);
524 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
525 pfamjv.setFont(LABEL_FONT);
526 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
527 pileupjv.setFont(LABEL_FONT);
528 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
529 pirjv.setFont(LABEL_FONT);
530 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
531 autoIdWidth.setFont(LABEL_FONT);
533 MessageManager.getString("label.automatically_set_id_width"));
534 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
535 .getString("label.adjusts_width_generated_eps_png")));
536 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
537 autoIdWidth.addActionListener(new ActionListener()
541 public void actionPerformed(ActionEvent e)
543 autoIdWidth_actionPerformed();
546 userIdWidthlabel.setFont(LABEL_FONT);
547 userIdWidthlabel.setText(
548 MessageManager.getString("label.figure_id_column_width"));
549 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
550 .getString("label.manually_specify_width_left_column")));
551 userIdWidthlabel.setToolTipText(
552 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
553 "label.manually_specify_width_left_column")));
554 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
555 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
556 userIdWidth.setText("");
557 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
558 userIdWidth.addActionListener(new ActionListener()
562 public void actionPerformed(ActionEvent e)
564 userIdWidth_actionPerformed();
567 modellerOutput.setFont(LABEL_FONT);
569 .setText(MessageManager.getString("label.use_modeller_output"));
570 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
571 embbedBioJSON.setFont(LABEL_FONT);
572 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
573 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
575 jPanel11.add(jLabel1);
577 jPanel11.add(clustaljv);
578 jPanel11.add(fastajv);
580 jPanel11.add(pfamjv);
581 jPanel11.add(pileupjv);
583 outputTab.add(autoIdWidth);
584 outputTab.add(userIdWidth);
585 outputTab.add(userIdWidthlabel);
586 outputTab.add(modellerOutput);
587 outputTab.add(embbedBioJSON);
588 outputTab.add(epsLabel);
589 outputTab.add(epsRendering);
590 outputTab.add(jPanel11);
595 * Initialises the Connections tabbed panel.
599 private JPanel initConnectionsTab()
601 JPanel connectTab = new JPanel();
602 connectTab.setLayout(new GridBagLayout());
604 // Label for browser text box
605 JLabel browserLabel = new JLabel();
606 browserLabel.setFont(LABEL_FONT);
607 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
608 browserLabel.setText(
609 MessageManager.getString("label.default_browser_unix"));
610 defaultBrowser.setFont(LABEL_FONT);
611 defaultBrowser.setText("");
613 defaultBrowser.addMouseListener(new MouseAdapter()
616 public void mouseClicked(MouseEvent e)
618 if (e.getClickCount() > 1)
620 defaultBrowser_mouseClicked(e);
625 JPanel proxyPanel = initConnTabProxyPanel();
626 initConnTabCheckboxes();
628 // Add default Browser text box
629 connectTab.add(browserLabel,
630 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
631 GridBagConstraints.WEST, GridBagConstraints.NONE,
632 new Insets(10, 0, 5, 5), 5, 1));
633 defaultBrowser.setFont(LABEL_FONT);
634 defaultBrowser.setText("");
636 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
637 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
638 new Insets(10, 0, 5, 10), 30, 1));
640 // Add proxy server panel
641 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
642 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
643 new Insets(10, 0, 5, 12), 4, 10));
645 // Add usage stats, version check and questionnaire checkboxes
646 connectTab.add(usagestats,
647 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
648 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
649 new Insets(0, 2, 5, 5), 70, 1));
650 connectTab.add(questionnaire,
651 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
652 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
653 new Insets(0, 2, 5, 10), 70, 1));
654 connectTab.add(versioncheck,
655 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
656 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
657 new Insets(0, 2, 5, 5), 70, 1));
659 // Add padding so the panel doesn't look ridiculous
660 JPanel spacePanel = new JPanel();
661 connectTab.add(spacePanel,
662 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
663 GridBagConstraints.WEST, GridBagConstraints.BOTH,
664 new Insets(0, 0, 0, 5), 70, 1));
670 * Initialises the Links tabbed panel.
674 private JPanel initLinksTab()
676 JPanel linkTab = new JPanel();
677 linkTab.setLayout(new GridBagLayout());
679 // Set up table for Url links
680 linkUrlTable.setFillsViewportHeight(true);
681 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
682 linkUrlTable.setAutoCreateRowSorter(true);
683 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
685 // adjust row height so radio buttons actually fit
686 // don't do this in the renderer, it causes the awt thread to activate
688 JRadioButton temp = new JRadioButton();
689 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
691 // Table in scrollpane so that the table is given a scrollbar
692 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
693 linkScrollPane.setBorder(null);
695 // Panel for links functionality
696 JPanel linkPanel = new JPanel(new GridBagLayout());
697 linkPanel.setBorder(new TitledBorder(
698 MessageManager.getString("label.url_linkfrom_sequence_id")));
700 // Put the Url links panel together
702 // Buttons go at top right, resizing only resizes the blank space vertically
703 JPanel buttonPanel = initLinkTabUrlButtons();
704 GridBagConstraints linkConstraints1 = new GridBagConstraints();
705 linkConstraints1.insets = new Insets(0, 0, 5, 0);
706 linkConstraints1.gridx = 0;
707 linkConstraints1.gridy = 0;
708 linkConstraints1.weightx = 1.0;
709 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
710 linkTab.add(buttonPanel, linkConstraints1);
712 // Links table goes at top left, resizing resizes the table
713 GridBagConstraints linkConstraints2 = new GridBagConstraints();
714 linkConstraints2.insets = new Insets(0, 0, 5, 5);
715 linkConstraints2.gridx = 0;
716 linkConstraints2.gridy = 1;
717 linkConstraints2.weightx = 1.0;
718 linkConstraints2.weighty = 1.0;
719 linkConstraints2.fill = GridBagConstraints.BOTH;
720 linkTab.add(linkScrollPane, linkConstraints2);
722 // Filter box and buttons goes at bottom left, resizing resizes the text box
723 JPanel filterPanel = initLinkTabFilterPanel();
724 GridBagConstraints linkConstraints3 = new GridBagConstraints();
725 linkConstraints3.insets = new Insets(0, 0, 0, 5);
726 linkConstraints3.gridx = 0;
727 linkConstraints3.gridy = 2;
728 linkConstraints3.weightx = 1.0;
729 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
730 linkTab.add(filterPanel, linkConstraints3);
735 private JPanel initLinkTabFilterPanel()
737 // Filter textbox and reset button
738 JLabel filterLabel = new JLabel(
739 MessageManager.getString("label.filter"));
740 filterLabel.setFont(LABEL_FONT);
741 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
742 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
744 filterTB.setFont(LABEL_FONT);
745 filterTB.setText("");
747 doReset.setText(MessageManager.getString("action.showall"));
748 userOnly.setText(MessageManager.getString("action.customfilter"));
750 // Panel for filter functionality
751 JPanel filterPanel = new JPanel(new GridBagLayout());
752 filterPanel.setBorder(new TitledBorder("Filter"));
753 GridBagConstraints gbc = new GridBagConstraints();
756 gbc.fill = GridBagConstraints.NONE;
757 gbc.anchor = GridBagConstraints.WEST;
759 filterPanel.add(filterLabel, gbc);
761 GridBagConstraints gbc1 = new GridBagConstraints();
764 gbc1.fill = GridBagConstraints.HORIZONTAL;
765 gbc1.anchor = GridBagConstraints.WEST;
767 filterPanel.add(filterTB, gbc1);
769 GridBagConstraints gbc2 = new GridBagConstraints();
771 gbc2.fill = GridBagConstraints.NONE;
772 gbc2.anchor = GridBagConstraints.WEST;
773 filterPanel.add(doReset, gbc2);
775 GridBagConstraints gbc3 = new GridBagConstraints();
777 gbc3.fill = GridBagConstraints.NONE;
778 gbc3.anchor = GridBagConstraints.WEST;
779 filterPanel.add(userOnly, gbc3);
784 private JPanel initLinkTabUrlButtons()
786 // Buttons for new / edit / delete Url links
787 JButton newLink = new JButton();
788 newLink.setText(MessageManager.getString("action.new"));
790 editLink.setText(MessageManager.getString("action.edit"));
792 deleteLink.setText(MessageManager.getString("action.delete"));
794 // no current selection, so initially disable delete/edit buttons
795 editLink.setEnabled(false);
796 deleteLink.setEnabled(false);
798 newLink.addActionListener(new java.awt.event.ActionListener()
801 public void actionPerformed(ActionEvent e)
803 newLink_actionPerformed(e);
807 editLink.setText(MessageManager.getString("action.edit"));
808 editLink.addActionListener(new java.awt.event.ActionListener()
811 public void actionPerformed(ActionEvent e)
813 editLink_actionPerformed(e);
817 deleteLink.setText(MessageManager.getString("action.delete"));
818 deleteLink.addActionListener(new java.awt.event.ActionListener()
821 public void actionPerformed(ActionEvent e)
823 deleteLink_actionPerformed(e);
827 JPanel buttonPanel = new JPanel(new GridBagLayout());
828 buttonPanel.setBorder(new TitledBorder("Edit links"));
829 GridBagConstraints gbc = new GridBagConstraints();
832 gbc.fill = GridBagConstraints.NONE;
833 buttonPanel.add(newLink, gbc);
835 GridBagConstraints gbc1 = new GridBagConstraints();
838 gbc1.fill = GridBagConstraints.NONE;
839 buttonPanel.add(editLink, gbc1);
841 GridBagConstraints gbc2 = new GridBagConstraints();
844 gbc2.fill = GridBagConstraints.NONE;
845 buttonPanel.add(deleteLink, gbc2);
847 GridBagConstraints gbc3 = new GridBagConstraints();
850 gbc3.fill = GridBagConstraints.HORIZONTAL;
852 JPanel spacePanel = new JPanel();
853 spacePanel.setBorder(null);
854 buttonPanel.add(spacePanel, gbc3);
860 * Initialises the proxy server panel in the Connections tab
862 * @return the proxy server panel
864 private JPanel initConnTabProxyPanel()
866 // Label for server text box
867 serverLabel.setText(MessageManager.getString("label.address"));
868 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
869 serverLabel.setFont(LABEL_FONT);
871 // Proxy server and port text boxes
872 proxyServerTB.setFont(LABEL_FONT);
873 proxyPortTB.setFont(LABEL_FONT);
875 // Label for Port text box
876 portLabel.setFont(LABEL_FONT);
877 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
878 portLabel.setText(MessageManager.getString("label.port"));
880 // Use proxy server checkbox
881 useProxy.setFont(LABEL_FONT);
882 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
883 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
884 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
885 useProxy.addActionListener(new ActionListener()
888 public void actionPerformed(ActionEvent e)
890 useProxy_actionPerformed();
894 // Make proxy server panel
895 JPanel proxyPanel = new JPanel();
896 TitledBorder titledBorder1 = new TitledBorder(
897 MessageManager.getString("label.proxy_server"));
898 proxyPanel.setBorder(titledBorder1);
899 proxyPanel.setLayout(new GridBagLayout());
900 proxyPanel.add(serverLabel,
901 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
902 GridBagConstraints.WEST, GridBagConstraints.NONE,
903 new Insets(0, 2, 2, 0), 5, 0));
904 proxyPanel.add(portLabel,
905 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
906 GridBagConstraints.WEST, GridBagConstraints.NONE,
907 new Insets(0, 0, 2, 0), 11, 0));
908 proxyPanel.add(useProxy,
909 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
910 GridBagConstraints.WEST, GridBagConstraints.NONE,
911 new Insets(0, 2, 5, 185), 2, -4));
912 proxyPanel.add(proxyPortTB,
913 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
914 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
915 new Insets(0, 2, 2, 2), 54, 1));
916 proxyPanel.add(proxyServerTB,
917 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
918 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
919 new Insets(0, 2, 2, 0), 263, 1));
925 * Initialises the checkboxes in the Connections tab
927 private void initConnTabCheckboxes()
929 // Usage stats checkbox label
931 MessageManager.getString("label.send_usage_statistics"));
932 usagestats.setFont(LABEL_FONT);
933 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
934 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
936 // Questionnaire checkbox label
937 questionnaire.setText(
938 MessageManager.getString("label.check_for_questionnaires"));
939 questionnaire.setFont(LABEL_FONT);
940 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
941 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
943 // Check for latest version checkbox label
944 versioncheck.setText(
945 MessageManager.getString("label.check_for_latest_version"));
946 versioncheck.setFont(LABEL_FONT);
947 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
948 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
952 * Initialises the parent panel which contains the tabbed sections.
956 private JPanel initOkCancelPanel()
958 JButton ok = new JButton();
959 ok.setText(MessageManager.getString("action.ok"));
960 ok.addActionListener(new ActionListener()
963 public void actionPerformed(ActionEvent e)
965 ok_actionPerformed(e);
968 JButton cancel = new JButton();
969 cancel.setText(MessageManager.getString("action.cancel"));
970 cancel.addActionListener(new ActionListener()
973 public void actionPerformed(ActionEvent e)
975 cancel_actionPerformed(e);
978 JPanel okCancelPanel = new JPanel();
979 okCancelPanel.add(ok);
980 okCancelPanel.add(cancel);
981 return okCancelPanel;
985 * Initialises the Colours tabbed panel.
989 private JPanel initColoursTab()
991 JPanel coloursTab = new JPanel();
992 coloursTab.setBorder(new TitledBorder(
993 MessageManager.getString("action.open_new_alignment")));
994 coloursTab.setLayout(new FlowLayout());
995 JLabel mincolourLabel = new JLabel();
996 mincolourLabel.setFont(LABEL_FONT);
997 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
998 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
999 minColour.setFont(LABEL_FONT);
1000 minColour.setBorder(BorderFactory.createEtchedBorder());
1001 minColour.setPreferredSize(new Dimension(40, 20));
1002 minColour.addMouseListener(new MouseAdapter()
1005 public void mousePressed(MouseEvent e)
1007 minColour_actionPerformed(minColour);
1010 JLabel maxcolourLabel = new JLabel();
1011 maxcolourLabel.setFont(LABEL_FONT);
1012 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1013 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1014 maxColour.setFont(LABEL_FONT);
1015 maxColour.setBorder(BorderFactory.createEtchedBorder());
1016 maxColour.setPreferredSize(new Dimension(40, 20));
1017 maxColour.addMouseListener(new MouseAdapter()
1020 public void mousePressed(MouseEvent e)
1022 maxColour_actionPerformed(maxColour);
1026 protColour.setFont(LABEL_FONT);
1027 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1028 JLabel protColourLabel = new JLabel();
1029 protColourLabel.setFont(LABEL_FONT);
1030 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1031 protColourLabel.setText(
1032 MessageManager.getString("label.prot_alignment_colour") + " ");
1033 JvSwingUtils.addtoLayout(coloursTab,
1035 .getString("label.default_colour_scheme_for_alignment"),
1036 protColourLabel, protColour);
1038 nucColour.setFont(LABEL_FONT);
1039 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1040 JLabel nucColourLabel = new JLabel();
1041 nucColourLabel.setFont(LABEL_FONT);
1042 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1043 nucColourLabel.setText(
1044 MessageManager.getString("label.nuc_alignment_colour") + " ");
1045 JvSwingUtils.addtoLayout(coloursTab,
1047 .getString("label.default_colour_scheme_for_alignment"),
1048 nucColourLabel, nucColour);
1050 JPanel annotationShding = new JPanel();
1051 annotationShding.setBorder(new TitledBorder(
1052 MessageManager.getString("label.annotation_shading_default")));
1053 annotationShding.setLayout(new GridLayout(1, 2));
1054 JvSwingUtils.addtoLayout(annotationShding,
1055 MessageManager.getString(
1056 "label.default_minimum_colour_annotation_shading"),
1057 mincolourLabel, minColour);
1058 JvSwingUtils.addtoLayout(annotationShding,
1059 MessageManager.getString(
1060 "label.default_maximum_colour_annotation_shading"),
1061 maxcolourLabel, maxColour);
1062 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1067 * Initialises the Structure tabbed panel.
1071 private JPanel initStructureTab()
1073 structureTab = new JPanel();
1075 structureTab.setBorder(new TitledBorder(
1076 MessageManager.getString("label.structure_options")));
1077 structureTab.setLayout(null);
1078 final int width = 400;
1079 final int height = 22;
1080 final int lineSpacing = 25;
1083 structFromPdb.setFont(LABEL_FONT);
1085 .setText(MessageManager.getString("label.struct_from_pdb"));
1086 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1087 structFromPdb.addActionListener(new ActionListener()
1090 public void actionPerformed(ActionEvent e)
1092 boolean selected = structFromPdb.isSelected();
1093 // enable other options only when the first is checked
1094 useRnaView.setEnabled(selected);
1095 addSecondaryStructure.setEnabled(selected);
1096 addTempFactor.setEnabled(selected);
1099 structureTab.add(structFromPdb);
1101 // indent checkboxes that are conditional on the first one
1102 ypos += lineSpacing;
1103 useRnaView.setFont(LABEL_FONT);
1104 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1105 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1106 structureTab.add(useRnaView);
1108 ypos += lineSpacing;
1109 addSecondaryStructure.setFont(LABEL_FONT);
1110 addSecondaryStructure
1111 .setText(MessageManager.getString("label.autoadd_secstr"));
1112 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1113 structureTab.add(addSecondaryStructure);
1115 ypos += lineSpacing;
1116 addTempFactor.setFont(LABEL_FONT);
1117 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1118 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1119 structureTab.add(addTempFactor);
1121 ypos += lineSpacing;
1122 JLabel viewerLabel = new JLabel();
1123 viewerLabel.setFont(LABEL_FONT);
1124 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1125 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1126 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1127 structureTab.add(viewerLabel);
1129 structViewer.setFont(LABEL_FONT);
1130 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1131 structViewer.addItem(ViewerType.JMOL.name());
1132 structViewer.addItem(ViewerType.CHIMERA.name());
1133 structViewer.addActionListener(new ActionListener()
1136 public void actionPerformed(ActionEvent e)
1138 structureViewer_actionPerformed(
1139 (String) structViewer.getSelectedItem());
1142 structureTab.add(structViewer);
1144 ypos += lineSpacing;
1145 JLabel pathLabel = new JLabel();
1146 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1147 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1148 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1149 final String tooltip = JvSwingUtils.wrapTooltip(true,
1150 MessageManager.getString("label.chimera_path_tip"));
1151 pathLabel.setToolTipText(tooltip);
1152 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1153 structureTab.add(pathLabel);
1155 chimeraPath.setFont(LABEL_FONT);
1156 chimeraPath.setText("");
1157 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1158 chimeraPath.addMouseListener(new MouseAdapter()
1161 public void mouseClicked(MouseEvent e)
1163 if (e.getClickCount() == 2)
1165 String chosen = openFileChooser(false);
1168 chimeraPath.setText(chosen);
1173 structureTab.add(chimeraPath);
1175 ypos += lineSpacing;
1176 nwMapping.setFont(LABEL_FONT);
1177 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1178 siftsMapping.setFont(LABEL_FONT);
1179 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1180 mappingMethod.add(nwMapping);
1181 mappingMethod.add(siftsMapping);
1182 JPanel mappingPanel = new JPanel();
1183 mappingPanel.setFont(LABEL_FONT);
1184 TitledBorder mmTitledBorder = new TitledBorder(
1185 MessageManager.getString("label.mapping_method"));
1186 mmTitledBorder.setTitleFont(LABEL_FONT);
1187 mappingPanel.setBorder(mmTitledBorder);
1188 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1189 // GridLayout mappingLayout = new GridLayout();
1190 mappingPanel.setLayout(new GridLayout());
1191 mappingPanel.add(nwMapping);
1192 mappingPanel.add(siftsMapping);
1193 structureTab.add(mappingPanel);
1195 ypos += lineSpacing;
1196 ypos += lineSpacing;
1197 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1198 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1199 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1200 structureTab.add(docFieldPref);
1202 return structureTab;
1206 * Action on choosing a structure viewer from combobox options.
1208 * @param selectedItem
1210 protected void structureViewer_actionPerformed(String selectedItem)
1215 * Show a dialog for the user to choose a file. Returns the chosen path, or
1220 protected String openFileChooser(boolean forFolder)
1222 String choice = null;
1223 JFileChooser chooser = new JFileChooser();
1226 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1229 // chooser.setFileView(new JalviewFileView());
1230 chooser.setDialogTitle(
1231 MessageManager.getString("label.open_local_file"));
1232 chooser.setToolTipText(MessageManager.getString("action.open"));
1234 int value = chooser.showOpenDialog(this);
1236 if (value == JFileChooser.APPROVE_OPTION)
1238 choice = chooser.getSelectedFile().getPath();
1243 protected boolean validateStructure()
1248 protected boolean validateHMMERPath(boolean showWarning)
1254 * Initialises the Visual tabbed panel.
1258 private JPanel initVisualTab()
1260 JPanel visualTab = new JPanel();
1261 visualTab.setBorder(new TitledBorder(
1262 MessageManager.getString("action.open_new_alignment")));
1263 visualTab.setLayout(null);
1264 fullScreen.setFont(LABEL_FONT);
1265 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1266 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1267 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1268 quality.setEnabled(false);
1269 quality.setFont(LABEL_FONT);
1270 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1271 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1272 quality.setSelected(true);
1273 quality.setText(MessageManager.getString("label.quality"));
1274 conservation.setEnabled(false);
1275 conservation.setFont(LABEL_FONT);
1276 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1277 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1278 conservation.setSelected(true);
1279 conservation.setText(MessageManager.getString("label.conservation"));
1280 identity.setEnabled(false);
1281 identity.setFont(LABEL_FONT);
1282 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1283 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1284 identity.setSelected(true);
1285 identity.setText(MessageManager.getString("label.consensus"));
1286 showOccupancy.setFont(LABEL_FONT);
1287 showOccupancy.setEnabled(false);
1288 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1289 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1290 showOccupancy.setSelected(true);
1291 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1293 JLabel showGroupbits = new JLabel();
1294 showGroupbits.setFont(LABEL_FONT);
1295 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1296 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1298 .setText(MessageManager.getString("action.show_group") + ":");
1299 JLabel showConsensbits = new JLabel();
1300 showConsensbits.setFont(LABEL_FONT);
1301 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1302 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1304 .setText(MessageManager.getString("label.consensus") + ":");
1305 showConsensHistogram.setEnabled(false);
1306 showConsensHistogram.setFont(LABEL_FONT);
1307 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1308 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1309 showConsensHistogram.setSelected(true);
1310 showConsensHistogram
1311 .setText(MessageManager.getString("label.histogram"));
1312 showConsensLogo.setEnabled(false);
1313 showConsensLogo.setFont(LABEL_FONT);
1314 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1315 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1316 showConsensLogo.setSelected(true);
1317 showConsensLogo.setText(MessageManager.getString("label.logo"));
1318 showGroupConsensus.setEnabled(false);
1319 showGroupConsensus.setFont(LABEL_FONT);
1320 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1321 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1322 showGroupConsensus.setSelected(true);
1323 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1324 showGroupConservation.setEnabled(false);
1325 showGroupConservation.setFont(LABEL_FONT);
1326 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1327 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1328 showGroupConservation.setSelected(true);
1329 showGroupConservation
1330 .setText(MessageManager.getString("label.conservation"));
1331 showNpTooltip.setEnabled(true);
1332 showNpTooltip.setFont(LABEL_FONT);
1333 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1334 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1335 showNpTooltip.setSelected(true);
1336 showNpTooltip.setText(
1337 MessageManager.getString("label.non_positional_features"));
1338 showDbRefTooltip.setEnabled(true);
1339 showDbRefTooltip.setFont(LABEL_FONT);
1340 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1341 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1342 showDbRefTooltip.setSelected(true);
1344 .setText(MessageManager.getString("label.database_references"));
1345 annotations.setFont(LABEL_FONT);
1346 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1347 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1348 annotations.setSelected(true);
1349 annotations.setText(MessageManager.getString("label.show_annotations"));
1350 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1351 annotations.addActionListener(new ActionListener()
1354 public void actionPerformed(ActionEvent e)
1356 annotations_actionPerformed(e);
1359 identity.addActionListener(new ActionListener()
1362 public void actionPerformed(ActionEvent e)
1364 annotations_actionPerformed(e);
1367 showGroupConsensus.addActionListener(new ActionListener()
1370 public void actionPerformed(ActionEvent e)
1372 annotations_actionPerformed(e);
1375 showUnconserved.setFont(LABEL_FONT);
1376 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1377 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1378 showUnconserved.setSelected(true);
1380 .setText(MessageManager.getString("action.show_unconserved"));
1381 showUnconserved.addActionListener(new ActionListener()
1384 public void actionPerformed(ActionEvent e)
1386 showunconserved_actionPerformed(e);
1390 // TODO these are not yet added to / action from Preferences
1391 // JCheckBox shareSelections = new JCheckBox();
1392 // shareSelections.setFont(verdana11);
1393 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1394 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1395 // shareSelections.setSelected(true);
1396 // shareSelections.setText(MessageManager
1397 // .getString("label.share_selection_across_views"));
1398 // JCheckBox followHighlight = new JCheckBox();
1399 // followHighlight.setFont(verdana11);
1400 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1401 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1402 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1403 // followHighlight.setSelected(true);
1404 // followHighlight.setText(MessageManager
1405 // .getString("label.scroll_highlighted_regions"));
1407 seqLimit.setFont(LABEL_FONT);
1408 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1409 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1410 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1411 smoothFont.setFont(LABEL_FONT);
1412 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1413 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1414 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1415 scaleProteinToCdna.setFont(LABEL_FONT);
1416 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1417 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1418 scaleProteinToCdna.setText(
1419 MessageManager.getString("label.scale_protein_to_cdna"));
1420 scaleProteinToCdna.setToolTipText(
1421 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1422 JLabel gapLabel = new JLabel();
1423 gapLabel.setFont(LABEL_FONT);
1424 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1425 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1426 JLabel fontLabel = new JLabel();
1427 fontLabel.setFont(LABEL_FONT);
1428 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1429 fontLabel.setText(MessageManager.getString("label.font"));
1430 fontSizeCB.setFont(LABEL_FONT);
1431 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1432 fontStyleCB.setFont(LABEL_FONT);
1433 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1434 fontNameCB.setFont(LABEL_FONT);
1435 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1436 gapSymbolCB.setFont(LABEL_FONT);
1437 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1438 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1439 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1440 gapSymbolCB.setRenderer(dlcr);
1442 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1443 startupCheckbox.setFont(LABEL_FONT);
1444 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1445 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1446 startupCheckbox.setSelected(true);
1447 startupFileTextfield.setFont(LABEL_FONT);
1448 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1449 startupFileTextfield.addMouseListener(new MouseAdapter()
1452 public void mouseClicked(MouseEvent e)
1454 if (e.getClickCount() > 1)
1456 startupFileTextfield_mouseClicked();
1461 sortby.setFont(LABEL_FONT);
1462 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1463 JLabel sortLabel = new JLabel();
1464 sortLabel.setFont(LABEL_FONT);
1465 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1466 sortLabel.setText(MessageManager.getString("label.sort_by"));
1467 sortAnnBy.setFont(LABEL_FONT);
1468 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1469 JLabel sortAnnLabel = new JLabel();
1470 sortAnnLabel.setFont(LABEL_FONT);
1471 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1472 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1473 sortAutocalc.setFont(LABEL_FONT);
1474 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1476 JPanel annsettingsPanel = new JPanel();
1477 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1478 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1479 annsettingsPanel.setBorder(new EtchedBorder());
1480 visualTab.add(annsettingsPanel);
1481 Border jb = new EmptyBorder(1, 1, 4, 5);
1482 annotations.setBorder(jb);
1483 showOccupancy.setBorder(jb);
1484 quality.setBorder(jb);
1485 conservation.setBorder(jb);
1486 identity.setBorder(jb);
1487 showConsensbits.setBorder(jb);
1488 showGroupbits.setBorder(jb);
1489 showGroupConsensus.setBorder(jb);
1490 showGroupConservation.setBorder(jb);
1491 showConsensHistogram.setBorder(jb);
1492 showConsensLogo.setBorder(jb);
1494 JPanel autoAnnotSettings = new JPanel();
1495 annsettingsPanel.add(autoAnnotSettings);
1496 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1497 autoAnnotSettings.add(annotations);
1498 autoAnnotSettings.add(quality);
1499 // second row of autoannotation box
1500 autoAnnotSettings = new JPanel();
1501 annsettingsPanel.add(autoAnnotSettings);
1503 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1504 autoAnnotSettings.add(conservation);
1505 autoAnnotSettings.add(identity);
1506 autoAnnotSettings.add(showOccupancy);
1507 autoAnnotSettings.add(showGroupbits);
1508 autoAnnotSettings.add(showGroupConservation);
1509 autoAnnotSettings.add(showGroupConsensus);
1510 autoAnnotSettings.add(showConsensbits);
1511 autoAnnotSettings.add(showConsensHistogram);
1512 autoAnnotSettings.add(showConsensLogo);
1514 JPanel tooltipSettings = new JPanel();
1515 tooltipSettings.setBorder(new TitledBorder(
1516 MessageManager.getString("label.sequence_id_tooltip")));
1517 tooltipSettings.setBounds(173, 140, 220, 62);
1518 tooltipSettings.setLayout(new GridLayout(2, 1));
1519 tooltipSettings.add(showDbRefTooltip);
1520 tooltipSettings.add(showNpTooltip);
1521 visualTab.add(tooltipSettings);
1523 wrap.setFont(LABEL_FONT);
1524 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1525 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1526 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1527 rightAlign.setFont(LABEL_FONT);
1528 rightAlign.setForeground(Color.black);
1529 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1530 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1531 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1532 idItalics.setFont(LABEL_FONT_ITALIC);
1533 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1534 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1536 MessageManager.getString("label.sequence_name_italics"));
1537 openoverv.setFont(LABEL_FONT);
1538 openoverv.setActionCommand(
1539 MessageManager.getString("label.open_overview"));
1540 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1541 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1542 openoverv.setText(MessageManager.getString("label.open_overview"));
1543 JPanel jPanel2 = new JPanel();
1544 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1545 jPanel2.setLayout(new GridLayout(14, 1));
1546 jPanel2.add(fullScreen);
1547 jPanel2.add(openoverv);
1548 jPanel2.add(seqLimit);
1549 jPanel2.add(rightAlign);
1550 jPanel2.add(fontLabel);
1551 jPanel2.add(showUnconserved);
1552 jPanel2.add(idItalics);
1553 jPanel2.add(smoothFont);
1554 jPanel2.add(scaleProteinToCdna);
1555 jPanel2.add(gapLabel);
1557 jPanel2.add(sortLabel);
1558 jPanel2.add(sortAnnLabel);
1559 jPanel2.add(startupCheckbox);
1560 visualTab.add(jPanel2);
1561 visualTab.add(startupFileTextfield);
1562 visualTab.add(sortby);
1563 visualTab.add(sortAnnBy);
1564 visualTab.add(sortAutocalc);
1565 visualTab.add(gapSymbolCB);
1566 visualTab.add(fontNameCB);
1567 visualTab.add(fontSizeCB);
1568 visualTab.add(fontStyleCB);
1572 protected void autoIdWidth_actionPerformed()
1574 // TODO Auto-generated method stub
1578 protected void userIdWidth_actionPerformed()
1580 // TODO Auto-generated method stub
1584 protected void maxColour_actionPerformed(JPanel panel)
1588 protected void minColour_actionPerformed(JPanel panel)
1592 protected void showunconserved_actionPerformed(ActionEvent e)
1594 // TODO Auto-generated method stub
1604 public void ok_actionPerformed(ActionEvent e)
1614 public void cancel_actionPerformed(ActionEvent e)
1624 public void annotations_actionPerformed(ActionEvent e)
1631 public void startupFileTextfield_mouseClicked()
1635 public void newLink_actionPerformed(ActionEvent e)
1640 public void editLink_actionPerformed(ActionEvent e)
1645 public void deleteLink_actionPerformed(ActionEvent e)
1650 public void defaultBrowser_mouseClicked(MouseEvent e)
1655 public void linkURLList_keyTyped(KeyEvent e)
1660 public void useProxy_actionPerformed()
1662 boolean enabled = useProxy.isSelected();
1663 portLabel.setEnabled(enabled);
1664 serverLabel.setEnabled(enabled);
1665 proxyServerTB.setEnabled(enabled);
1666 proxyPortTB.setEnabled(enabled);
1670 * Customer renderer for JTable: supports column of radio buttons
1672 public class RadioButtonRenderer extends JRadioButton
1673 implements TableCellRenderer
1675 public RadioButtonRenderer()
1677 setHorizontalAlignment(CENTER);
1678 setToolTipText(MessageManager.getString("label.urltooltip"));
1682 public Component getTableCellRendererComponent(JTable table,
1683 Object value, boolean isSelected, boolean hasFocus, int row,
1686 setSelected((boolean) value);
1688 // set colours to match rest of table
1691 setBackground(table.getSelectionBackground());
1692 setForeground(table.getSelectionForeground());
1696 setBackground(table.getBackground());
1697 setForeground(table.getForeground());
1704 * Customer cell editor for JTable: supports column of radio buttons in
1705 * conjunction with renderer
1707 public class RadioButtonEditor extends AbstractCellEditor
1708 implements TableCellEditor
1710 private JRadioButton button = new JRadioButton();
1712 public RadioButtonEditor()
1714 button.setHorizontalAlignment(SwingConstants.CENTER);
1715 this.button.addActionListener(new ActionListener()
1718 public void actionPerformed(ActionEvent e)
1720 fireEditingStopped();
1726 public Component getTableCellEditorComponent(JTable table, Object value,
1727 boolean isSelected, int row, int column)
1729 button.setSelected((boolean) value);
1734 public Object getCellEditorValue()
1736 return button.isSelected();
1741 public void hmmerPath_actionPerformed(ActionEvent e)