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.bin.Jalview;
24 import jalview.fts.core.FTSDataColumnPreferences;
25 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
26 import jalview.fts.service.pdb.PDBFTSRestClient;
27 import jalview.gui.JvSwingUtils;
28 import jalview.gui.StructureViewer.ViewerType;
29 import jalview.util.MessageManager;
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.FocusEvent;
45 import java.awt.event.KeyEvent;
46 import java.awt.event.MouseAdapter;
47 import java.awt.event.MouseEvent;
49 import javax.swing.AbstractCellEditor;
50 import javax.swing.BorderFactory;
51 import javax.swing.ButtonGroup;
52 import javax.swing.DefaultListCellRenderer;
53 import javax.swing.JButton;
54 import javax.swing.JCheckBox;
55 import javax.swing.JComboBox;
56 import javax.swing.JFileChooser;
57 import javax.swing.JLabel;
58 import javax.swing.JPanel;
59 import javax.swing.JRadioButton;
60 import javax.swing.JScrollPane;
61 import javax.swing.JTabbedPane;
62 import javax.swing.JTable;
63 import javax.swing.JTextField;
64 import javax.swing.ListSelectionModel;
65 import javax.swing.SwingConstants;
66 import javax.swing.border.Border;
67 import javax.swing.border.EmptyBorder;
68 import javax.swing.border.EtchedBorder;
69 import javax.swing.border.TitledBorder;
70 import javax.swing.event.ChangeEvent;
71 import javax.swing.event.ChangeListener;
72 import javax.swing.table.TableCellEditor;
73 import javax.swing.table.TableCellRenderer;
76 * Base class for the Preferences panel.
81 public class GPreferences extends JPanel
83 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
85 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
86 .getLabelFont(false, true);
89 * Visual tab components
91 protected JCheckBox fullScreen = new JCheckBox();
93 protected JCheckBox openoverv = new JCheckBox();
95 protected JCheckBox seqLimit = new JCheckBox();
97 protected JCheckBox rightAlign = new JCheckBox();
99 protected JComboBox<String> fontSizeCB = new JComboBox<>();
101 protected JComboBox<String> fontStyleCB = new JComboBox<>();
103 protected JComboBox<String> fontNameCB = new JComboBox<>();
105 protected JCheckBox showOccupancy = new JCheckBox();
107 protected JCheckBox showUnconserved = new JCheckBox();
109 protected JCheckBox idItalics = new JCheckBox();
111 protected JCheckBox smoothFont = new JCheckBox();
113 protected JCheckBox scaleProteinToCdna = new JCheckBox();
115 protected JComboBox<String> gapSymbolCB = new JComboBox<>();
117 protected JCheckBox wrap = new JCheckBox();
119 protected JComboBox<String> sortby = new JComboBox<>();
121 protected JComboBox<String> sortAnnBy = new JComboBox<>();
123 protected JComboBox<String> sortAutocalc = new JComboBox<>();
125 protected JCheckBox startupCheckbox = new JCheckBox();
127 protected JTextField startupFileTextfield = new JTextField();
129 // below are in the 'second column'
130 protected JCheckBox annotations = new JCheckBox();
132 protected JCheckBox quality = new JCheckBox();
134 protected JCheckBox conservation = new JCheckBox();
136 protected JCheckBox identity = new JCheckBox();
138 protected JCheckBox showGroupConsensus = new JCheckBox();
140 protected JCheckBox showGroupConservation = new JCheckBox();
142 protected JCheckBox showConsensHistogram = new JCheckBox();
144 protected JCheckBox showConsensLogo = new JCheckBox();
146 protected JCheckBox showDbRefTooltip = new JCheckBox();
148 protected JCheckBox showNpTooltip = new JCheckBox();
151 * Structure tab and components
153 protected JPanel structureTab;
155 protected JCheckBox structFromPdb = new JCheckBox();
157 protected JCheckBox useRnaView = new JCheckBox();
159 protected JCheckBox addSecondaryStructure = new JCheckBox();
161 protected JCheckBox addTempFactor = new JCheckBox();
163 protected JComboBox<String> structViewer = new JComboBox<>();
165 protected JTextField chimeraPath = new JTextField();
167 protected ButtonGroup mappingMethod = new ButtonGroup();
169 protected JRadioButton siftsMapping = new JRadioButton();
171 protected JRadioButton nwMapping = new JRadioButton();
174 * Colours tab components
176 protected JPanel minColour = new JPanel();
178 protected JPanel maxColour = new JPanel();
180 protected JComboBox<String> protColour = new JComboBox<>();
182 protected JComboBox<String> nucColour = new JComboBox<>();
185 * Overview tab components
187 protected JPanel gapColour = new JPanel();
189 protected JPanel hiddenColour = new JPanel();
191 protected JCheckBox useLegacyGap;
193 protected JCheckBox showHiddenAtStart;
195 protected JLabel gapLabel;
198 * Connections tab components
200 protected JTable linkUrlTable = new JTable();
202 protected JButton editLink = new JButton();
204 protected JButton deleteLink = new JButton();
206 protected JTextField filterTB = new JTextField();
208 protected JButton doReset = new JButton();
210 protected JButton userOnly = new JButton();
212 protected JLabel portLabel = new JLabel();
214 protected JLabel serverLabel = new JLabel();
216 protected JTextField proxyServerTB = new JTextField();
218 protected JTextField proxyPortTB = new JTextField();
220 protected JTextField defaultBrowser = new JTextField();
222 protected JCheckBox useProxy = new JCheckBox();
224 protected JCheckBox usagestats = new JCheckBox();
226 protected JCheckBox questionnaire = new JCheckBox();
228 protected JCheckBox versioncheck = new JCheckBox();
231 * Output tab components
233 protected JComboBox<Object> epsRendering = new JComboBox<>();
235 protected JComboBox<Object> htmlRendering = new JComboBox<>();
237 protected JComboBox<Object> svgRendering = new JComboBox<>();
239 protected JLabel userIdWidthlabel = new JLabel();
241 protected JCheckBox autoIdWidth = new JCheckBox();
243 protected JTextField userIdWidth = new JTextField();
245 protected JCheckBox blcjv = new JCheckBox();
247 protected JCheckBox pileupjv = new JCheckBox();
249 protected JCheckBox clustaljv = new JCheckBox();
251 protected JCheckBox msfjv = new JCheckBox();
253 protected JCheckBox fastajv = new JCheckBox();
255 protected JCheckBox pfamjv = new JCheckBox();
257 protected JCheckBox pirjv = new JCheckBox();
259 protected JCheckBox modellerOutput = new JCheckBox();
261 protected JCheckBox embbedBioJSON = new JCheckBox();
264 * Editing tab components
266 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
268 protected JCheckBox padGaps = new JCheckBox();
270 protected JCheckBox sortByTree = new JCheckBox();
276 protected JPanel wsTab = new JPanel();
279 * Creates a new GPreferences object.
281 public GPreferences()
286 } catch (Exception ex)
288 ex.printStackTrace();
293 * Construct the panel and its tabbed sub-panels.
297 private void jbInit() throws Exception
299 final JTabbedPane tabbedPane = jalview.jbgui.GDesktop.createTabbedPane();
300 this.setLayout(new BorderLayout());
301 JPanel okCancelPanel = initOkCancelPanel();
302 this.add(tabbedPane, BorderLayout.CENTER);
303 this.add(okCancelPanel, BorderLayout.SOUTH);
305 tabbedPane.add(initVisualTab(),
306 MessageManager.getString("label.visual"));
308 tabbedPane.add(initColoursTab(),
309 MessageManager.getString("label.colours"));
311 tabbedPane.add(initOverviewTab(),
312 MessageManager.getString("label.overview"));
314 tabbedPane.add(initStructureTab(),
315 MessageManager.getString("label.structure"));
317 tabbedPane.add(initConnectionsTab(),
318 MessageManager.getString("label.connections"));
320 tabbedPane.add(initLinksTab(),
321 MessageManager.getString("label.urllinks"));
323 tabbedPane.add(initOutputTab(),
324 MessageManager.getString("label.output"));
326 tabbedPane.add(initEditingTab(),
327 MessageManager.getString("label.editing"));
330 * See WsPreferences for the real work of configuring this tab.
334 wsTab.setLayout(new BorderLayout());
335 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
339 * Handler to validate a tab before leaving it - currently only for
342 tabbedPane.addChangeListener(new ChangeListener()
344 private Component lastTab;
347 public void stateChanged(ChangeEvent e)
349 if (lastTab == structureTab
350 && tabbedPane.getSelectedComponent() != structureTab)
352 if (!validateStructure())
354 tabbedPane.setSelectedComponent(structureTab);
358 lastTab = tabbedPane.getSelectedComponent();
365 * Initialises the Editing tabbed panel.
369 private JPanel initEditingTab()
371 JPanel editingTab = new JPanel();
372 editingTab.setLayout(null);
373 autoCalculateConsCheck.setFont(LABEL_FONT);
374 autoCalculateConsCheck.setText(
375 MessageManager.getString("label.autocalculate_consensus"));
376 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
377 padGaps.setFont(LABEL_FONT);
379 MessageManager.getString("label.pad_gaps_when_editing"));
380 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
381 sortByTree.setFont(LABEL_FONT);
383 .setText(MessageManager.getString("label.sort_with_new_tree"));
384 sortByTree.setToolTipText(MessageManager.getString(
385 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
386 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
387 editingTab.add(autoCalculateConsCheck);
388 editingTab.add(padGaps);
389 editingTab.add(sortByTree);
394 * Initialises the Output tab
398 private JPanel initOutputTab()
400 JPanel outputTab = new JPanel();
401 outputTab.setLayout(null);
403 JLabel epsLabel = new JLabel(
404 MessageManager.formatMessage("label.rendering_style", "EPS"));
405 epsLabel.setFont(LABEL_FONT);
406 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
407 epsLabel.setBounds(new Rectangle(9, 31, 160, 24));
408 epsRendering.setFont(LABEL_FONT);
409 epsRendering.setBounds(new Rectangle(174, 34, 187, 21));
410 JLabel htmlLabel = new JLabel(
411 MessageManager.formatMessage("label.rendering_style", "HTML"));
412 htmlLabel.setFont(LABEL_FONT);
413 htmlLabel.setHorizontalAlignment(SwingConstants.RIGHT);
414 htmlLabel.setBounds(new Rectangle(9, 55, 160, 24));
415 htmlRendering.setFont(LABEL_FONT);
416 htmlRendering.setBounds(new Rectangle(174, 58, 187, 21));
417 JLabel svgLabel = new JLabel(
418 MessageManager.formatMessage("label.rendering_style", "SVG"));
419 svgLabel.setFont(LABEL_FONT);
420 svgLabel.setHorizontalAlignment(SwingConstants.RIGHT);
421 svgLabel.setBounds(new Rectangle(9, 79, 160, 24));
422 svgRendering.setFont(LABEL_FONT);
423 svgRendering.setBounds(new Rectangle(174, 82, 187, 21));
425 JLabel jLabel1 = new JLabel();
426 jLabel1.setFont(LABEL_FONT);
427 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
428 jLabel1.setText(MessageManager.getString("label.append_start_end"));
429 jLabel1.setFont(LABEL_FONT);
431 fastajv.setFont(LABEL_FONT);
432 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
433 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
434 blcjv.setText(MessageManager.getString("label.blc") + " ");
435 fastajv.setText(MessageManager.getString("label.fasta") + " ");
436 msfjv.setText(MessageManager.getString("label.msf") + " ");
437 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
438 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
439 msfjv.setFont(LABEL_FONT);
440 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
441 pirjv.setText(MessageManager.getString("label.pir") + " ");
442 JPanel jPanel11 = new JPanel();
443 jPanel11.setFont(LABEL_FONT);
444 TitledBorder titledBorder2 = new TitledBorder(
445 MessageManager.getString("label.file_output"));
446 jPanel11.setBorder(titledBorder2);
447 jPanel11.setBounds(new Rectangle(30, 120, 196, 182));
448 GridLayout gridLayout3 = new GridLayout();
449 jPanel11.setLayout(gridLayout3);
450 gridLayout3.setRows(8);
451 blcjv.setFont(LABEL_FONT);
452 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
453 clustaljv.setFont(LABEL_FONT);
454 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
455 pfamjv.setFont(LABEL_FONT);
456 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
457 pileupjv.setFont(LABEL_FONT);
458 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
459 pirjv.setFont(LABEL_FONT);
460 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
461 autoIdWidth.setFont(LABEL_FONT);
463 MessageManager.getString("label.automatically_set_id_width"));
464 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
465 .getString("label.adjusts_width_generated_eps_png")));
466 autoIdWidth.setBounds(new Rectangle(228, 144, 320, 23));
467 autoIdWidth.addActionListener(new ActionListener()
471 public void actionPerformed(ActionEvent e)
473 autoIdWidth_actionPerformed();
476 userIdWidthlabel.setFont(LABEL_FONT);
477 userIdWidthlabel.setText(
478 MessageManager.getString("label.figure_id_column_width"));
479 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
480 .getString("label.manually_specify_width_left_column")));
481 userIdWidthlabel.setToolTipText(
482 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
483 "label.manually_specify_width_left_column")));
484 userIdWidthlabel.setBounds(new Rectangle(236, 168, 320, 23));
485 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
486 userIdWidth.setText("");
487 userIdWidth.setBounds(new Rectangle(232, 192, 84, 23));
488 userIdWidth.addActionListener(new ActionListener()
492 public void actionPerformed(ActionEvent e)
494 userIdWidth_actionPerformed();
497 modellerOutput.setFont(LABEL_FONT);
499 .setText(MessageManager.getString("label.use_modeller_output"));
500 modellerOutput.setBounds(new Rectangle(228, 274, 320, 23));
501 embbedBioJSON.setFont(LABEL_FONT);
502 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
503 embbedBioJSON.setBounds(new Rectangle(228, 248, 250, 23));
505 jPanel11.add(jLabel1);
507 jPanel11.add(clustaljv);
508 jPanel11.add(fastajv);
510 jPanel11.add(pfamjv);
511 jPanel11.add(pileupjv);
513 outputTab.add(autoIdWidth);
514 outputTab.add(userIdWidth);
515 outputTab.add(userIdWidthlabel);
516 outputTab.add(modellerOutput);
520 * JalviewJS doesn't support Lineart option or SVG output
522 outputTab.add(embbedBioJSON);
523 outputTab.add(epsLabel);
524 outputTab.add(epsRendering);
525 outputTab.add(htmlLabel);
526 outputTab.add(htmlRendering);
527 outputTab.add(svgLabel);
528 outputTab.add(svgRendering);
530 outputTab.add(jPanel11);
535 * Initialises the Connections tabbed panel.
539 private JPanel initConnectionsTab()
541 JPanel connectTab = new JPanel();
542 connectTab.setLayout(new GridBagLayout());
544 // Label for browser text box
545 JLabel browserLabel = new JLabel();
546 browserLabel.setFont(LABEL_FONT);
547 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
548 browserLabel.setText(
549 MessageManager.getString("label.default_browser_unix"));
550 defaultBrowser.setFont(LABEL_FONT);
551 defaultBrowser.setText("");
552 final String tooltip = JvSwingUtils.wrapTooltip(true,
553 MessageManager.getString("label.double_click_to_browse"));
554 defaultBrowser.setToolTipText(tooltip);
555 defaultBrowser.addMouseListener(new MouseAdapter()
558 public void mouseClicked(MouseEvent e)
560 if (e.getClickCount() > 1)
562 defaultBrowser_mouseClicked(e);
567 JPanel proxyPanel = initConnTabProxyPanel();
568 initConnTabCheckboxes();
570 // Add default Browser text box
571 connectTab.add(browserLabel,
572 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
573 GridBagConstraints.WEST, GridBagConstraints.NONE,
574 new Insets(10, 0, 5, 5), 5, 1));
575 defaultBrowser.setFont(LABEL_FONT);
576 defaultBrowser.setText("");
578 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
579 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
580 new Insets(10, 0, 5, 10), 30, 1));
582 // Add proxy server panel
583 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
584 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
585 new Insets(10, 0, 5, 12), 4, 10));
587 // Add usage stats, version check and questionnaire checkboxes
588 connectTab.add(usagestats,
589 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
590 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
591 new Insets(0, 2, 5, 5), 70, 1));
592 connectTab.add(questionnaire,
593 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
594 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
595 new Insets(0, 2, 5, 10), 70, 1));
596 connectTab.add(versioncheck,
597 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
598 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
599 new Insets(0, 2, 5, 5), 70, 1));
601 // Add padding so the panel doesn't look ridiculous
602 JPanel spacePanel = new JPanel();
603 connectTab.add(spacePanel,
604 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
605 GridBagConstraints.WEST, GridBagConstraints.BOTH,
606 new Insets(0, 0, 0, 5), 70, 1));
612 * Initialises the Links tabbed panel.
616 private JPanel initLinksTab()
618 JPanel linkTab = new JPanel();
619 linkTab.setLayout(new GridBagLayout());
621 // Set up table for Url links
622 linkUrlTable.setFillsViewportHeight(true);
623 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
624 linkUrlTable.setAutoCreateRowSorter(true);
625 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
627 // adjust row height so radio buttons actually fit
628 // don't do this in the renderer, it causes the awt thread to activate
630 JRadioButton temp = new JRadioButton();
631 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
633 // Table in scrollpane so that the table is given a scrollbar
634 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
635 linkScrollPane.setBorder(null);
637 // Panel for links functionality
638 JPanel linkPanel = new JPanel(new GridBagLayout());
639 linkPanel.setBorder(new TitledBorder(
640 MessageManager.getString("label.url_linkfrom_sequence_id")));
642 // Put the Url links panel together
644 // Buttons go at top right, resizing only resizes the blank space vertically
645 JPanel buttonPanel = initLinkTabUrlButtons();
646 GridBagConstraints linkConstraints1 = new GridBagConstraints();
647 linkConstraints1.insets = new Insets(0, 0, 5, 0);
648 linkConstraints1.gridx = 0;
649 linkConstraints1.gridy = 0;
650 linkConstraints1.weightx = 1.0;
651 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
652 linkTab.add(buttonPanel, linkConstraints1);
654 // Links table goes at top left, resizing resizes the table
655 GridBagConstraints linkConstraints2 = new GridBagConstraints();
656 linkConstraints2.insets = new Insets(0, 0, 5, 5);
657 linkConstraints2.gridx = 0;
658 linkConstraints2.gridy = 1;
659 linkConstraints2.weightx = 1.0;
660 linkConstraints2.weighty = 1.0;
661 linkConstraints2.fill = GridBagConstraints.BOTH;
662 linkTab.add(linkScrollPane, linkConstraints2);
664 // Filter box and buttons goes at bottom left, resizing resizes the text box
665 JPanel filterPanel = initLinkTabFilterPanel();
666 GridBagConstraints linkConstraints3 = new GridBagConstraints();
667 linkConstraints3.insets = new Insets(0, 0, 0, 5);
668 linkConstraints3.gridx = 0;
669 linkConstraints3.gridy = 2;
670 linkConstraints3.weightx = 1.0;
671 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
672 linkTab.add(filterPanel, linkConstraints3);
677 private JPanel initLinkTabFilterPanel()
679 // Filter textbox and reset button
680 JLabel filterLabel = new JLabel(
681 MessageManager.getString("label.filter"));
682 filterLabel.setFont(LABEL_FONT);
683 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
684 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
686 filterTB.setFont(LABEL_FONT);
687 filterTB.setText("");
689 doReset.setText(MessageManager.getString("action.showall"));
690 userOnly.setText(MessageManager.getString("action.customfilter"));
692 // Panel for filter functionality
693 JPanel filterPanel = new JPanel(new GridBagLayout());
694 filterPanel.setBorder(new TitledBorder("Filter"));
695 GridBagConstraints gbc = new GridBagConstraints();
698 gbc.fill = GridBagConstraints.NONE;
699 gbc.anchor = GridBagConstraints.WEST;
701 filterPanel.add(filterLabel, gbc);
703 GridBagConstraints gbc1 = new GridBagConstraints();
706 gbc1.fill = GridBagConstraints.HORIZONTAL;
707 gbc1.anchor = GridBagConstraints.WEST;
709 filterPanel.add(filterTB, gbc1);
711 GridBagConstraints gbc2 = new GridBagConstraints();
713 gbc2.fill = GridBagConstraints.NONE;
714 gbc2.anchor = GridBagConstraints.WEST;
715 filterPanel.add(doReset, gbc2);
717 GridBagConstraints gbc3 = new GridBagConstraints();
719 gbc3.fill = GridBagConstraints.NONE;
720 gbc3.anchor = GridBagConstraints.WEST;
721 filterPanel.add(userOnly, gbc3);
726 private JPanel initLinkTabUrlButtons()
728 // Buttons for new / edit / delete Url links
729 JButton newLink = new JButton();
730 newLink.setText(MessageManager.getString("action.new"));
732 editLink.setText(MessageManager.getString("action.edit"));
734 deleteLink.setText(MessageManager.getString("action.delete"));
736 // no current selection, so initially disable delete/edit buttons
737 editLink.setEnabled(false);
738 deleteLink.setEnabled(false);
740 newLink.addActionListener(new java.awt.event.ActionListener()
743 public void actionPerformed(ActionEvent e)
745 newLink_actionPerformed(e);
749 editLink.setText(MessageManager.getString("action.edit"));
750 editLink.addActionListener(new java.awt.event.ActionListener()
753 public void actionPerformed(ActionEvent e)
755 editLink_actionPerformed(e);
759 deleteLink.setText(MessageManager.getString("action.delete"));
760 deleteLink.addActionListener(new java.awt.event.ActionListener()
763 public void actionPerformed(ActionEvent e)
765 deleteLink_actionPerformed(e);
769 JPanel buttonPanel = new JPanel(new GridBagLayout());
770 buttonPanel.setBorder(new TitledBorder("Edit links"));
771 GridBagConstraints gbc = new GridBagConstraints();
774 gbc.fill = GridBagConstraints.NONE;
775 buttonPanel.add(newLink, gbc);
777 GridBagConstraints gbc1 = new GridBagConstraints();
780 gbc1.fill = GridBagConstraints.NONE;
781 buttonPanel.add(editLink, gbc1);
783 GridBagConstraints gbc2 = new GridBagConstraints();
786 gbc2.fill = GridBagConstraints.NONE;
787 buttonPanel.add(deleteLink, gbc2);
789 GridBagConstraints gbc3 = new GridBagConstraints();
792 gbc3.fill = GridBagConstraints.HORIZONTAL;
794 JPanel spacePanel = new JPanel();
795 spacePanel.setBorder(null);
796 buttonPanel.add(spacePanel, gbc3);
802 * Initialises the proxy server panel in the Connections tab
804 * @return the proxy server panel
806 private JPanel initConnTabProxyPanel()
808 // Label for server text box
809 serverLabel.setText(MessageManager.getString("label.address"));
810 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
811 serverLabel.setFont(LABEL_FONT);
813 // Proxy server and port text boxes
814 proxyServerTB.setFont(LABEL_FONT);
815 proxyPortTB.setFont(LABEL_FONT);
817 // Label for Port text box
818 portLabel.setFont(LABEL_FONT);
819 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
820 portLabel.setText(MessageManager.getString("label.port"));
822 // Use proxy server checkbox
823 useProxy.setFont(LABEL_FONT);
824 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
825 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
826 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
827 useProxy.addActionListener(new ActionListener()
830 public void actionPerformed(ActionEvent e)
832 useProxy_actionPerformed();
836 // Make proxy server panel
837 JPanel proxyPanel = new JPanel();
838 TitledBorder titledBorder1 = new TitledBorder(
839 MessageManager.getString("label.proxy_server"));
840 proxyPanel.setBorder(titledBorder1);
841 proxyPanel.setLayout(new GridBagLayout());
842 proxyPanel.add(serverLabel,
843 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
844 GridBagConstraints.WEST, GridBagConstraints.NONE,
845 new Insets(0, 2, 2, 0), 5, 0));
846 proxyPanel.add(portLabel,
847 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
848 GridBagConstraints.WEST, GridBagConstraints.NONE,
849 new Insets(0, 0, 2, 0), 11, 0));
850 proxyPanel.add(useProxy,
851 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
852 GridBagConstraints.WEST, GridBagConstraints.NONE,
853 new Insets(0, 2, 5, 185), 2, -4));
854 proxyPanel.add(proxyPortTB,
855 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
856 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
857 new Insets(0, 2, 2, 2), 54, 1));
858 proxyPanel.add(proxyServerTB,
859 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
860 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
861 new Insets(0, 2, 2, 0), 263, 1));
867 * Initialises the checkboxes in the Connections tab
869 private void initConnTabCheckboxes()
871 // Usage stats checkbox label
873 MessageManager.getString("label.send_usage_statistics"));
874 usagestats.setFont(LABEL_FONT);
875 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
876 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
878 // Questionnaire checkbox label
879 questionnaire.setText(
880 MessageManager.getString("label.check_for_questionnaires"));
881 questionnaire.setFont(LABEL_FONT);
882 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
883 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
885 // Check for latest version checkbox label
886 versioncheck.setText(
887 MessageManager.getString("label.check_for_latest_version"));
888 versioncheck.setFont(LABEL_FONT);
889 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
890 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
894 * Initialises the parent panel which contains the tabbed sections.
898 private JPanel initOkCancelPanel()
900 JButton ok = new JButton();
901 ok.setText(MessageManager.getString("action.ok"));
902 ok.addActionListener(new ActionListener()
905 public void actionPerformed(ActionEvent e)
907 ok_actionPerformed(e);
910 JButton cancel = new JButton();
911 cancel.setText(MessageManager.getString("action.cancel"));
912 cancel.addActionListener(new ActionListener()
915 public void actionPerformed(ActionEvent e)
917 cancel_actionPerformed(e);
920 JPanel okCancelPanel = new JPanel();
921 okCancelPanel.add(ok);
922 okCancelPanel.add(cancel);
923 return okCancelPanel;
927 * Initialises the Colours tabbed panel.
931 private JPanel initColoursTab()
933 JPanel coloursTab = new JPanel();
934 coloursTab.setBorder(new TitledBorder(
935 MessageManager.getString("action.open_new_alignment")));
936 coloursTab.setLayout(new FlowLayout());
937 JLabel mincolourLabel = new JLabel();
938 mincolourLabel.setFont(LABEL_FONT);
939 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
940 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
941 minColour.setFont(LABEL_FONT);
942 minColour.setBorder(BorderFactory.createEtchedBorder());
943 minColour.setPreferredSize(new Dimension(40, 20));
944 minColour.addMouseListener(new MouseAdapter()
947 public void mousePressed(MouseEvent e)
949 minColour_actionPerformed(minColour);
952 JLabel maxcolourLabel = new JLabel();
953 maxcolourLabel.setFont(LABEL_FONT);
954 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
955 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
956 maxColour.setFont(LABEL_FONT);
957 maxColour.setBorder(BorderFactory.createEtchedBorder());
958 maxColour.setPreferredSize(new Dimension(40, 20));
959 maxColour.addMouseListener(new MouseAdapter()
962 public void mousePressed(MouseEvent e)
964 maxColour_actionPerformed(maxColour);
968 protColour.setFont(LABEL_FONT);
969 protColour.setBounds(new Rectangle(172, 225, 155, 21));
970 JLabel protColourLabel = new JLabel();
971 protColourLabel.setFont(LABEL_FONT);
972 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
973 protColourLabel.setText(
974 MessageManager.getString("label.prot_alignment_colour") + " ");
975 JvSwingUtils.addtoLayout(coloursTab,
977 .getString("label.default_colour_scheme_for_alignment"),
978 protColourLabel, protColour);
980 nucColour.setFont(LABEL_FONT);
981 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
982 JLabel nucColourLabel = new JLabel();
983 nucColourLabel.setFont(LABEL_FONT);
984 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
985 nucColourLabel.setText(
986 MessageManager.getString("label.nuc_alignment_colour") + " ");
987 JvSwingUtils.addtoLayout(coloursTab,
989 .getString("label.default_colour_scheme_for_alignment"),
990 nucColourLabel, nucColour);
992 JPanel annotationShding = new JPanel();
993 annotationShding.setBorder(new TitledBorder(
994 MessageManager.getString("label.annotation_shading_default")));
995 annotationShding.setLayout(new GridLayout(1, 2));
996 JvSwingUtils.addtoLayout(annotationShding,
997 MessageManager.getString(
998 "label.default_minimum_colour_annotation_shading"),
999 mincolourLabel, minColour);
1000 JvSwingUtils.addtoLayout(annotationShding,
1001 MessageManager.getString(
1002 "label.default_maximum_colour_annotation_shading"),
1003 maxcolourLabel, maxColour);
1004 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1009 * Initialises the Overview tabbed panel.
1013 private JPanel initOverviewTab()
1015 JPanel overviewPanel = new JPanel();
1016 overviewPanel.setBorder(new TitledBorder(
1017 MessageManager.getString("label.overview_settings")));
1019 gapColour.setFont(LABEL_FONT);
1020 // fixing the border colours stops apparent colour bleed from the panel
1021 gapColour.setBorder(
1022 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1023 gapColour.setPreferredSize(new Dimension(40, 20));
1024 gapColour.addMouseListener(new MouseAdapter()
1027 public void mousePressed(MouseEvent e)
1029 gapColour_actionPerformed(gapColour);
1033 hiddenColour.setFont(LABEL_FONT);
1034 // fixing the border colours stops apparent colour bleed from the panel
1035 hiddenColour.setBorder(
1036 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1037 hiddenColour.setPreferredSize(new Dimension(40, 20));
1038 hiddenColour.addMouseListener(new MouseAdapter()
1041 public void mousePressed(MouseEvent e)
1043 hiddenColour_actionPerformed(hiddenColour);
1047 useLegacyGap = new JCheckBox(
1048 MessageManager.getString("label.ov_legacy_gap"));
1049 useLegacyGap.setFont(LABEL_FONT);
1050 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1051 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1052 gapLabel = new JLabel(
1053 MessageManager.getString("label.gap_colour"));
1054 gapLabel.setFont(LABEL_FONT);
1055 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1056 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1057 showHiddenAtStart = new JCheckBox(
1058 MessageManager.getString("label.ov_show_hide_default"));
1059 showHiddenAtStart.setFont(LABEL_FONT);
1060 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1061 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1062 JLabel hiddenLabel = new JLabel(
1063 MessageManager.getString("label.hidden_colour"));
1064 hiddenLabel.setFont(LABEL_FONT);
1065 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1066 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1068 useLegacyGap.addActionListener(new ActionListener()
1071 public void actionPerformed(ActionEvent e)
1073 useLegacyGaps_actionPerformed(e);
1077 overviewPanel.setLayout(new GridBagLayout());
1078 GridBagConstraints c1 = new GridBagConstraints();
1080 c1.fill = GridBagConstraints.HORIZONTAL;
1085 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1086 overviewPanel.add(useLegacyGap, c1);
1088 GridBagConstraints c2 = new GridBagConstraints();
1089 c2.fill = GridBagConstraints.HORIZONTAL;
1092 c2.insets = new Insets(0, 15, 0, 10);
1093 overviewPanel.add(gapLabel, c2);
1095 GridBagConstraints c3 = new GridBagConstraints();
1096 c3.fill = GridBagConstraints.HORIZONTAL;
1099 c3.insets = new Insets(0, 0, 0, 15);
1100 overviewPanel.add(gapColour, c3);
1102 GridBagConstraints c4 = new GridBagConstraints();
1103 c4.fill = GridBagConstraints.HORIZONTAL;
1107 overviewPanel.add(showHiddenAtStart, c4);
1109 GridBagConstraints c5 = new GridBagConstraints();
1110 c5.fill = GridBagConstraints.HORIZONTAL;
1113 c5.insets = new Insets(0, 15, 0, 10);
1114 overviewPanel.add(hiddenLabel, c5);
1116 GridBagConstraints c6 = new GridBagConstraints();
1117 c6.fill = GridBagConstraints.HORIZONTAL;
1120 c6.insets = new Insets(0, 0, 0, 15);
1121 overviewPanel.add(hiddenColour, c6);
1123 JButton resetButton = new JButton(
1124 MessageManager.getString("label.reset_to_defaults"));
1126 resetButton.addActionListener(new ActionListener()
1129 public void actionPerformed(ActionEvent e)
1131 resetOvDefaults_actionPerformed(e);
1135 GridBagConstraints c7 = new GridBagConstraints();
1136 c7.fill = GridBagConstraints.NONE;
1139 c7.insets = new Insets(10, 0, 0, 0);
1140 c7.anchor = GridBagConstraints.WEST;
1141 overviewPanel.add(resetButton, c7);
1143 // Add padding so the panel doesn't look ridiculous
1144 JPanel spacePanel = new JPanel();
1145 overviewPanel.add(spacePanel,
1146 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1147 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1148 new Insets(0, 0, 0, 5), 0, 0));
1150 return overviewPanel;
1154 * Initialises the Structure tabbed panel.
1158 private JPanel initStructureTab()
1160 structureTab = new JPanel();
1162 structureTab.setBorder(new TitledBorder(
1163 MessageManager.getString("label.structure_options")));
1164 structureTab.setLayout(null);
1165 final int width = 400;
1166 final int height = 22;
1167 final int lineSpacing = 25;
1170 structFromPdb.setFont(LABEL_FONT);
1172 .setText(MessageManager.getString("label.struct_from_pdb"));
1173 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1174 structFromPdb.addActionListener(new ActionListener()
1177 public void actionPerformed(ActionEvent e)
1179 boolean selected = structFromPdb.isSelected();
1180 // enable other options only when the first is checked
1181 useRnaView.setEnabled(selected);
1182 addSecondaryStructure.setEnabled(selected);
1183 addTempFactor.setEnabled(selected);
1186 structureTab.add(structFromPdb);
1188 // indent checkboxes that are conditional on the first one
1189 ypos += lineSpacing;
1190 useRnaView.setFont(LABEL_FONT);
1191 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1192 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1193 structureTab.add(useRnaView);
1195 ypos += lineSpacing;
1196 addSecondaryStructure.setFont(LABEL_FONT);
1197 addSecondaryStructure
1198 .setText(MessageManager.getString("label.autoadd_secstr"));
1199 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1200 structureTab.add(addSecondaryStructure);
1202 ypos += lineSpacing;
1203 addTempFactor.setFont(LABEL_FONT);
1204 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1205 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1206 structureTab.add(addTempFactor);
1208 ypos += lineSpacing;
1209 JLabel viewerLabel = new JLabel();
1210 viewerLabel.setFont(LABEL_FONT);
1211 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1212 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1213 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1214 structureTab.add(viewerLabel);
1216 structViewer.setFont(LABEL_FONT);
1217 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1218 structViewer.addItem(ViewerType.JMOL.name());
1219 structViewer.addItem(ViewerType.CHIMERA.name());
1220 structViewer.addActionListener(new ActionListener()
1223 public void actionPerformed(ActionEvent e)
1225 structureViewer_actionPerformed(
1226 (String) structViewer.getSelectedItem());
1229 structureTab.add(structViewer);
1231 ypos += lineSpacing;
1232 JLabel pathLabel = new JLabel();
1233 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1234 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1235 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1236 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1237 structureTab.add(pathLabel);
1239 chimeraPath.setFont(LABEL_FONT);
1240 chimeraPath.setText("");
1241 final String tooltip = JvSwingUtils.wrapTooltip(true,
1242 MessageManager.getString("label.chimera_path_tip"));
1243 chimeraPath.setToolTipText(tooltip);
1244 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1245 chimeraPath.addMouseListener(new MouseAdapter()
1248 public void mouseClicked(MouseEvent e)
1250 if (e.getClickCount() == 2)
1252 String chosen = openFileChooser();
1255 chimeraPath.setText(chosen);
1260 structureTab.add(chimeraPath);
1262 ypos += lineSpacing;
1263 nwMapping.setFont(LABEL_FONT);
1264 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1265 siftsMapping.setFont(LABEL_FONT);
1266 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1267 mappingMethod.add(nwMapping);
1268 mappingMethod.add(siftsMapping);
1269 JPanel mappingPanel = new JPanel();
1270 mappingPanel.setFont(LABEL_FONT);
1271 TitledBorder mmTitledBorder = new TitledBorder(
1272 MessageManager.getString("label.mapping_method"));
1273 mmTitledBorder.setTitleFont(LABEL_FONT);
1274 mappingPanel.setBorder(mmTitledBorder);
1275 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1276 // GridLayout mappingLayout = new GridLayout();
1277 mappingPanel.setLayout(new GridLayout());
1278 mappingPanel.add(nwMapping);
1279 mappingPanel.add(siftsMapping);
1280 structureTab.add(mappingPanel);
1282 ypos += lineSpacing;
1283 ypos += lineSpacing;
1284 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1285 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1286 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1287 structureTab.add(docFieldPref);
1290 * hide Chimera options in JalviewJS
1294 pathLabel.setVisible(false);
1295 chimeraPath.setVisible(false);
1296 viewerLabel.setVisible(false);
1297 structViewer.setVisible(false);
1300 return structureTab;
1304 * Action on choosing a structure viewer from combobox options.
1306 * @param selectedItem
1308 protected void structureViewer_actionPerformed(String selectedItem)
1313 * Show a dialog for the user to choose a file. Returns the chosen path, or
1318 protected String openFileChooser()
1320 String choice = null;
1321 JFileChooser chooser = new JFileChooser();
1323 // chooser.setFileView(new JalviewFileView());
1324 chooser.setDialogTitle(
1325 MessageManager.getString("label.open_local_file"));
1326 chooser.setToolTipText(MessageManager.getString("action.open"));
1328 int value = chooser.showOpenDialog(this);
1330 if (value == JFileChooser.APPROVE_OPTION)
1332 choice = chooser.getSelectedFile().getPath();
1338 * Validate the structure tab preferences; if invalid, set focus on this tab.
1342 protected boolean validateStructure(FocusEvent e)
1344 if (!validateStructure())
1346 e.getComponent().requestFocusInWindow();
1352 protected boolean validateStructure()
1358 * Initialises the Visual tabbed panel.
1362 private JPanel initVisualTab()
1364 JPanel visualTab = new JPanel();
1365 visualTab.setBorder(new TitledBorder(
1366 MessageManager.getString("action.open_new_alignment")));
1367 visualTab.setLayout(null);
1368 fullScreen.setFont(LABEL_FONT);
1369 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1370 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1371 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1372 quality.setEnabled(false);
1373 quality.setFont(LABEL_FONT);
1374 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1375 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1376 quality.setSelected(true);
1377 quality.setText(MessageManager.getString("label.quality"));
1378 conservation.setEnabled(false);
1379 conservation.setFont(LABEL_FONT);
1380 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1381 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1382 conservation.setSelected(true);
1383 conservation.setText(MessageManager.getString("label.conservation"));
1384 identity.setEnabled(false);
1385 identity.setFont(LABEL_FONT);
1386 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1387 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1388 identity.setSelected(true);
1389 identity.setText(MessageManager.getString("label.consensus"));
1390 showOccupancy.setFont(LABEL_FONT);
1391 showOccupancy.setEnabled(false);
1392 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1393 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1394 showOccupancy.setSelected(true);
1395 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1397 JLabel showGroupbits = new JLabel();
1398 showGroupbits.setFont(LABEL_FONT);
1399 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1400 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1402 .setText(MessageManager.getString("action.show_group") + ":");
1403 JLabel showConsensbits = new JLabel();
1404 showConsensbits.setFont(LABEL_FONT);
1405 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1406 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1408 .setText(MessageManager.getString("label.consensus") + ":");
1409 showConsensHistogram.setEnabled(false);
1410 showConsensHistogram.setFont(LABEL_FONT);
1411 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1412 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1413 showConsensHistogram.setSelected(true);
1414 showConsensHistogram
1415 .setText(MessageManager.getString("label.histogram"));
1416 showConsensLogo.setEnabled(false);
1417 showConsensLogo.setFont(LABEL_FONT);
1418 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1419 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1420 showConsensLogo.setSelected(true);
1421 showConsensLogo.setText(MessageManager.getString("label.logo"));
1422 showGroupConsensus.setEnabled(false);
1423 showGroupConsensus.setFont(LABEL_FONT);
1424 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1425 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1426 showGroupConsensus.setSelected(true);
1427 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1428 showGroupConservation.setEnabled(false);
1429 showGroupConservation.setFont(LABEL_FONT);
1430 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1431 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1432 showGroupConservation.setSelected(true);
1433 showGroupConservation
1434 .setText(MessageManager.getString("label.conservation"));
1435 showNpTooltip.setEnabled(true);
1436 showNpTooltip.setFont(LABEL_FONT);
1437 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1438 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1439 showNpTooltip.setSelected(true);
1440 showNpTooltip.setText(
1441 MessageManager.getString("label.non_positional_features"));
1442 showDbRefTooltip.setEnabled(true);
1443 showDbRefTooltip.setFont(LABEL_FONT);
1444 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1445 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1446 showDbRefTooltip.setSelected(true);
1448 .setText(MessageManager.getString("label.database_references"));
1449 annotations.setFont(LABEL_FONT);
1450 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1451 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1452 annotations.setSelected(true);
1453 annotations.setText(MessageManager.getString("label.show_annotations"));
1454 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1455 annotations.addActionListener(new ActionListener()
1458 public void actionPerformed(ActionEvent e)
1460 annotations_actionPerformed(e);
1463 identity.addActionListener(new ActionListener()
1466 public void actionPerformed(ActionEvent e)
1468 annotations_actionPerformed(e);
1471 showGroupConsensus.addActionListener(new ActionListener()
1474 public void actionPerformed(ActionEvent e)
1476 annotations_actionPerformed(e);
1479 showUnconserved.setFont(LABEL_FONT);
1480 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1481 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1482 showUnconserved.setSelected(true);
1484 .setText(MessageManager.getString("action.show_unconserved"));
1485 showUnconserved.addActionListener(new ActionListener()
1488 public void actionPerformed(ActionEvent e)
1490 showunconserved_actionPerformed(e);
1494 // TODO these are not yet added to / action from Preferences
1495 // JCheckBox shareSelections = new JCheckBox();
1496 // shareSelections.setFont(verdana11);
1497 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1498 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1499 // shareSelections.setSelected(true);
1500 // shareSelections.setText(MessageManager
1501 // .getString("label.share_selection_across_views"));
1502 // JCheckBox followHighlight = new JCheckBox();
1503 // followHighlight.setFont(verdana11);
1504 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1505 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1506 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1507 // followHighlight.setSelected(true);
1508 // followHighlight.setText(MessageManager
1509 // .getString("label.scroll_highlighted_regions"));
1511 seqLimit.setFont(LABEL_FONT);
1512 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1513 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1514 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1515 smoothFont.setFont(LABEL_FONT);
1516 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1517 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1518 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1519 scaleProteinToCdna.setFont(LABEL_FONT);
1520 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1521 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1522 scaleProteinToCdna.setText(
1523 MessageManager.getString("label.scale_protein_to_cdna"));
1524 scaleProteinToCdna.setToolTipText(
1525 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1526 JLabel gapLabel = new JLabel();
1527 gapLabel.setFont(LABEL_FONT);
1528 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1529 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1530 JLabel fontLabel = new JLabel();
1531 fontLabel.setFont(LABEL_FONT);
1532 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1533 fontLabel.setText(MessageManager.getString("label.font"));
1534 fontSizeCB.setFont(LABEL_FONT);
1535 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1536 fontStyleCB.setFont(LABEL_FONT);
1537 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1538 fontNameCB.setFont(LABEL_FONT);
1539 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1540 gapSymbolCB.setFont(LABEL_FONT);
1541 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1542 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1543 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1544 gapSymbolCB.setRenderer(dlcr);
1546 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1547 startupCheckbox.setFont(LABEL_FONT);
1548 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1549 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1550 startupCheckbox.setSelected(true);
1551 startupFileTextfield.setFont(LABEL_FONT);
1552 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1553 final String tooltip = JvSwingUtils.wrapTooltip(true,
1554 MessageManager.getString("label.double_click_to_browse"));
1555 startupFileTextfield.setToolTipText(tooltip);
1556 startupFileTextfield.addMouseListener(new MouseAdapter()
1559 public void mouseClicked(MouseEvent e)
1561 if (e.getClickCount() > 1)
1563 startupFileTextfield_mouseClicked();
1568 sortby.setFont(LABEL_FONT);
1569 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1570 JLabel sortLabel = new JLabel();
1571 sortLabel.setFont(LABEL_FONT);
1572 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1573 sortLabel.setText(MessageManager.getString("label.sort_by"));
1574 sortAnnBy.setFont(LABEL_FONT);
1575 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1576 JLabel sortAnnLabel = new JLabel();
1577 sortAnnLabel.setFont(LABEL_FONT);
1578 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1579 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1580 sortAutocalc.setFont(LABEL_FONT);
1581 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1583 JPanel annsettingsPanel = new JPanel();
1584 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1585 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1586 annsettingsPanel.setBorder(new EtchedBorder());
1587 visualTab.add(annsettingsPanel);
1588 Border jb = new EmptyBorder(1, 1, 4, 5);
1589 annotations.setBorder(jb);
1590 showOccupancy.setBorder(jb);
1591 quality.setBorder(jb);
1592 conservation.setBorder(jb);
1593 identity.setBorder(jb);
1594 showConsensbits.setBorder(jb);
1595 showGroupbits.setBorder(jb);
1596 showGroupConsensus.setBorder(jb);
1597 showGroupConservation.setBorder(jb);
1598 showConsensHistogram.setBorder(jb);
1599 showConsensLogo.setBorder(jb);
1601 JPanel autoAnnotSettings = new JPanel();
1602 annsettingsPanel.add(autoAnnotSettings);
1603 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1604 autoAnnotSettings.add(annotations);
1605 autoAnnotSettings.add(quality);
1606 // second row of autoannotation box
1607 autoAnnotSettings = new JPanel();
1608 annsettingsPanel.add(autoAnnotSettings);
1610 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1611 autoAnnotSettings.add(conservation);
1612 autoAnnotSettings.add(identity);
1613 autoAnnotSettings.add(showOccupancy);
1614 autoAnnotSettings.add(showGroupbits);
1615 autoAnnotSettings.add(showGroupConservation);
1616 autoAnnotSettings.add(showGroupConsensus);
1617 autoAnnotSettings.add(showConsensbits);
1618 autoAnnotSettings.add(showConsensHistogram);
1619 autoAnnotSettings.add(showConsensLogo);
1621 JPanel tooltipSettings = new JPanel();
1622 tooltipSettings.setBorder(new TitledBorder(
1623 MessageManager.getString("label.sequence_id_tooltip")));
1624 tooltipSettings.setBounds(173, 140, 220, 62);
1625 tooltipSettings.setLayout(new GridLayout(2, 1));
1626 tooltipSettings.add(showDbRefTooltip);
1627 tooltipSettings.add(showNpTooltip);
1628 visualTab.add(tooltipSettings);
1630 wrap.setFont(LABEL_FONT);
1631 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1632 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1633 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1634 rightAlign.setFont(LABEL_FONT);
1635 rightAlign.setForeground(Color.black);
1636 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1637 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1638 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1639 idItalics.setFont(LABEL_FONT_ITALIC);
1640 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1641 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1643 MessageManager.getString("label.sequence_name_italics"));
1644 openoverv.setFont(LABEL_FONT);
1645 openoverv.setActionCommand(
1646 MessageManager.getString("label.open_overview"));
1647 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1648 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1649 openoverv.setText(MessageManager.getString("label.open_overview"));
1650 JPanel jPanel2 = new JPanel();
1651 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1652 jPanel2.setLayout(new GridLayout(14, 1));
1653 jPanel2.add(fullScreen);
1654 jPanel2.add(openoverv);
1655 jPanel2.add(seqLimit);
1656 jPanel2.add(rightAlign);
1657 jPanel2.add(fontLabel);
1658 jPanel2.add(showUnconserved);
1659 jPanel2.add(idItalics);
1660 jPanel2.add(smoothFont);
1661 jPanel2.add(scaleProteinToCdna);
1662 jPanel2.add(gapLabel);
1664 jPanel2.add(sortLabel);
1665 jPanel2.add(sortAnnLabel);
1666 jPanel2.add(startupCheckbox);
1667 visualTab.add(jPanel2);
1668 visualTab.add(startupFileTextfield);
1669 visualTab.add(sortby);
1670 visualTab.add(sortAnnBy);
1671 visualTab.add(sortAutocalc);
1672 visualTab.add(gapSymbolCB);
1673 visualTab.add(fontNameCB);
1674 visualTab.add(fontSizeCB);
1675 visualTab.add(fontStyleCB);
1679 startupCheckbox.setVisible(false);
1680 startupFileTextfield.setVisible(false);
1686 protected void autoIdWidth_actionPerformed()
1688 // TODO Auto-generated method stub
1692 protected void userIdWidth_actionPerformed()
1694 // TODO Auto-generated method stub
1698 protected void maxColour_actionPerformed(JPanel panel)
1702 protected void minColour_actionPerformed(JPanel panel)
1706 protected void gapColour_actionPerformed(JPanel panel)
1710 protected void hiddenColour_actionPerformed(JPanel panel)
1714 protected void showunconserved_actionPerformed(ActionEvent e)
1716 // TODO Auto-generated method stub
1720 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1724 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1734 public void ok_actionPerformed(ActionEvent e)
1744 public void cancel_actionPerformed(ActionEvent e)
1754 public void annotations_actionPerformed(ActionEvent e)
1761 public void startupFileTextfield_mouseClicked()
1765 public void newLink_actionPerformed(ActionEvent e)
1770 public void editLink_actionPerformed(ActionEvent e)
1775 public void deleteLink_actionPerformed(ActionEvent e)
1780 public void defaultBrowser_mouseClicked(MouseEvent e)
1785 public void linkURLList_keyTyped(KeyEvent e)
1790 public void useProxy_actionPerformed()
1792 boolean enabled = useProxy.isSelected();
1793 portLabel.setEnabled(enabled);
1794 serverLabel.setEnabled(enabled);
1795 proxyServerTB.setEnabled(enabled);
1796 proxyPortTB.setEnabled(enabled);
1800 * Customer renderer for JTable: supports column of radio buttons
1802 public class RadioButtonRenderer extends JRadioButton
1803 implements TableCellRenderer
1805 public RadioButtonRenderer()
1807 setHorizontalAlignment(CENTER);
1808 setToolTipText(MessageManager.getString("label.urltooltip"));
1812 public Component getTableCellRendererComponent(JTable table,
1813 Object value, boolean isSelected, boolean hasFocus, int row,
1816 setSelected((boolean) value);
1818 // set colours to match rest of table
1821 setBackground(table.getSelectionBackground());
1822 setForeground(table.getSelectionForeground());
1826 setBackground(table.getBackground());
1827 setForeground(table.getForeground());
1834 * Customer cell editor for JTable: supports column of radio buttons in
1835 * conjunction with renderer
1837 public class RadioButtonEditor extends AbstractCellEditor
1838 implements TableCellEditor
1840 private JRadioButton button = new JRadioButton();
1842 public RadioButtonEditor()
1844 button.setHorizontalAlignment(SwingConstants.CENTER);
1845 this.button.addActionListener(new ActionListener()
1848 public void actionPerformed(ActionEvent e)
1850 fireEditingStopped();
1856 public Component getTableCellEditorComponent(JTable table, Object value,
1857 boolean isSelected, int row, int column)
1859 button.setSelected((boolean) value);
1864 public Object getCellEditorValue()
1866 return button.isSelected();