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(true);
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(false);
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(boolean forFolder)
1245 String choice = null;
1246 JFileChooser chooser = new JFileChooser();
1249 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1252 // chooser.setFileView(new JalviewFileView());
1253 chooser.setDialogTitle(MessageManager
1254 .getString("label.open_local_file"));
1255 chooser.setToolTipText(MessageManager.getString("action.open"));
1257 int value = chooser.showOpenDialog(this);
1259 if (value == JFileChooser.APPROVE_OPTION)
1261 choice = chooser.getSelectedFile().getPath();
1267 * Validate the structure tab preferences; if invalid, set focus on this tab.
1271 protected boolean validateStructure(FocusEvent e)
1273 if (!validateStructure())
1275 e.getComponent().requestFocusInWindow();
1282 * Validate the hmmer tab preferences; if invalid, set focus on this tab.
1286 protected boolean validateHMMER(FocusEvent e)
1288 if (!validateHMMER())
1290 e.getComponent().requestFocusInWindow();
1296 protected boolean validateStructure()
1301 protected boolean validateHMMER()
1307 * Initialises the Visual tabbed panel.
1311 private JPanel initVisualTab()
1313 JPanel visualTab = new JPanel();
1314 visualTab.setBorder(new TitledBorder(MessageManager
1315 .getString("action.open_new_alignment")));
1316 visualTab.setLayout(null);
1317 fullScreen.setFont(LABEL_FONT);
1318 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1319 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1320 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1321 quality.setEnabled(false);
1322 quality.setFont(LABEL_FONT);
1323 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1324 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1325 quality.setSelected(true);
1326 quality.setText(MessageManager.getString("label.quality"));
1327 conservation.setEnabled(false);
1328 conservation.setFont(LABEL_FONT);
1329 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1330 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1331 conservation.setSelected(true);
1332 conservation.setText(MessageManager.getString("label.conservation"));
1333 identity.setEnabled(false);
1334 identity.setFont(LABEL_FONT);
1335 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1336 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1337 identity.setSelected(true);
1338 identity.setText(MessageManager.getString("label.consensus"));
1339 showOccupancy.setFont(LABEL_FONT);
1340 showOccupancy.setEnabled(false);
1341 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1342 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1343 showOccupancy.setSelected(true);
1344 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1346 JLabel showGroupbits = new JLabel();
1347 showGroupbits.setFont(LABEL_FONT);
1348 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1349 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1350 showGroupbits.setText(MessageManager.getString("action.show_group")
1352 JLabel showConsensbits = new JLabel();
1353 showConsensbits.setFont(LABEL_FONT);
1354 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1355 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1356 showConsensbits.setText(MessageManager.getString("label.consensus")
1358 showConsensHistogram.setEnabled(false);
1359 showConsensHistogram.setFont(LABEL_FONT);
1360 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1361 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1362 showConsensHistogram.setSelected(true);
1363 showConsensHistogram.setText(MessageManager
1364 .getString("label.histogram"));
1365 showConsensLogo.setEnabled(false);
1366 showConsensLogo.setFont(LABEL_FONT);
1367 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1368 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1369 showConsensLogo.setSelected(true);
1370 showConsensLogo.setText(MessageManager.getString("label.logo"));
1371 showGroupConsensus.setEnabled(false);
1372 showGroupConsensus.setFont(LABEL_FONT);
1373 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1374 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1375 showGroupConsensus.setSelected(true);
1376 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1377 showGroupConservation.setEnabled(false);
1378 showGroupConservation.setFont(LABEL_FONT);
1379 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1380 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1381 showGroupConservation.setSelected(true);
1382 showGroupConservation.setText(MessageManager
1383 .getString("label.conservation"));
1384 showNpTooltip.setEnabled(true);
1385 showNpTooltip.setFont(LABEL_FONT);
1386 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1387 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1388 showNpTooltip.setSelected(true);
1389 showNpTooltip.setText(MessageManager
1390 .getString("label.non_positional_features"));
1391 showDbRefTooltip.setEnabled(true);
1392 showDbRefTooltip.setFont(LABEL_FONT);
1393 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1394 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1395 showDbRefTooltip.setSelected(true);
1396 showDbRefTooltip.setText(MessageManager
1397 .getString("label.database_references"));
1398 annotations.setFont(LABEL_FONT);
1399 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1400 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1401 annotations.setSelected(true);
1402 annotations.setText(MessageManager.getString("label.show_annotations"));
1403 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1404 annotations.addActionListener(new ActionListener()
1407 public void actionPerformed(ActionEvent e)
1409 annotations_actionPerformed(e);
1412 identity.addActionListener(new ActionListener()
1415 public void actionPerformed(ActionEvent e)
1417 annotations_actionPerformed(e);
1420 showGroupConsensus.addActionListener(new ActionListener()
1423 public void actionPerformed(ActionEvent e)
1425 annotations_actionPerformed(e);
1428 showUnconserved.setFont(LABEL_FONT);
1429 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1430 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1431 showUnconserved.setSelected(true);
1432 showUnconserved.setText(MessageManager
1433 .getString("action.show_unconserved"));
1434 showUnconserved.addActionListener(new ActionListener()
1437 public void actionPerformed(ActionEvent e)
1439 showunconserved_actionPerformed(e);
1443 // TODO these are not yet added to / action from Preferences
1444 // JCheckBox shareSelections = new JCheckBox();
1445 // shareSelections.setFont(verdana11);
1446 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1447 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1448 // shareSelections.setSelected(true);
1449 // shareSelections.setText(MessageManager
1450 // .getString("label.share_selection_across_views"));
1451 // JCheckBox followHighlight = new JCheckBox();
1452 // followHighlight.setFont(verdana11);
1453 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1454 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1455 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1456 // followHighlight.setSelected(true);
1457 // followHighlight.setText(MessageManager
1458 // .getString("label.scroll_highlighted_regions"));
1460 seqLimit.setFont(LABEL_FONT);
1461 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1462 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1463 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1464 smoothFont.setFont(LABEL_FONT);
1465 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1466 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1467 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1468 scaleProteinToCdna.setFont(LABEL_FONT);
1469 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1470 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1471 scaleProteinToCdna.setText(MessageManager
1472 .getString("label.scale_protein_to_cdna"));
1473 scaleProteinToCdna.setToolTipText(MessageManager
1474 .getString("label.scale_protein_to_cdna_tip"));
1475 JLabel gapLabel = new JLabel();
1476 gapLabel.setFont(LABEL_FONT);
1477 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1478 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1479 JLabel fontLabel = new JLabel();
1480 fontLabel.setFont(LABEL_FONT);
1481 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1482 fontLabel.setText(MessageManager.getString("label.font"));
1483 fontSizeCB.setFont(LABEL_FONT);
1484 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1485 fontStyleCB.setFont(LABEL_FONT);
1486 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1487 fontNameCB.setFont(LABEL_FONT);
1488 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1489 gapSymbolCB.setFont(LABEL_FONT);
1490 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1491 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1492 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1493 gapSymbolCB.setRenderer(dlcr);
1495 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1496 startupCheckbox.setFont(LABEL_FONT);
1497 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1498 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1499 startupCheckbox.setSelected(true);
1500 startupFileTextfield.setFont(LABEL_FONT);
1501 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1502 startupFileTextfield.addMouseListener(new MouseAdapter()
1505 public void mouseClicked(MouseEvent e)
1507 if (e.getClickCount() > 1)
1509 startupFileTextfield_mouseClicked();
1514 sortby.setFont(LABEL_FONT);
1515 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1516 JLabel sortLabel = new JLabel();
1517 sortLabel.setFont(LABEL_FONT);
1518 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1519 sortLabel.setText(MessageManager.getString("label.sort_by"));
1520 sortAnnBy.setFont(LABEL_FONT);
1521 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1522 JLabel sortAnnLabel = new JLabel();
1523 sortAnnLabel.setFont(LABEL_FONT);
1524 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1525 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1526 sortAutocalc.setFont(LABEL_FONT);
1527 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1529 JPanel annsettingsPanel = new JPanel();
1530 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1531 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1532 annsettingsPanel.setBorder(new EtchedBorder());
1533 visualTab.add(annsettingsPanel);
1534 Border jb = new EmptyBorder(1, 1, 4, 5);
1535 annotations.setBorder(jb);
1536 showOccupancy.setBorder(jb);
1537 quality.setBorder(jb);
1538 conservation.setBorder(jb);
1539 identity.setBorder(jb);
1540 showConsensbits.setBorder(jb);
1541 showGroupbits.setBorder(jb);
1542 showGroupConsensus.setBorder(jb);
1543 showGroupConservation.setBorder(jb);
1544 showConsensHistogram.setBorder(jb);
1545 showConsensLogo.setBorder(jb);
1547 JPanel autoAnnotSettings = new JPanel();
1548 annsettingsPanel.add(autoAnnotSettings);
1549 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1550 autoAnnotSettings.add(annotations);
1551 autoAnnotSettings.add(quality);
1552 // second row of autoannotation box
1553 autoAnnotSettings = new JPanel();
1554 annsettingsPanel.add(autoAnnotSettings);
1556 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1557 autoAnnotSettings.add(conservation);
1558 autoAnnotSettings.add(identity);
1559 autoAnnotSettings.add(showOccupancy);
1560 autoAnnotSettings.add(showGroupbits);
1561 autoAnnotSettings.add(showGroupConservation);
1562 autoAnnotSettings.add(showGroupConsensus);
1563 autoAnnotSettings.add(showConsensbits);
1564 autoAnnotSettings.add(showConsensHistogram);
1565 autoAnnotSettings.add(showConsensLogo);
1569 JPanel tooltipSettings = new JPanel();
1570 tooltipSettings.setBorder(new TitledBorder(MessageManager
1571 .getString("label.sequence_id_tooltip")));
1572 tooltipSettings.setBounds(173, 140, 220, 62);
1573 tooltipSettings.setLayout(new GridLayout(2, 1));
1574 tooltipSettings.add(showDbRefTooltip);
1575 tooltipSettings.add(showNpTooltip);
1576 visualTab.add(tooltipSettings);
1578 wrap.setFont(LABEL_FONT);
1579 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1580 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1581 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1582 rightAlign.setFont(LABEL_FONT);
1583 rightAlign.setForeground(Color.black);
1584 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1585 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1586 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1587 idItalics.setFont(LABEL_FONT_ITALIC);
1588 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1589 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1590 idItalics.setText(MessageManager
1591 .getString("label.sequence_name_italics"));
1592 openoverv.setFont(LABEL_FONT);
1593 openoverv.setActionCommand(MessageManager
1594 .getString("label.open_overview"));
1595 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1596 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1597 openoverv.setText(MessageManager.getString("label.open_overview"));
1598 JPanel jPanel2 = new JPanel();
1599 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1600 jPanel2.setLayout(new GridLayout(14, 1));
1601 jPanel2.add(fullScreen);
1602 jPanel2.add(openoverv);
1603 jPanel2.add(seqLimit);
1604 jPanel2.add(rightAlign);
1605 jPanel2.add(fontLabel);
1606 jPanel2.add(showUnconserved);
1607 jPanel2.add(idItalics);
1608 jPanel2.add(smoothFont);
1609 jPanel2.add(scaleProteinToCdna);
1610 jPanel2.add(gapLabel);
1612 jPanel2.add(sortLabel);
1613 jPanel2.add(sortAnnLabel);
1614 jPanel2.add(startupCheckbox);
1615 visualTab.add(jPanel2);
1616 visualTab.add(startupFileTextfield);
1617 visualTab.add(sortby);
1618 visualTab.add(sortAnnBy);
1619 visualTab.add(sortAutocalc);
1620 visualTab.add(gapSymbolCB);
1621 visualTab.add(fontNameCB);
1622 visualTab.add(fontSizeCB);
1623 visualTab.add(fontStyleCB);
1627 protected void autoIdWidth_actionPerformed()
1629 // TODO Auto-generated method stub
1633 protected void userIdWidth_actionPerformed()
1635 // TODO Auto-generated method stub
1639 protected void maxColour_actionPerformed(JPanel panel)
1643 protected void minColour_actionPerformed(JPanel panel)
1647 protected void showunconserved_actionPerformed(ActionEvent e)
1649 // TODO Auto-generated method stub
1659 public void ok_actionPerformed(ActionEvent e)
1669 public void cancel_actionPerformed(ActionEvent e)
1679 public void annotations_actionPerformed(ActionEvent e)
1686 public void startupFileTextfield_mouseClicked()
1690 public void newLink_actionPerformed(ActionEvent e)
1695 public void editLink_actionPerformed(ActionEvent e)
1700 public void deleteLink_actionPerformed(ActionEvent e)
1705 public void defaultBrowser_mouseClicked(MouseEvent e)
1710 public void linkURLList_keyTyped(KeyEvent e)
1715 public void useProxy_actionPerformed()
1717 boolean enabled = useProxy.isSelected();
1718 portLabel.setEnabled(enabled);
1719 serverLabel.setEnabled(enabled);
1720 proxyServerTB.setEnabled(enabled);
1721 proxyPortTB.setEnabled(enabled);
1725 * Customer renderer for JTable: supports column of radio buttons
1727 public class RadioButtonRenderer extends JRadioButton implements
1730 public RadioButtonRenderer()
1732 setHorizontalAlignment(CENTER);
1733 setToolTipText(MessageManager.getString("label.urltooltip"));
1737 public Component getTableCellRendererComponent(JTable table,
1738 Object value, boolean isSelected, boolean hasFocus, int row,
1741 setSelected((boolean) value);
1743 // set colours to match rest of table
1746 setBackground(table.getSelectionBackground());
1747 setForeground(table.getSelectionForeground());
1751 setBackground(table.getBackground());
1752 setForeground(table.getForeground());
1759 * Customer cell editor for JTable: supports column of radio buttons in
1760 * conjunction with renderer
1762 public class RadioButtonEditor extends AbstractCellEditor implements
1765 private JRadioButton button = new JRadioButton();
1767 public RadioButtonEditor()
1769 button.setHorizontalAlignment(SwingConstants.CENTER);
1770 this.button.addActionListener(new ActionListener()
1773 public void actionPerformed(ActionEvent e)
1775 fireEditingStopped();
1781 public Component getTableCellEditorComponent(JTable table,
1782 Object value, boolean isSelected, int row, int column)
1784 button.setSelected((boolean) value);
1789 public Object getCellEditorValue()
1791 return button.isSelected();
1796 public void hmmerPath_actionPerformed(ActionEvent e)