2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.fts.core.FTSDataColumnPreferences;
24 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
25 import jalview.fts.service.pdb.PDBFTSRestClient;
26 import jalview.gui.JvSwingUtils;
27 import jalview.gui.StructureViewer.ViewerType;
28 import jalview.util.MessageManager;
30 import java.awt.BorderLayout;
31 import java.awt.Color;
32 import java.awt.Component;
33 import java.awt.Dimension;
34 import java.awt.FlowLayout;
36 import java.awt.GridBagConstraints;
37 import java.awt.GridBagLayout;
38 import java.awt.GridLayout;
39 import java.awt.Insets;
40 import java.awt.Rectangle;
41 import java.awt.event.ActionEvent;
42 import java.awt.event.ActionListener;
43 import java.awt.event.FocusEvent;
44 import java.awt.event.KeyEvent;
45 import java.awt.event.MouseAdapter;
46 import java.awt.event.MouseEvent;
48 import javax.swing.AbstractButton;
49 import javax.swing.AbstractCellEditor;
50 import javax.swing.BorderFactory;
51 import javax.swing.ButtonGroup;
52 import javax.swing.DefaultListCellRenderer;
53 import javax.swing.JButton;
54 import javax.swing.JCheckBox;
55 import javax.swing.JComboBox;
56 import javax.swing.JFileChooser;
57 import javax.swing.JLabel;
58 import javax.swing.JPanel;
59 import javax.swing.JRadioButton;
60 import javax.swing.JScrollPane;
61 import javax.swing.JTabbedPane;
62 import javax.swing.JTable;
63 import javax.swing.JTextField;
64 import javax.swing.ListSelectionModel;
65 import javax.swing.SwingConstants;
66 import javax.swing.border.Border;
67 import javax.swing.border.EmptyBorder;
68 import javax.swing.border.EtchedBorder;
69 import javax.swing.border.TitledBorder;
70 import javax.swing.event.ChangeEvent;
71 import javax.swing.event.ChangeListener;
72 import javax.swing.table.TableCellEditor;
73 import javax.swing.table.TableCellRenderer;
76 * Base class for the Preferences panel.
81 public class GPreferences extends JPanel
83 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
85 private static final Font LABEL_FONT_ITALIC = JvSwingUtils.getLabelFont(
89 * Visual tab components
91 protected JCheckBox fullScreen = new JCheckBox();
93 protected JCheckBox openoverv = new JCheckBox();
95 protected JCheckBox seqLimit = new JCheckBox();
97 protected JCheckBox rightAlign = new JCheckBox();
99 protected JComboBox<String> fontSizeCB = new JComboBox<>();
101 protected JComboBox<String> fontStyleCB = new JComboBox<>();
103 protected JComboBox<String> fontNameCB = new JComboBox<>();
105 protected JCheckBox showOccupancy = new JCheckBox();
107 protected JCheckBox showUnconserved = new JCheckBox();
109 protected JCheckBox idItalics = new JCheckBox();
111 protected JCheckBox smoothFont = new JCheckBox();
113 protected JCheckBox scaleProteinToCdna = new JCheckBox();
115 protected JComboBox<String> gapSymbolCB = new JComboBox<>();
117 protected JCheckBox wrap = new JCheckBox();
119 protected JComboBox<String> sortby = new JComboBox<>();
121 protected JComboBox<String> sortAnnBy = new JComboBox<>();
123 protected JComboBox<String> sortAutocalc = new JComboBox<>();
125 protected JCheckBox startupCheckbox = new JCheckBox();
127 protected JTextField startupFileTextfield = new JTextField();
129 // below are in the 'second column'
130 protected JCheckBox annotations = new JCheckBox();
132 protected JCheckBox quality = new JCheckBox();
134 protected JCheckBox conservation = new JCheckBox();
136 protected JCheckBox identity = new JCheckBox();
138 protected JCheckBox showGroupConsensus = new JCheckBox();
140 protected JCheckBox showGroupConservation = new JCheckBox();
142 protected JCheckBox showConsensHistogram = new JCheckBox();
144 protected JCheckBox showConsensLogo = new JCheckBox();
146 protected JCheckBox showInformationHistogram = new JCheckBox();
148 protected JCheckBox showHMMLogo = new JCheckBox();
150 protected JCheckBox showDbRefTooltip = new JCheckBox();
152 protected JCheckBox showNpTooltip = new JCheckBox();
156 * Structure tab and components
158 protected JPanel structureTab;
160 protected JCheckBox structFromPdb = new JCheckBox();
162 protected JCheckBox useRnaView = new JCheckBox();
164 protected JCheckBox addSecondaryStructure = new JCheckBox();
166 protected JCheckBox addTempFactor = new JCheckBox();
168 protected JComboBox<String> structViewer = new JComboBox<>();
170 protected JTextField chimeraPath = new JTextField();
172 protected ButtonGroup mappingMethod = new ButtonGroup();
174 protected JRadioButton siftsMapping = new JRadioButton();
176 protected JRadioButton nwMapping = new JRadioButton();
179 * Colours tab components
181 protected JPanel minColour = new JPanel();
183 protected JPanel maxColour = new JPanel();
185 protected JComboBox<String> protColour = new JComboBox<>();
187 protected JComboBox<String> nucColour = new JComboBox<>();
190 * Connections tab components
192 protected JTable linkUrlTable = new JTable();
194 protected JButton editLink = new JButton();
196 protected JButton deleteLink = new JButton();
198 protected JTextField filterTB = new JTextField();
200 protected JButton doReset = new JButton();
202 protected JButton userOnly = new JButton();
204 protected JLabel portLabel = new JLabel();
206 protected JLabel serverLabel = new JLabel();
208 protected JTextField proxyServerTB = new JTextField();
210 protected JTextField proxyPortTB = new JTextField();
212 protected JTextField defaultBrowser = new JTextField();
214 protected JCheckBox useProxy = new JCheckBox();
216 protected JCheckBox usagestats = new JCheckBox();
218 protected JCheckBox questionnaire = new JCheckBox();
220 protected JCheckBox versioncheck = new JCheckBox();
223 * Output tab components
225 protected JComboBox<Object> epsRendering = new JComboBox<>();
227 protected JLabel userIdWidthlabel = new JLabel();
229 protected JCheckBox autoIdWidth = new JCheckBox();
231 protected JTextField userIdWidth = new JTextField();
233 protected JCheckBox blcjv = new JCheckBox();
235 protected JCheckBox pileupjv = new JCheckBox();
237 protected JCheckBox clustaljv = new JCheckBox();
239 protected JCheckBox msfjv = new JCheckBox();
241 protected JCheckBox fastajv = new JCheckBox();
243 protected JCheckBox pfamjv = new JCheckBox();
245 protected JCheckBox pirjv = new JCheckBox();
247 protected JCheckBox modellerOutput = new JCheckBox();
249 protected JCheckBox embbedBioJSON = new JCheckBox();
252 * Editing tab components
254 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
256 protected JCheckBox padGaps = new JCheckBox();
258 protected JCheckBox sortByTree = new JCheckBox();
261 * hmmer tab and components
263 protected JPanel hmmerTab = new JPanel();
265 protected JCheckBox trimTermini = new JCheckBox();
267 protected ButtonGroup backgroundFreqSource = new ButtonGroup();
269 protected AbstractButton uniprot = new JCheckBox();
271 protected AbstractButton alignment = new JCheckBox();
273 protected JLabel sequencesToKeep = new JLabel();
275 protected JTextField numberOfSequencesToKeepField = new JTextField();
277 protected JLabel installationLocation = new JLabel();
279 protected JTextField installationLocationField = new JTextField();
281 protected JLabel hmmsearch = new JLabel();
283 protected JLabel hmmalign = new JLabel();
288 protected JPanel dasTab = new JPanel();
293 protected JPanel wsTab = new JPanel();
298 * Creates a new GPreferences object.
300 public GPreferences()
305 } catch (Exception ex)
307 ex.printStackTrace();
312 * Construct the panel and its tabbed sub-panels.
316 private void jbInit() throws Exception
318 final JTabbedPane tabbedPane = new JTabbedPane();
319 this.setLayout(new BorderLayout());
320 JPanel okCancelPanel = initOkCancelPanel();
321 this.add(tabbedPane, BorderLayout.CENTER);
322 this.add(okCancelPanel, BorderLayout.SOUTH);
324 tabbedPane.add(initVisualTab(),
325 MessageManager.getString("label.visual"));
327 tabbedPane.add(initColoursTab(),
328 MessageManager.getString("label.colours"));
330 tabbedPane.add(initStructureTab(),
331 MessageManager.getString("label.structure"));
333 tabbedPane.add(initConnectionsTab(),
334 MessageManager.getString("label.connections"));
336 tabbedPane.add(initLinksTab(),
337 MessageManager.getString("label.urllinks"));
339 tabbedPane.add(initOutputTab(),
340 MessageManager.getString("label.output"));
342 tabbedPane.add(initEditingTab(),
343 MessageManager.getString("label.editing"));
345 tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
348 * See DasSourceBrowser for the real work of configuring this tab.
350 dasTab.setLayout(new BorderLayout());
351 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
354 * See WsPreferences for the real work of configuring this tab.
356 wsTab.setLayout(new BorderLayout());
357 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
360 * Handler to validate a tab before leaving it - currently only for
363 tabbedPane.addChangeListener(new ChangeListener()
365 private Component lastTab;
368 public void stateChanged(ChangeEvent e)
370 if (lastTab == structureTab
371 && tabbedPane.getSelectedComponent() != structureTab)
373 if (!validateStructure())
375 tabbedPane.setSelectedComponent(structureTab);
379 lastTab = tabbedPane.getSelectedComponent();
386 * Initialises the Editing tabbed panel.
390 private JPanel initEditingTab()
392 JPanel editingTab = new JPanel();
393 editingTab.setLayout(null);
394 autoCalculateConsCheck.setFont(LABEL_FONT);
395 autoCalculateConsCheck.setText(MessageManager
396 .getString("label.autocalculate_consensus"));
397 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
398 padGaps.setFont(LABEL_FONT);
399 padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
400 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
401 sortByTree.setFont(LABEL_FONT);
403 .setText(MessageManager.getString("label.sort_with_new_tree"));
405 .setToolTipText(MessageManager
406 .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
407 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
408 editingTab.add(autoCalculateConsCheck);
409 editingTab.add(padGaps);
410 editingTab.add(sortByTree);
415 * Initialises the hmmer tabbed panel.
419 private JPanel initHMMERTab()
421 JPanel hmmerTab = new JPanel();
422 hmmerTab.setLayout(null);
424 hmmalign.setFont(LABEL_FONT);
425 hmmalign.setText(MessageManager.getString("label.hmmalign_label"));
426 hmmalign.setBounds(new Rectangle(22, 10, 200, 23));
428 trimTermini.setFont(LABEL_FONT);
429 trimTermini.setText(MessageManager.getString("label.trim_termini"));
430 trimTermini.setBounds(new Rectangle(22, 30, 200, 23));
432 hmmsearch.setFont(LABEL_FONT);
433 hmmsearch.setText(MessageManager.getString("label.hmmsearch_label"));
434 hmmsearch.setBounds(new Rectangle(250, 10, 200, 23));
436 sequencesToKeep.setFont(LABEL_FONT);
438 .setText(MessageManager.getString("label.no_of_sequences"));
439 sequencesToKeep.setBounds(new Rectangle(250, 30, 125, 23));
440 numberOfSequencesToKeepField.setBounds(new Rectangle(375, 30, 40, 23));
442 installationLocation.setFont(LABEL_FONT);
443 installationLocation.setText(
444 MessageManager.getString("label.change_hmmer_location"));
445 installationLocation.setBounds(new Rectangle(22, 200, 200, 23));
446 installationLocationField.setBounds(new Rectangle(22, 220, 200, 23));
447 installationLocationField.addMouseListener(new MouseAdapter()
450 public void mouseClicked(MouseEvent e)
452 if (e.getClickCount() == 2)
454 String chosen = openFileChooser();
457 installationLocationField.setText(chosen);
463 backgroundFreqSource.add(uniprot);
464 backgroundFreqSource.add(alignment);
465 backgroundFreqSource.setSelected(uniprot.getModel(), true);
467 uniprot.setText(MessageManager.getString("label.freq_uniprot"));
468 uniprot.setFont(LABEL_FONT);
469 uniprot.setBounds(new Rectangle(22, 260, 255, 23));
471 alignment.setText(MessageManager.getString("label.freq_alignment"));
472 alignment.setFont(LABEL_FONT);
473 alignment.setBounds(new Rectangle(22, 280, 255, 23));
475 hmmerTab.add(uniprot);
476 hmmerTab.add(alignment);
477 hmmerTab.add(hmmalign);
478 hmmerTab.add(hmmsearch);
479 hmmerTab.add(installationLocation);
480 hmmerTab.add(installationLocationField);
481 hmmerTab.add(trimTermini);
482 hmmerTab.add(sequencesToKeep);
483 hmmerTab.add(sequencesToKeep);
484 hmmerTab.add(numberOfSequencesToKeepField);
489 * Initialises the Output tabbed panel.
493 private JPanel initOutputTab()
495 JPanel outputTab = new JPanel();
496 outputTab.setLayout(null);
497 JLabel epsLabel = new JLabel();
498 epsLabel.setFont(LABEL_FONT);
499 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
500 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
501 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
502 epsRendering.setFont(LABEL_FONT);
503 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
504 JLabel jLabel1 = new JLabel();
505 jLabel1.setFont(LABEL_FONT);
506 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
507 jLabel1.setText(MessageManager.getString("label.append_start_end"));
508 jLabel1.setFont(LABEL_FONT);
509 fastajv.setFont(LABEL_FONT);
510 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
511 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
512 blcjv.setText(MessageManager.getString("label.blc") + " ");
513 fastajv.setText(MessageManager.getString("label.fasta") + " ");
514 msfjv.setText(MessageManager.getString("label.msf") + " ");
515 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
516 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
517 msfjv.setFont(LABEL_FONT);
518 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
519 pirjv.setText(MessageManager.getString("label.pir") + " ");
520 JPanel jPanel11 = new JPanel();
521 jPanel11.setFont(LABEL_FONT);
522 TitledBorder titledBorder2 = new TitledBorder(
523 MessageManager.getString("label.file_output"));
524 jPanel11.setBorder(titledBorder2);
525 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
526 GridLayout gridLayout3 = new GridLayout();
527 jPanel11.setLayout(gridLayout3);
528 gridLayout3.setRows(8);
529 blcjv.setFont(LABEL_FONT);
530 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
531 clustaljv.setFont(LABEL_FONT);
532 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
533 pfamjv.setFont(LABEL_FONT);
534 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
535 pileupjv.setFont(LABEL_FONT);
536 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
537 pirjv.setFont(LABEL_FONT);
538 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
539 autoIdWidth.setFont(LABEL_FONT);
540 autoIdWidth.setText(MessageManager
541 .getString("label.automatically_set_id_width"));
542 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true,
544 .getString("label.adjusts_width_generated_eps_png")));
545 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
546 autoIdWidth.addActionListener(new ActionListener()
550 public void actionPerformed(ActionEvent e)
552 autoIdWidth_actionPerformed();
555 userIdWidthlabel.setFont(LABEL_FONT);
556 userIdWidthlabel.setText(MessageManager
557 .getString("label.figure_id_column_width"));
559 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
560 .getString("label.manually_specify_width_left_column")));
562 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
563 .getString("label.manually_specify_width_left_column")));
564 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
565 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
566 userIdWidth.setText("");
567 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
568 userIdWidth.addActionListener(new ActionListener()
572 public void actionPerformed(ActionEvent e)
574 userIdWidth_actionPerformed();
577 modellerOutput.setFont(LABEL_FONT);
578 modellerOutput.setText(MessageManager
579 .getString("label.use_modeller_output"));
580 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
581 embbedBioJSON.setFont(LABEL_FONT);
582 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
583 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
585 jPanel11.add(jLabel1);
587 jPanel11.add(clustaljv);
588 jPanel11.add(fastajv);
590 jPanel11.add(pfamjv);
591 jPanel11.add(pileupjv);
593 outputTab.add(autoIdWidth);
594 outputTab.add(userIdWidth);
595 outputTab.add(userIdWidthlabel);
596 outputTab.add(modellerOutput);
597 outputTab.add(embbedBioJSON);
598 outputTab.add(epsLabel);
599 outputTab.add(epsRendering);
600 outputTab.add(jPanel11);
605 * Initialises the Connections tabbed panel.
609 private JPanel initConnectionsTab()
611 JPanel connectTab = new JPanel();
612 connectTab.setLayout(new GridBagLayout());
614 // Label for browser text box
615 JLabel browserLabel = new JLabel();
616 browserLabel.setFont(LABEL_FONT);
617 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
618 browserLabel.setText(MessageManager
619 .getString("label.default_browser_unix"));
620 defaultBrowser.setFont(LABEL_FONT);
621 defaultBrowser.setText("");
623 defaultBrowser.addMouseListener(new MouseAdapter()
626 public void mouseClicked(MouseEvent e)
628 if (e.getClickCount() > 1)
630 defaultBrowser_mouseClicked(e);
635 JPanel proxyPanel = initConnTabProxyPanel();
636 initConnTabCheckboxes();
638 // Add default Browser text box
639 connectTab.add(browserLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,
640 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
641 new Insets(10, 0, 5, 5), 5, 1));
642 defaultBrowser.setFont(LABEL_FONT);
643 defaultBrowser.setText("");
645 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
646 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
647 new Insets(10, 0, 5, 10), 30, 1));
649 // Add proxy server panel
650 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
651 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
652 new Insets(10, 0, 5, 12), 4, 10));
654 // Add usage stats, version check and questionnaire checkboxes
655 connectTab.add(usagestats, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
656 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
657 new Insets(0, 2, 5, 5), 70, 1));
658 connectTab.add(questionnaire, new GridBagConstraints(1, 2, 1, 1, 1.0,
659 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
660 new Insets(0, 2, 5, 10), 70, 1));
661 connectTab.add(versioncheck, new GridBagConstraints(0, 3, 1, 1, 1.0,
662 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
663 new Insets(0, 2, 5, 5), 70, 1));
665 // Add padding so the panel doesn't look ridiculous
666 JPanel spacePanel = new JPanel();
667 connectTab.add(spacePanel, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
668 GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0,
675 * Initialises the Links tabbed panel.
679 private JPanel initLinksTab()
681 JPanel linkTab = new JPanel();
682 linkTab.setLayout(new GridBagLayout());
684 // Set up table for Url links
685 linkUrlTable.setFillsViewportHeight(true);
686 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
687 linkUrlTable.setAutoCreateRowSorter(true);
688 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
690 // adjust row height so radio buttons actually fit
691 // don't do this in the renderer, it causes the awt thread to activate
693 JRadioButton temp = new JRadioButton();
694 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
696 // Table in scrollpane so that the table is given a scrollbar
697 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
698 linkScrollPane.setBorder(null);
700 // Panel for links functionality
701 JPanel linkPanel = new JPanel(new GridBagLayout());
702 linkPanel.setBorder(new TitledBorder(MessageManager
703 .getString("label.url_linkfrom_sequence_id")));
705 // Put the Url links panel together
707 // Buttons go at top right, resizing only resizes the blank space vertically
708 JPanel buttonPanel = initLinkTabUrlButtons();
709 GridBagConstraints linkConstraints1 = new GridBagConstraints();
710 linkConstraints1.insets = new Insets(0, 0, 5, 0);
711 linkConstraints1.gridx = 0;
712 linkConstraints1.gridy = 0;
713 linkConstraints1.weightx = 1.0;
714 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
715 linkTab.add(buttonPanel, linkConstraints1);
717 // Links table goes at top left, resizing resizes the table
718 GridBagConstraints linkConstraints2 = new GridBagConstraints();
719 linkConstraints2.insets = new Insets(0, 0, 5, 5);
720 linkConstraints2.gridx = 0;
721 linkConstraints2.gridy = 1;
722 linkConstraints2.weightx = 1.0;
723 linkConstraints2.weighty = 1.0;
724 linkConstraints2.fill = GridBagConstraints.BOTH;
725 linkTab.add(linkScrollPane, linkConstraints2);
727 // Filter box and buttons goes at bottom left, resizing resizes the text box
728 JPanel filterPanel = initLinkTabFilterPanel();
729 GridBagConstraints linkConstraints3 = new GridBagConstraints();
730 linkConstraints3.insets = new Insets(0, 0, 0, 5);
731 linkConstraints3.gridx = 0;
732 linkConstraints3.gridy = 2;
733 linkConstraints3.weightx = 1.0;
734 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
735 linkTab.add(filterPanel, linkConstraints3);
740 private JPanel initLinkTabFilterPanel()
742 // Filter textbox and reset button
743 JLabel filterLabel = new JLabel(
744 MessageManager.getString("label.filter"));
745 filterLabel.setFont(LABEL_FONT);
746 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
747 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
749 filterTB.setFont(LABEL_FONT);
750 filterTB.setText("");
752 doReset.setText(MessageManager.getString("action.showall"));
753 userOnly.setText(MessageManager.getString("action.customfilter"));
755 // Panel for filter functionality
756 JPanel filterPanel = new JPanel(new GridBagLayout());
757 filterPanel.setBorder(new TitledBorder("Filter"));
758 GridBagConstraints gbc = new GridBagConstraints();
761 gbc.fill = GridBagConstraints.NONE;
762 gbc.anchor = GridBagConstraints.WEST;
764 filterPanel.add(filterLabel, gbc);
766 GridBagConstraints gbc1 = new GridBagConstraints();
769 gbc1.fill = GridBagConstraints.HORIZONTAL;
770 gbc1.anchor = GridBagConstraints.WEST;
772 filterPanel.add(filterTB, gbc1);
774 GridBagConstraints gbc2 = new GridBagConstraints();
776 gbc2.fill = GridBagConstraints.NONE;
777 gbc2.anchor = GridBagConstraints.WEST;
778 filterPanel.add(doReset, gbc2);
780 GridBagConstraints gbc3 = new GridBagConstraints();
782 gbc3.fill = GridBagConstraints.NONE;
783 gbc3.anchor = GridBagConstraints.WEST;
784 filterPanel.add(userOnly, gbc3);
789 private JPanel initLinkTabUrlButtons()
791 // Buttons for new / edit / delete Url links
792 JButton newLink = new JButton();
793 newLink.setText(MessageManager.getString("action.new"));
795 editLink.setText(MessageManager.getString("action.edit"));
797 deleteLink.setText(MessageManager.getString("action.delete"));
799 // no current selection, so initially disable delete/edit buttons
800 editLink.setEnabled(false);
801 deleteLink.setEnabled(false);
803 newLink.addActionListener(new java.awt.event.ActionListener()
806 public void actionPerformed(ActionEvent e)
808 newLink_actionPerformed(e);
812 editLink.setText(MessageManager.getString("action.edit"));
813 editLink.addActionListener(new java.awt.event.ActionListener()
816 public void actionPerformed(ActionEvent e)
818 editLink_actionPerformed(e);
822 deleteLink.setText(MessageManager.getString("action.delete"));
823 deleteLink.addActionListener(new java.awt.event.ActionListener()
826 public void actionPerformed(ActionEvent e)
828 deleteLink_actionPerformed(e);
832 JPanel buttonPanel = new JPanel(new GridBagLayout());
833 buttonPanel.setBorder(new TitledBorder("Edit links"));
834 GridBagConstraints gbc = new GridBagConstraints();
837 gbc.fill = GridBagConstraints.NONE;
838 buttonPanel.add(newLink, gbc);
840 GridBagConstraints gbc1 = new GridBagConstraints();
843 gbc1.fill = GridBagConstraints.NONE;
844 buttonPanel.add(editLink, gbc1);
846 GridBagConstraints gbc2 = new GridBagConstraints();
849 gbc2.fill = GridBagConstraints.NONE;
850 buttonPanel.add(deleteLink, gbc2);
852 GridBagConstraints gbc3 = new GridBagConstraints();
855 gbc3.fill = GridBagConstraints.HORIZONTAL;
857 JPanel spacePanel = new JPanel();
858 spacePanel.setBorder(null);
859 buttonPanel.add(spacePanel, gbc3);
865 * Initialises the proxy server panel in the Connections tab
867 * @return the proxy server panel
869 private JPanel initConnTabProxyPanel()
871 // Label for server text box
872 serverLabel.setText(MessageManager.getString("label.address"));
873 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
874 serverLabel.setFont(LABEL_FONT);
876 // Proxy server and port text boxes
877 proxyServerTB.setFont(LABEL_FONT);
878 proxyPortTB.setFont(LABEL_FONT);
880 // Label for Port text box
881 portLabel.setFont(LABEL_FONT);
882 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
883 portLabel.setText(MessageManager.getString("label.port"));
885 // Use proxy server checkbox
886 useProxy.setFont(LABEL_FONT);
887 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
888 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
889 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
890 useProxy.addActionListener(new ActionListener()
893 public void actionPerformed(ActionEvent e)
895 useProxy_actionPerformed();
899 // Make proxy server panel
900 JPanel proxyPanel = new JPanel();
901 TitledBorder titledBorder1 = new TitledBorder(
902 MessageManager.getString("label.proxy_server"));
903 proxyPanel.setBorder(titledBorder1);
904 proxyPanel.setLayout(new GridBagLayout());
905 proxyPanel.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
906 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
907 new Insets(0, 2, 2, 0), 5, 0));
908 proxyPanel.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
909 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
911 proxyPanel.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
912 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
914 proxyPanel.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0,
915 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
916 new Insets(0, 2, 2, 2), 54, 1));
917 proxyPanel.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0,
918 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
919 new Insets(0, 2, 2, 0), 263, 1));
925 * Initialises the checkboxes in the Connections tab
927 private void initConnTabCheckboxes()
929 // Usage stats checkbox label
930 usagestats.setText(MessageManager
931 .getString("label.send_usage_statistics"));
932 usagestats.setFont(LABEL_FONT);
933 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
934 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
936 // Questionnaire checkbox label
937 questionnaire.setText(MessageManager
938 .getString("label.check_for_questionnaires"));
939 questionnaire.setFont(LABEL_FONT);
940 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
941 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
943 // Check for latest version checkbox label
944 versioncheck.setText(MessageManager
945 .getString("label.check_for_latest_version"));
946 versioncheck.setFont(LABEL_FONT);
947 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
948 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
952 * Initialises the parent panel which contains the tabbed sections.
956 private JPanel initOkCancelPanel()
958 JButton ok = new JButton();
959 ok.setText(MessageManager.getString("action.ok"));
960 ok.addActionListener(new ActionListener()
963 public void actionPerformed(ActionEvent e)
965 ok_actionPerformed(e);
968 JButton cancel = new JButton();
969 cancel.setText(MessageManager.getString("action.cancel"));
970 cancel.addActionListener(new ActionListener()
973 public void actionPerformed(ActionEvent e)
975 cancel_actionPerformed(e);
978 JPanel okCancelPanel = new JPanel();
979 okCancelPanel.add(ok);
980 okCancelPanel.add(cancel);
981 return okCancelPanel;
985 * Initialises the Colours tabbed panel.
989 private JPanel initColoursTab()
991 JPanel coloursTab = new JPanel();
992 coloursTab.setBorder(new TitledBorder(MessageManager
993 .getString("action.open_new_alignment")));
994 coloursTab.setLayout(new FlowLayout());
995 JLabel mincolourLabel = new JLabel();
996 mincolourLabel.setFont(LABEL_FONT);
997 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
998 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
999 minColour.setFont(LABEL_FONT);
1000 minColour.setBorder(BorderFactory.createEtchedBorder());
1001 minColour.setPreferredSize(new Dimension(40, 20));
1002 minColour.addMouseListener(new MouseAdapter()
1005 public void mousePressed(MouseEvent e)
1007 minColour_actionPerformed(minColour);
1010 JLabel maxcolourLabel = new JLabel();
1011 maxcolourLabel.setFont(LABEL_FONT);
1012 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1013 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1014 maxColour.setFont(LABEL_FONT);
1015 maxColour.setBorder(BorderFactory.createEtchedBorder());
1016 maxColour.setPreferredSize(new Dimension(40, 20));
1017 maxColour.addMouseListener(new MouseAdapter()
1020 public void mousePressed(MouseEvent e)
1022 maxColour_actionPerformed(maxColour);
1026 protColour.setFont(LABEL_FONT);
1027 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1028 JLabel protColourLabel = new JLabel();
1029 protColourLabel.setFont(LABEL_FONT);
1030 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1031 protColourLabel.setText(MessageManager
1032 .getString("label.prot_alignment_colour") + " ");
1033 JvSwingUtils.addtoLayout(coloursTab, MessageManager
1034 .getString("label.default_colour_scheme_for_alignment"),
1035 protColourLabel, protColour);
1037 nucColour.setFont(LABEL_FONT);
1038 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1039 JLabel nucColourLabel = new JLabel();
1040 nucColourLabel.setFont(LABEL_FONT);
1041 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1042 nucColourLabel.setText(MessageManager
1043 .getString("label.nuc_alignment_colour") + " ");
1044 JvSwingUtils.addtoLayout(coloursTab, MessageManager
1045 .getString("label.default_colour_scheme_for_alignment"),
1046 nucColourLabel, nucColour);
1048 JPanel annotationShding = new JPanel();
1049 annotationShding.setBorder(new TitledBorder(MessageManager
1050 .getString("label.annotation_shading_default")));
1051 annotationShding.setLayout(new GridLayout(1, 2));
1052 JvSwingUtils.addtoLayout(annotationShding, MessageManager
1053 .getString("label.default_minimum_colour_annotation_shading"),
1054 mincolourLabel, minColour);
1055 JvSwingUtils.addtoLayout(annotationShding, MessageManager
1056 .getString("label.default_maximum_colour_annotation_shading"),
1057 maxcolourLabel, maxColour);
1058 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1063 * Initialises the Structure tabbed panel.
1067 private JPanel initStructureTab()
1069 structureTab = new JPanel();
1071 structureTab.setBorder(new TitledBorder(MessageManager
1072 .getString("label.structure_options")));
1073 structureTab.setLayout(null);
1074 final int width = 400;
1075 final int height = 22;
1076 final int lineSpacing = 25;
1079 structFromPdb.setFont(LABEL_FONT);
1081 .setText(MessageManager.getString("label.struct_from_pdb"));
1082 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1083 structFromPdb.addActionListener(new ActionListener()
1086 public void actionPerformed(ActionEvent e)
1088 boolean selected = structFromPdb.isSelected();
1089 // enable other options only when the first is checked
1090 useRnaView.setEnabled(selected);
1091 addSecondaryStructure.setEnabled(selected);
1092 addTempFactor.setEnabled(selected);
1095 structureTab.add(structFromPdb);
1097 // indent checkboxes that are conditional on the first one
1098 ypos += lineSpacing;
1099 useRnaView.setFont(LABEL_FONT);
1100 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1101 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1102 structureTab.add(useRnaView);
1104 ypos += lineSpacing;
1105 addSecondaryStructure.setFont(LABEL_FONT);
1106 addSecondaryStructure.setText(MessageManager
1107 .getString("label.autoadd_secstr"));
1108 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1109 structureTab.add(addSecondaryStructure);
1111 ypos += lineSpacing;
1112 addTempFactor.setFont(LABEL_FONT);
1113 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1114 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1115 structureTab.add(addTempFactor);
1117 ypos += lineSpacing;
1118 JLabel viewerLabel = new JLabel();
1119 viewerLabel.setFont(LABEL_FONT);
1120 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1121 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1122 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1123 structureTab.add(viewerLabel);
1125 structViewer.setFont(LABEL_FONT);
1126 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1127 structViewer.addItem(ViewerType.JMOL.name());
1128 structViewer.addItem(ViewerType.CHIMERA.name());
1129 structViewer.addActionListener(new ActionListener()
1132 public void actionPerformed(ActionEvent e)
1134 structureViewer_actionPerformed((String) structViewer
1135 .getSelectedItem());
1138 structureTab.add(structViewer);
1140 ypos += lineSpacing;
1141 JLabel pathLabel = new JLabel();
1142 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1143 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1144 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1145 final String tooltip = JvSwingUtils.wrapTooltip(true,
1146 MessageManager.getString("label.chimera_path_tip"));
1147 pathLabel.setToolTipText(tooltip);
1148 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1149 structureTab.add(pathLabel);
1151 chimeraPath.setFont(LABEL_FONT);
1152 chimeraPath.setText("");
1153 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1154 chimeraPath.addMouseListener(new MouseAdapter()
1157 public void mouseClicked(MouseEvent e)
1159 if (e.getClickCount() == 2)
1161 String chosen = openFileChooser();
1164 chimeraPath.setText(chosen);
1169 structureTab.add(chimeraPath);
1171 ypos += lineSpacing;
1172 nwMapping.setFont(LABEL_FONT);
1173 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1174 siftsMapping.setFont(LABEL_FONT);
1175 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1176 mappingMethod.add(nwMapping);
1177 mappingMethod.add(siftsMapping);
1178 JPanel mappingPanel = new JPanel();
1179 mappingPanel.setFont(LABEL_FONT);
1180 TitledBorder mmTitledBorder = new TitledBorder(
1181 MessageManager.getString("label.mapping_method"));
1182 mmTitledBorder.setTitleFont(LABEL_FONT);
1183 mappingPanel.setBorder(mmTitledBorder);
1184 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1185 // GridLayout mappingLayout = new GridLayout();
1186 mappingPanel.setLayout(new GridLayout());
1187 mappingPanel.add(nwMapping);
1188 mappingPanel.add(siftsMapping);
1189 structureTab.add(mappingPanel);
1191 ypos += lineSpacing;
1192 ypos += lineSpacing;
1193 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1194 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1195 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1196 structureTab.add(docFieldPref);
1198 return structureTab;
1202 * Action on choosing a structure viewer from combobox options.
1204 * @param selectedItem
1206 protected void structureViewer_actionPerformed(String selectedItem)
1211 * Show a dialog for the user to choose a file. Returns the chosen path, or
1216 protected String openFileChooser()
1218 String choice = null;
1219 JFileChooser chooser = new JFileChooser();
1221 // chooser.setFileView(new JalviewFileView());
1222 chooser.setDialogTitle(MessageManager
1223 .getString("label.open_local_file"));
1224 chooser.setToolTipText(MessageManager.getString("action.open"));
1226 int value = chooser.showOpenDialog(this);
1228 if (value == JFileChooser.APPROVE_OPTION)
1230 choice = chooser.getSelectedFile().getPath();
1236 * Validate the structure tab preferences; if invalid, set focus on this tab.
1240 protected boolean validateStructure(FocusEvent e)
1242 if (!validateStructure())
1244 e.getComponent().requestFocusInWindow();
1250 protected boolean validateStructure()
1256 * Initialises the Visual tabbed panel.
1260 private JPanel initVisualTab()
1262 JPanel visualTab = new JPanel();
1263 visualTab.setBorder(new TitledBorder(MessageManager
1264 .getString("action.open_new_alignment")));
1265 visualTab.setLayout(null);
1266 fullScreen.setFont(LABEL_FONT);
1267 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1268 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1269 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1270 quality.setEnabled(false);
1271 quality.setFont(LABEL_FONT);
1272 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1273 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1274 quality.setSelected(true);
1275 quality.setText(MessageManager.getString("label.quality"));
1276 conservation.setEnabled(false);
1277 conservation.setFont(LABEL_FONT);
1278 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1279 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1280 conservation.setSelected(true);
1281 conservation.setText(MessageManager.getString("label.conservation"));
1282 identity.setEnabled(false);
1283 identity.setFont(LABEL_FONT);
1284 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1285 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1286 identity.setSelected(true);
1287 identity.setText(MessageManager.getString("label.consensus"));
1288 showOccupancy.setFont(LABEL_FONT);
1289 showOccupancy.setEnabled(false);
1290 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1291 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1292 showOccupancy.setSelected(true);
1293 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1295 JLabel showGroupbits = new JLabel();
1296 showGroupbits.setFont(LABEL_FONT);
1297 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1298 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1299 showGroupbits.setText(MessageManager.getString("action.show_group")
1301 JLabel showConsensbits = new JLabel();
1302 showConsensbits.setFont(LABEL_FONT);
1303 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1304 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1305 showConsensbits.setText(MessageManager.getString("label.consensus")
1307 showConsensHistogram.setEnabled(false);
1308 showConsensHistogram.setFont(LABEL_FONT);
1309 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1310 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1311 showConsensHistogram.setSelected(true);
1312 showConsensHistogram.setText(MessageManager
1313 .getString("label.histogram"));
1314 showConsensLogo.setEnabled(false);
1315 showConsensLogo.setFont(LABEL_FONT);
1316 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1317 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1318 showConsensLogo.setSelected(true);
1319 showConsensLogo.setText(MessageManager.getString("label.logo"));
1320 showGroupConsensus.setEnabled(false);
1321 showGroupConsensus.setFont(LABEL_FONT);
1322 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1323 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1324 showGroupConsensus.setSelected(true);
1325 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1326 showGroupConservation.setEnabled(false);
1327 showGroupConservation.setFont(LABEL_FONT);
1328 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1329 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1330 showGroupConservation.setSelected(true);
1331 showGroupConservation.setText(MessageManager
1332 .getString("label.conservation"));
1333 showNpTooltip.setEnabled(true);
1334 showNpTooltip.setFont(LABEL_FONT);
1335 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1336 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1337 showNpTooltip.setSelected(true);
1338 showNpTooltip.setText(MessageManager
1339 .getString("label.non_positional_features"));
1340 showDbRefTooltip.setEnabled(true);
1341 showDbRefTooltip.setFont(LABEL_FONT);
1342 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1343 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1344 showDbRefTooltip.setSelected(true);
1345 showDbRefTooltip.setText(MessageManager
1346 .getString("label.database_references"));
1347 annotations.setFont(LABEL_FONT);
1348 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1349 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1350 annotations.setSelected(true);
1351 annotations.setText(MessageManager.getString("label.show_annotations"));
1352 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1353 annotations.addActionListener(new ActionListener()
1356 public void actionPerformed(ActionEvent e)
1358 annotations_actionPerformed(e);
1361 identity.addActionListener(new ActionListener()
1364 public void actionPerformed(ActionEvent e)
1366 annotations_actionPerformed(e);
1369 showGroupConsensus.addActionListener(new ActionListener()
1372 public void actionPerformed(ActionEvent e)
1374 annotations_actionPerformed(e);
1377 showUnconserved.setFont(LABEL_FONT);
1378 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1379 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1380 showUnconserved.setSelected(true);
1381 showUnconserved.setText(MessageManager
1382 .getString("action.show_unconserved"));
1383 showUnconserved.addActionListener(new ActionListener()
1386 public void actionPerformed(ActionEvent e)
1388 showunconserved_actionPerformed(e);
1392 // TODO these are not yet added to / action from Preferences
1393 // JCheckBox shareSelections = new JCheckBox();
1394 // shareSelections.setFont(verdana11);
1395 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1396 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1397 // shareSelections.setSelected(true);
1398 // shareSelections.setText(MessageManager
1399 // .getString("label.share_selection_across_views"));
1400 // JCheckBox followHighlight = new JCheckBox();
1401 // followHighlight.setFont(verdana11);
1402 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1403 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1404 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1405 // followHighlight.setSelected(true);
1406 // followHighlight.setText(MessageManager
1407 // .getString("label.scroll_highlighted_regions"));
1409 seqLimit.setFont(LABEL_FONT);
1410 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1411 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1412 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1413 smoothFont.setFont(LABEL_FONT);
1414 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1415 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1416 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1417 scaleProteinToCdna.setFont(LABEL_FONT);
1418 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1419 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1420 scaleProteinToCdna.setText(MessageManager
1421 .getString("label.scale_protein_to_cdna"));
1422 scaleProteinToCdna.setToolTipText(MessageManager
1423 .getString("label.scale_protein_to_cdna_tip"));
1424 JLabel gapLabel = new JLabel();
1425 gapLabel.setFont(LABEL_FONT);
1426 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1427 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1428 JLabel fontLabel = new JLabel();
1429 fontLabel.setFont(LABEL_FONT);
1430 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1431 fontLabel.setText(MessageManager.getString("label.font"));
1432 fontSizeCB.setFont(LABEL_FONT);
1433 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1434 fontStyleCB.setFont(LABEL_FONT);
1435 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1436 fontNameCB.setFont(LABEL_FONT);
1437 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1438 gapSymbolCB.setFont(LABEL_FONT);
1439 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1440 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1441 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1442 gapSymbolCB.setRenderer(dlcr);
1444 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1445 startupCheckbox.setFont(LABEL_FONT);
1446 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1447 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1448 startupCheckbox.setSelected(true);
1449 startupFileTextfield.setFont(LABEL_FONT);
1450 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1451 startupFileTextfield.addMouseListener(new MouseAdapter()
1454 public void mouseClicked(MouseEvent e)
1456 if (e.getClickCount() > 1)
1458 startupFileTextfield_mouseClicked();
1463 sortby.setFont(LABEL_FONT);
1464 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1465 JLabel sortLabel = new JLabel();
1466 sortLabel.setFont(LABEL_FONT);
1467 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1468 sortLabel.setText(MessageManager.getString("label.sort_by"));
1469 sortAnnBy.setFont(LABEL_FONT);
1470 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1471 JLabel sortAnnLabel = new JLabel();
1472 sortAnnLabel.setFont(LABEL_FONT);
1473 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1474 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1475 sortAutocalc.setFont(LABEL_FONT);
1476 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1478 JPanel annsettingsPanel = new JPanel();
1479 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1480 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1481 annsettingsPanel.setBorder(new EtchedBorder());
1482 visualTab.add(annsettingsPanel);
1483 Border jb = new EmptyBorder(1, 1, 4, 5);
1484 annotations.setBorder(jb);
1485 showOccupancy.setBorder(jb);
1486 quality.setBorder(jb);
1487 conservation.setBorder(jb);
1488 identity.setBorder(jb);
1489 showConsensbits.setBorder(jb);
1490 showGroupbits.setBorder(jb);
1491 showGroupConsensus.setBorder(jb);
1492 showGroupConservation.setBorder(jb);
1493 showConsensHistogram.setBorder(jb);
1494 showConsensLogo.setBorder(jb);
1496 JPanel autoAnnotSettings = new JPanel();
1497 annsettingsPanel.add(autoAnnotSettings);
1498 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1499 autoAnnotSettings.add(annotations);
1500 autoAnnotSettings.add(quality);
1501 // second row of autoannotation box
1502 autoAnnotSettings = new JPanel();
1503 annsettingsPanel.add(autoAnnotSettings);
1505 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1506 autoAnnotSettings.add(conservation);
1507 autoAnnotSettings.add(identity);
1508 autoAnnotSettings.add(showOccupancy);
1509 autoAnnotSettings.add(showGroupbits);
1510 autoAnnotSettings.add(showGroupConservation);
1511 autoAnnotSettings.add(showGroupConsensus);
1512 autoAnnotSettings.add(showConsensbits);
1513 autoAnnotSettings.add(showConsensHistogram);
1514 autoAnnotSettings.add(showConsensLogo);
1518 JPanel tooltipSettings = new JPanel();
1519 tooltipSettings.setBorder(new TitledBorder(MessageManager
1520 .getString("label.sequence_id_tooltip")));
1521 tooltipSettings.setBounds(173, 140, 220, 62);
1522 tooltipSettings.setLayout(new GridLayout(2, 1));
1523 tooltipSettings.add(showDbRefTooltip);
1524 tooltipSettings.add(showNpTooltip);
1525 visualTab.add(tooltipSettings);
1527 wrap.setFont(LABEL_FONT);
1528 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1529 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1530 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1531 rightAlign.setFont(LABEL_FONT);
1532 rightAlign.setForeground(Color.black);
1533 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1534 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1535 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1536 idItalics.setFont(LABEL_FONT_ITALIC);
1537 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1538 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1539 idItalics.setText(MessageManager
1540 .getString("label.sequence_name_italics"));
1541 openoverv.setFont(LABEL_FONT);
1542 openoverv.setActionCommand(MessageManager
1543 .getString("label.open_overview"));
1544 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1545 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1546 openoverv.setText(MessageManager.getString("label.open_overview"));
1547 JPanel jPanel2 = new JPanel();
1548 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1549 jPanel2.setLayout(new GridLayout(14, 1));
1550 jPanel2.add(fullScreen);
1551 jPanel2.add(openoverv);
1552 jPanel2.add(seqLimit);
1553 jPanel2.add(rightAlign);
1554 jPanel2.add(fontLabel);
1555 jPanel2.add(showUnconserved);
1556 jPanel2.add(idItalics);
1557 jPanel2.add(smoothFont);
1558 jPanel2.add(scaleProteinToCdna);
1559 jPanel2.add(gapLabel);
1561 jPanel2.add(sortLabel);
1562 jPanel2.add(sortAnnLabel);
1563 jPanel2.add(startupCheckbox);
1564 visualTab.add(jPanel2);
1565 visualTab.add(startupFileTextfield);
1566 visualTab.add(sortby);
1567 visualTab.add(sortAnnBy);
1568 visualTab.add(sortAutocalc);
1569 visualTab.add(gapSymbolCB);
1570 visualTab.add(fontNameCB);
1571 visualTab.add(fontSizeCB);
1572 visualTab.add(fontStyleCB);
1576 protected void autoIdWidth_actionPerformed()
1578 // TODO Auto-generated method stub
1582 protected void userIdWidth_actionPerformed()
1584 // TODO Auto-generated method stub
1588 protected void maxColour_actionPerformed(JPanel panel)
1592 protected void minColour_actionPerformed(JPanel panel)
1596 protected void showunconserved_actionPerformed(ActionEvent e)
1598 // TODO Auto-generated method stub
1608 public void ok_actionPerformed(ActionEvent e)
1618 public void cancel_actionPerformed(ActionEvent e)
1628 public void annotations_actionPerformed(ActionEvent e)
1635 public void startupFileTextfield_mouseClicked()
1639 public void newLink_actionPerformed(ActionEvent e)
1644 public void editLink_actionPerformed(ActionEvent e)
1649 public void deleteLink_actionPerformed(ActionEvent e)
1654 public void defaultBrowser_mouseClicked(MouseEvent e)
1659 public void linkURLList_keyTyped(KeyEvent e)
1664 public void useProxy_actionPerformed()
1666 boolean enabled = useProxy.isSelected();
1667 portLabel.setEnabled(enabled);
1668 serverLabel.setEnabled(enabled);
1669 proxyServerTB.setEnabled(enabled);
1670 proxyPortTB.setEnabled(enabled);
1674 * Customer renderer for JTable: supports column of radio buttons
1676 public class RadioButtonRenderer extends JRadioButton implements
1679 public RadioButtonRenderer()
1681 setHorizontalAlignment(CENTER);
1682 setToolTipText(MessageManager.getString("label.urltooltip"));
1686 public Component getTableCellRendererComponent(JTable table,
1687 Object value, boolean isSelected, boolean hasFocus, int row,
1690 setSelected((boolean) value);
1692 // set colours to match rest of table
1695 setBackground(table.getSelectionBackground());
1696 setForeground(table.getSelectionForeground());
1700 setBackground(table.getBackground());
1701 setForeground(table.getForeground());
1708 * Customer cell editor for JTable: supports column of radio buttons in
1709 * conjunction with renderer
1711 public class RadioButtonEditor extends AbstractCellEditor implements
1714 private JRadioButton button = new JRadioButton();
1716 public RadioButtonEditor()
1718 button.setHorizontalAlignment(SwingConstants.CENTER);
1719 this.button.addActionListener(new ActionListener()
1722 public void actionPerformed(ActionEvent e)
1724 fireEditingStopped();
1730 public Component getTableCellEditorComponent(JTable table,
1731 Object value, boolean isSelected, int row, int column)
1733 button.setSelected((boolean) value);
1738 public Object getCellEditorValue()
1740 return button.isSelected();