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 JCheckBox isHMMERInstalled = new JCheckBox();
281 protected JTextField hmmerPath = new JTextField();
283 protected JLabel hmmsearch = new JLabel();
285 protected JLabel hmmalign = new JLabel();
290 protected JPanel dasTab = new JPanel();
295 protected JPanel wsTab = new JPanel();
300 * Creates a new GPreferences object.
302 public GPreferences()
307 } catch (Exception ex)
309 ex.printStackTrace();
314 * Construct the panel and its tabbed sub-panels.
318 private void jbInit() throws Exception
320 final JTabbedPane tabbedPane = new JTabbedPane();
321 this.setLayout(new BorderLayout());
322 JPanel okCancelPanel = initOkCancelPanel();
323 this.add(tabbedPane, BorderLayout.CENTER);
324 this.add(okCancelPanel, BorderLayout.SOUTH);
326 tabbedPane.add(initVisualTab(),
327 MessageManager.getString("label.visual"));
329 tabbedPane.add(initColoursTab(),
330 MessageManager.getString("label.colours"));
332 tabbedPane.add(initStructureTab(),
333 MessageManager.getString("label.structure"));
335 tabbedPane.add(initConnectionsTab(),
336 MessageManager.getString("label.connections"));
338 tabbedPane.add(initLinksTab(),
339 MessageManager.getString("label.urllinks"));
341 tabbedPane.add(initOutputTab(),
342 MessageManager.getString("label.output"));
344 tabbedPane.add(initEditingTab(),
345 MessageManager.getString("label.editing"));
347 tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
350 * See DasSourceBrowser for the real work of configuring this tab.
352 dasTab.setLayout(new BorderLayout());
353 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
356 * See WsPreferences for the real work of configuring this tab.
358 wsTab.setLayout(new BorderLayout());
359 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
362 * Handler to validate a tab before leaving it - currently only for
365 tabbedPane.addChangeListener(new ChangeListener()
367 private Component lastTab;
370 public void stateChanged(ChangeEvent e)
372 if (lastTab == structureTab
373 && tabbedPane.getSelectedComponent() != structureTab)
375 if (!validateStructure())
377 tabbedPane.setSelectedComponent(structureTab);
381 else if (lastTab == hmmerTab
382 && tabbedPane.getSelectedComponent() != hmmerTab
383 && isHMMERInstalled.isSelected())
385 if (!validateHMMER())
387 tabbedPane.setSelectedComponent(hmmerTab);
391 lastTab = tabbedPane.getSelectedComponent();
398 * Initialises the Editing tabbed panel.
402 private JPanel initEditingTab()
404 JPanel editingTab = new JPanel();
405 editingTab.setLayout(null);
406 autoCalculateConsCheck.setFont(LABEL_FONT);
407 autoCalculateConsCheck.setText(MessageManager
408 .getString("label.autocalculate_consensus"));
409 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
410 padGaps.setFont(LABEL_FONT);
411 padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
412 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
413 sortByTree.setFont(LABEL_FONT);
415 .setText(MessageManager.getString("label.sort_with_new_tree"));
417 .setToolTipText(MessageManager
418 .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
419 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
420 editingTab.add(autoCalculateConsCheck);
421 editingTab.add(padGaps);
422 editingTab.add(sortByTree);
427 * Initialises the hmmer tabbed panel.
431 private JPanel initHMMERTab()
433 hmmerTab.setLayout(null);
435 hmmalign.setFont(LABEL_FONT);
436 hmmalign.setText(MessageManager.getString("label.hmmalign_label"));
437 hmmalign.setBounds(new Rectangle(22, 10, 200, 23));
439 trimTermini.setFont(LABEL_FONT);
440 trimTermini.setText(MessageManager.getString("label.trim_termini"));
441 trimTermini.setBounds(new Rectangle(22, 30, 200, 23));
443 hmmsearch.setFont(LABEL_FONT);
444 hmmsearch.setText(MessageManager.getString("label.hmmsearch_label"));
445 hmmsearch.setBounds(new Rectangle(250, 10, 200, 23));
447 sequencesToKeep.setFont(LABEL_FONT);
449 .setText(MessageManager.getString("label.no_of_sequences"));
450 sequencesToKeep.setBounds(new Rectangle(250, 30, 125, 23));
451 numberOfSequencesToKeepField.setBounds(new Rectangle(375, 30, 40, 23));
453 isHMMERInstalled.setFont(LABEL_FONT);
454 isHMMERInstalled.setText(
455 MessageManager.getString("label.hmmer_installed"));
456 isHMMERInstalled.setBounds(new Rectangle(22, 180, 200, 23));
457 isHMMERInstalled.addActionListener(new ActionListener()
460 public void actionPerformed(ActionEvent e)
462 boolean status = isHMMERInstalled.isSelected();
463 installationLocation.setEnabled(status);
464 hmmerPath.setEnabled(status);
467 installationLocation.setFont(LABEL_FONT);
468 installationLocation.setText(
469 MessageManager.getString("label.change_hmmer_location"));
470 installationLocation.setBounds(new Rectangle(22, 200, 200, 23));
471 hmmerPath.setBounds(new Rectangle(22, 220, 200, 23));
472 hmmerPath.addMouseListener(new MouseAdapter()
475 public void mouseClicked(MouseEvent e)
477 if (e.getClickCount() == 2)
479 String chosen = openFileChooser();
482 hmmerPath.setText(chosen);
488 backgroundFreqSource.add(uniprot);
489 backgroundFreqSource.add(alignment);
490 backgroundFreqSource.setSelected(uniprot.getModel(), true);
492 uniprot.setText(MessageManager.getString("label.freq_uniprot"));
493 uniprot.setFont(LABEL_FONT);
494 uniprot.setBounds(new Rectangle(22, 260, 255, 23));
496 alignment.setText(MessageManager.getString("label.freq_alignment"));
497 alignment.setFont(LABEL_FONT);
498 alignment.setBounds(new Rectangle(22, 280, 255, 23));
500 hmmerTab.add(uniprot);
501 hmmerTab.add(alignment);
502 hmmerTab.add(hmmalign);
503 hmmerTab.add(hmmsearch);
504 hmmerTab.add(installationLocation);
505 hmmerTab.add(hmmerPath);
506 hmmerTab.add(trimTermini);
507 hmmerTab.add(sequencesToKeep);
508 hmmerTab.add(sequencesToKeep);
509 hmmerTab.add(numberOfSequencesToKeepField);
510 hmmerTab.add(isHMMERInstalled);
516 * Initialises the Output tabbed panel.
520 private JPanel initOutputTab()
522 JPanel outputTab = new JPanel();
523 outputTab.setLayout(null);
524 JLabel epsLabel = new JLabel();
525 epsLabel.setFont(LABEL_FONT);
526 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
527 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
528 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
529 epsRendering.setFont(LABEL_FONT);
530 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
531 JLabel jLabel1 = new JLabel();
532 jLabel1.setFont(LABEL_FONT);
533 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
534 jLabel1.setText(MessageManager.getString("label.append_start_end"));
535 jLabel1.setFont(LABEL_FONT);
536 fastajv.setFont(LABEL_FONT);
537 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
538 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
539 blcjv.setText(MessageManager.getString("label.blc") + " ");
540 fastajv.setText(MessageManager.getString("label.fasta") + " ");
541 msfjv.setText(MessageManager.getString("label.msf") + " ");
542 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
543 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
544 msfjv.setFont(LABEL_FONT);
545 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
546 pirjv.setText(MessageManager.getString("label.pir") + " ");
547 JPanel jPanel11 = new JPanel();
548 jPanel11.setFont(LABEL_FONT);
549 TitledBorder titledBorder2 = new TitledBorder(
550 MessageManager.getString("label.file_output"));
551 jPanel11.setBorder(titledBorder2);
552 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
553 GridLayout gridLayout3 = new GridLayout();
554 jPanel11.setLayout(gridLayout3);
555 gridLayout3.setRows(8);
556 blcjv.setFont(LABEL_FONT);
557 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
558 clustaljv.setFont(LABEL_FONT);
559 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
560 pfamjv.setFont(LABEL_FONT);
561 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
562 pileupjv.setFont(LABEL_FONT);
563 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
564 pirjv.setFont(LABEL_FONT);
565 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
566 autoIdWidth.setFont(LABEL_FONT);
567 autoIdWidth.setText(MessageManager
568 .getString("label.automatically_set_id_width"));
569 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true,
571 .getString("label.adjusts_width_generated_eps_png")));
572 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
573 autoIdWidth.addActionListener(new ActionListener()
577 public void actionPerformed(ActionEvent e)
579 autoIdWidth_actionPerformed();
582 userIdWidthlabel.setFont(LABEL_FONT);
583 userIdWidthlabel.setText(MessageManager
584 .getString("label.figure_id_column_width"));
586 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
587 .getString("label.manually_specify_width_left_column")));
589 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
590 .getString("label.manually_specify_width_left_column")));
591 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
592 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
593 userIdWidth.setText("");
594 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
595 userIdWidth.addActionListener(new ActionListener()
599 public void actionPerformed(ActionEvent e)
601 userIdWidth_actionPerformed();
604 modellerOutput.setFont(LABEL_FONT);
605 modellerOutput.setText(MessageManager
606 .getString("label.use_modeller_output"));
607 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
608 embbedBioJSON.setFont(LABEL_FONT);
609 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
610 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
612 jPanel11.add(jLabel1);
614 jPanel11.add(clustaljv);
615 jPanel11.add(fastajv);
617 jPanel11.add(pfamjv);
618 jPanel11.add(pileupjv);
620 outputTab.add(autoIdWidth);
621 outputTab.add(userIdWidth);
622 outputTab.add(userIdWidthlabel);
623 outputTab.add(modellerOutput);
624 outputTab.add(embbedBioJSON);
625 outputTab.add(epsLabel);
626 outputTab.add(epsRendering);
627 outputTab.add(jPanel11);
632 * Initialises the Connections tabbed panel.
636 private JPanel initConnectionsTab()
638 JPanel connectTab = new JPanel();
639 connectTab.setLayout(new GridBagLayout());
641 // Label for browser text box
642 JLabel browserLabel = new JLabel();
643 browserLabel.setFont(LABEL_FONT);
644 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
645 browserLabel.setText(MessageManager
646 .getString("label.default_browser_unix"));
647 defaultBrowser.setFont(LABEL_FONT);
648 defaultBrowser.setText("");
650 defaultBrowser.addMouseListener(new MouseAdapter()
653 public void mouseClicked(MouseEvent e)
655 if (e.getClickCount() > 1)
657 defaultBrowser_mouseClicked(e);
662 JPanel proxyPanel = initConnTabProxyPanel();
663 initConnTabCheckboxes();
665 // Add default Browser text box
666 connectTab.add(browserLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,
667 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
668 new Insets(10, 0, 5, 5), 5, 1));
669 defaultBrowser.setFont(LABEL_FONT);
670 defaultBrowser.setText("");
672 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
673 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
674 new Insets(10, 0, 5, 10), 30, 1));
676 // Add proxy server panel
677 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
678 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
679 new Insets(10, 0, 5, 12), 4, 10));
681 // Add usage stats, version check and questionnaire checkboxes
682 connectTab.add(usagestats, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
683 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
684 new Insets(0, 2, 5, 5), 70, 1));
685 connectTab.add(questionnaire, new GridBagConstraints(1, 2, 1, 1, 1.0,
686 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
687 new Insets(0, 2, 5, 10), 70, 1));
688 connectTab.add(versioncheck, new GridBagConstraints(0, 3, 1, 1, 1.0,
689 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
690 new Insets(0, 2, 5, 5), 70, 1));
692 // Add padding so the panel doesn't look ridiculous
693 JPanel spacePanel = new JPanel();
694 connectTab.add(spacePanel, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
695 GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0,
702 * Initialises the Links tabbed panel.
706 private JPanel initLinksTab()
708 JPanel linkTab = new JPanel();
709 linkTab.setLayout(new GridBagLayout());
711 // Set up table for Url links
712 linkUrlTable.setFillsViewportHeight(true);
713 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
714 linkUrlTable.setAutoCreateRowSorter(true);
715 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
717 // adjust row height so radio buttons actually fit
718 // don't do this in the renderer, it causes the awt thread to activate
720 JRadioButton temp = new JRadioButton();
721 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
723 // Table in scrollpane so that the table is given a scrollbar
724 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
725 linkScrollPane.setBorder(null);
727 // Panel for links functionality
728 JPanel linkPanel = new JPanel(new GridBagLayout());
729 linkPanel.setBorder(new TitledBorder(MessageManager
730 .getString("label.url_linkfrom_sequence_id")));
732 // Put the Url links panel together
734 // Buttons go at top right, resizing only resizes the blank space vertically
735 JPanel buttonPanel = initLinkTabUrlButtons();
736 GridBagConstraints linkConstraints1 = new GridBagConstraints();
737 linkConstraints1.insets = new Insets(0, 0, 5, 0);
738 linkConstraints1.gridx = 0;
739 linkConstraints1.gridy = 0;
740 linkConstraints1.weightx = 1.0;
741 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
742 linkTab.add(buttonPanel, linkConstraints1);
744 // Links table goes at top left, resizing resizes the table
745 GridBagConstraints linkConstraints2 = new GridBagConstraints();
746 linkConstraints2.insets = new Insets(0, 0, 5, 5);
747 linkConstraints2.gridx = 0;
748 linkConstraints2.gridy = 1;
749 linkConstraints2.weightx = 1.0;
750 linkConstraints2.weighty = 1.0;
751 linkConstraints2.fill = GridBagConstraints.BOTH;
752 linkTab.add(linkScrollPane, linkConstraints2);
754 // Filter box and buttons goes at bottom left, resizing resizes the text box
755 JPanel filterPanel = initLinkTabFilterPanel();
756 GridBagConstraints linkConstraints3 = new GridBagConstraints();
757 linkConstraints3.insets = new Insets(0, 0, 0, 5);
758 linkConstraints3.gridx = 0;
759 linkConstraints3.gridy = 2;
760 linkConstraints3.weightx = 1.0;
761 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
762 linkTab.add(filterPanel, linkConstraints3);
767 private JPanel initLinkTabFilterPanel()
769 // Filter textbox and reset button
770 JLabel filterLabel = new JLabel(
771 MessageManager.getString("label.filter"));
772 filterLabel.setFont(LABEL_FONT);
773 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
774 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
776 filterTB.setFont(LABEL_FONT);
777 filterTB.setText("");
779 doReset.setText(MessageManager.getString("action.showall"));
780 userOnly.setText(MessageManager.getString("action.customfilter"));
782 // Panel for filter functionality
783 JPanel filterPanel = new JPanel(new GridBagLayout());
784 filterPanel.setBorder(new TitledBorder("Filter"));
785 GridBagConstraints gbc = new GridBagConstraints();
788 gbc.fill = GridBagConstraints.NONE;
789 gbc.anchor = GridBagConstraints.WEST;
791 filterPanel.add(filterLabel, gbc);
793 GridBagConstraints gbc1 = new GridBagConstraints();
796 gbc1.fill = GridBagConstraints.HORIZONTAL;
797 gbc1.anchor = GridBagConstraints.WEST;
799 filterPanel.add(filterTB, gbc1);
801 GridBagConstraints gbc2 = new GridBagConstraints();
803 gbc2.fill = GridBagConstraints.NONE;
804 gbc2.anchor = GridBagConstraints.WEST;
805 filterPanel.add(doReset, gbc2);
807 GridBagConstraints gbc3 = new GridBagConstraints();
809 gbc3.fill = GridBagConstraints.NONE;
810 gbc3.anchor = GridBagConstraints.WEST;
811 filterPanel.add(userOnly, gbc3);
816 private JPanel initLinkTabUrlButtons()
818 // Buttons for new / edit / delete Url links
819 JButton newLink = new JButton();
820 newLink.setText(MessageManager.getString("action.new"));
822 editLink.setText(MessageManager.getString("action.edit"));
824 deleteLink.setText(MessageManager.getString("action.delete"));
826 // no current selection, so initially disable delete/edit buttons
827 editLink.setEnabled(false);
828 deleteLink.setEnabled(false);
830 newLink.addActionListener(new java.awt.event.ActionListener()
833 public void actionPerformed(ActionEvent e)
835 newLink_actionPerformed(e);
839 editLink.setText(MessageManager.getString("action.edit"));
840 editLink.addActionListener(new java.awt.event.ActionListener()
843 public void actionPerformed(ActionEvent e)
845 editLink_actionPerformed(e);
849 deleteLink.setText(MessageManager.getString("action.delete"));
850 deleteLink.addActionListener(new java.awt.event.ActionListener()
853 public void actionPerformed(ActionEvent e)
855 deleteLink_actionPerformed(e);
859 JPanel buttonPanel = new JPanel(new GridBagLayout());
860 buttonPanel.setBorder(new TitledBorder("Edit links"));
861 GridBagConstraints gbc = new GridBagConstraints();
864 gbc.fill = GridBagConstraints.NONE;
865 buttonPanel.add(newLink, gbc);
867 GridBagConstraints gbc1 = new GridBagConstraints();
870 gbc1.fill = GridBagConstraints.NONE;
871 buttonPanel.add(editLink, gbc1);
873 GridBagConstraints gbc2 = new GridBagConstraints();
876 gbc2.fill = GridBagConstraints.NONE;
877 buttonPanel.add(deleteLink, gbc2);
879 GridBagConstraints gbc3 = new GridBagConstraints();
882 gbc3.fill = GridBagConstraints.HORIZONTAL;
884 JPanel spacePanel = new JPanel();
885 spacePanel.setBorder(null);
886 buttonPanel.add(spacePanel, gbc3);
892 * Initialises the proxy server panel in the Connections tab
894 * @return the proxy server panel
896 private JPanel initConnTabProxyPanel()
898 // Label for server text box
899 serverLabel.setText(MessageManager.getString("label.address"));
900 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
901 serverLabel.setFont(LABEL_FONT);
903 // Proxy server and port text boxes
904 proxyServerTB.setFont(LABEL_FONT);
905 proxyPortTB.setFont(LABEL_FONT);
907 // Label for Port text box
908 portLabel.setFont(LABEL_FONT);
909 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
910 portLabel.setText(MessageManager.getString("label.port"));
912 // Use proxy server checkbox
913 useProxy.setFont(LABEL_FONT);
914 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
915 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
916 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
917 useProxy.addActionListener(new ActionListener()
920 public void actionPerformed(ActionEvent e)
922 useProxy_actionPerformed();
926 // Make proxy server panel
927 JPanel proxyPanel = new JPanel();
928 TitledBorder titledBorder1 = new TitledBorder(
929 MessageManager.getString("label.proxy_server"));
930 proxyPanel.setBorder(titledBorder1);
931 proxyPanel.setLayout(new GridBagLayout());
932 proxyPanel.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
933 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
934 new Insets(0, 2, 2, 0), 5, 0));
935 proxyPanel.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
936 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
938 proxyPanel.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
939 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
941 proxyPanel.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0,
942 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
943 new Insets(0, 2, 2, 2), 54, 1));
944 proxyPanel.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0,
945 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
946 new Insets(0, 2, 2, 0), 263, 1));
952 * Initialises the checkboxes in the Connections tab
954 private void initConnTabCheckboxes()
956 // Usage stats checkbox label
957 usagestats.setText(MessageManager
958 .getString("label.send_usage_statistics"));
959 usagestats.setFont(LABEL_FONT);
960 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
961 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
963 // Questionnaire checkbox label
964 questionnaire.setText(MessageManager
965 .getString("label.check_for_questionnaires"));
966 questionnaire.setFont(LABEL_FONT);
967 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
968 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
970 // Check for latest version checkbox label
971 versioncheck.setText(MessageManager
972 .getString("label.check_for_latest_version"));
973 versioncheck.setFont(LABEL_FONT);
974 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
975 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
979 * Initialises the parent panel which contains the tabbed sections.
983 private JPanel initOkCancelPanel()
985 JButton ok = new JButton();
986 ok.setText(MessageManager.getString("action.ok"));
987 ok.addActionListener(new ActionListener()
990 public void actionPerformed(ActionEvent e)
992 ok_actionPerformed(e);
995 JButton cancel = new JButton();
996 cancel.setText(MessageManager.getString("action.cancel"));
997 cancel.addActionListener(new ActionListener()
1000 public void actionPerformed(ActionEvent e)
1002 cancel_actionPerformed(e);
1005 JPanel okCancelPanel = new JPanel();
1006 okCancelPanel.add(ok);
1007 okCancelPanel.add(cancel);
1008 return okCancelPanel;
1012 * Initialises the Colours tabbed panel.
1016 private JPanel initColoursTab()
1018 JPanel coloursTab = new JPanel();
1019 coloursTab.setBorder(new TitledBorder(MessageManager
1020 .getString("action.open_new_alignment")));
1021 coloursTab.setLayout(new FlowLayout());
1022 JLabel mincolourLabel = new JLabel();
1023 mincolourLabel.setFont(LABEL_FONT);
1024 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1025 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1026 minColour.setFont(LABEL_FONT);
1027 minColour.setBorder(BorderFactory.createEtchedBorder());
1028 minColour.setPreferredSize(new Dimension(40, 20));
1029 minColour.addMouseListener(new MouseAdapter()
1032 public void mousePressed(MouseEvent e)
1034 minColour_actionPerformed(minColour);
1037 JLabel maxcolourLabel = new JLabel();
1038 maxcolourLabel.setFont(LABEL_FONT);
1039 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1040 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1041 maxColour.setFont(LABEL_FONT);
1042 maxColour.setBorder(BorderFactory.createEtchedBorder());
1043 maxColour.setPreferredSize(new Dimension(40, 20));
1044 maxColour.addMouseListener(new MouseAdapter()
1047 public void mousePressed(MouseEvent e)
1049 maxColour_actionPerformed(maxColour);
1053 protColour.setFont(LABEL_FONT);
1054 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1055 JLabel protColourLabel = new JLabel();
1056 protColourLabel.setFont(LABEL_FONT);
1057 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1058 protColourLabel.setText(MessageManager
1059 .getString("label.prot_alignment_colour") + " ");
1060 JvSwingUtils.addtoLayout(coloursTab, MessageManager
1061 .getString("label.default_colour_scheme_for_alignment"),
1062 protColourLabel, protColour);
1064 nucColour.setFont(LABEL_FONT);
1065 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1066 JLabel nucColourLabel = new JLabel();
1067 nucColourLabel.setFont(LABEL_FONT);
1068 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1069 nucColourLabel.setText(MessageManager
1070 .getString("label.nuc_alignment_colour") + " ");
1071 JvSwingUtils.addtoLayout(coloursTab, MessageManager
1072 .getString("label.default_colour_scheme_for_alignment"),
1073 nucColourLabel, nucColour);
1075 JPanel annotationShding = new JPanel();
1076 annotationShding.setBorder(new TitledBorder(MessageManager
1077 .getString("label.annotation_shading_default")));
1078 annotationShding.setLayout(new GridLayout(1, 2));
1079 JvSwingUtils.addtoLayout(annotationShding, MessageManager
1080 .getString("label.default_minimum_colour_annotation_shading"),
1081 mincolourLabel, minColour);
1082 JvSwingUtils.addtoLayout(annotationShding, MessageManager
1083 .getString("label.default_maximum_colour_annotation_shading"),
1084 maxcolourLabel, maxColour);
1085 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1090 * Initialises the Structure tabbed panel.
1094 private JPanel initStructureTab()
1096 structureTab = new JPanel();
1098 structureTab.setBorder(new TitledBorder(MessageManager
1099 .getString("label.structure_options")));
1100 structureTab.setLayout(null);
1101 final int width = 400;
1102 final int height = 22;
1103 final int lineSpacing = 25;
1106 structFromPdb.setFont(LABEL_FONT);
1108 .setText(MessageManager.getString("label.struct_from_pdb"));
1109 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1110 structFromPdb.addActionListener(new ActionListener()
1113 public void actionPerformed(ActionEvent e)
1115 boolean selected = structFromPdb.isSelected();
1116 // enable other options only when the first is checked
1117 useRnaView.setEnabled(selected);
1118 addSecondaryStructure.setEnabled(selected);
1119 addTempFactor.setEnabled(selected);
1122 structureTab.add(structFromPdb);
1124 // indent checkboxes that are conditional on the first one
1125 ypos += lineSpacing;
1126 useRnaView.setFont(LABEL_FONT);
1127 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1128 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1129 structureTab.add(useRnaView);
1131 ypos += lineSpacing;
1132 addSecondaryStructure.setFont(LABEL_FONT);
1133 addSecondaryStructure.setText(MessageManager
1134 .getString("label.autoadd_secstr"));
1135 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1136 structureTab.add(addSecondaryStructure);
1138 ypos += lineSpacing;
1139 addTempFactor.setFont(LABEL_FONT);
1140 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1141 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1142 structureTab.add(addTempFactor);
1144 ypos += lineSpacing;
1145 JLabel viewerLabel = new JLabel();
1146 viewerLabel.setFont(LABEL_FONT);
1147 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1148 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1149 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1150 structureTab.add(viewerLabel);
1152 structViewer.setFont(LABEL_FONT);
1153 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1154 structViewer.addItem(ViewerType.JMOL.name());
1155 structViewer.addItem(ViewerType.CHIMERA.name());
1156 structViewer.addActionListener(new ActionListener()
1159 public void actionPerformed(ActionEvent e)
1161 structureViewer_actionPerformed((String) structViewer
1162 .getSelectedItem());
1165 structureTab.add(structViewer);
1167 ypos += lineSpacing;
1168 JLabel pathLabel = new JLabel();
1169 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1170 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1171 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1172 final String tooltip = JvSwingUtils.wrapTooltip(true,
1173 MessageManager.getString("label.chimera_path_tip"));
1174 pathLabel.setToolTipText(tooltip);
1175 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1176 structureTab.add(pathLabel);
1178 chimeraPath.setFont(LABEL_FONT);
1179 chimeraPath.setText("");
1180 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1181 chimeraPath.addMouseListener(new MouseAdapter()
1184 public void mouseClicked(MouseEvent e)
1186 if (e.getClickCount() == 2)
1188 String chosen = openFileChooser();
1191 chimeraPath.setText(chosen);
1196 structureTab.add(chimeraPath);
1198 ypos += lineSpacing;
1199 nwMapping.setFont(LABEL_FONT);
1200 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1201 siftsMapping.setFont(LABEL_FONT);
1202 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1203 mappingMethod.add(nwMapping);
1204 mappingMethod.add(siftsMapping);
1205 JPanel mappingPanel = new JPanel();
1206 mappingPanel.setFont(LABEL_FONT);
1207 TitledBorder mmTitledBorder = new TitledBorder(
1208 MessageManager.getString("label.mapping_method"));
1209 mmTitledBorder.setTitleFont(LABEL_FONT);
1210 mappingPanel.setBorder(mmTitledBorder);
1211 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1212 // GridLayout mappingLayout = new GridLayout();
1213 mappingPanel.setLayout(new GridLayout());
1214 mappingPanel.add(nwMapping);
1215 mappingPanel.add(siftsMapping);
1216 structureTab.add(mappingPanel);
1218 ypos += lineSpacing;
1219 ypos += lineSpacing;
1220 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1221 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1222 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1223 structureTab.add(docFieldPref);
1225 return structureTab;
1229 * Action on choosing a structure viewer from combobox options.
1231 * @param selectedItem
1233 protected void structureViewer_actionPerformed(String selectedItem)
1238 * Show a dialog for the user to choose a file. Returns the chosen path, or
1243 protected String openFileChooser()
1245 String choice = null;
1246 JFileChooser chooser = new JFileChooser();
1248 // chooser.setFileView(new JalviewFileView());
1249 chooser.setDialogTitle(MessageManager
1250 .getString("label.open_local_file"));
1251 chooser.setToolTipText(MessageManager.getString("action.open"));
1253 int value = chooser.showOpenDialog(this);
1255 if (value == JFileChooser.APPROVE_OPTION)
1257 choice = chooser.getSelectedFile().getPath();
1263 * Validate the structure tab preferences; if invalid, set focus on this tab.
1267 protected boolean validateStructure(FocusEvent e)
1269 if (!validateStructure())
1271 e.getComponent().requestFocusInWindow();
1278 * Validate the hmmer tab preferences; if invalid, set focus on this tab.
1282 protected boolean validateHMMER(FocusEvent e)
1284 if (!validateHMMER())
1286 e.getComponent().requestFocusInWindow();
1292 protected boolean validateStructure()
1297 protected boolean validateHMMER()
1303 * Initialises the Visual tabbed panel.
1307 private JPanel initVisualTab()
1309 JPanel visualTab = new JPanel();
1310 visualTab.setBorder(new TitledBorder(MessageManager
1311 .getString("action.open_new_alignment")));
1312 visualTab.setLayout(null);
1313 fullScreen.setFont(LABEL_FONT);
1314 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1315 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1316 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1317 quality.setEnabled(false);
1318 quality.setFont(LABEL_FONT);
1319 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1320 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1321 quality.setSelected(true);
1322 quality.setText(MessageManager.getString("label.quality"));
1323 conservation.setEnabled(false);
1324 conservation.setFont(LABEL_FONT);
1325 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1326 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1327 conservation.setSelected(true);
1328 conservation.setText(MessageManager.getString("label.conservation"));
1329 identity.setEnabled(false);
1330 identity.setFont(LABEL_FONT);
1331 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1332 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1333 identity.setSelected(true);
1334 identity.setText(MessageManager.getString("label.consensus"));
1335 showOccupancy.setFont(LABEL_FONT);
1336 showOccupancy.setEnabled(false);
1337 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1338 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1339 showOccupancy.setSelected(true);
1340 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1342 JLabel showGroupbits = new JLabel();
1343 showGroupbits.setFont(LABEL_FONT);
1344 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1345 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1346 showGroupbits.setText(MessageManager.getString("action.show_group")
1348 JLabel showConsensbits = new JLabel();
1349 showConsensbits.setFont(LABEL_FONT);
1350 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1351 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1352 showConsensbits.setText(MessageManager.getString("label.consensus")
1354 showConsensHistogram.setEnabled(false);
1355 showConsensHistogram.setFont(LABEL_FONT);
1356 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1357 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1358 showConsensHistogram.setSelected(true);
1359 showConsensHistogram.setText(MessageManager
1360 .getString("label.histogram"));
1361 showConsensLogo.setEnabled(false);
1362 showConsensLogo.setFont(LABEL_FONT);
1363 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1364 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1365 showConsensLogo.setSelected(true);
1366 showConsensLogo.setText(MessageManager.getString("label.logo"));
1367 showGroupConsensus.setEnabled(false);
1368 showGroupConsensus.setFont(LABEL_FONT);
1369 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1370 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1371 showGroupConsensus.setSelected(true);
1372 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1373 showGroupConservation.setEnabled(false);
1374 showGroupConservation.setFont(LABEL_FONT);
1375 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1376 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1377 showGroupConservation.setSelected(true);
1378 showGroupConservation.setText(MessageManager
1379 .getString("label.conservation"));
1380 showNpTooltip.setEnabled(true);
1381 showNpTooltip.setFont(LABEL_FONT);
1382 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1383 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1384 showNpTooltip.setSelected(true);
1385 showNpTooltip.setText(MessageManager
1386 .getString("label.non_positional_features"));
1387 showDbRefTooltip.setEnabled(true);
1388 showDbRefTooltip.setFont(LABEL_FONT);
1389 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1390 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1391 showDbRefTooltip.setSelected(true);
1392 showDbRefTooltip.setText(MessageManager
1393 .getString("label.database_references"));
1394 annotations.setFont(LABEL_FONT);
1395 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1396 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1397 annotations.setSelected(true);
1398 annotations.setText(MessageManager.getString("label.show_annotations"));
1399 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1400 annotations.addActionListener(new ActionListener()
1403 public void actionPerformed(ActionEvent e)
1405 annotations_actionPerformed(e);
1408 identity.addActionListener(new ActionListener()
1411 public void actionPerformed(ActionEvent e)
1413 annotations_actionPerformed(e);
1416 showGroupConsensus.addActionListener(new ActionListener()
1419 public void actionPerformed(ActionEvent e)
1421 annotations_actionPerformed(e);
1424 showUnconserved.setFont(LABEL_FONT);
1425 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1426 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1427 showUnconserved.setSelected(true);
1428 showUnconserved.setText(MessageManager
1429 .getString("action.show_unconserved"));
1430 showUnconserved.addActionListener(new ActionListener()
1433 public void actionPerformed(ActionEvent e)
1435 showunconserved_actionPerformed(e);
1439 // TODO these are not yet added to / action from Preferences
1440 // JCheckBox shareSelections = new JCheckBox();
1441 // shareSelections.setFont(verdana11);
1442 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1443 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1444 // shareSelections.setSelected(true);
1445 // shareSelections.setText(MessageManager
1446 // .getString("label.share_selection_across_views"));
1447 // JCheckBox followHighlight = new JCheckBox();
1448 // followHighlight.setFont(verdana11);
1449 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1450 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1451 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1452 // followHighlight.setSelected(true);
1453 // followHighlight.setText(MessageManager
1454 // .getString("label.scroll_highlighted_regions"));
1456 seqLimit.setFont(LABEL_FONT);
1457 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1458 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1459 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1460 smoothFont.setFont(LABEL_FONT);
1461 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1462 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1463 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1464 scaleProteinToCdna.setFont(LABEL_FONT);
1465 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1466 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1467 scaleProteinToCdna.setText(MessageManager
1468 .getString("label.scale_protein_to_cdna"));
1469 scaleProteinToCdna.setToolTipText(MessageManager
1470 .getString("label.scale_protein_to_cdna_tip"));
1471 JLabel gapLabel = new JLabel();
1472 gapLabel.setFont(LABEL_FONT);
1473 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1474 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1475 JLabel fontLabel = new JLabel();
1476 fontLabel.setFont(LABEL_FONT);
1477 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1478 fontLabel.setText(MessageManager.getString("label.font"));
1479 fontSizeCB.setFont(LABEL_FONT);
1480 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1481 fontStyleCB.setFont(LABEL_FONT);
1482 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1483 fontNameCB.setFont(LABEL_FONT);
1484 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1485 gapSymbolCB.setFont(LABEL_FONT);
1486 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1487 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1488 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1489 gapSymbolCB.setRenderer(dlcr);
1491 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1492 startupCheckbox.setFont(LABEL_FONT);
1493 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1494 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1495 startupCheckbox.setSelected(true);
1496 startupFileTextfield.setFont(LABEL_FONT);
1497 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1498 startupFileTextfield.addMouseListener(new MouseAdapter()
1501 public void mouseClicked(MouseEvent e)
1503 if (e.getClickCount() > 1)
1505 startupFileTextfield_mouseClicked();
1510 sortby.setFont(LABEL_FONT);
1511 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1512 JLabel sortLabel = new JLabel();
1513 sortLabel.setFont(LABEL_FONT);
1514 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1515 sortLabel.setText(MessageManager.getString("label.sort_by"));
1516 sortAnnBy.setFont(LABEL_FONT);
1517 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1518 JLabel sortAnnLabel = new JLabel();
1519 sortAnnLabel.setFont(LABEL_FONT);
1520 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1521 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1522 sortAutocalc.setFont(LABEL_FONT);
1523 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1525 JPanel annsettingsPanel = new JPanel();
1526 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1527 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1528 annsettingsPanel.setBorder(new EtchedBorder());
1529 visualTab.add(annsettingsPanel);
1530 Border jb = new EmptyBorder(1, 1, 4, 5);
1531 annotations.setBorder(jb);
1532 showOccupancy.setBorder(jb);
1533 quality.setBorder(jb);
1534 conservation.setBorder(jb);
1535 identity.setBorder(jb);
1536 showConsensbits.setBorder(jb);
1537 showGroupbits.setBorder(jb);
1538 showGroupConsensus.setBorder(jb);
1539 showGroupConservation.setBorder(jb);
1540 showConsensHistogram.setBorder(jb);
1541 showConsensLogo.setBorder(jb);
1543 JPanel autoAnnotSettings = new JPanel();
1544 annsettingsPanel.add(autoAnnotSettings);
1545 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1546 autoAnnotSettings.add(annotations);
1547 autoAnnotSettings.add(quality);
1548 // second row of autoannotation box
1549 autoAnnotSettings = new JPanel();
1550 annsettingsPanel.add(autoAnnotSettings);
1552 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1553 autoAnnotSettings.add(conservation);
1554 autoAnnotSettings.add(identity);
1555 autoAnnotSettings.add(showOccupancy);
1556 autoAnnotSettings.add(showGroupbits);
1557 autoAnnotSettings.add(showGroupConservation);
1558 autoAnnotSettings.add(showGroupConsensus);
1559 autoAnnotSettings.add(showConsensbits);
1560 autoAnnotSettings.add(showConsensHistogram);
1561 autoAnnotSettings.add(showConsensLogo);
1565 JPanel tooltipSettings = new JPanel();
1566 tooltipSettings.setBorder(new TitledBorder(MessageManager
1567 .getString("label.sequence_id_tooltip")));
1568 tooltipSettings.setBounds(173, 140, 220, 62);
1569 tooltipSettings.setLayout(new GridLayout(2, 1));
1570 tooltipSettings.add(showDbRefTooltip);
1571 tooltipSettings.add(showNpTooltip);
1572 visualTab.add(tooltipSettings);
1574 wrap.setFont(LABEL_FONT);
1575 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1576 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1577 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1578 rightAlign.setFont(LABEL_FONT);
1579 rightAlign.setForeground(Color.black);
1580 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1581 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1582 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1583 idItalics.setFont(LABEL_FONT_ITALIC);
1584 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1585 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1586 idItalics.setText(MessageManager
1587 .getString("label.sequence_name_italics"));
1588 openoverv.setFont(LABEL_FONT);
1589 openoverv.setActionCommand(MessageManager
1590 .getString("label.open_overview"));
1591 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1592 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1593 openoverv.setText(MessageManager.getString("label.open_overview"));
1594 JPanel jPanel2 = new JPanel();
1595 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1596 jPanel2.setLayout(new GridLayout(14, 1));
1597 jPanel2.add(fullScreen);
1598 jPanel2.add(openoverv);
1599 jPanel2.add(seqLimit);
1600 jPanel2.add(rightAlign);
1601 jPanel2.add(fontLabel);
1602 jPanel2.add(showUnconserved);
1603 jPanel2.add(idItalics);
1604 jPanel2.add(smoothFont);
1605 jPanel2.add(scaleProteinToCdna);
1606 jPanel2.add(gapLabel);
1608 jPanel2.add(sortLabel);
1609 jPanel2.add(sortAnnLabel);
1610 jPanel2.add(startupCheckbox);
1611 visualTab.add(jPanel2);
1612 visualTab.add(startupFileTextfield);
1613 visualTab.add(sortby);
1614 visualTab.add(sortAnnBy);
1615 visualTab.add(sortAutocalc);
1616 visualTab.add(gapSymbolCB);
1617 visualTab.add(fontNameCB);
1618 visualTab.add(fontSizeCB);
1619 visualTab.add(fontStyleCB);
1623 protected void autoIdWidth_actionPerformed()
1625 // TODO Auto-generated method stub
1629 protected void userIdWidth_actionPerformed()
1631 // TODO Auto-generated method stub
1635 protected void maxColour_actionPerformed(JPanel panel)
1639 protected void minColour_actionPerformed(JPanel panel)
1643 protected void showunconserved_actionPerformed(ActionEvent e)
1645 // TODO Auto-generated method stub
1655 public void ok_actionPerformed(ActionEvent e)
1665 public void cancel_actionPerformed(ActionEvent e)
1675 public void annotations_actionPerformed(ActionEvent e)
1682 public void startupFileTextfield_mouseClicked()
1686 public void newLink_actionPerformed(ActionEvent e)
1691 public void editLink_actionPerformed(ActionEvent e)
1696 public void deleteLink_actionPerformed(ActionEvent e)
1701 public void defaultBrowser_mouseClicked(MouseEvent e)
1706 public void linkURLList_keyTyped(KeyEvent e)
1711 public void useProxy_actionPerformed()
1713 boolean enabled = useProxy.isSelected();
1714 portLabel.setEnabled(enabled);
1715 serverLabel.setEnabled(enabled);
1716 proxyServerTB.setEnabled(enabled);
1717 proxyPortTB.setEnabled(enabled);
1721 * Customer renderer for JTable: supports column of radio buttons
1723 public class RadioButtonRenderer extends JRadioButton implements
1726 public RadioButtonRenderer()
1728 setHorizontalAlignment(CENTER);
1729 setToolTipText(MessageManager.getString("label.urltooltip"));
1733 public Component getTableCellRendererComponent(JTable table,
1734 Object value, boolean isSelected, boolean hasFocus, int row,
1737 setSelected((boolean) value);
1739 // set colours to match rest of table
1742 setBackground(table.getSelectionBackground());
1743 setForeground(table.getSelectionForeground());
1747 setBackground(table.getBackground());
1748 setForeground(table.getForeground());
1755 * Customer cell editor for JTable: supports column of radio buttons in
1756 * conjunction with renderer
1758 public class RadioButtonEditor extends AbstractCellEditor implements
1761 private JRadioButton button = new JRadioButton();
1763 public RadioButtonEditor()
1765 button.setHorizontalAlignment(SwingConstants.CENTER);
1766 this.button.addActionListener(new ActionListener()
1769 public void actionPerformed(ActionEvent e)
1771 fireEditingStopped();
1777 public Component getTableCellEditorComponent(JTable table,
1778 Object value, boolean isSelected, int row, int column)
1780 button.setSelected((boolean) value);
1785 public Object getCellEditorValue()
1787 return button.isSelected();
1792 public void hmmerPath_actionPerformed(ActionEvent e)