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;
29 import jalview.util.Platform;
31 import java.awt.BorderLayout;
32 import java.awt.Color;
33 import java.awt.Component;
34 import java.awt.Dimension;
35 import java.awt.FlowLayout;
37 import java.awt.GridBagConstraints;
38 import java.awt.GridBagLayout;
39 import java.awt.GridLayout;
40 import java.awt.Insets;
41 import java.awt.Rectangle;
42 import java.awt.event.ActionEvent;
43 import java.awt.event.ActionListener;
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.BoxLayout;
52 import javax.swing.ButtonGroup;
53 import javax.swing.DefaultListCellRenderer;
54 import javax.swing.JButton;
55 import javax.swing.JCheckBox;
56 import javax.swing.JComboBox;
57 import javax.swing.JComponent;
58 import javax.swing.JFileChooser;
59 import javax.swing.JLabel;
60 import javax.swing.JPanel;
61 import javax.swing.JRadioButton;
62 import javax.swing.JScrollPane;
63 import javax.swing.JTabbedPane;
64 import javax.swing.JTable;
65 import javax.swing.JTextField;
66 import javax.swing.ListSelectionModel;
67 import javax.swing.SwingConstants;
68 import javax.swing.border.Border;
69 import javax.swing.border.EmptyBorder;
70 import javax.swing.border.EtchedBorder;
71 import javax.swing.border.TitledBorder;
72 import javax.swing.event.ChangeEvent;
73 import javax.swing.event.ChangeListener;
74 import javax.swing.table.TableCellEditor;
75 import javax.swing.table.TableCellRenderer;
77 import net.miginfocom.swing.MigLayout;
80 * Base class for the Preferences panel.
85 public class GPreferences extends JPanel
87 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
89 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
90 .getLabelFont(false, true);
93 * Visual tab components
95 protected JCheckBox fullScreen = new JCheckBox();
97 protected JCheckBox openoverv = new JCheckBox();
99 protected JCheckBox seqLimit = new JCheckBox();
101 protected JCheckBox rightAlign = new JCheckBox();
103 protected JComboBox<String> fontSizeCB = new JComboBox<>();
105 protected JComboBox<String> fontStyleCB = new JComboBox<>();
107 protected JComboBox<String> fontNameCB = new JComboBox<>();
109 protected JCheckBox showOccupancy = new JCheckBox();
111 protected JCheckBox showUnconserved = new JCheckBox();
113 protected JCheckBox idItalics = new JCheckBox();
115 protected JCheckBox smoothFont = new JCheckBox();
117 protected JCheckBox scaleProteinToCdna = new JCheckBox();
119 protected JComboBox<String> gapSymbolCB = new JComboBox<>();
121 protected JCheckBox wrap = new JCheckBox();
123 protected JComboBox<String> sortby = new JComboBox<>();
125 protected JComboBox<String> sortAnnBy = new JComboBox<>();
127 protected JComboBox<String> sortAutocalc = new JComboBox<>();
129 protected JCheckBox startupCheckbox = new JCheckBox();
131 protected JTextField startupFileTextfield = new JTextField();
133 // below are in the 'second column'
134 protected JCheckBox annotations = new JCheckBox();
136 protected JCheckBox quality = new JCheckBox();
138 protected JCheckBox conservation = new JCheckBox();
140 protected JCheckBox identity = new JCheckBox();
142 protected JCheckBox showGroupConsensus = new JCheckBox();
144 protected JCheckBox showGroupConservation = new JCheckBox();
146 protected JCheckBox showConsensHistogram = new JCheckBox();
148 protected JCheckBox showConsensLogo = new JCheckBox();
150 protected JCheckBox showInformationHistogram = new JCheckBox();
152 protected JCheckBox showHMMLogo = new JCheckBox();
154 protected JCheckBox showDbRefTooltip = new JCheckBox();
156 protected JCheckBox showNpTooltip = new JCheckBox();
160 * Structure tab and components
162 protected JPanel structureTab;
164 protected JCheckBox structFromPdb = new JCheckBox();
166 protected JCheckBox useRnaView = new JCheckBox();
168 protected JCheckBox addSecondaryStructure = new JCheckBox();
170 protected JCheckBox addTempFactor = new JCheckBox();
172 protected JComboBox<String> structViewer = new JComboBox<>();
174 protected JTextField chimeraPath = new JTextField();
176 protected ButtonGroup mappingMethod = new ButtonGroup();
178 protected JRadioButton siftsMapping = new JRadioButton();
180 protected JRadioButton nwMapping = new JRadioButton();
183 * Colours tab components
185 protected JPanel minColour = new JPanel();
187 protected JPanel maxColour = new JPanel();
189 protected JComboBox<String> protColour = new JComboBox<>();
191 protected JComboBox<String> nucColour = new JComboBox<>();
194 * Overview tab components
196 protected JPanel gapColour = new JPanel();
198 protected JPanel hiddenColour = new JPanel();
200 protected JCheckBox useLegacyGap;
202 protected JCheckBox showHiddenAtStart;
204 protected JLabel gapLabel;
207 * Connections tab components
209 protected JTable linkUrlTable = new JTable();
211 protected JButton editLink = new JButton();
213 protected JButton deleteLink = new JButton();
215 protected JTextField filterTB = new JTextField();
217 protected JButton doReset = new JButton();
219 protected JButton userOnly = new JButton();
221 protected JLabel portLabel = new JLabel();
223 protected JLabel serverLabel = new JLabel();
225 protected JTextField proxyServerTB = new JTextField();
227 protected JTextField proxyPortTB = new JTextField();
229 protected JTextField defaultBrowser = new JTextField();
231 protected JCheckBox useProxy = new JCheckBox();
233 protected JCheckBox usagestats = new JCheckBox();
235 protected JCheckBox questionnaire = new JCheckBox();
237 protected JCheckBox versioncheck = new JCheckBox();
240 * Output tab components
242 protected JComboBox<Object> epsRendering = new JComboBox<>();
244 protected JLabel userIdWidthlabel = new JLabel();
246 protected JCheckBox autoIdWidth = new JCheckBox();
248 protected JTextField userIdWidth = new JTextField();
250 protected JCheckBox blcjv = new JCheckBox();
252 protected JCheckBox pileupjv = new JCheckBox();
254 protected JCheckBox clustaljv = new JCheckBox();
256 protected JCheckBox msfjv = new JCheckBox();
258 protected JCheckBox fastajv = new JCheckBox();
260 protected JCheckBox pfamjv = new JCheckBox();
262 protected JCheckBox pirjv = new JCheckBox();
264 protected JCheckBox modellerOutput = new JCheckBox();
266 protected JCheckBox embbedBioJSON = new JCheckBox();
269 * Editing tab components
271 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
273 protected JCheckBox padGaps = new JCheckBox();
275 protected JCheckBox sortByTree = new JCheckBox();
278 * hmmer tab and components
280 protected JPanel hmmerTab;
282 protected JCheckBox hmmrTrimTermini;
284 protected AbstractButton hmmerBackgroundUniprot;
286 protected AbstractButton hmmerBackgroundAlignment;
288 protected JTextField hmmerSequenceCount;
290 protected JTextField hmmerPath;
292 protected JTextField cygwinPath;
297 protected JPanel wsTab = new JPanel();
302 * Creates a new GPreferences object.
304 public GPreferences()
309 } catch (Exception ex)
311 ex.printStackTrace();
316 * Construct the panel and its tabbed sub-panels.
320 private void jbInit() throws Exception
322 final JTabbedPane tabbedPane = new JTabbedPane();
323 this.setLayout(new BorderLayout());
324 JPanel okCancelPanel = initOkCancelPanel();
325 this.add(tabbedPane, BorderLayout.CENTER);
326 this.add(okCancelPanel, BorderLayout.SOUTH);
328 tabbedPane.add(initVisualTab(),
329 MessageManager.getString("label.visual"));
331 tabbedPane.add(initColoursTab(),
332 MessageManager.getString("label.colours"));
334 tabbedPane.add(initOverviewTab(),
335 MessageManager.getString("label.overview"));
337 tabbedPane.add(initStructureTab(),
338 MessageManager.getString("label.structure"));
340 tabbedPane.add(initConnectionsTab(),
341 MessageManager.getString("label.connections"));
343 tabbedPane.add(initLinksTab(),
344 MessageManager.getString("label.urllinks"));
346 tabbedPane.add(initOutputTab(),
347 MessageManager.getString("label.output"));
349 tabbedPane.add(initEditingTab(),
350 MessageManager.getString("label.editing"));
352 tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
355 * See WsPreferences for the real work of configuring this tab.
357 wsTab.setLayout(new BorderLayout());
358 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
361 * Handler to validate a tab before leaving it - currently only for
364 tabbedPane.addChangeListener(new ChangeListener()
366 private Component lastTab;
369 public void stateChanged(ChangeEvent e)
371 if (lastTab == structureTab
372 && tabbedPane.getSelectedComponent() != structureTab)
374 if (!validateStructure())
376 tabbedPane.setSelectedComponent(structureTab);
380 lastTab = tabbedPane.getSelectedComponent();
387 * Initialises the Editing tabbed panel.
391 private JPanel initEditingTab()
393 JPanel editingTab = new JPanel();
394 editingTab.setLayout(null);
395 autoCalculateConsCheck.setFont(LABEL_FONT);
396 autoCalculateConsCheck.setText(
397 MessageManager.getString("label.autocalculate_consensus"));
398 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
399 padGaps.setFont(LABEL_FONT);
401 MessageManager.getString("label.pad_gaps_when_editing"));
402 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
403 sortByTree.setFont(LABEL_FONT);
405 .setText(MessageManager.getString("label.sort_with_new_tree"));
406 sortByTree.setToolTipText(MessageManager.getString(
407 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
408 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
409 editingTab.add(autoCalculateConsCheck);
410 editingTab.add(padGaps);
411 editingTab.add(sortByTree);
416 * Initialises the hmmer tabbed panel
420 private JPanel initHMMERTab()
422 hmmerTab = new JPanel();
423 hmmerTab.setLayout(new BoxLayout(hmmerTab, BoxLayout.Y_AXIS));
424 hmmerTab.setLayout(new MigLayout("flowy"));
427 * path to hmmer binaries folder
429 JPanel installationPanel = new JPanel(new MigLayout("flowy"));
430 // new FlowLayout(FlowLayout.LEFT));
431 JvSwingUtils.createTitledBorder(installationPanel,
432 MessageManager.getString("label.installation"), true);
433 hmmerTab.add(installationPanel);
434 JLabel hmmerLocation = new JLabel(
435 MessageManager.getString("label.hmmer_location"));
436 hmmerLocation.setFont(LABEL_FONT);
437 final int pathFieldLength = 40;
438 hmmerPath = new JTextField(pathFieldLength);
439 hmmerPath.addMouseListener(new MouseAdapter()
442 public void mouseClicked(MouseEvent e)
444 if (e.getClickCount() == 2)
446 String chosen = openFileChooser(true);
449 hmmerPath.setText(chosen);
455 installationPanel.add(hmmerLocation);
456 installationPanel.add(hmmerPath);
459 * path to Cygwin binaries folder (for Windows)
461 if (Platform.isWindows())
463 JLabel cygwinLocation = new JLabel(
464 MessageManager.getString("label.cygwin_location"));
465 cygwinLocation.setFont(LABEL_FONT);
466 cygwinPath = new JTextField(pathFieldLength);
467 cygwinPath.addMouseListener(new MouseAdapter()
470 public void mouseClicked(MouseEvent e)
472 if (e.getClickCount() == 2)
474 String chosen = openFileChooser(true);
477 cygwinPath.setText(chosen);
478 validateCygwinPath();
483 installationPanel.add(cygwinLocation);
484 installationPanel.add(cygwinPath);
488 * preferences for hmmalign
490 JPanel alignOptionsPanel = new JPanel(new MigLayout());
491 // new FlowLayout(FlowLayout.LEFT));
492 JvSwingUtils.createTitledBorder(alignOptionsPanel,
493 MessageManager.getString("label.hmmalign_options"), true);
494 hmmerTab.add(alignOptionsPanel);
495 hmmrTrimTermini = new JCheckBox();
496 hmmrTrimTermini.setFont(LABEL_FONT);
497 hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
498 alignOptionsPanel.add(hmmrTrimTermini);
501 * preferences for hmmsearch
503 JPanel searchOptions = new JPanel(new MigLayout());
504 // FlowLayout(FlowLayout.LEFT));
505 JvSwingUtils.createTitledBorder(searchOptions,
506 MessageManager.getString("label.hmmsearch_options"), true);
507 hmmerTab.add(searchOptions);
508 JLabel sequencesToKeep = new JLabel(
509 MessageManager.getString("label.no_of_sequences"));
510 sequencesToKeep.setFont(LABEL_FONT);
511 searchOptions.add(sequencesToKeep);
512 hmmerSequenceCount = new JTextField(5);
513 searchOptions.add(hmmerSequenceCount);
516 * preferences for Information Content annotation
518 // JPanel dummy = new JPanel(new FlowLayout(FlowLayout.LEFT));
519 JPanel annotationOptions = new JPanel(new MigLayout("left"));
520 JvSwingUtils.createTitledBorder(annotationOptions,
521 MessageManager.getString("label.information_annotation"), true);
522 // dummy.add(annotationOptions);
523 hmmerTab.add(annotationOptions);
524 ButtonGroup backgroundOptions = new ButtonGroup();
525 hmmerBackgroundUniprot = new JRadioButton(
526 MessageManager.getString("label.freq_uniprot"));
527 hmmerBackgroundUniprot.setFont(LABEL_FONT);
528 hmmerBackgroundAlignment = new JRadioButton(
529 MessageManager.getString("label.freq_alignment"));
530 hmmerBackgroundAlignment.setFont(LABEL_FONT);
531 backgroundOptions.add(hmmerBackgroundUniprot);
532 backgroundOptions.add(hmmerBackgroundAlignment);
533 backgroundOptions.setSelected(hmmerBackgroundUniprot.getModel(), true);
534 // disable buttons for now as annotation only uses Uniprot background
535 hmmerBackgroundAlignment.setEnabled(false);
536 hmmerBackgroundUniprot.setEnabled(false);
537 annotationOptions.add(hmmerBackgroundUniprot, "wrap");
538 annotationOptions.add(hmmerBackgroundAlignment);
544 * Initialises the Output tabbed panel.
548 private JPanel initOutputTab()
550 JPanel outputTab = new JPanel();
551 outputTab.setLayout(null);
552 JLabel epsLabel = new JLabel();
553 epsLabel.setFont(LABEL_FONT);
554 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
555 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
556 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
557 epsRendering.setFont(LABEL_FONT);
558 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
559 JLabel jLabel1 = new JLabel();
560 jLabel1.setFont(LABEL_FONT);
561 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
562 jLabel1.setText(MessageManager.getString("label.append_start_end"));
563 jLabel1.setFont(LABEL_FONT);
564 fastajv.setFont(LABEL_FONT);
565 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
566 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
567 blcjv.setText(MessageManager.getString("label.blc") + " ");
568 fastajv.setText(MessageManager.getString("label.fasta") + " ");
569 msfjv.setText(MessageManager.getString("label.msf") + " ");
570 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
571 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
572 msfjv.setFont(LABEL_FONT);
573 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
574 pirjv.setText(MessageManager.getString("label.pir") + " ");
575 JPanel jPanel11 = new JPanel();
576 jPanel11.setFont(LABEL_FONT);
577 TitledBorder titledBorder2 = new TitledBorder(
578 MessageManager.getString("label.file_output"));
579 jPanel11.setBorder(titledBorder2);
580 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
581 GridLayout gridLayout3 = new GridLayout();
582 jPanel11.setLayout(gridLayout3);
583 gridLayout3.setRows(8);
584 blcjv.setFont(LABEL_FONT);
585 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
586 clustaljv.setFont(LABEL_FONT);
587 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
588 pfamjv.setFont(LABEL_FONT);
589 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
590 pileupjv.setFont(LABEL_FONT);
591 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
592 pirjv.setFont(LABEL_FONT);
593 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
594 autoIdWidth.setFont(LABEL_FONT);
596 MessageManager.getString("label.automatically_set_id_width"));
597 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
598 .getString("label.adjusts_width_generated_eps_png")));
599 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
600 autoIdWidth.addActionListener(new ActionListener()
604 public void actionPerformed(ActionEvent e)
606 autoIdWidth_actionPerformed();
609 userIdWidthlabel.setFont(LABEL_FONT);
610 userIdWidthlabel.setText(
611 MessageManager.getString("label.figure_id_column_width"));
612 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
613 .getString("label.manually_specify_width_left_column")));
614 userIdWidthlabel.setToolTipText(
615 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
616 "label.manually_specify_width_left_column")));
617 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
618 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
619 userIdWidth.setText("");
620 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
621 userIdWidth.addActionListener(new ActionListener()
625 public void actionPerformed(ActionEvent e)
627 userIdWidth_actionPerformed();
630 modellerOutput.setFont(LABEL_FONT);
632 .setText(MessageManager.getString("label.use_modeller_output"));
633 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
634 embbedBioJSON.setFont(LABEL_FONT);
635 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
636 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
638 jPanel11.add(jLabel1);
640 jPanel11.add(clustaljv);
641 jPanel11.add(fastajv);
643 jPanel11.add(pfamjv);
644 jPanel11.add(pileupjv);
646 outputTab.add(autoIdWidth);
647 outputTab.add(userIdWidth);
648 outputTab.add(userIdWidthlabel);
649 outputTab.add(modellerOutput);
650 outputTab.add(embbedBioJSON);
651 outputTab.add(epsLabel);
652 outputTab.add(epsRendering);
653 outputTab.add(jPanel11);
658 * Initialises the Connections tabbed panel.
662 private JPanel initConnectionsTab()
664 JPanel connectTab = new JPanel();
665 connectTab.setLayout(new GridBagLayout());
667 // Label for browser text box
668 JLabel browserLabel = new JLabel();
669 browserLabel.setFont(LABEL_FONT);
670 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
671 browserLabel.setText(
672 MessageManager.getString("label.default_browser_unix"));
673 defaultBrowser.setFont(LABEL_FONT);
674 defaultBrowser.setText("");
675 final String tooltip = JvSwingUtils.wrapTooltip(true,
676 MessageManager.getString("label.double_click_to_browse"));
677 defaultBrowser.setToolTipText(tooltip);
678 defaultBrowser.addMouseListener(new MouseAdapter()
681 public void mouseClicked(MouseEvent e)
683 if (e.getClickCount() > 1)
685 defaultBrowser_mouseClicked(e);
690 JPanel proxyPanel = initConnTabProxyPanel();
691 initConnTabCheckboxes();
693 // Add default Browser text box
694 connectTab.add(browserLabel,
695 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
696 GridBagConstraints.WEST, GridBagConstraints.NONE,
697 new Insets(10, 0, 5, 5), 5, 1));
698 defaultBrowser.setFont(LABEL_FONT);
699 defaultBrowser.setText("");
701 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
702 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
703 new Insets(10, 0, 5, 10), 30, 1));
705 // Add proxy server panel
706 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
707 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
708 new Insets(10, 0, 5, 12), 4, 10));
710 // Add usage stats, version check and questionnaire checkboxes
711 connectTab.add(usagestats,
712 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
713 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
714 new Insets(0, 2, 5, 5), 70, 1));
715 connectTab.add(questionnaire,
716 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
717 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
718 new Insets(0, 2, 5, 10), 70, 1));
719 connectTab.add(versioncheck,
720 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
721 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
722 new Insets(0, 2, 5, 5), 70, 1));
724 // Add padding so the panel doesn't look ridiculous
725 JPanel spacePanel = new JPanel();
726 connectTab.add(spacePanel,
727 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
728 GridBagConstraints.WEST, GridBagConstraints.BOTH,
729 new Insets(0, 0, 0, 5), 70, 1));
735 * Initialises the Links tabbed panel.
739 private JPanel initLinksTab()
741 JPanel linkTab = new JPanel();
742 linkTab.setLayout(new GridBagLayout());
744 // Set up table for Url links
745 linkUrlTable.setFillsViewportHeight(true);
746 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
747 linkUrlTable.setAutoCreateRowSorter(true);
748 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
750 // adjust row height so radio buttons actually fit
751 // don't do this in the renderer, it causes the awt thread to activate
753 JRadioButton temp = new JRadioButton();
754 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
756 // Table in scrollpane so that the table is given a scrollbar
757 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
758 linkScrollPane.setBorder(null);
760 // Panel for links functionality
761 JPanel linkPanel = new JPanel(new GridBagLayout());
762 linkPanel.setBorder(new TitledBorder(
763 MessageManager.getString("label.url_linkfrom_sequence_id")));
765 // Put the Url links panel together
767 // Buttons go at top right, resizing only resizes the blank space vertically
768 JPanel buttonPanel = initLinkTabUrlButtons();
769 GridBagConstraints linkConstraints1 = new GridBagConstraints();
770 linkConstraints1.insets = new Insets(0, 0, 5, 0);
771 linkConstraints1.gridx = 0;
772 linkConstraints1.gridy = 0;
773 linkConstraints1.weightx = 1.0;
774 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
775 linkTab.add(buttonPanel, linkConstraints1);
777 // Links table goes at top left, resizing resizes the table
778 GridBagConstraints linkConstraints2 = new GridBagConstraints();
779 linkConstraints2.insets = new Insets(0, 0, 5, 5);
780 linkConstraints2.gridx = 0;
781 linkConstraints2.gridy = 1;
782 linkConstraints2.weightx = 1.0;
783 linkConstraints2.weighty = 1.0;
784 linkConstraints2.fill = GridBagConstraints.BOTH;
785 linkTab.add(linkScrollPane, linkConstraints2);
787 // Filter box and buttons goes at bottom left, resizing resizes the text box
788 JPanel filterPanel = initLinkTabFilterPanel();
789 GridBagConstraints linkConstraints3 = new GridBagConstraints();
790 linkConstraints3.insets = new Insets(0, 0, 0, 5);
791 linkConstraints3.gridx = 0;
792 linkConstraints3.gridy = 2;
793 linkConstraints3.weightx = 1.0;
794 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
795 linkTab.add(filterPanel, linkConstraints3);
800 private JPanel initLinkTabFilterPanel()
802 // Filter textbox and reset button
803 JLabel filterLabel = new JLabel(
804 MessageManager.getString("label.filter"));
805 filterLabel.setFont(LABEL_FONT);
806 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
807 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
809 filterTB.setFont(LABEL_FONT);
810 filterTB.setText("");
812 doReset.setText(MessageManager.getString("action.showall"));
813 userOnly.setText(MessageManager.getString("action.customfilter"));
815 // Panel for filter functionality
816 JPanel filterPanel = new JPanel(new GridBagLayout());
817 filterPanel.setBorder(new TitledBorder("Filter"));
818 GridBagConstraints gbc = new GridBagConstraints();
821 gbc.fill = GridBagConstraints.NONE;
822 gbc.anchor = GridBagConstraints.WEST;
824 filterPanel.add(filterLabel, gbc);
826 GridBagConstraints gbc1 = new GridBagConstraints();
829 gbc1.fill = GridBagConstraints.HORIZONTAL;
830 gbc1.anchor = GridBagConstraints.WEST;
832 filterPanel.add(filterTB, gbc1);
834 GridBagConstraints gbc2 = new GridBagConstraints();
836 gbc2.fill = GridBagConstraints.NONE;
837 gbc2.anchor = GridBagConstraints.WEST;
838 filterPanel.add(doReset, gbc2);
840 GridBagConstraints gbc3 = new GridBagConstraints();
842 gbc3.fill = GridBagConstraints.NONE;
843 gbc3.anchor = GridBagConstraints.WEST;
844 filterPanel.add(userOnly, gbc3);
849 private JPanel initLinkTabUrlButtons()
851 // Buttons for new / edit / delete Url links
852 JButton newLink = new JButton();
853 newLink.setText(MessageManager.getString("action.new"));
855 editLink.setText(MessageManager.getString("action.edit"));
857 deleteLink.setText(MessageManager.getString("action.delete"));
859 // no current selection, so initially disable delete/edit buttons
860 editLink.setEnabled(false);
861 deleteLink.setEnabled(false);
863 newLink.addActionListener(new java.awt.event.ActionListener()
866 public void actionPerformed(ActionEvent e)
868 newLink_actionPerformed(e);
872 editLink.setText(MessageManager.getString("action.edit"));
873 editLink.addActionListener(new java.awt.event.ActionListener()
876 public void actionPerformed(ActionEvent e)
878 editLink_actionPerformed(e);
882 deleteLink.setText(MessageManager.getString("action.delete"));
883 deleteLink.addActionListener(new java.awt.event.ActionListener()
886 public void actionPerformed(ActionEvent e)
888 deleteLink_actionPerformed(e);
892 JPanel buttonPanel = new JPanel(new GridBagLayout());
893 buttonPanel.setBorder(new TitledBorder("Edit links"));
894 GridBagConstraints gbc = new GridBagConstraints();
897 gbc.fill = GridBagConstraints.NONE;
898 buttonPanel.add(newLink, gbc);
900 GridBagConstraints gbc1 = new GridBagConstraints();
903 gbc1.fill = GridBagConstraints.NONE;
904 buttonPanel.add(editLink, gbc1);
906 GridBagConstraints gbc2 = new GridBagConstraints();
909 gbc2.fill = GridBagConstraints.NONE;
910 buttonPanel.add(deleteLink, gbc2);
912 GridBagConstraints gbc3 = new GridBagConstraints();
915 gbc3.fill = GridBagConstraints.HORIZONTAL;
917 JPanel spacePanel = new JPanel();
918 spacePanel.setBorder(null);
919 buttonPanel.add(spacePanel, gbc3);
925 * Initialises the proxy server panel in the Connections tab
927 * @return the proxy server panel
929 private JPanel initConnTabProxyPanel()
931 // Label for server text box
932 serverLabel.setText(MessageManager.getString("label.address"));
933 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
934 serverLabel.setFont(LABEL_FONT);
936 // Proxy server and port text boxes
937 proxyServerTB.setFont(LABEL_FONT);
938 proxyPortTB.setFont(LABEL_FONT);
940 // Label for Port text box
941 portLabel.setFont(LABEL_FONT);
942 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
943 portLabel.setText(MessageManager.getString("label.port"));
945 // Use proxy server checkbox
946 useProxy.setFont(LABEL_FONT);
947 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
948 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
949 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
950 useProxy.addActionListener(new ActionListener()
953 public void actionPerformed(ActionEvent e)
955 useProxy_actionPerformed();
959 // Make proxy server panel
960 JPanel proxyPanel = new JPanel();
961 TitledBorder titledBorder1 = new TitledBorder(
962 MessageManager.getString("label.proxy_server"));
963 proxyPanel.setBorder(titledBorder1);
964 proxyPanel.setLayout(new GridBagLayout());
965 proxyPanel.add(serverLabel,
966 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
967 GridBagConstraints.WEST, GridBagConstraints.NONE,
968 new Insets(0, 2, 2, 0), 5, 0));
969 proxyPanel.add(portLabel,
970 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
971 GridBagConstraints.WEST, GridBagConstraints.NONE,
972 new Insets(0, 0, 2, 0), 11, 0));
973 proxyPanel.add(useProxy,
974 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
975 GridBagConstraints.WEST, GridBagConstraints.NONE,
976 new Insets(0, 2, 5, 185), 2, -4));
977 proxyPanel.add(proxyPortTB,
978 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
979 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
980 new Insets(0, 2, 2, 2), 54, 1));
981 proxyPanel.add(proxyServerTB,
982 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
983 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
984 new Insets(0, 2, 2, 0), 263, 1));
990 * Initialises the checkboxes in the Connections tab
992 private void initConnTabCheckboxes()
994 // Usage stats checkbox label
996 MessageManager.getString("label.send_usage_statistics"));
997 usagestats.setFont(LABEL_FONT);
998 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
999 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
1001 // Questionnaire checkbox label
1002 questionnaire.setText(
1003 MessageManager.getString("label.check_for_questionnaires"));
1004 questionnaire.setFont(LABEL_FONT);
1005 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
1006 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
1008 // Check for latest version checkbox label
1009 versioncheck.setText(
1010 MessageManager.getString("label.check_for_latest_version"));
1011 versioncheck.setFont(LABEL_FONT);
1012 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
1013 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
1017 * Initialises the parent panel which contains the tabbed sections.
1021 private JPanel initOkCancelPanel()
1023 JButton ok = new JButton();
1024 ok.setText(MessageManager.getString("action.ok"));
1025 ok.addActionListener(new ActionListener()
1028 public void actionPerformed(ActionEvent e)
1030 ok_actionPerformed(e);
1033 JButton cancel = new JButton();
1034 cancel.setText(MessageManager.getString("action.cancel"));
1035 cancel.addActionListener(new ActionListener()
1038 public void actionPerformed(ActionEvent e)
1040 cancel_actionPerformed(e);
1043 JPanel okCancelPanel = new JPanel();
1044 okCancelPanel.add(ok);
1045 okCancelPanel.add(cancel);
1046 return okCancelPanel;
1050 * Initialises the Colours tabbed panel.
1054 private JPanel initColoursTab()
1056 JPanel coloursTab = new JPanel();
1057 coloursTab.setBorder(new TitledBorder(
1058 MessageManager.getString("action.open_new_alignment")));
1059 coloursTab.setLayout(new FlowLayout());
1060 JLabel mincolourLabel = new JLabel();
1061 mincolourLabel.setFont(LABEL_FONT);
1062 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1063 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1064 minColour.setFont(LABEL_FONT);
1065 minColour.setBorder(BorderFactory.createEtchedBorder());
1066 minColour.setPreferredSize(new Dimension(40, 20));
1067 minColour.addMouseListener(new MouseAdapter()
1070 public void mousePressed(MouseEvent e)
1072 minColour_actionPerformed(minColour);
1075 JLabel maxcolourLabel = new JLabel();
1076 maxcolourLabel.setFont(LABEL_FONT);
1077 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1078 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1079 maxColour.setFont(LABEL_FONT);
1080 maxColour.setBorder(BorderFactory.createEtchedBorder());
1081 maxColour.setPreferredSize(new Dimension(40, 20));
1082 maxColour.addMouseListener(new MouseAdapter()
1085 public void mousePressed(MouseEvent e)
1087 maxColour_actionPerformed(maxColour);
1091 protColour.setFont(LABEL_FONT);
1092 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1093 JLabel protColourLabel = new JLabel();
1094 protColourLabel.setFont(LABEL_FONT);
1095 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1096 protColourLabel.setText(
1097 MessageManager.getString("label.prot_alignment_colour") + " ");
1098 GPreferences.addtoLayout(coloursTab,
1100 .getString("label.default_colour_scheme_for_alignment"),
1101 protColourLabel, protColour);
1103 nucColour.setFont(LABEL_FONT);
1104 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1105 JLabel nucColourLabel = new JLabel();
1106 nucColourLabel.setFont(LABEL_FONT);
1107 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1108 nucColourLabel.setText(
1109 MessageManager.getString("label.nuc_alignment_colour") + " ");
1110 GPreferences.addtoLayout(coloursTab,
1112 .getString("label.default_colour_scheme_for_alignment"),
1113 nucColourLabel, nucColour);
1115 JPanel annotationShding = new JPanel();
1116 annotationShding.setBorder(new TitledBorder(
1117 MessageManager.getString("label.annotation_shading_default")));
1118 annotationShding.setLayout(new GridLayout(1, 2));
1119 GPreferences.addtoLayout(annotationShding,
1120 MessageManager.getString(
1121 "label.default_minimum_colour_annotation_shading"),
1122 mincolourLabel, minColour);
1123 GPreferences.addtoLayout(annotationShding,
1124 MessageManager.getString(
1125 "label.default_maximum_colour_annotation_shading"),
1126 maxcolourLabel, maxColour);
1127 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1132 * Initialises the Overview tabbed panel.
1136 private JPanel initOverviewTab()
1138 JPanel overviewPanel = new JPanel();
1139 overviewPanel.setBorder(new TitledBorder(
1140 MessageManager.getString("label.overview_settings")));
1142 gapColour.setFont(LABEL_FONT);
1143 // fixing the border colours stops apparent colour bleed from the panel
1144 gapColour.setBorder(
1145 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1146 gapColour.setPreferredSize(new Dimension(40, 20));
1147 gapColour.addMouseListener(new MouseAdapter()
1150 public void mousePressed(MouseEvent e)
1152 gapColour_actionPerformed(gapColour);
1156 hiddenColour.setFont(LABEL_FONT);
1157 // fixing the border colours stops apparent colour bleed from the panel
1158 hiddenColour.setBorder(
1159 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1160 hiddenColour.setPreferredSize(new Dimension(40, 20));
1161 hiddenColour.addMouseListener(new MouseAdapter()
1164 public void mousePressed(MouseEvent e)
1166 hiddenColour_actionPerformed(hiddenColour);
1170 useLegacyGap = new JCheckBox(
1171 MessageManager.getString("label.ov_legacy_gap"));
1172 useLegacyGap.setFont(LABEL_FONT);
1173 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1174 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1175 gapLabel = new JLabel(
1176 MessageManager.getString("label.gap_colour"));
1177 gapLabel.setFont(LABEL_FONT);
1178 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1179 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1180 showHiddenAtStart = new JCheckBox(
1181 MessageManager.getString("label.ov_show_hide_default"));
1182 showHiddenAtStart.setFont(LABEL_FONT);
1183 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1184 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1185 JLabel hiddenLabel = new JLabel(
1186 MessageManager.getString("label.hidden_colour"));
1187 hiddenLabel.setFont(LABEL_FONT);
1188 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1189 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1191 useLegacyGap.addActionListener(new ActionListener()
1194 public void actionPerformed(ActionEvent e)
1196 useLegacyGaps_actionPerformed(e);
1200 overviewPanel.setLayout(new GridBagLayout());
1201 GridBagConstraints c1 = new GridBagConstraints();
1203 c1.fill = GridBagConstraints.HORIZONTAL;
1208 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1209 overviewPanel.add(useLegacyGap, c1);
1211 GridBagConstraints c2 = new GridBagConstraints();
1212 c2.fill = GridBagConstraints.HORIZONTAL;
1215 c2.insets = new Insets(0, 15, 0, 10);
1216 overviewPanel.add(gapLabel, c2);
1218 GridBagConstraints c3 = new GridBagConstraints();
1219 c3.fill = GridBagConstraints.HORIZONTAL;
1222 c3.insets = new Insets(0, 0, 0, 15);
1223 overviewPanel.add(gapColour, c3);
1225 GridBagConstraints c4 = new GridBagConstraints();
1226 c4.fill = GridBagConstraints.HORIZONTAL;
1230 overviewPanel.add(showHiddenAtStart, c4);
1232 GridBagConstraints c5 = new GridBagConstraints();
1233 c5.fill = GridBagConstraints.HORIZONTAL;
1236 c5.insets = new Insets(0, 15, 0, 10);
1237 overviewPanel.add(hiddenLabel, c5);
1239 GridBagConstraints c6 = new GridBagConstraints();
1240 c6.fill = GridBagConstraints.HORIZONTAL;
1243 c6.insets = new Insets(0, 0, 0, 15);
1244 overviewPanel.add(hiddenColour, c6);
1246 JButton resetButton = new JButton(
1247 MessageManager.getString("label.reset_to_defaults"));
1249 resetButton.addActionListener(new ActionListener()
1252 public void actionPerformed(ActionEvent e)
1254 resetOvDefaults_actionPerformed(e);
1258 GridBagConstraints c7 = new GridBagConstraints();
1259 c7.fill = GridBagConstraints.NONE;
1262 c7.insets = new Insets(10, 0, 0, 0);
1263 c7.anchor = GridBagConstraints.WEST;
1264 overviewPanel.add(resetButton, c7);
1266 // Add padding so the panel doesn't look ridiculous
1267 JPanel spacePanel = new JPanel();
1268 overviewPanel.add(spacePanel,
1269 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1270 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1271 new Insets(0, 0, 0, 5), 0, 0));
1273 return overviewPanel;
1277 * Initialises the Structure tabbed panel.
1281 private JPanel initStructureTab()
1283 structureTab = new JPanel();
1285 structureTab.setBorder(new TitledBorder(
1286 MessageManager.getString("label.structure_options")));
1287 structureTab.setLayout(null);
1288 final int width = 400;
1289 final int height = 22;
1290 final int lineSpacing = 25;
1293 structFromPdb.setFont(LABEL_FONT);
1295 .setText(MessageManager.getString("label.struct_from_pdb"));
1296 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1297 structFromPdb.addActionListener(new ActionListener()
1300 public void actionPerformed(ActionEvent e)
1302 boolean selected = structFromPdb.isSelected();
1303 // enable other options only when the first is checked
1304 useRnaView.setEnabled(selected);
1305 addSecondaryStructure.setEnabled(selected);
1306 addTempFactor.setEnabled(selected);
1309 structureTab.add(structFromPdb);
1311 // indent checkboxes that are conditional on the first one
1312 ypos += lineSpacing;
1313 useRnaView.setFont(LABEL_FONT);
1314 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1315 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1316 structureTab.add(useRnaView);
1318 ypos += lineSpacing;
1319 addSecondaryStructure.setFont(LABEL_FONT);
1320 addSecondaryStructure
1321 .setText(MessageManager.getString("label.autoadd_secstr"));
1322 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1323 structureTab.add(addSecondaryStructure);
1325 ypos += lineSpacing;
1326 addTempFactor.setFont(LABEL_FONT);
1327 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1328 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1329 structureTab.add(addTempFactor);
1331 ypos += lineSpacing;
1332 JLabel viewerLabel = new JLabel();
1333 viewerLabel.setFont(LABEL_FONT);
1334 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1335 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1336 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1337 structureTab.add(viewerLabel);
1339 structViewer.setFont(LABEL_FONT);
1340 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1341 structViewer.addItem(ViewerType.JMOL.name());
1342 structViewer.addItem(ViewerType.CHIMERA.name());
1343 structViewer.addActionListener(new ActionListener()
1346 public void actionPerformed(ActionEvent e)
1348 structureViewer_actionPerformed(
1349 (String) structViewer.getSelectedItem());
1352 structureTab.add(structViewer);
1354 ypos += lineSpacing;
1355 JLabel pathLabel = new JLabel();
1356 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1357 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1358 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1359 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1360 structureTab.add(pathLabel);
1362 chimeraPath.setFont(LABEL_FONT);
1363 chimeraPath.setText("");
1364 final String tooltip = JvSwingUtils.wrapTooltip(true,
1365 MessageManager.getString("label.chimera_path_tip"));
1366 chimeraPath.setToolTipText(tooltip);
1367 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1368 chimeraPath.addMouseListener(new MouseAdapter()
1371 public void mouseClicked(MouseEvent e)
1373 if (e.getClickCount() == 2)
1375 String chosen = openFileChooser(false);
1378 chimeraPath.setText(chosen);
1383 structureTab.add(chimeraPath);
1385 ypos += lineSpacing;
1386 nwMapping.setFont(LABEL_FONT);
1387 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1388 siftsMapping.setFont(LABEL_FONT);
1389 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1390 mappingMethod.add(nwMapping);
1391 mappingMethod.add(siftsMapping);
1392 JPanel mappingPanel = new JPanel();
1393 mappingPanel.setFont(LABEL_FONT);
1394 TitledBorder mmTitledBorder = new TitledBorder(
1395 MessageManager.getString("label.mapping_method"));
1396 mmTitledBorder.setTitleFont(LABEL_FONT);
1397 mappingPanel.setBorder(mmTitledBorder);
1398 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1399 // GridLayout mappingLayout = new GridLayout();
1400 mappingPanel.setLayout(new GridLayout());
1401 mappingPanel.add(nwMapping);
1402 mappingPanel.add(siftsMapping);
1403 structureTab.add(mappingPanel);
1405 ypos += lineSpacing;
1406 ypos += lineSpacing;
1407 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1408 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1409 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1410 structureTab.add(docFieldPref);
1412 return structureTab;
1416 * Action on choosing a structure viewer from combobox options.
1418 * @param selectedItem
1420 protected void structureViewer_actionPerformed(String selectedItem)
1425 * Show a dialog for the user to choose a file. Returns the chosen path, or
1430 protected String openFileChooser(boolean forFolder)
1432 String choice = null;
1433 JFileChooser chooser = new JFileChooser();
1436 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1439 // chooser.setFileView(new JalviewFileView());
1440 chooser.setDialogTitle(
1441 MessageManager.getString("label.open_local_file"));
1442 chooser.setToolTipText(MessageManager.getString("action.open"));
1444 int value = chooser.showOpenDialog(this);
1446 if (value == JFileChooser.APPROVE_OPTION)
1448 choice = chooser.getSelectedFile().getPath();
1453 protected boolean validateStructure()
1459 * Initialises the Visual tabbed panel.
1463 private JPanel initVisualTab()
1465 JPanel visualTab = new JPanel();
1466 visualTab.setBorder(new TitledBorder(
1467 MessageManager.getString("action.open_new_alignment")));
1468 visualTab.setLayout(null);
1469 fullScreen.setFont(LABEL_FONT);
1470 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1471 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1472 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1473 quality.setEnabled(false);
1474 quality.setFont(LABEL_FONT);
1475 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1476 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1477 quality.setSelected(true);
1478 quality.setText(MessageManager.getString("label.quality"));
1479 conservation.setEnabled(false);
1480 conservation.setFont(LABEL_FONT);
1481 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1482 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1483 conservation.setSelected(true);
1484 conservation.setText(MessageManager.getString("label.conservation"));
1485 identity.setEnabled(false);
1486 identity.setFont(LABEL_FONT);
1487 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1488 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1489 identity.setSelected(true);
1490 identity.setText(MessageManager.getString("label.consensus"));
1491 showOccupancy.setFont(LABEL_FONT);
1492 showOccupancy.setEnabled(false);
1493 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1494 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1495 showOccupancy.setSelected(true);
1496 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1498 JLabel showGroupbits = new JLabel();
1499 showGroupbits.setFont(LABEL_FONT);
1500 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1501 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1503 .setText(MessageManager.getString("action.show_group") + ":");
1504 JLabel showConsensbits = new JLabel();
1505 showConsensbits.setFont(LABEL_FONT);
1506 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1507 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1509 .setText(MessageManager.getString("label.consensus") + ":");
1510 showConsensHistogram.setEnabled(false);
1511 showConsensHistogram.setFont(LABEL_FONT);
1512 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1513 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1514 showConsensHistogram.setSelected(true);
1515 showConsensHistogram
1516 .setText(MessageManager.getString("label.histogram"));
1517 showConsensLogo.setEnabled(false);
1518 showConsensLogo.setFont(LABEL_FONT);
1519 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1520 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1521 showConsensLogo.setSelected(true);
1522 showConsensLogo.setText(MessageManager.getString("label.logo"));
1523 showGroupConsensus.setEnabled(false);
1524 showGroupConsensus.setFont(LABEL_FONT);
1525 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1526 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1527 showGroupConsensus.setSelected(true);
1528 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1529 showGroupConservation.setEnabled(false);
1530 showGroupConservation.setFont(LABEL_FONT);
1531 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1532 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1533 showGroupConservation.setSelected(true);
1534 showGroupConservation
1535 .setText(MessageManager.getString("label.conservation"));
1536 showNpTooltip.setEnabled(true);
1537 showNpTooltip.setFont(LABEL_FONT);
1538 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1539 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1540 showNpTooltip.setSelected(true);
1541 showNpTooltip.setText(
1542 MessageManager.getString("label.non_positional_features"));
1543 showDbRefTooltip.setEnabled(true);
1544 showDbRefTooltip.setFont(LABEL_FONT);
1545 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1546 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1547 showDbRefTooltip.setSelected(true);
1549 .setText(MessageManager.getString("label.database_references"));
1550 annotations.setFont(LABEL_FONT);
1551 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1552 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1553 annotations.setSelected(true);
1554 annotations.setText(MessageManager.getString("label.show_annotations"));
1555 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1556 annotations.addActionListener(new ActionListener()
1559 public void actionPerformed(ActionEvent e)
1561 annotations_actionPerformed(e);
1564 identity.addActionListener(new ActionListener()
1567 public void actionPerformed(ActionEvent e)
1569 annotations_actionPerformed(e);
1572 showGroupConsensus.addActionListener(new ActionListener()
1575 public void actionPerformed(ActionEvent e)
1577 annotations_actionPerformed(e);
1580 showUnconserved.setFont(LABEL_FONT);
1581 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1582 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1583 showUnconserved.setSelected(true);
1585 .setText(MessageManager.getString("action.show_unconserved"));
1586 showUnconserved.addActionListener(new ActionListener()
1589 public void actionPerformed(ActionEvent e)
1591 showunconserved_actionPerformed(e);
1595 // TODO these are not yet added to / action from Preferences
1596 // JCheckBox shareSelections = new JCheckBox();
1597 // shareSelections.setFont(verdana11);
1598 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1599 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1600 // shareSelections.setSelected(true);
1601 // shareSelections.setText(MessageManager
1602 // .getString("label.share_selection_across_views"));
1603 // JCheckBox followHighlight = new JCheckBox();
1604 // followHighlight.setFont(verdana11);
1605 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1606 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1607 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1608 // followHighlight.setSelected(true);
1609 // followHighlight.setText(MessageManager
1610 // .getString("label.scroll_highlighted_regions"));
1612 seqLimit.setFont(LABEL_FONT);
1613 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1614 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1615 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1616 smoothFont.setFont(LABEL_FONT);
1617 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1618 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1619 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1620 scaleProteinToCdna.setFont(LABEL_FONT);
1621 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1622 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1623 scaleProteinToCdna.setText(
1624 MessageManager.getString("label.scale_protein_to_cdna"));
1625 scaleProteinToCdna.setToolTipText(
1626 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1627 JLabel gapLabel = new JLabel();
1628 gapLabel.setFont(LABEL_FONT);
1629 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1630 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1631 JLabel fontLabel = new JLabel();
1632 fontLabel.setFont(LABEL_FONT);
1633 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1634 fontLabel.setText(MessageManager.getString("label.font"));
1635 fontSizeCB.setFont(LABEL_FONT);
1636 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1637 fontStyleCB.setFont(LABEL_FONT);
1638 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1639 fontNameCB.setFont(LABEL_FONT);
1640 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1641 gapSymbolCB.setFont(LABEL_FONT);
1642 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1643 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1644 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1645 gapSymbolCB.setRenderer(dlcr);
1647 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1648 startupCheckbox.setFont(LABEL_FONT);
1649 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1650 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1651 startupCheckbox.setSelected(true);
1652 startupFileTextfield.setFont(LABEL_FONT);
1653 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1654 final String tooltip = JvSwingUtils.wrapTooltip(true,
1655 MessageManager.getString("label.double_click_to_browse"));
1656 startupFileTextfield.setToolTipText(tooltip);
1657 startupFileTextfield.addMouseListener(new MouseAdapter()
1660 public void mouseClicked(MouseEvent e)
1662 if (e.getClickCount() > 1)
1664 startupFileTextfield_mouseClicked();
1669 sortby.setFont(LABEL_FONT);
1670 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1671 JLabel sortLabel = new JLabel();
1672 sortLabel.setFont(LABEL_FONT);
1673 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1674 sortLabel.setText(MessageManager.getString("label.sort_by"));
1675 sortAnnBy.setFont(LABEL_FONT);
1676 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1677 JLabel sortAnnLabel = new JLabel();
1678 sortAnnLabel.setFont(LABEL_FONT);
1679 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1680 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1681 sortAutocalc.setFont(LABEL_FONT);
1682 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1684 JPanel annsettingsPanel = new JPanel();
1685 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1686 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1687 annsettingsPanel.setBorder(new EtchedBorder());
1688 visualTab.add(annsettingsPanel);
1689 Border jb = new EmptyBorder(1, 1, 4, 5);
1690 annotations.setBorder(jb);
1691 showOccupancy.setBorder(jb);
1692 quality.setBorder(jb);
1693 conservation.setBorder(jb);
1694 identity.setBorder(jb);
1695 showConsensbits.setBorder(jb);
1696 showGroupbits.setBorder(jb);
1697 showGroupConsensus.setBorder(jb);
1698 showGroupConservation.setBorder(jb);
1699 showConsensHistogram.setBorder(jb);
1700 showConsensLogo.setBorder(jb);
1702 JPanel autoAnnotSettings = new JPanel();
1703 annsettingsPanel.add(autoAnnotSettings);
1704 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1705 autoAnnotSettings.add(annotations);
1706 autoAnnotSettings.add(quality);
1707 // second row of autoannotation box
1708 autoAnnotSettings = new JPanel();
1709 annsettingsPanel.add(autoAnnotSettings);
1711 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1712 autoAnnotSettings.add(conservation);
1713 autoAnnotSettings.add(identity);
1714 autoAnnotSettings.add(showOccupancy);
1715 autoAnnotSettings.add(showGroupbits);
1716 autoAnnotSettings.add(showGroupConservation);
1717 autoAnnotSettings.add(showGroupConsensus);
1718 autoAnnotSettings.add(showConsensbits);
1719 autoAnnotSettings.add(showConsensHistogram);
1720 autoAnnotSettings.add(showConsensLogo);
1722 JPanel tooltipSettings = new JPanel();
1723 tooltipSettings.setBorder(new TitledBorder(
1724 MessageManager.getString("label.sequence_id_tooltip")));
1725 tooltipSettings.setBounds(173, 140, 220, 62);
1726 tooltipSettings.setLayout(new GridLayout(2, 1));
1727 tooltipSettings.add(showDbRefTooltip);
1728 tooltipSettings.add(showNpTooltip);
1729 visualTab.add(tooltipSettings);
1731 wrap.setFont(LABEL_FONT);
1732 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1733 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1734 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1735 rightAlign.setFont(LABEL_FONT);
1736 rightAlign.setForeground(Color.black);
1737 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1738 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1739 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1740 idItalics.setFont(LABEL_FONT_ITALIC);
1741 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1742 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1744 MessageManager.getString("label.sequence_name_italics"));
1745 openoverv.setFont(LABEL_FONT);
1746 openoverv.setActionCommand(
1747 MessageManager.getString("label.open_overview"));
1748 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1749 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1750 openoverv.setText(MessageManager.getString("label.open_overview"));
1751 JPanel jPanel2 = new JPanel();
1752 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1753 jPanel2.setLayout(new GridLayout(14, 1));
1754 jPanel2.add(fullScreen);
1755 jPanel2.add(openoverv);
1756 jPanel2.add(seqLimit);
1757 jPanel2.add(rightAlign);
1758 jPanel2.add(fontLabel);
1759 jPanel2.add(showUnconserved);
1760 jPanel2.add(idItalics);
1761 jPanel2.add(smoothFont);
1762 jPanel2.add(scaleProteinToCdna);
1763 jPanel2.add(gapLabel);
1765 jPanel2.add(sortLabel);
1766 jPanel2.add(sortAnnLabel);
1767 jPanel2.add(startupCheckbox);
1768 visualTab.add(jPanel2);
1769 visualTab.add(startupFileTextfield);
1770 visualTab.add(sortby);
1771 visualTab.add(sortAnnBy);
1772 visualTab.add(sortAutocalc);
1773 visualTab.add(gapSymbolCB);
1774 visualTab.add(fontNameCB);
1775 visualTab.add(fontSizeCB);
1776 visualTab.add(fontStyleCB);
1780 protected void autoIdWidth_actionPerformed()
1782 // TODO Auto-generated method stub
1786 protected void userIdWidth_actionPerformed()
1788 // TODO Auto-generated method stub
1792 protected void maxColour_actionPerformed(JPanel panel)
1796 protected void minColour_actionPerformed(JPanel panel)
1800 protected void gapColour_actionPerformed(JPanel panel)
1804 protected void hiddenColour_actionPerformed(JPanel panel)
1808 protected void showunconserved_actionPerformed(ActionEvent e)
1810 // TODO Auto-generated method stub
1814 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1818 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1828 public void ok_actionPerformed(ActionEvent e)
1838 public void cancel_actionPerformed(ActionEvent e)
1848 public void annotations_actionPerformed(ActionEvent e)
1855 public void startupFileTextfield_mouseClicked()
1859 public void newLink_actionPerformed(ActionEvent e)
1864 public void editLink_actionPerformed(ActionEvent e)
1869 public void deleteLink_actionPerformed(ActionEvent e)
1874 public void defaultBrowser_mouseClicked(MouseEvent e)
1879 public void linkURLList_keyTyped(KeyEvent e)
1884 public void useProxy_actionPerformed()
1886 boolean enabled = useProxy.isSelected();
1887 portLabel.setEnabled(enabled);
1888 serverLabel.setEnabled(enabled);
1889 proxyServerTB.setEnabled(enabled);
1890 proxyPortTB.setEnabled(enabled);
1894 * Customer renderer for JTable: supports column of radio buttons
1896 public class RadioButtonRenderer extends JRadioButton
1897 implements TableCellRenderer
1899 public RadioButtonRenderer()
1901 setHorizontalAlignment(CENTER);
1902 setToolTipText(MessageManager.getString("label.urltooltip"));
1906 public Component getTableCellRendererComponent(JTable table,
1907 Object value, boolean isSelected, boolean hasFocus, int row,
1910 setSelected((boolean) value);
1912 // set colours to match rest of table
1915 setBackground(table.getSelectionBackground());
1916 setForeground(table.getSelectionForeground());
1920 setBackground(table.getBackground());
1921 setForeground(table.getForeground());
1928 * Customer cell editor for JTable: supports column of radio buttons in
1929 * conjunction with renderer
1931 public class RadioButtonEditor extends AbstractCellEditor
1932 implements TableCellEditor
1934 private JRadioButton button = new JRadioButton();
1936 public RadioButtonEditor()
1938 button.setHorizontalAlignment(SwingConstants.CENTER);
1939 this.button.addActionListener(new ActionListener()
1942 public void actionPerformed(ActionEvent e)
1944 fireEditingStopped();
1950 public Component getTableCellEditorComponent(JTable table, Object value,
1951 boolean isSelected, int row, int column)
1953 button.setSelected((boolean) value);
1958 public Object getCellEditorValue()
1960 return button.isSelected();
1965 protected void validateHmmerPath()
1969 protected void validateCygwinPath()
1974 * A helper method to add a panel containing a label and a component to a
1982 protected static void addtoLayout(JPanel panel, String tooltip,
1983 JComponent label, JComponent valBox)
1985 JPanel laypanel = new JPanel(new GridLayout(1, 2));
1986 JPanel labPanel = new JPanel(new BorderLayout());
1987 JPanel valPanel = new JPanel();
1988 labPanel.setBounds(new Rectangle(7, 7, 158, 23));
1989 valPanel.setBounds(new Rectangle(172, 7, 270, 23));
1990 labPanel.add(label, BorderLayout.WEST);
1991 valPanel.add(valBox);
1992 laypanel.add(labPanel);
1993 laypanel.add(valPanel);
1994 valPanel.setToolTipText(tooltip);
1995 labPanel.setToolTipText(tooltip);
1996 valBox.setToolTipText(tooltip);
1997 panel.add(laypanel);