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
86 .getLabelFont(false, true);
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(
408 MessageManager.getString("label.autocalculate_consensus"));
409 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
410 padGaps.setFont(LABEL_FONT);
412 MessageManager.getString("label.pad_gaps_when_editing"));
413 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
414 sortByTree.setFont(LABEL_FONT);
416 .setText(MessageManager.getString("label.sort_with_new_tree"));
417 sortByTree.setToolTipText(MessageManager.getString(
418 "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);
568 MessageManager.getString("label.automatically_set_id_width"));
569 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
570 .getString("label.adjusts_width_generated_eps_png")));
571 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
572 autoIdWidth.addActionListener(new ActionListener()
576 public void actionPerformed(ActionEvent e)
578 autoIdWidth_actionPerformed();
581 userIdWidthlabel.setFont(LABEL_FONT);
582 userIdWidthlabel.setText(
583 MessageManager.getString("label.figure_id_column_width"));
584 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
585 .getString("label.manually_specify_width_left_column")));
586 userIdWidthlabel.setToolTipText(
587 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
588 "label.manually_specify_width_left_column")));
589 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
590 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
591 userIdWidth.setText("");
592 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
593 userIdWidth.addActionListener(new ActionListener()
597 public void actionPerformed(ActionEvent e)
599 userIdWidth_actionPerformed();
602 modellerOutput.setFont(LABEL_FONT);
604 .setText(MessageManager.getString("label.use_modeller_output"));
605 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
606 embbedBioJSON.setFont(LABEL_FONT);
607 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
608 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
610 jPanel11.add(jLabel1);
612 jPanel11.add(clustaljv);
613 jPanel11.add(fastajv);
615 jPanel11.add(pfamjv);
616 jPanel11.add(pileupjv);
618 outputTab.add(autoIdWidth);
619 outputTab.add(userIdWidth);
620 outputTab.add(userIdWidthlabel);
621 outputTab.add(modellerOutput);
622 outputTab.add(embbedBioJSON);
623 outputTab.add(epsLabel);
624 outputTab.add(epsRendering);
625 outputTab.add(jPanel11);
630 * Initialises the Connections tabbed panel.
634 private JPanel initConnectionsTab()
636 JPanel connectTab = new JPanel();
637 connectTab.setLayout(new GridBagLayout());
639 // Label for browser text box
640 JLabel browserLabel = new JLabel();
641 browserLabel.setFont(LABEL_FONT);
642 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
643 browserLabel.setText(
644 MessageManager.getString("label.default_browser_unix"));
645 defaultBrowser.setFont(LABEL_FONT);
646 defaultBrowser.setText("");
648 defaultBrowser.addMouseListener(new MouseAdapter()
651 public void mouseClicked(MouseEvent e)
653 if (e.getClickCount() > 1)
655 defaultBrowser_mouseClicked(e);
660 JPanel proxyPanel = initConnTabProxyPanel();
661 initConnTabCheckboxes();
663 // Add default Browser text box
664 connectTab.add(browserLabel,
665 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
666 GridBagConstraints.WEST, GridBagConstraints.NONE,
667 new Insets(10, 0, 5, 5), 5, 1));
668 defaultBrowser.setFont(LABEL_FONT);
669 defaultBrowser.setText("");
671 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
672 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
673 new Insets(10, 0, 5, 10), 30, 1));
675 // Add proxy server panel
676 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
677 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
678 new Insets(10, 0, 5, 12), 4, 10));
680 // Add usage stats, version check and questionnaire checkboxes
681 connectTab.add(usagestats,
682 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,
686 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
687 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
688 new Insets(0, 2, 5, 10), 70, 1));
689 connectTab.add(versioncheck,
690 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
691 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
692 new Insets(0, 2, 5, 5), 70, 1));
694 // Add padding so the panel doesn't look ridiculous
695 JPanel spacePanel = new JPanel();
696 connectTab.add(spacePanel,
697 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
698 GridBagConstraints.WEST, GridBagConstraints.BOTH,
699 new Insets(0, 0, 0, 5), 70, 1));
705 * Initialises the Links tabbed panel.
709 private JPanel initLinksTab()
711 JPanel linkTab = new JPanel();
712 linkTab.setLayout(new GridBagLayout());
714 // Set up table for Url links
715 linkUrlTable.setFillsViewportHeight(true);
716 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
717 linkUrlTable.setAutoCreateRowSorter(true);
718 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
720 // adjust row height so radio buttons actually fit
721 // don't do this in the renderer, it causes the awt thread to activate
723 JRadioButton temp = new JRadioButton();
724 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
726 // Table in scrollpane so that the table is given a scrollbar
727 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
728 linkScrollPane.setBorder(null);
730 // Panel for links functionality
731 JPanel linkPanel = new JPanel(new GridBagLayout());
732 linkPanel.setBorder(new TitledBorder(
733 MessageManager.getString("label.url_linkfrom_sequence_id")));
735 // Put the Url links panel together
737 // Buttons go at top right, resizing only resizes the blank space vertically
738 JPanel buttonPanel = initLinkTabUrlButtons();
739 GridBagConstraints linkConstraints1 = new GridBagConstraints();
740 linkConstraints1.insets = new Insets(0, 0, 5, 0);
741 linkConstraints1.gridx = 0;
742 linkConstraints1.gridy = 0;
743 linkConstraints1.weightx = 1.0;
744 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
745 linkTab.add(buttonPanel, linkConstraints1);
747 // Links table goes at top left, resizing resizes the table
748 GridBagConstraints linkConstraints2 = new GridBagConstraints();
749 linkConstraints2.insets = new Insets(0, 0, 5, 5);
750 linkConstraints2.gridx = 0;
751 linkConstraints2.gridy = 1;
752 linkConstraints2.weightx = 1.0;
753 linkConstraints2.weighty = 1.0;
754 linkConstraints2.fill = GridBagConstraints.BOTH;
755 linkTab.add(linkScrollPane, linkConstraints2);
757 // Filter box and buttons goes at bottom left, resizing resizes the text box
758 JPanel filterPanel = initLinkTabFilterPanel();
759 GridBagConstraints linkConstraints3 = new GridBagConstraints();
760 linkConstraints3.insets = new Insets(0, 0, 0, 5);
761 linkConstraints3.gridx = 0;
762 linkConstraints3.gridy = 2;
763 linkConstraints3.weightx = 1.0;
764 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
765 linkTab.add(filterPanel, linkConstraints3);
770 private JPanel initLinkTabFilterPanel()
772 // Filter textbox and reset button
773 JLabel filterLabel = new JLabel(
774 MessageManager.getString("label.filter"));
775 filterLabel.setFont(LABEL_FONT);
776 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
777 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
779 filterTB.setFont(LABEL_FONT);
780 filterTB.setText("");
782 doReset.setText(MessageManager.getString("action.showall"));
783 userOnly.setText(MessageManager.getString("action.customfilter"));
785 // Panel for filter functionality
786 JPanel filterPanel = new JPanel(new GridBagLayout());
787 filterPanel.setBorder(new TitledBorder("Filter"));
788 GridBagConstraints gbc = new GridBagConstraints();
791 gbc.fill = GridBagConstraints.NONE;
792 gbc.anchor = GridBagConstraints.WEST;
794 filterPanel.add(filterLabel, gbc);
796 GridBagConstraints gbc1 = new GridBagConstraints();
799 gbc1.fill = GridBagConstraints.HORIZONTAL;
800 gbc1.anchor = GridBagConstraints.WEST;
802 filterPanel.add(filterTB, gbc1);
804 GridBagConstraints gbc2 = new GridBagConstraints();
806 gbc2.fill = GridBagConstraints.NONE;
807 gbc2.anchor = GridBagConstraints.WEST;
808 filterPanel.add(doReset, gbc2);
810 GridBagConstraints gbc3 = new GridBagConstraints();
812 gbc3.fill = GridBagConstraints.NONE;
813 gbc3.anchor = GridBagConstraints.WEST;
814 filterPanel.add(userOnly, gbc3);
819 private JPanel initLinkTabUrlButtons()
821 // Buttons for new / edit / delete Url links
822 JButton newLink = new JButton();
823 newLink.setText(MessageManager.getString("action.new"));
825 editLink.setText(MessageManager.getString("action.edit"));
827 deleteLink.setText(MessageManager.getString("action.delete"));
829 // no current selection, so initially disable delete/edit buttons
830 editLink.setEnabled(false);
831 deleteLink.setEnabled(false);
833 newLink.addActionListener(new java.awt.event.ActionListener()
836 public void actionPerformed(ActionEvent e)
838 newLink_actionPerformed(e);
842 editLink.setText(MessageManager.getString("action.edit"));
843 editLink.addActionListener(new java.awt.event.ActionListener()
846 public void actionPerformed(ActionEvent e)
848 editLink_actionPerformed(e);
852 deleteLink.setText(MessageManager.getString("action.delete"));
853 deleteLink.addActionListener(new java.awt.event.ActionListener()
856 public void actionPerformed(ActionEvent e)
858 deleteLink_actionPerformed(e);
862 JPanel buttonPanel = new JPanel(new GridBagLayout());
863 buttonPanel.setBorder(new TitledBorder("Edit links"));
864 GridBagConstraints gbc = new GridBagConstraints();
867 gbc.fill = GridBagConstraints.NONE;
868 buttonPanel.add(newLink, gbc);
870 GridBagConstraints gbc1 = new GridBagConstraints();
873 gbc1.fill = GridBagConstraints.NONE;
874 buttonPanel.add(editLink, gbc1);
876 GridBagConstraints gbc2 = new GridBagConstraints();
879 gbc2.fill = GridBagConstraints.NONE;
880 buttonPanel.add(deleteLink, gbc2);
882 GridBagConstraints gbc3 = new GridBagConstraints();
885 gbc3.fill = GridBagConstraints.HORIZONTAL;
887 JPanel spacePanel = new JPanel();
888 spacePanel.setBorder(null);
889 buttonPanel.add(spacePanel, gbc3);
895 * Initialises the proxy server panel in the Connections tab
897 * @return the proxy server panel
899 private JPanel initConnTabProxyPanel()
901 // Label for server text box
902 serverLabel.setText(MessageManager.getString("label.address"));
903 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
904 serverLabel.setFont(LABEL_FONT);
906 // Proxy server and port text boxes
907 proxyServerTB.setFont(LABEL_FONT);
908 proxyPortTB.setFont(LABEL_FONT);
910 // Label for Port text box
911 portLabel.setFont(LABEL_FONT);
912 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
913 portLabel.setText(MessageManager.getString("label.port"));
915 // Use proxy server checkbox
916 useProxy.setFont(LABEL_FONT);
917 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
918 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
919 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
920 useProxy.addActionListener(new ActionListener()
923 public void actionPerformed(ActionEvent e)
925 useProxy_actionPerformed();
929 // Make proxy server panel
930 JPanel proxyPanel = new JPanel();
931 TitledBorder titledBorder1 = new TitledBorder(
932 MessageManager.getString("label.proxy_server"));
933 proxyPanel.setBorder(titledBorder1);
934 proxyPanel.setLayout(new GridBagLayout());
935 proxyPanel.add(serverLabel,
936 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
937 GridBagConstraints.WEST, GridBagConstraints.NONE,
938 new Insets(0, 2, 2, 0), 5, 0));
939 proxyPanel.add(portLabel,
940 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
941 GridBagConstraints.WEST, GridBagConstraints.NONE,
942 new Insets(0, 0, 2, 0), 11, 0));
943 proxyPanel.add(useProxy,
944 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
945 GridBagConstraints.WEST, GridBagConstraints.NONE,
946 new Insets(0, 2, 5, 185), 2, -4));
947 proxyPanel.add(proxyPortTB,
948 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
949 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
950 new Insets(0, 2, 2, 2), 54, 1));
951 proxyPanel.add(proxyServerTB,
952 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
953 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
954 new Insets(0, 2, 2, 0), 263, 1));
960 * Initialises the checkboxes in the Connections tab
962 private void initConnTabCheckboxes()
964 // Usage stats checkbox label
966 MessageManager.getString("label.send_usage_statistics"));
967 usagestats.setFont(LABEL_FONT);
968 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
969 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
971 // Questionnaire checkbox label
972 questionnaire.setText(
973 MessageManager.getString("label.check_for_questionnaires"));
974 questionnaire.setFont(LABEL_FONT);
975 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
976 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
978 // Check for latest version checkbox label
979 versioncheck.setText(
980 MessageManager.getString("label.check_for_latest_version"));
981 versioncheck.setFont(LABEL_FONT);
982 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
983 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
987 * Initialises the parent panel which contains the tabbed sections.
991 private JPanel initOkCancelPanel()
993 JButton ok = new JButton();
994 ok.setText(MessageManager.getString("action.ok"));
995 ok.addActionListener(new ActionListener()
998 public void actionPerformed(ActionEvent e)
1000 ok_actionPerformed(e);
1003 JButton cancel = new JButton();
1004 cancel.setText(MessageManager.getString("action.cancel"));
1005 cancel.addActionListener(new ActionListener()
1008 public void actionPerformed(ActionEvent e)
1010 cancel_actionPerformed(e);
1013 JPanel okCancelPanel = new JPanel();
1014 okCancelPanel.add(ok);
1015 okCancelPanel.add(cancel);
1016 return okCancelPanel;
1020 * Initialises the Colours tabbed panel.
1024 private JPanel initColoursTab()
1026 JPanel coloursTab = new JPanel();
1027 coloursTab.setBorder(new TitledBorder(
1028 MessageManager.getString("action.open_new_alignment")));
1029 coloursTab.setLayout(new FlowLayout());
1030 JLabel mincolourLabel = new JLabel();
1031 mincolourLabel.setFont(LABEL_FONT);
1032 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1033 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1034 minColour.setFont(LABEL_FONT);
1035 minColour.setBorder(BorderFactory.createEtchedBorder());
1036 minColour.setPreferredSize(new Dimension(40, 20));
1037 minColour.addMouseListener(new MouseAdapter()
1040 public void mousePressed(MouseEvent e)
1042 minColour_actionPerformed(minColour);
1045 JLabel maxcolourLabel = new JLabel();
1046 maxcolourLabel.setFont(LABEL_FONT);
1047 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1048 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1049 maxColour.setFont(LABEL_FONT);
1050 maxColour.setBorder(BorderFactory.createEtchedBorder());
1051 maxColour.setPreferredSize(new Dimension(40, 20));
1052 maxColour.addMouseListener(new MouseAdapter()
1055 public void mousePressed(MouseEvent e)
1057 maxColour_actionPerformed(maxColour);
1061 protColour.setFont(LABEL_FONT);
1062 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1063 JLabel protColourLabel = new JLabel();
1064 protColourLabel.setFont(LABEL_FONT);
1065 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1066 protColourLabel.setText(
1067 MessageManager.getString("label.prot_alignment_colour") + " ");
1068 JvSwingUtils.addtoLayout(coloursTab,
1070 .getString("label.default_colour_scheme_for_alignment"),
1071 protColourLabel, protColour);
1073 nucColour.setFont(LABEL_FONT);
1074 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1075 JLabel nucColourLabel = new JLabel();
1076 nucColourLabel.setFont(LABEL_FONT);
1077 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1078 nucColourLabel.setText(
1079 MessageManager.getString("label.nuc_alignment_colour") + " ");
1080 JvSwingUtils.addtoLayout(coloursTab,
1082 .getString("label.default_colour_scheme_for_alignment"),
1083 nucColourLabel, nucColour);
1085 JPanel annotationShding = new JPanel();
1086 annotationShding.setBorder(new TitledBorder(
1087 MessageManager.getString("label.annotation_shading_default")));
1088 annotationShding.setLayout(new GridLayout(1, 2));
1089 JvSwingUtils.addtoLayout(annotationShding,
1090 MessageManager.getString(
1091 "label.default_minimum_colour_annotation_shading"),
1092 mincolourLabel, minColour);
1093 JvSwingUtils.addtoLayout(annotationShding,
1094 MessageManager.getString(
1095 "label.default_maximum_colour_annotation_shading"),
1096 maxcolourLabel, maxColour);
1097 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1102 * Initialises the Structure tabbed panel.
1106 private JPanel initStructureTab()
1108 structureTab = new JPanel();
1110 structureTab.setBorder(new TitledBorder(
1111 MessageManager.getString("label.structure_options")));
1112 structureTab.setLayout(null);
1113 final int width = 400;
1114 final int height = 22;
1115 final int lineSpacing = 25;
1118 structFromPdb.setFont(LABEL_FONT);
1120 .setText(MessageManager.getString("label.struct_from_pdb"));
1121 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1122 structFromPdb.addActionListener(new ActionListener()
1125 public void actionPerformed(ActionEvent e)
1127 boolean selected = structFromPdb.isSelected();
1128 // enable other options only when the first is checked
1129 useRnaView.setEnabled(selected);
1130 addSecondaryStructure.setEnabled(selected);
1131 addTempFactor.setEnabled(selected);
1134 structureTab.add(structFromPdb);
1136 // indent checkboxes that are conditional on the first one
1137 ypos += lineSpacing;
1138 useRnaView.setFont(LABEL_FONT);
1139 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1140 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1141 structureTab.add(useRnaView);
1143 ypos += lineSpacing;
1144 addSecondaryStructure.setFont(LABEL_FONT);
1145 addSecondaryStructure
1146 .setText(MessageManager.getString("label.autoadd_secstr"));
1147 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1148 structureTab.add(addSecondaryStructure);
1150 ypos += lineSpacing;
1151 addTempFactor.setFont(LABEL_FONT);
1152 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1153 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1154 structureTab.add(addTempFactor);
1156 ypos += lineSpacing;
1157 JLabel viewerLabel = new JLabel();
1158 viewerLabel.setFont(LABEL_FONT);
1159 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1160 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1161 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1162 structureTab.add(viewerLabel);
1164 structViewer.setFont(LABEL_FONT);
1165 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1166 structViewer.addItem(ViewerType.JMOL.name());
1167 structViewer.addItem(ViewerType.CHIMERA.name());
1168 structViewer.addActionListener(new ActionListener()
1171 public void actionPerformed(ActionEvent e)
1173 structureViewer_actionPerformed(
1174 (String) structViewer.getSelectedItem());
1177 structureTab.add(structViewer);
1179 ypos += lineSpacing;
1180 JLabel pathLabel = new JLabel();
1181 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1182 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1183 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1184 final String tooltip = JvSwingUtils.wrapTooltip(true,
1185 MessageManager.getString("label.chimera_path_tip"));
1186 pathLabel.setToolTipText(tooltip);
1187 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1188 structureTab.add(pathLabel);
1190 chimeraPath.setFont(LABEL_FONT);
1191 chimeraPath.setText("");
1192 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1193 chimeraPath.addMouseListener(new MouseAdapter()
1196 public void mouseClicked(MouseEvent e)
1198 if (e.getClickCount() == 2)
1200 String chosen = openFileChooser(false);
1203 chimeraPath.setText(chosen);
1208 structureTab.add(chimeraPath);
1210 ypos += lineSpacing;
1211 nwMapping.setFont(LABEL_FONT);
1212 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1213 siftsMapping.setFont(LABEL_FONT);
1214 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1215 mappingMethod.add(nwMapping);
1216 mappingMethod.add(siftsMapping);
1217 JPanel mappingPanel = new JPanel();
1218 mappingPanel.setFont(LABEL_FONT);
1219 TitledBorder mmTitledBorder = new TitledBorder(
1220 MessageManager.getString("label.mapping_method"));
1221 mmTitledBorder.setTitleFont(LABEL_FONT);
1222 mappingPanel.setBorder(mmTitledBorder);
1223 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1224 // GridLayout mappingLayout = new GridLayout();
1225 mappingPanel.setLayout(new GridLayout());
1226 mappingPanel.add(nwMapping);
1227 mappingPanel.add(siftsMapping);
1228 structureTab.add(mappingPanel);
1230 ypos += lineSpacing;
1231 ypos += lineSpacing;
1232 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1233 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1234 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1235 structureTab.add(docFieldPref);
1237 return structureTab;
1241 * Action on choosing a structure viewer from combobox options.
1243 * @param selectedItem
1245 protected void structureViewer_actionPerformed(String selectedItem)
1250 * Show a dialog for the user to choose a file. Returns the chosen path, or
1255 protected String openFileChooser(boolean forFolder)
1257 String choice = null;
1258 JFileChooser chooser = new JFileChooser();
1261 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1264 // chooser.setFileView(new JalviewFileView());
1265 chooser.setDialogTitle(
1266 MessageManager.getString("label.open_local_file"));
1267 chooser.setToolTipText(MessageManager.getString("action.open"));
1269 int value = chooser.showOpenDialog(this);
1271 if (value == JFileChooser.APPROVE_OPTION)
1273 choice = chooser.getSelectedFile().getPath();
1279 * Validate the structure tab preferences; if invalid, set focus on this tab.
1283 protected boolean validateStructure(FocusEvent e)
1285 if (!validateStructure())
1287 e.getComponent().requestFocusInWindow();
1294 * Validate the hmmer tab preferences; if invalid, set focus on this tab.
1298 protected boolean validateHMMER(FocusEvent e)
1300 if (!validateHMMER())
1302 e.getComponent().requestFocusInWindow();
1308 protected boolean validateStructure()
1313 protected boolean validateHMMER()
1319 * Initialises the Visual tabbed panel.
1323 private JPanel initVisualTab()
1325 JPanel visualTab = new JPanel();
1326 visualTab.setBorder(new TitledBorder(
1327 MessageManager.getString("action.open_new_alignment")));
1328 visualTab.setLayout(null);
1329 fullScreen.setFont(LABEL_FONT);
1330 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1331 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1332 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1333 quality.setEnabled(false);
1334 quality.setFont(LABEL_FONT);
1335 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1336 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1337 quality.setSelected(true);
1338 quality.setText(MessageManager.getString("label.quality"));
1339 conservation.setEnabled(false);
1340 conservation.setFont(LABEL_FONT);
1341 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1342 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1343 conservation.setSelected(true);
1344 conservation.setText(MessageManager.getString("label.conservation"));
1345 identity.setEnabled(false);
1346 identity.setFont(LABEL_FONT);
1347 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1348 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1349 identity.setSelected(true);
1350 identity.setText(MessageManager.getString("label.consensus"));
1351 showOccupancy.setFont(LABEL_FONT);
1352 showOccupancy.setEnabled(false);
1353 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1354 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1355 showOccupancy.setSelected(true);
1356 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1358 JLabel showGroupbits = new JLabel();
1359 showGroupbits.setFont(LABEL_FONT);
1360 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1361 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1363 .setText(MessageManager.getString("action.show_group") + ":");
1364 JLabel showConsensbits = new JLabel();
1365 showConsensbits.setFont(LABEL_FONT);
1366 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1367 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1369 .setText(MessageManager.getString("label.consensus") + ":");
1370 showConsensHistogram.setEnabled(false);
1371 showConsensHistogram.setFont(LABEL_FONT);
1372 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1373 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1374 showConsensHistogram.setSelected(true);
1375 showConsensHistogram
1376 .setText(MessageManager.getString("label.histogram"));
1377 showConsensLogo.setEnabled(false);
1378 showConsensLogo.setFont(LABEL_FONT);
1379 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1380 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1381 showConsensLogo.setSelected(true);
1382 showConsensLogo.setText(MessageManager.getString("label.logo"));
1383 showGroupConsensus.setEnabled(false);
1384 showGroupConsensus.setFont(LABEL_FONT);
1385 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1386 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1387 showGroupConsensus.setSelected(true);
1388 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1389 showGroupConservation.setEnabled(false);
1390 showGroupConservation.setFont(LABEL_FONT);
1391 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1392 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1393 showGroupConservation.setSelected(true);
1394 showGroupConservation
1395 .setText(MessageManager.getString("label.conservation"));
1396 showNpTooltip.setEnabled(true);
1397 showNpTooltip.setFont(LABEL_FONT);
1398 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1399 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1400 showNpTooltip.setSelected(true);
1401 showNpTooltip.setText(
1402 MessageManager.getString("label.non_positional_features"));
1403 showDbRefTooltip.setEnabled(true);
1404 showDbRefTooltip.setFont(LABEL_FONT);
1405 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1406 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1407 showDbRefTooltip.setSelected(true);
1409 .setText(MessageManager.getString("label.database_references"));
1410 annotations.setFont(LABEL_FONT);
1411 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1412 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1413 annotations.setSelected(true);
1414 annotations.setText(MessageManager.getString("label.show_annotations"));
1415 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1416 annotations.addActionListener(new ActionListener()
1419 public void actionPerformed(ActionEvent e)
1421 annotations_actionPerformed(e);
1424 identity.addActionListener(new ActionListener()
1427 public void actionPerformed(ActionEvent e)
1429 annotations_actionPerformed(e);
1432 showGroupConsensus.addActionListener(new ActionListener()
1435 public void actionPerformed(ActionEvent e)
1437 annotations_actionPerformed(e);
1440 showUnconserved.setFont(LABEL_FONT);
1441 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1442 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1443 showUnconserved.setSelected(true);
1445 .setText(MessageManager.getString("action.show_unconserved"));
1446 showUnconserved.addActionListener(new ActionListener()
1449 public void actionPerformed(ActionEvent e)
1451 showunconserved_actionPerformed(e);
1455 // TODO these are not yet added to / action from Preferences
1456 // JCheckBox shareSelections = new JCheckBox();
1457 // shareSelections.setFont(verdana11);
1458 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1459 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1460 // shareSelections.setSelected(true);
1461 // shareSelections.setText(MessageManager
1462 // .getString("label.share_selection_across_views"));
1463 // JCheckBox followHighlight = new JCheckBox();
1464 // followHighlight.setFont(verdana11);
1465 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1466 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1467 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1468 // followHighlight.setSelected(true);
1469 // followHighlight.setText(MessageManager
1470 // .getString("label.scroll_highlighted_regions"));
1472 seqLimit.setFont(LABEL_FONT);
1473 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1474 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1475 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1476 smoothFont.setFont(LABEL_FONT);
1477 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1478 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1479 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1480 scaleProteinToCdna.setFont(LABEL_FONT);
1481 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1482 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1483 scaleProteinToCdna.setText(
1484 MessageManager.getString("label.scale_protein_to_cdna"));
1485 scaleProteinToCdna.setToolTipText(
1486 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1487 JLabel gapLabel = new JLabel();
1488 gapLabel.setFont(LABEL_FONT);
1489 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1490 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1491 JLabel fontLabel = new JLabel();
1492 fontLabel.setFont(LABEL_FONT);
1493 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1494 fontLabel.setText(MessageManager.getString("label.font"));
1495 fontSizeCB.setFont(LABEL_FONT);
1496 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1497 fontStyleCB.setFont(LABEL_FONT);
1498 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1499 fontNameCB.setFont(LABEL_FONT);
1500 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1501 gapSymbolCB.setFont(LABEL_FONT);
1502 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1503 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1504 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1505 gapSymbolCB.setRenderer(dlcr);
1507 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1508 startupCheckbox.setFont(LABEL_FONT);
1509 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1510 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1511 startupCheckbox.setSelected(true);
1512 startupFileTextfield.setFont(LABEL_FONT);
1513 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1514 startupFileTextfield.addMouseListener(new MouseAdapter()
1517 public void mouseClicked(MouseEvent e)
1519 if (e.getClickCount() > 1)
1521 startupFileTextfield_mouseClicked();
1526 sortby.setFont(LABEL_FONT);
1527 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1528 JLabel sortLabel = new JLabel();
1529 sortLabel.setFont(LABEL_FONT);
1530 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1531 sortLabel.setText(MessageManager.getString("label.sort_by"));
1532 sortAnnBy.setFont(LABEL_FONT);
1533 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1534 JLabel sortAnnLabel = new JLabel();
1535 sortAnnLabel.setFont(LABEL_FONT);
1536 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1537 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1538 sortAutocalc.setFont(LABEL_FONT);
1539 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1541 JPanel annsettingsPanel = new JPanel();
1542 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1543 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1544 annsettingsPanel.setBorder(new EtchedBorder());
1545 visualTab.add(annsettingsPanel);
1546 Border jb = new EmptyBorder(1, 1, 4, 5);
1547 annotations.setBorder(jb);
1548 showOccupancy.setBorder(jb);
1549 quality.setBorder(jb);
1550 conservation.setBorder(jb);
1551 identity.setBorder(jb);
1552 showConsensbits.setBorder(jb);
1553 showGroupbits.setBorder(jb);
1554 showGroupConsensus.setBorder(jb);
1555 showGroupConservation.setBorder(jb);
1556 showConsensHistogram.setBorder(jb);
1557 showConsensLogo.setBorder(jb);
1559 JPanel autoAnnotSettings = new JPanel();
1560 annsettingsPanel.add(autoAnnotSettings);
1561 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1562 autoAnnotSettings.add(annotations);
1563 autoAnnotSettings.add(quality);
1564 // second row of autoannotation box
1565 autoAnnotSettings = new JPanel();
1566 annsettingsPanel.add(autoAnnotSettings);
1568 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1569 autoAnnotSettings.add(conservation);
1570 autoAnnotSettings.add(identity);
1571 autoAnnotSettings.add(showOccupancy);
1572 autoAnnotSettings.add(showGroupbits);
1573 autoAnnotSettings.add(showGroupConservation);
1574 autoAnnotSettings.add(showGroupConsensus);
1575 autoAnnotSettings.add(showConsensbits);
1576 autoAnnotSettings.add(showConsensHistogram);
1577 autoAnnotSettings.add(showConsensLogo);
1579 JPanel tooltipSettings = new JPanel();
1580 tooltipSettings.setBorder(new TitledBorder(
1581 MessageManager.getString("label.sequence_id_tooltip")));
1582 tooltipSettings.setBounds(173, 140, 220, 62);
1583 tooltipSettings.setLayout(new GridLayout(2, 1));
1584 tooltipSettings.add(showDbRefTooltip);
1585 tooltipSettings.add(showNpTooltip);
1586 visualTab.add(tooltipSettings);
1588 wrap.setFont(LABEL_FONT);
1589 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1590 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1591 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1592 rightAlign.setFont(LABEL_FONT);
1593 rightAlign.setForeground(Color.black);
1594 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1595 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1596 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1597 idItalics.setFont(LABEL_FONT_ITALIC);
1598 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1599 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1601 MessageManager.getString("label.sequence_name_italics"));
1602 openoverv.setFont(LABEL_FONT);
1603 openoverv.setActionCommand(
1604 MessageManager.getString("label.open_overview"));
1605 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1606 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1607 openoverv.setText(MessageManager.getString("label.open_overview"));
1608 JPanel jPanel2 = new JPanel();
1609 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1610 jPanel2.setLayout(new GridLayout(14, 1));
1611 jPanel2.add(fullScreen);
1612 jPanel2.add(openoverv);
1613 jPanel2.add(seqLimit);
1614 jPanel2.add(rightAlign);
1615 jPanel2.add(fontLabel);
1616 jPanel2.add(showUnconserved);
1617 jPanel2.add(idItalics);
1618 jPanel2.add(smoothFont);
1619 jPanel2.add(scaleProteinToCdna);
1620 jPanel2.add(gapLabel);
1622 jPanel2.add(sortLabel);
1623 jPanel2.add(sortAnnLabel);
1624 jPanel2.add(startupCheckbox);
1625 visualTab.add(jPanel2);
1626 visualTab.add(startupFileTextfield);
1627 visualTab.add(sortby);
1628 visualTab.add(sortAnnBy);
1629 visualTab.add(sortAutocalc);
1630 visualTab.add(gapSymbolCB);
1631 visualTab.add(fontNameCB);
1632 visualTab.add(fontSizeCB);
1633 visualTab.add(fontStyleCB);
1637 protected void autoIdWidth_actionPerformed()
1639 // TODO Auto-generated method stub
1643 protected void userIdWidth_actionPerformed()
1645 // TODO Auto-generated method stub
1649 protected void maxColour_actionPerformed(JPanel panel)
1653 protected void minColour_actionPerformed(JPanel panel)
1657 protected void showunconserved_actionPerformed(ActionEvent e)
1659 // TODO Auto-generated method stub
1669 public void ok_actionPerformed(ActionEvent e)
1679 public void cancel_actionPerformed(ActionEvent e)
1689 public void annotations_actionPerformed(ActionEvent e)
1696 public void startupFileTextfield_mouseClicked()
1700 public void newLink_actionPerformed(ActionEvent e)
1705 public void editLink_actionPerformed(ActionEvent e)
1710 public void deleteLink_actionPerformed(ActionEvent e)
1715 public void defaultBrowser_mouseClicked(MouseEvent e)
1720 public void linkURLList_keyTyped(KeyEvent e)
1725 public void useProxy_actionPerformed()
1727 boolean enabled = useProxy.isSelected();
1728 portLabel.setEnabled(enabled);
1729 serverLabel.setEnabled(enabled);
1730 proxyServerTB.setEnabled(enabled);
1731 proxyPortTB.setEnabled(enabled);
1735 * Customer renderer for JTable: supports column of radio buttons
1737 public class RadioButtonRenderer extends JRadioButton
1738 implements TableCellRenderer
1740 public RadioButtonRenderer()
1742 setHorizontalAlignment(CENTER);
1743 setToolTipText(MessageManager.getString("label.urltooltip"));
1747 public Component getTableCellRendererComponent(JTable table,
1748 Object value, boolean isSelected, boolean hasFocus, int row,
1751 setSelected((boolean) value);
1753 // set colours to match rest of table
1756 setBackground(table.getSelectionBackground());
1757 setForeground(table.getSelectionForeground());
1761 setBackground(table.getBackground());
1762 setForeground(table.getForeground());
1769 * Customer cell editor for JTable: supports column of radio buttons in
1770 * conjunction with renderer
1772 public class RadioButtonEditor extends AbstractCellEditor
1773 implements TableCellEditor
1775 private JRadioButton button = new JRadioButton();
1777 public RadioButtonEditor()
1779 button.setHorizontalAlignment(SwingConstants.CENTER);
1780 this.button.addActionListener(new ActionListener()
1783 public void actionPerformed(ActionEvent e)
1785 fireEditingStopped();
1791 public Component getTableCellEditorComponent(JTable table, Object value,
1792 boolean isSelected, int row, int column)
1794 button.setSelected((boolean) value);
1799 public Object getCellEditorValue()
1801 return button.isSelected();
1806 public void hmmerPath_actionPerformed(ActionEvent e)