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.AbstractCellEditor;
49 import javax.swing.BorderFactory;
50 import javax.swing.ButtonGroup;
51 import javax.swing.DefaultListCellRenderer;
52 import javax.swing.JButton;
53 import javax.swing.JCheckBox;
54 import javax.swing.JComboBox;
55 import javax.swing.JFileChooser;
56 import javax.swing.JLabel;
57 import javax.swing.JPanel;
58 import javax.swing.JRadioButton;
59 import javax.swing.JScrollPane;
60 import javax.swing.JTabbedPane;
61 import javax.swing.JTable;
62 import javax.swing.JTextField;
63 import javax.swing.ListSelectionModel;
64 import javax.swing.SwingConstants;
65 import javax.swing.border.Border;
66 import javax.swing.border.EmptyBorder;
67 import javax.swing.border.EtchedBorder;
68 import javax.swing.border.TitledBorder;
69 import javax.swing.event.ChangeEvent;
70 import javax.swing.event.ChangeListener;
71 import javax.swing.table.TableCellEditor;
72 import javax.swing.table.TableCellRenderer;
75 * Base class for the Preferences panel.
80 public class GPreferences extends JPanel
82 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
84 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
85 .getLabelFont(false, true);
88 * Visual tab components
90 protected JCheckBox fullScreen = new JCheckBox();
92 protected JCheckBox openoverv = new JCheckBox();
94 protected JCheckBox seqLimit = new JCheckBox();
96 protected JCheckBox rightAlign = new JCheckBox();
98 protected JComboBox<String> fontSizeCB = new JComboBox<>();
100 protected JComboBox<String> fontStyleCB = new JComboBox<>();
102 protected JComboBox<String> fontNameCB = new JComboBox<>();
104 protected JCheckBox showOccupancy = new JCheckBox();
106 protected JCheckBox showUnconserved = new JCheckBox();
108 protected JCheckBox idItalics = new JCheckBox();
110 protected JCheckBox smoothFont = new JCheckBox();
112 protected JCheckBox scaleProteinToCdna = new JCheckBox();
114 protected JComboBox<String> gapSymbolCB = new JComboBox<>();
116 protected JCheckBox wrap = new JCheckBox();
118 protected JComboBox<String> sortby = new JComboBox<>();
120 protected JComboBox<String> sortAnnBy = new JComboBox<>();
122 protected JComboBox<String> sortAutocalc = new JComboBox<>();
124 protected JCheckBox startupCheckbox = new JCheckBox();
126 protected JTextField startupFileTextfield = new JTextField();
128 // below are in the 'second column'
129 protected JCheckBox annotations = new JCheckBox();
131 protected JCheckBox quality = new JCheckBox();
133 protected JCheckBox conservation = new JCheckBox();
135 protected JCheckBox identity = new JCheckBox();
137 protected JCheckBox showGroupConsensus = new JCheckBox();
139 protected JCheckBox showGroupConservation = new JCheckBox();
141 protected JCheckBox showConsensHistogram = new JCheckBox();
143 protected JCheckBox showConsensLogo = new JCheckBox();
145 protected JCheckBox showDbRefTooltip = new JCheckBox();
147 protected JCheckBox showNpTooltip = new JCheckBox();
150 * Structure tab and components
152 protected JPanel structureTab;
154 protected JCheckBox structFromPdb = new JCheckBox();
156 protected JCheckBox useRnaView = new JCheckBox();
158 protected JCheckBox addSecondaryStructure = new JCheckBox();
160 protected JCheckBox addTempFactor = new JCheckBox();
162 protected JComboBox<String> structViewer = new JComboBox<>();
164 protected JTextField chimeraPath = new JTextField();
166 protected ButtonGroup mappingMethod = new ButtonGroup();
168 protected JRadioButton siftsMapping = new JRadioButton();
170 protected JRadioButton nwMapping = new JRadioButton();
173 * Colours tab components
175 protected JPanel minColour = new JPanel();
177 protected JPanel maxColour = new JPanel();
179 protected JComboBox<String> protColour = new JComboBox<>();
181 protected JComboBox<String> nucColour = new JComboBox<>();
184 * Overview tab components
186 protected JPanel gapColour = new JPanel();
188 protected JPanel hiddenColour = new JPanel();
190 protected JCheckBox useLegacyGap;
192 protected JCheckBox showHiddenAtStart;
194 protected JLabel gapLabel;
197 * Connections tab components
199 protected JTable linkUrlTable = new JTable();
201 protected JButton editLink = new JButton();
203 protected JButton deleteLink = new JButton();
205 protected JTextField filterTB = new JTextField();
207 protected JButton doReset = new JButton();
209 protected JButton userOnly = new JButton();
211 protected JLabel portLabel = new JLabel();
213 protected JLabel serverLabel = new JLabel();
215 protected JTextField proxyServerTB = new JTextField();
217 protected JTextField proxyPortTB = new JTextField();
219 protected JTextField defaultBrowser = new JTextField();
221 protected JCheckBox useProxy = new JCheckBox();
223 protected JCheckBox usagestats = new JCheckBox();
225 protected JCheckBox questionnaire = new JCheckBox();
227 protected JCheckBox versioncheck = new JCheckBox();
230 * Output tab components
232 protected JComboBox<Object> epsRendering = new JComboBox<>();
234 protected JComboBox<Object> htmlRendering = new JComboBox<>();
236 protected JComboBox<Object> svgRendering = new JComboBox<>();
238 protected JLabel userIdWidthlabel = new JLabel();
240 protected JCheckBox autoIdWidth = new JCheckBox();
242 protected JTextField userIdWidth = new JTextField();
244 protected JCheckBox blcjv = new JCheckBox();
246 protected JCheckBox pileupjv = new JCheckBox();
248 protected JCheckBox clustaljv = new JCheckBox();
250 protected JCheckBox msfjv = new JCheckBox();
252 protected JCheckBox fastajv = new JCheckBox();
254 protected JCheckBox pfamjv = new JCheckBox();
256 protected JCheckBox pirjv = new JCheckBox();
258 protected JCheckBox modellerOutput = new JCheckBox();
260 protected JCheckBox embbedBioJSON = new JCheckBox();
263 * Editing tab components
265 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
267 protected JCheckBox padGaps = new JCheckBox();
269 protected JCheckBox sortByTree = new JCheckBox();
275 protected JPanel wsTab = new JPanel();
278 * Creates a new GPreferences object.
280 public GPreferences()
285 } catch (Exception ex)
287 ex.printStackTrace();
292 * Construct the panel and its tabbed sub-panels.
296 private void jbInit() throws Exception
298 final JTabbedPane tabbedPane = jalview.jbgui.GDesktop.createTabbedPane();
299 this.setLayout(new BorderLayout());
300 JPanel okCancelPanel = initOkCancelPanel();
301 this.add(tabbedPane, BorderLayout.CENTER);
302 this.add(okCancelPanel, BorderLayout.SOUTH);
304 tabbedPane.add(initVisualTab(),
305 MessageManager.getString("label.visual"));
307 tabbedPane.add(initColoursTab(),
308 MessageManager.getString("label.colours"));
310 tabbedPane.add(initOverviewTab(),
311 MessageManager.getString("label.overview"));
313 tabbedPane.add(initStructureTab(),
314 MessageManager.getString("label.structure"));
316 tabbedPane.add(initConnectionsTab(),
317 MessageManager.getString("label.connections"));
319 tabbedPane.add(initLinksTab(),
320 MessageManager.getString("label.urllinks"));
322 tabbedPane.add(initOutputTab(),
323 MessageManager.getString("label.output"));
325 tabbedPane.add(initEditingTab(),
326 MessageManager.getString("label.editing"));
329 * See WsPreferences for the real work of configuring this tab.
331 wsTab.setLayout(new BorderLayout());
332 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
335 * Handler to validate a tab before leaving it - currently only for
338 tabbedPane.addChangeListener(new ChangeListener()
340 private Component lastTab;
343 public void stateChanged(ChangeEvent e)
345 if (lastTab == structureTab
346 && tabbedPane.getSelectedComponent() != structureTab)
348 if (!validateStructure())
350 tabbedPane.setSelectedComponent(structureTab);
354 lastTab = tabbedPane.getSelectedComponent();
361 * Initialises the Editing tabbed panel.
365 private JPanel initEditingTab()
367 JPanel editingTab = new JPanel();
368 editingTab.setLayout(null);
369 autoCalculateConsCheck.setFont(LABEL_FONT);
370 autoCalculateConsCheck.setText(
371 MessageManager.getString("label.autocalculate_consensus"));
372 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
373 padGaps.setFont(LABEL_FONT);
375 MessageManager.getString("label.pad_gaps_when_editing"));
376 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
377 sortByTree.setFont(LABEL_FONT);
379 .setText(MessageManager.getString("label.sort_with_new_tree"));
380 sortByTree.setToolTipText(MessageManager.getString(
381 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
382 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
383 editingTab.add(autoCalculateConsCheck);
384 editingTab.add(padGaps);
385 editingTab.add(sortByTree);
390 * Initialises the Output tab
394 private JPanel initOutputTab()
396 JPanel outputTab = new JPanel();
397 outputTab.setLayout(null);
399 JLabel epsLabel = new JLabel(
400 MessageManager.formatMessage("label.rendering_style", "EPS"));
401 epsLabel.setFont(LABEL_FONT);
402 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
403 epsLabel.setBounds(new Rectangle(9, 31, 160, 24));
404 epsRendering.setFont(LABEL_FONT);
405 epsRendering.setBounds(new Rectangle(174, 34, 187, 21));
406 JLabel htmlLabel = new JLabel(
407 MessageManager.formatMessage("label.rendering_style", "HTML"));
408 htmlLabel.setFont(LABEL_FONT);
409 htmlLabel.setHorizontalAlignment(SwingConstants.RIGHT);
410 htmlLabel.setBounds(new Rectangle(9, 55, 160, 24));
411 htmlRendering.setFont(LABEL_FONT);
412 htmlRendering.setBounds(new Rectangle(174, 58, 187, 21));
413 JLabel svgLabel = new JLabel(
414 MessageManager.formatMessage("label.rendering_style", "SVG"));
415 svgLabel.setFont(LABEL_FONT);
416 svgLabel.setHorizontalAlignment(SwingConstants.RIGHT);
417 svgLabel.setBounds(new Rectangle(9, 79, 160, 24));
418 svgRendering.setFont(LABEL_FONT);
419 svgRendering.setBounds(new Rectangle(174, 82, 187, 21));
421 JLabel jLabel1 = new JLabel();
422 jLabel1.setFont(LABEL_FONT);
423 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
424 jLabel1.setText(MessageManager.getString("label.append_start_end"));
425 jLabel1.setFont(LABEL_FONT);
427 fastajv.setFont(LABEL_FONT);
428 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
429 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
430 blcjv.setText(MessageManager.getString("label.blc") + " ");
431 fastajv.setText(MessageManager.getString("label.fasta") + " ");
432 msfjv.setText(MessageManager.getString("label.msf") + " ");
433 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
434 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
435 msfjv.setFont(LABEL_FONT);
436 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
437 pirjv.setText(MessageManager.getString("label.pir") + " ");
438 JPanel jPanel11 = new JPanel();
439 jPanel11.setFont(LABEL_FONT);
440 TitledBorder titledBorder2 = new TitledBorder(
441 MessageManager.getString("label.file_output"));
442 jPanel11.setBorder(titledBorder2);
443 jPanel11.setBounds(new Rectangle(30, 120, 196, 182));
444 GridLayout gridLayout3 = new GridLayout();
445 jPanel11.setLayout(gridLayout3);
446 gridLayout3.setRows(8);
447 blcjv.setFont(LABEL_FONT);
448 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
449 clustaljv.setFont(LABEL_FONT);
450 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
451 pfamjv.setFont(LABEL_FONT);
452 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
453 pileupjv.setFont(LABEL_FONT);
454 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
455 pirjv.setFont(LABEL_FONT);
456 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
457 autoIdWidth.setFont(LABEL_FONT);
459 MessageManager.getString("label.automatically_set_id_width"));
460 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
461 .getString("label.adjusts_width_generated_eps_png")));
462 autoIdWidth.setBounds(new Rectangle(228, 144, 320, 23));
463 autoIdWidth.addActionListener(new ActionListener()
467 public void actionPerformed(ActionEvent e)
469 autoIdWidth_actionPerformed();
472 userIdWidthlabel.setFont(LABEL_FONT);
473 userIdWidthlabel.setText(
474 MessageManager.getString("label.figure_id_column_width"));
475 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
476 .getString("label.manually_specify_width_left_column")));
477 userIdWidthlabel.setToolTipText(
478 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
479 "label.manually_specify_width_left_column")));
480 userIdWidthlabel.setBounds(new Rectangle(236, 168, 320, 23));
481 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
482 userIdWidth.setText("");
483 userIdWidth.setBounds(new Rectangle(232, 192, 84, 23));
484 userIdWidth.addActionListener(new ActionListener()
488 public void actionPerformed(ActionEvent e)
490 userIdWidth_actionPerformed();
493 modellerOutput.setFont(LABEL_FONT);
495 .setText(MessageManager.getString("label.use_modeller_output"));
496 modellerOutput.setBounds(new Rectangle(228, 274, 320, 23));
497 embbedBioJSON.setFont(LABEL_FONT);
498 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
499 embbedBioJSON.setBounds(new Rectangle(228, 248, 250, 23));
501 jPanel11.add(jLabel1);
503 jPanel11.add(clustaljv);
504 jPanel11.add(fastajv);
506 jPanel11.add(pfamjv);
507 jPanel11.add(pileupjv);
509 outputTab.add(autoIdWidth);
510 outputTab.add(userIdWidth);
511 outputTab.add(userIdWidthlabel);
512 outputTab.add(modellerOutput);
513 outputTab.add(embbedBioJSON);
514 outputTab.add(epsLabel);
515 outputTab.add(epsRendering);
516 outputTab.add(htmlLabel);
517 outputTab.add(htmlRendering);
518 outputTab.add(svgLabel);
519 outputTab.add(svgRendering);
520 outputTab.add(jPanel11);
525 * Initialises the Connections tabbed panel.
529 private JPanel initConnectionsTab()
531 JPanel connectTab = new JPanel();
532 connectTab.setLayout(new GridBagLayout());
534 // Label for browser text box
535 JLabel browserLabel = new JLabel();
536 browserLabel.setFont(LABEL_FONT);
537 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
538 browserLabel.setText(
539 MessageManager.getString("label.default_browser_unix"));
540 defaultBrowser.setFont(LABEL_FONT);
541 defaultBrowser.setText("");
542 final String tooltip = JvSwingUtils.wrapTooltip(true,
543 MessageManager.getString("label.double_click_to_browse"));
544 defaultBrowser.setToolTipText(tooltip);
545 defaultBrowser.addMouseListener(new MouseAdapter()
548 public void mouseClicked(MouseEvent e)
550 if (e.getClickCount() > 1)
552 defaultBrowser_mouseClicked(e);
557 JPanel proxyPanel = initConnTabProxyPanel();
558 initConnTabCheckboxes();
560 // Add default Browser text box
561 connectTab.add(browserLabel,
562 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
563 GridBagConstraints.WEST, GridBagConstraints.NONE,
564 new Insets(10, 0, 5, 5), 5, 1));
565 defaultBrowser.setFont(LABEL_FONT);
566 defaultBrowser.setText("");
568 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
569 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
570 new Insets(10, 0, 5, 10), 30, 1));
572 // Add proxy server panel
573 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
574 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
575 new Insets(10, 0, 5, 12), 4, 10));
577 // Add usage stats, version check and questionnaire checkboxes
578 connectTab.add(usagestats,
579 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
580 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
581 new Insets(0, 2, 5, 5), 70, 1));
582 connectTab.add(questionnaire,
583 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
584 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
585 new Insets(0, 2, 5, 10), 70, 1));
586 connectTab.add(versioncheck,
587 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
588 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
589 new Insets(0, 2, 5, 5), 70, 1));
591 // Add padding so the panel doesn't look ridiculous
592 JPanel spacePanel = new JPanel();
593 connectTab.add(spacePanel,
594 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
595 GridBagConstraints.WEST, GridBagConstraints.BOTH,
596 new Insets(0, 0, 0, 5), 70, 1));
602 * Initialises the Links tabbed panel.
606 private JPanel initLinksTab()
608 JPanel linkTab = new JPanel();
609 linkTab.setLayout(new GridBagLayout());
611 // Set up table for Url links
612 linkUrlTable.setFillsViewportHeight(true);
613 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
614 linkUrlTable.setAutoCreateRowSorter(true);
615 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
617 // adjust row height so radio buttons actually fit
618 // don't do this in the renderer, it causes the awt thread to activate
620 JRadioButton temp = new JRadioButton();
621 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
623 // Table in scrollpane so that the table is given a scrollbar
624 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
625 linkScrollPane.setBorder(null);
627 // Panel for links functionality
628 JPanel linkPanel = new JPanel(new GridBagLayout());
629 linkPanel.setBorder(new TitledBorder(
630 MessageManager.getString("label.url_linkfrom_sequence_id")));
632 // Put the Url links panel together
634 // Buttons go at top right, resizing only resizes the blank space vertically
635 JPanel buttonPanel = initLinkTabUrlButtons();
636 GridBagConstraints linkConstraints1 = new GridBagConstraints();
637 linkConstraints1.insets = new Insets(0, 0, 5, 0);
638 linkConstraints1.gridx = 0;
639 linkConstraints1.gridy = 0;
640 linkConstraints1.weightx = 1.0;
641 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
642 linkTab.add(buttonPanel, linkConstraints1);
644 // Links table goes at top left, resizing resizes the table
645 GridBagConstraints linkConstraints2 = new GridBagConstraints();
646 linkConstraints2.insets = new Insets(0, 0, 5, 5);
647 linkConstraints2.gridx = 0;
648 linkConstraints2.gridy = 1;
649 linkConstraints2.weightx = 1.0;
650 linkConstraints2.weighty = 1.0;
651 linkConstraints2.fill = GridBagConstraints.BOTH;
652 linkTab.add(linkScrollPane, linkConstraints2);
654 // Filter box and buttons goes at bottom left, resizing resizes the text box
655 JPanel filterPanel = initLinkTabFilterPanel();
656 GridBagConstraints linkConstraints3 = new GridBagConstraints();
657 linkConstraints3.insets = new Insets(0, 0, 0, 5);
658 linkConstraints3.gridx = 0;
659 linkConstraints3.gridy = 2;
660 linkConstraints3.weightx = 1.0;
661 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
662 linkTab.add(filterPanel, linkConstraints3);
667 private JPanel initLinkTabFilterPanel()
669 // Filter textbox and reset button
670 JLabel filterLabel = new JLabel(
671 MessageManager.getString("label.filter"));
672 filterLabel.setFont(LABEL_FONT);
673 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
674 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
676 filterTB.setFont(LABEL_FONT);
677 filterTB.setText("");
679 doReset.setText(MessageManager.getString("action.showall"));
680 userOnly.setText(MessageManager.getString("action.customfilter"));
682 // Panel for filter functionality
683 JPanel filterPanel = new JPanel(new GridBagLayout());
684 filterPanel.setBorder(new TitledBorder("Filter"));
685 GridBagConstraints gbc = new GridBagConstraints();
688 gbc.fill = GridBagConstraints.NONE;
689 gbc.anchor = GridBagConstraints.WEST;
691 filterPanel.add(filterLabel, gbc);
693 GridBagConstraints gbc1 = new GridBagConstraints();
696 gbc1.fill = GridBagConstraints.HORIZONTAL;
697 gbc1.anchor = GridBagConstraints.WEST;
699 filterPanel.add(filterTB, gbc1);
701 GridBagConstraints gbc2 = new GridBagConstraints();
703 gbc2.fill = GridBagConstraints.NONE;
704 gbc2.anchor = GridBagConstraints.WEST;
705 filterPanel.add(doReset, gbc2);
707 GridBagConstraints gbc3 = new GridBagConstraints();
709 gbc3.fill = GridBagConstraints.NONE;
710 gbc3.anchor = GridBagConstraints.WEST;
711 filterPanel.add(userOnly, gbc3);
716 private JPanel initLinkTabUrlButtons()
718 // Buttons for new / edit / delete Url links
719 JButton newLink = new JButton();
720 newLink.setText(MessageManager.getString("action.new"));
722 editLink.setText(MessageManager.getString("action.edit"));
724 deleteLink.setText(MessageManager.getString("action.delete"));
726 // no current selection, so initially disable delete/edit buttons
727 editLink.setEnabled(false);
728 deleteLink.setEnabled(false);
730 newLink.addActionListener(new java.awt.event.ActionListener()
733 public void actionPerformed(ActionEvent e)
735 newLink_actionPerformed(e);
739 editLink.setText(MessageManager.getString("action.edit"));
740 editLink.addActionListener(new java.awt.event.ActionListener()
743 public void actionPerformed(ActionEvent e)
745 editLink_actionPerformed(e);
749 deleteLink.setText(MessageManager.getString("action.delete"));
750 deleteLink.addActionListener(new java.awt.event.ActionListener()
753 public void actionPerformed(ActionEvent e)
755 deleteLink_actionPerformed(e);
759 JPanel buttonPanel = new JPanel(new GridBagLayout());
760 buttonPanel.setBorder(new TitledBorder("Edit links"));
761 GridBagConstraints gbc = new GridBagConstraints();
764 gbc.fill = GridBagConstraints.NONE;
765 buttonPanel.add(newLink, gbc);
767 GridBagConstraints gbc1 = new GridBagConstraints();
770 gbc1.fill = GridBagConstraints.NONE;
771 buttonPanel.add(editLink, gbc1);
773 GridBagConstraints gbc2 = new GridBagConstraints();
776 gbc2.fill = GridBagConstraints.NONE;
777 buttonPanel.add(deleteLink, gbc2);
779 GridBagConstraints gbc3 = new GridBagConstraints();
782 gbc3.fill = GridBagConstraints.HORIZONTAL;
784 JPanel spacePanel = new JPanel();
785 spacePanel.setBorder(null);
786 buttonPanel.add(spacePanel, gbc3);
792 * Initialises the proxy server panel in the Connections tab
794 * @return the proxy server panel
796 private JPanel initConnTabProxyPanel()
798 // Label for server text box
799 serverLabel.setText(MessageManager.getString("label.address"));
800 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
801 serverLabel.setFont(LABEL_FONT);
803 // Proxy server and port text boxes
804 proxyServerTB.setFont(LABEL_FONT);
805 proxyPortTB.setFont(LABEL_FONT);
807 // Label for Port text box
808 portLabel.setFont(LABEL_FONT);
809 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
810 portLabel.setText(MessageManager.getString("label.port"));
812 // Use proxy server checkbox
813 useProxy.setFont(LABEL_FONT);
814 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
815 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
816 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
817 useProxy.addActionListener(new ActionListener()
820 public void actionPerformed(ActionEvent e)
822 useProxy_actionPerformed();
826 // Make proxy server panel
827 JPanel proxyPanel = new JPanel();
828 TitledBorder titledBorder1 = new TitledBorder(
829 MessageManager.getString("label.proxy_server"));
830 proxyPanel.setBorder(titledBorder1);
831 proxyPanel.setLayout(new GridBagLayout());
832 proxyPanel.add(serverLabel,
833 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
834 GridBagConstraints.WEST, GridBagConstraints.NONE,
835 new Insets(0, 2, 2, 0), 5, 0));
836 proxyPanel.add(portLabel,
837 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
838 GridBagConstraints.WEST, GridBagConstraints.NONE,
839 new Insets(0, 0, 2, 0), 11, 0));
840 proxyPanel.add(useProxy,
841 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
842 GridBagConstraints.WEST, GridBagConstraints.NONE,
843 new Insets(0, 2, 5, 185), 2, -4));
844 proxyPanel.add(proxyPortTB,
845 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
846 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
847 new Insets(0, 2, 2, 2), 54, 1));
848 proxyPanel.add(proxyServerTB,
849 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
850 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
851 new Insets(0, 2, 2, 0), 263, 1));
857 * Initialises the checkboxes in the Connections tab
859 private void initConnTabCheckboxes()
861 // Usage stats checkbox label
863 MessageManager.getString("label.send_usage_statistics"));
864 usagestats.setFont(LABEL_FONT);
865 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
866 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
868 // Questionnaire checkbox label
869 questionnaire.setText(
870 MessageManager.getString("label.check_for_questionnaires"));
871 questionnaire.setFont(LABEL_FONT);
872 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
873 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
875 // Check for latest version checkbox label
876 versioncheck.setText(
877 MessageManager.getString("label.check_for_latest_version"));
878 versioncheck.setFont(LABEL_FONT);
879 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
880 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
884 * Initialises the parent panel which contains the tabbed sections.
888 private JPanel initOkCancelPanel()
890 JButton ok = new JButton();
891 ok.setText(MessageManager.getString("action.ok"));
892 ok.addActionListener(new ActionListener()
895 public void actionPerformed(ActionEvent e)
897 ok_actionPerformed(e);
900 JButton cancel = new JButton();
901 cancel.setText(MessageManager.getString("action.cancel"));
902 cancel.addActionListener(new ActionListener()
905 public void actionPerformed(ActionEvent e)
907 cancel_actionPerformed(e);
910 JPanel okCancelPanel = new JPanel();
911 okCancelPanel.add(ok);
912 okCancelPanel.add(cancel);
913 return okCancelPanel;
917 * Initialises the Colours tabbed panel.
921 private JPanel initColoursTab()
923 JPanel coloursTab = new JPanel();
924 coloursTab.setBorder(new TitledBorder(
925 MessageManager.getString("action.open_new_alignment")));
926 coloursTab.setLayout(new FlowLayout());
927 JLabel mincolourLabel = new JLabel();
928 mincolourLabel.setFont(LABEL_FONT);
929 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
930 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
931 minColour.setFont(LABEL_FONT);
932 minColour.setBorder(BorderFactory.createEtchedBorder());
933 minColour.setPreferredSize(new Dimension(40, 20));
934 minColour.addMouseListener(new MouseAdapter()
937 public void mousePressed(MouseEvent e)
939 minColour_actionPerformed(minColour);
942 JLabel maxcolourLabel = new JLabel();
943 maxcolourLabel.setFont(LABEL_FONT);
944 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
945 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
946 maxColour.setFont(LABEL_FONT);
947 maxColour.setBorder(BorderFactory.createEtchedBorder());
948 maxColour.setPreferredSize(new Dimension(40, 20));
949 maxColour.addMouseListener(new MouseAdapter()
952 public void mousePressed(MouseEvent e)
954 maxColour_actionPerformed(maxColour);
958 protColour.setFont(LABEL_FONT);
959 protColour.setBounds(new Rectangle(172, 225, 155, 21));
960 JLabel protColourLabel = new JLabel();
961 protColourLabel.setFont(LABEL_FONT);
962 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
963 protColourLabel.setText(
964 MessageManager.getString("label.prot_alignment_colour") + " ");
965 JvSwingUtils.addtoLayout(coloursTab,
967 .getString("label.default_colour_scheme_for_alignment"),
968 protColourLabel, protColour);
970 nucColour.setFont(LABEL_FONT);
971 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
972 JLabel nucColourLabel = new JLabel();
973 nucColourLabel.setFont(LABEL_FONT);
974 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
975 nucColourLabel.setText(
976 MessageManager.getString("label.nuc_alignment_colour") + " ");
977 JvSwingUtils.addtoLayout(coloursTab,
979 .getString("label.default_colour_scheme_for_alignment"),
980 nucColourLabel, nucColour);
982 JPanel annotationShding = new JPanel();
983 annotationShding.setBorder(new TitledBorder(
984 MessageManager.getString("label.annotation_shading_default")));
985 annotationShding.setLayout(new GridLayout(1, 2));
986 JvSwingUtils.addtoLayout(annotationShding,
987 MessageManager.getString(
988 "label.default_minimum_colour_annotation_shading"),
989 mincolourLabel, minColour);
990 JvSwingUtils.addtoLayout(annotationShding,
991 MessageManager.getString(
992 "label.default_maximum_colour_annotation_shading"),
993 maxcolourLabel, maxColour);
994 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
999 * Initialises the Overview tabbed panel.
1003 private JPanel initOverviewTab()
1005 JPanel overviewPanel = new JPanel();
1006 overviewPanel.setBorder(new TitledBorder(
1007 MessageManager.getString("label.overview_settings")));
1009 gapColour.setFont(LABEL_FONT);
1010 // fixing the border colours stops apparent colour bleed from the panel
1011 gapColour.setBorder(
1012 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1013 gapColour.setPreferredSize(new Dimension(40, 20));
1014 gapColour.addMouseListener(new MouseAdapter()
1017 public void mousePressed(MouseEvent e)
1019 gapColour_actionPerformed(gapColour);
1023 hiddenColour.setFont(LABEL_FONT);
1024 // fixing the border colours stops apparent colour bleed from the panel
1025 hiddenColour.setBorder(
1026 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1027 hiddenColour.setPreferredSize(new Dimension(40, 20));
1028 hiddenColour.addMouseListener(new MouseAdapter()
1031 public void mousePressed(MouseEvent e)
1033 hiddenColour_actionPerformed(hiddenColour);
1037 useLegacyGap = new JCheckBox(
1038 MessageManager.getString("label.ov_legacy_gap"));
1039 useLegacyGap.setFont(LABEL_FONT);
1040 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1041 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1042 gapLabel = new JLabel(
1043 MessageManager.getString("label.gap_colour"));
1044 gapLabel.setFont(LABEL_FONT);
1045 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1046 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1047 showHiddenAtStart = new JCheckBox(
1048 MessageManager.getString("label.ov_show_hide_default"));
1049 showHiddenAtStart.setFont(LABEL_FONT);
1050 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1051 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1052 JLabel hiddenLabel = new JLabel(
1053 MessageManager.getString("label.hidden_colour"));
1054 hiddenLabel.setFont(LABEL_FONT);
1055 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1056 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1058 useLegacyGap.addActionListener(new ActionListener()
1061 public void actionPerformed(ActionEvent e)
1063 useLegacyGaps_actionPerformed(e);
1067 overviewPanel.setLayout(new GridBagLayout());
1068 GridBagConstraints c1 = new GridBagConstraints();
1070 c1.fill = GridBagConstraints.HORIZONTAL;
1075 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1076 overviewPanel.add(useLegacyGap, c1);
1078 GridBagConstraints c2 = new GridBagConstraints();
1079 c2.fill = GridBagConstraints.HORIZONTAL;
1082 c2.insets = new Insets(0, 15, 0, 10);
1083 overviewPanel.add(gapLabel, c2);
1085 GridBagConstraints c3 = new GridBagConstraints();
1086 c3.fill = GridBagConstraints.HORIZONTAL;
1089 c3.insets = new Insets(0, 0, 0, 15);
1090 overviewPanel.add(gapColour, c3);
1092 GridBagConstraints c4 = new GridBagConstraints();
1093 c4.fill = GridBagConstraints.HORIZONTAL;
1097 overviewPanel.add(showHiddenAtStart, c4);
1099 GridBagConstraints c5 = new GridBagConstraints();
1100 c5.fill = GridBagConstraints.HORIZONTAL;
1103 c5.insets = new Insets(0, 15, 0, 10);
1104 overviewPanel.add(hiddenLabel, c5);
1106 GridBagConstraints c6 = new GridBagConstraints();
1107 c6.fill = GridBagConstraints.HORIZONTAL;
1110 c6.insets = new Insets(0, 0, 0, 15);
1111 overviewPanel.add(hiddenColour, c6);
1113 JButton resetButton = new JButton(
1114 MessageManager.getString("label.reset_to_defaults"));
1116 resetButton.addActionListener(new ActionListener()
1119 public void actionPerformed(ActionEvent e)
1121 resetOvDefaults_actionPerformed(e);
1125 GridBagConstraints c7 = new GridBagConstraints();
1126 c7.fill = GridBagConstraints.NONE;
1129 c7.insets = new Insets(10, 0, 0, 0);
1130 c7.anchor = GridBagConstraints.WEST;
1131 overviewPanel.add(resetButton, c7);
1133 // Add padding so the panel doesn't look ridiculous
1134 JPanel spacePanel = new JPanel();
1135 overviewPanel.add(spacePanel,
1136 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1137 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1138 new Insets(0, 0, 0, 5), 0, 0));
1140 return overviewPanel;
1144 * Initialises the Structure tabbed panel.
1148 private JPanel initStructureTab()
1150 structureTab = new JPanel();
1152 structureTab.setBorder(new TitledBorder(
1153 MessageManager.getString("label.structure_options")));
1154 structureTab.setLayout(null);
1155 final int width = 400;
1156 final int height = 22;
1157 final int lineSpacing = 25;
1160 structFromPdb.setFont(LABEL_FONT);
1162 .setText(MessageManager.getString("label.struct_from_pdb"));
1163 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1164 structFromPdb.addActionListener(new ActionListener()
1167 public void actionPerformed(ActionEvent e)
1169 boolean selected = structFromPdb.isSelected();
1170 // enable other options only when the first is checked
1171 useRnaView.setEnabled(selected);
1172 addSecondaryStructure.setEnabled(selected);
1173 addTempFactor.setEnabled(selected);
1176 structureTab.add(structFromPdb);
1178 // indent checkboxes that are conditional on the first one
1179 ypos += lineSpacing;
1180 useRnaView.setFont(LABEL_FONT);
1181 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1182 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1183 structureTab.add(useRnaView);
1185 ypos += lineSpacing;
1186 addSecondaryStructure.setFont(LABEL_FONT);
1187 addSecondaryStructure
1188 .setText(MessageManager.getString("label.autoadd_secstr"));
1189 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1190 structureTab.add(addSecondaryStructure);
1192 ypos += lineSpacing;
1193 addTempFactor.setFont(LABEL_FONT);
1194 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1195 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1196 structureTab.add(addTempFactor);
1198 ypos += lineSpacing;
1199 JLabel viewerLabel = new JLabel();
1200 viewerLabel.setFont(LABEL_FONT);
1201 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1202 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1203 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1204 structureTab.add(viewerLabel);
1206 structViewer.setFont(LABEL_FONT);
1207 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1208 structViewer.addItem(ViewerType.JMOL.name());
1209 structViewer.addItem(ViewerType.CHIMERA.name());
1210 structViewer.addActionListener(new ActionListener()
1213 public void actionPerformed(ActionEvent e)
1215 structureViewer_actionPerformed(
1216 (String) structViewer.getSelectedItem());
1219 structureTab.add(structViewer);
1221 ypos += lineSpacing;
1222 JLabel pathLabel = new JLabel();
1223 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1224 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1225 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1226 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1227 structureTab.add(pathLabel);
1229 chimeraPath.setFont(LABEL_FONT);
1230 chimeraPath.setText("");
1231 final String tooltip = JvSwingUtils.wrapTooltip(true,
1232 MessageManager.getString("label.chimera_path_tip"));
1233 chimeraPath.setToolTipText(tooltip);
1234 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1235 chimeraPath.addMouseListener(new MouseAdapter()
1238 public void mouseClicked(MouseEvent e)
1240 if (e.getClickCount() == 2)
1242 String chosen = openFileChooser();
1245 chimeraPath.setText(chosen);
1250 structureTab.add(chimeraPath);
1252 ypos += lineSpacing;
1253 nwMapping.setFont(LABEL_FONT);
1254 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1255 siftsMapping.setFont(LABEL_FONT);
1256 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1257 mappingMethod.add(nwMapping);
1258 mappingMethod.add(siftsMapping);
1259 JPanel mappingPanel = new JPanel();
1260 mappingPanel.setFont(LABEL_FONT);
1261 TitledBorder mmTitledBorder = new TitledBorder(
1262 MessageManager.getString("label.mapping_method"));
1263 mmTitledBorder.setTitleFont(LABEL_FONT);
1264 mappingPanel.setBorder(mmTitledBorder);
1265 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1266 // GridLayout mappingLayout = new GridLayout();
1267 mappingPanel.setLayout(new GridLayout());
1268 mappingPanel.add(nwMapping);
1269 mappingPanel.add(siftsMapping);
1270 structureTab.add(mappingPanel);
1272 ypos += lineSpacing;
1273 ypos += lineSpacing;
1274 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1275 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1276 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1277 structureTab.add(docFieldPref);
1279 return structureTab;
1283 * Action on choosing a structure viewer from combobox options.
1285 * @param selectedItem
1287 protected void structureViewer_actionPerformed(String selectedItem)
1292 * Show a dialog for the user to choose a file. Returns the chosen path, or
1297 protected String openFileChooser()
1299 String choice = null;
1300 JFileChooser chooser = new JFileChooser();
1302 // chooser.setFileView(new JalviewFileView());
1303 chooser.setDialogTitle(
1304 MessageManager.getString("label.open_local_file"));
1305 chooser.setToolTipText(MessageManager.getString("action.open"));
1307 int value = chooser.showOpenDialog(this);
1309 if (value == JFileChooser.APPROVE_OPTION)
1311 choice = chooser.getSelectedFile().getPath();
1317 * Validate the structure tab preferences; if invalid, set focus on this tab.
1321 protected boolean validateStructure(FocusEvent e)
1323 if (!validateStructure())
1325 e.getComponent().requestFocusInWindow();
1331 protected boolean validateStructure()
1337 * Initialises the Visual tabbed panel.
1341 private JPanel initVisualTab()
1343 JPanel visualTab = new JPanel();
1344 visualTab.setBorder(new TitledBorder(
1345 MessageManager.getString("action.open_new_alignment")));
1346 visualTab.setLayout(null);
1347 fullScreen.setFont(LABEL_FONT);
1348 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1349 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1350 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1351 quality.setEnabled(false);
1352 quality.setFont(LABEL_FONT);
1353 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1354 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1355 quality.setSelected(true);
1356 quality.setText(MessageManager.getString("label.quality"));
1357 conservation.setEnabled(false);
1358 conservation.setFont(LABEL_FONT);
1359 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1360 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1361 conservation.setSelected(true);
1362 conservation.setText(MessageManager.getString("label.conservation"));
1363 identity.setEnabled(false);
1364 identity.setFont(LABEL_FONT);
1365 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1366 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1367 identity.setSelected(true);
1368 identity.setText(MessageManager.getString("label.consensus"));
1369 showOccupancy.setFont(LABEL_FONT);
1370 showOccupancy.setEnabled(false);
1371 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1372 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1373 showOccupancy.setSelected(true);
1374 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1376 JLabel showGroupbits = new JLabel();
1377 showGroupbits.setFont(LABEL_FONT);
1378 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1379 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1381 .setText(MessageManager.getString("action.show_group") + ":");
1382 JLabel showConsensbits = new JLabel();
1383 showConsensbits.setFont(LABEL_FONT);
1384 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1385 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1387 .setText(MessageManager.getString("label.consensus") + ":");
1388 showConsensHistogram.setEnabled(false);
1389 showConsensHistogram.setFont(LABEL_FONT);
1390 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1391 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1392 showConsensHistogram.setSelected(true);
1393 showConsensHistogram
1394 .setText(MessageManager.getString("label.histogram"));
1395 showConsensLogo.setEnabled(false);
1396 showConsensLogo.setFont(LABEL_FONT);
1397 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1398 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1399 showConsensLogo.setSelected(true);
1400 showConsensLogo.setText(MessageManager.getString("label.logo"));
1401 showGroupConsensus.setEnabled(false);
1402 showGroupConsensus.setFont(LABEL_FONT);
1403 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1404 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1405 showGroupConsensus.setSelected(true);
1406 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1407 showGroupConservation.setEnabled(false);
1408 showGroupConservation.setFont(LABEL_FONT);
1409 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1410 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1411 showGroupConservation.setSelected(true);
1412 showGroupConservation
1413 .setText(MessageManager.getString("label.conservation"));
1414 showNpTooltip.setEnabled(true);
1415 showNpTooltip.setFont(LABEL_FONT);
1416 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1417 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1418 showNpTooltip.setSelected(true);
1419 showNpTooltip.setText(
1420 MessageManager.getString("label.non_positional_features"));
1421 showDbRefTooltip.setEnabled(true);
1422 showDbRefTooltip.setFont(LABEL_FONT);
1423 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1424 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1425 showDbRefTooltip.setSelected(true);
1427 .setText(MessageManager.getString("label.database_references"));
1428 annotations.setFont(LABEL_FONT);
1429 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1430 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1431 annotations.setSelected(true);
1432 annotations.setText(MessageManager.getString("label.show_annotations"));
1433 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1434 annotations.addActionListener(new ActionListener()
1437 public void actionPerformed(ActionEvent e)
1439 annotations_actionPerformed(e);
1442 identity.addActionListener(new ActionListener()
1445 public void actionPerformed(ActionEvent e)
1447 annotations_actionPerformed(e);
1450 showGroupConsensus.addActionListener(new ActionListener()
1453 public void actionPerformed(ActionEvent e)
1455 annotations_actionPerformed(e);
1458 showUnconserved.setFont(LABEL_FONT);
1459 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1460 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1461 showUnconserved.setSelected(true);
1463 .setText(MessageManager.getString("action.show_unconserved"));
1464 showUnconserved.addActionListener(new ActionListener()
1467 public void actionPerformed(ActionEvent e)
1469 showunconserved_actionPerformed(e);
1473 // TODO these are not yet added to / action from Preferences
1474 // JCheckBox shareSelections = new JCheckBox();
1475 // shareSelections.setFont(verdana11);
1476 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1477 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1478 // shareSelections.setSelected(true);
1479 // shareSelections.setText(MessageManager
1480 // .getString("label.share_selection_across_views"));
1481 // JCheckBox followHighlight = new JCheckBox();
1482 // followHighlight.setFont(verdana11);
1483 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1484 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1485 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1486 // followHighlight.setSelected(true);
1487 // followHighlight.setText(MessageManager
1488 // .getString("label.scroll_highlighted_regions"));
1490 seqLimit.setFont(LABEL_FONT);
1491 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1492 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1493 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1494 smoothFont.setFont(LABEL_FONT);
1495 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1496 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1497 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1498 scaleProteinToCdna.setFont(LABEL_FONT);
1499 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1500 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1501 scaleProteinToCdna.setText(
1502 MessageManager.getString("label.scale_protein_to_cdna"));
1503 scaleProteinToCdna.setToolTipText(
1504 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1505 JLabel gapLabel = new JLabel();
1506 gapLabel.setFont(LABEL_FONT);
1507 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1508 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1509 JLabel fontLabel = new JLabel();
1510 fontLabel.setFont(LABEL_FONT);
1511 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1512 fontLabel.setText(MessageManager.getString("label.font"));
1513 fontSizeCB.setFont(LABEL_FONT);
1514 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1515 fontStyleCB.setFont(LABEL_FONT);
1516 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1517 fontNameCB.setFont(LABEL_FONT);
1518 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1519 gapSymbolCB.setFont(LABEL_FONT);
1520 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1521 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1522 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1523 gapSymbolCB.setRenderer(dlcr);
1525 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1526 startupCheckbox.setFont(LABEL_FONT);
1527 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1528 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1529 startupCheckbox.setSelected(true);
1530 startupFileTextfield.setFont(LABEL_FONT);
1531 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1532 final String tooltip = JvSwingUtils.wrapTooltip(true,
1533 MessageManager.getString("label.double_click_to_browse"));
1534 startupFileTextfield.setToolTipText(tooltip);
1535 startupFileTextfield.addMouseListener(new MouseAdapter()
1538 public void mouseClicked(MouseEvent e)
1540 if (e.getClickCount() > 1)
1542 startupFileTextfield_mouseClicked();
1547 sortby.setFont(LABEL_FONT);
1548 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1549 JLabel sortLabel = new JLabel();
1550 sortLabel.setFont(LABEL_FONT);
1551 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1552 sortLabel.setText(MessageManager.getString("label.sort_by"));
1553 sortAnnBy.setFont(LABEL_FONT);
1554 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1555 JLabel sortAnnLabel = new JLabel();
1556 sortAnnLabel.setFont(LABEL_FONT);
1557 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1558 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1559 sortAutocalc.setFont(LABEL_FONT);
1560 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1562 JPanel annsettingsPanel = new JPanel();
1563 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1564 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1565 annsettingsPanel.setBorder(new EtchedBorder());
1566 visualTab.add(annsettingsPanel);
1567 Border jb = new EmptyBorder(1, 1, 4, 5);
1568 annotations.setBorder(jb);
1569 showOccupancy.setBorder(jb);
1570 quality.setBorder(jb);
1571 conservation.setBorder(jb);
1572 identity.setBorder(jb);
1573 showConsensbits.setBorder(jb);
1574 showGroupbits.setBorder(jb);
1575 showGroupConsensus.setBorder(jb);
1576 showGroupConservation.setBorder(jb);
1577 showConsensHistogram.setBorder(jb);
1578 showConsensLogo.setBorder(jb);
1580 JPanel autoAnnotSettings = new JPanel();
1581 annsettingsPanel.add(autoAnnotSettings);
1582 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1583 autoAnnotSettings.add(annotations);
1584 autoAnnotSettings.add(quality);
1585 // second row of autoannotation box
1586 autoAnnotSettings = new JPanel();
1587 annsettingsPanel.add(autoAnnotSettings);
1589 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1590 autoAnnotSettings.add(conservation);
1591 autoAnnotSettings.add(identity);
1592 autoAnnotSettings.add(showOccupancy);
1593 autoAnnotSettings.add(showGroupbits);
1594 autoAnnotSettings.add(showGroupConservation);
1595 autoAnnotSettings.add(showGroupConsensus);
1596 autoAnnotSettings.add(showConsensbits);
1597 autoAnnotSettings.add(showConsensHistogram);
1598 autoAnnotSettings.add(showConsensLogo);
1600 JPanel tooltipSettings = new JPanel();
1601 tooltipSettings.setBorder(new TitledBorder(
1602 MessageManager.getString("label.sequence_id_tooltip")));
1603 tooltipSettings.setBounds(173, 140, 220, 62);
1604 tooltipSettings.setLayout(new GridLayout(2, 1));
1605 tooltipSettings.add(showDbRefTooltip);
1606 tooltipSettings.add(showNpTooltip);
1607 visualTab.add(tooltipSettings);
1609 wrap.setFont(LABEL_FONT);
1610 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1611 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1612 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1613 rightAlign.setFont(LABEL_FONT);
1614 rightAlign.setForeground(Color.black);
1615 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1616 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1617 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1618 idItalics.setFont(LABEL_FONT_ITALIC);
1619 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1620 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1622 MessageManager.getString("label.sequence_name_italics"));
1623 openoverv.setFont(LABEL_FONT);
1624 openoverv.setActionCommand(
1625 MessageManager.getString("label.open_overview"));
1626 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1627 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1628 openoverv.setText(MessageManager.getString("label.open_overview"));
1629 JPanel jPanel2 = new JPanel();
1630 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1631 jPanel2.setLayout(new GridLayout(14, 1));
1632 jPanel2.add(fullScreen);
1633 jPanel2.add(openoverv);
1634 jPanel2.add(seqLimit);
1635 jPanel2.add(rightAlign);
1636 jPanel2.add(fontLabel);
1637 jPanel2.add(showUnconserved);
1638 jPanel2.add(idItalics);
1639 jPanel2.add(smoothFont);
1640 jPanel2.add(scaleProteinToCdna);
1641 jPanel2.add(gapLabel);
1643 jPanel2.add(sortLabel);
1644 jPanel2.add(sortAnnLabel);
1645 jPanel2.add(startupCheckbox);
1646 visualTab.add(jPanel2);
1647 visualTab.add(startupFileTextfield);
1648 visualTab.add(sortby);
1649 visualTab.add(sortAnnBy);
1650 visualTab.add(sortAutocalc);
1651 visualTab.add(gapSymbolCB);
1652 visualTab.add(fontNameCB);
1653 visualTab.add(fontSizeCB);
1654 visualTab.add(fontStyleCB);
1658 protected void autoIdWidth_actionPerformed()
1660 // TODO Auto-generated method stub
1664 protected void userIdWidth_actionPerformed()
1666 // TODO Auto-generated method stub
1670 protected void maxColour_actionPerformed(JPanel panel)
1674 protected void minColour_actionPerformed(JPanel panel)
1678 protected void gapColour_actionPerformed(JPanel panel)
1682 protected void hiddenColour_actionPerformed(JPanel panel)
1686 protected void showunconserved_actionPerformed(ActionEvent e)
1688 // TODO Auto-generated method stub
1692 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1696 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1706 public void ok_actionPerformed(ActionEvent e)
1716 public void cancel_actionPerformed(ActionEvent e)
1726 public void annotations_actionPerformed(ActionEvent e)
1733 public void startupFileTextfield_mouseClicked()
1737 public void newLink_actionPerformed(ActionEvent e)
1742 public void editLink_actionPerformed(ActionEvent e)
1747 public void deleteLink_actionPerformed(ActionEvent e)
1752 public void defaultBrowser_mouseClicked(MouseEvent e)
1757 public void linkURLList_keyTyped(KeyEvent e)
1762 public void useProxy_actionPerformed()
1764 boolean enabled = useProxy.isSelected();
1765 portLabel.setEnabled(enabled);
1766 serverLabel.setEnabled(enabled);
1767 proxyServerTB.setEnabled(enabled);
1768 proxyPortTB.setEnabled(enabled);
1772 * Customer renderer for JTable: supports column of radio buttons
1774 public class RadioButtonRenderer extends JRadioButton
1775 implements TableCellRenderer
1777 public RadioButtonRenderer()
1779 setHorizontalAlignment(CENTER);
1780 setToolTipText(MessageManager.getString("label.urltooltip"));
1784 public Component getTableCellRendererComponent(JTable table,
1785 Object value, boolean isSelected, boolean hasFocus, int row,
1788 setSelected((boolean) value);
1790 // set colours to match rest of table
1793 setBackground(table.getSelectionBackground());
1794 setForeground(table.getSelectionForeground());
1798 setBackground(table.getBackground());
1799 setForeground(table.getForeground());
1806 * Customer cell editor for JTable: supports column of radio buttons in
1807 * conjunction with renderer
1809 public class RadioButtonEditor extends AbstractCellEditor
1810 implements TableCellEditor
1812 private JRadioButton button = new JRadioButton();
1814 public RadioButtonEditor()
1816 button.setHorizontalAlignment(SwingConstants.CENTER);
1817 this.button.addActionListener(new ActionListener()
1820 public void actionPerformed(ActionEvent e)
1822 fireEditingStopped();
1828 public Component getTableCellEditorComponent(JTable table, Object value,
1829 boolean isSelected, int row, int column)
1831 button.setSelected((boolean) value);
1836 public Object getCellEditorValue()
1838 return button.isSelected();