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 JLabel userIdWidthlabel = new JLabel();
236 protected JCheckBox autoIdWidth = new JCheckBox();
238 protected JTextField userIdWidth = new JTextField();
240 protected JCheckBox blcjv = new JCheckBox();
242 protected JCheckBox pileupjv = new JCheckBox();
244 protected JCheckBox clustaljv = new JCheckBox();
246 protected JCheckBox msfjv = new JCheckBox();
248 protected JCheckBox fastajv = new JCheckBox();
250 protected JCheckBox pfamjv = new JCheckBox();
252 protected JCheckBox pirjv = new JCheckBox();
254 protected JCheckBox modellerOutput = new JCheckBox();
256 protected JCheckBox embbedBioJSON = new JCheckBox();
259 * Editing tab components
261 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
263 protected JCheckBox padGaps = new JCheckBox();
265 protected JCheckBox sortByTree = new JCheckBox();
271 protected JPanel wsTab = new JPanel();
274 * Creates a new GPreferences object.
276 public GPreferences()
281 } catch (Exception ex)
283 ex.printStackTrace();
288 * Construct the panel and its tabbed sub-panels.
292 private void jbInit() throws Exception
294 final JTabbedPane tabbedPane = new JTabbedPane();
295 this.setLayout(new BorderLayout());
296 JPanel okCancelPanel = initOkCancelPanel();
297 this.add(tabbedPane, BorderLayout.CENTER);
298 this.add(okCancelPanel, BorderLayout.SOUTH);
300 tabbedPane.add(initVisualTab(),
301 MessageManager.getString("label.visual"));
303 tabbedPane.add(initColoursTab(),
304 MessageManager.getString("label.colours"));
306 tabbedPane.add(initOverviewTab(),
307 MessageManager.getString("label.overview"));
309 tabbedPane.add(initStructureTab(),
310 MessageManager.getString("label.structure"));
312 tabbedPane.add(initConnectionsTab(),
313 MessageManager.getString("label.connections"));
315 tabbedPane.add(initLinksTab(),
316 MessageManager.getString("label.urllinks"));
318 tabbedPane.add(initOutputTab(),
319 MessageManager.getString("label.output"));
321 tabbedPane.add(initEditingTab(),
322 MessageManager.getString("label.editing"));
325 * See WsPreferences for the real work of configuring this tab.
327 wsTab.setLayout(new BorderLayout());
328 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
331 * Handler to validate a tab before leaving it - currently only for
334 tabbedPane.addChangeListener(new ChangeListener()
336 private Component lastTab;
339 public void stateChanged(ChangeEvent e)
341 if (lastTab == structureTab
342 && tabbedPane.getSelectedComponent() != structureTab)
344 if (!validateStructure())
346 tabbedPane.setSelectedComponent(structureTab);
350 lastTab = tabbedPane.getSelectedComponent();
357 * Initialises the Editing tabbed panel.
361 private JPanel initEditingTab()
363 JPanel editingTab = new JPanel();
364 editingTab.setLayout(null);
365 autoCalculateConsCheck.setFont(LABEL_FONT);
366 autoCalculateConsCheck.setText(
367 MessageManager.getString("label.autocalculate_consensus"));
368 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
369 padGaps.setFont(LABEL_FONT);
371 MessageManager.getString("label.pad_gaps_when_editing"));
372 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
373 sortByTree.setFont(LABEL_FONT);
375 .setText(MessageManager.getString("label.sort_with_new_tree"));
376 sortByTree.setToolTipText(MessageManager.getString(
377 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
378 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
379 editingTab.add(autoCalculateConsCheck);
380 editingTab.add(padGaps);
381 editingTab.add(sortByTree);
386 * Initialises the Output tabbed panel.
390 private JPanel initOutputTab()
392 JPanel outputTab = new JPanel();
393 outputTab.setLayout(null);
394 JLabel epsLabel = new JLabel();
395 epsLabel.setFont(LABEL_FONT);
396 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
397 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
398 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
399 epsRendering.setFont(LABEL_FONT);
400 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
401 JLabel jLabel1 = new JLabel();
402 jLabel1.setFont(LABEL_FONT);
403 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
404 jLabel1.setText(MessageManager.getString("label.append_start_end"));
405 jLabel1.setFont(LABEL_FONT);
406 fastajv.setFont(LABEL_FONT);
407 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
408 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
409 blcjv.setText(MessageManager.getString("label.blc") + " ");
410 fastajv.setText(MessageManager.getString("label.fasta") + " ");
411 msfjv.setText(MessageManager.getString("label.msf") + " ");
412 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
413 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
414 msfjv.setFont(LABEL_FONT);
415 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
416 pirjv.setText(MessageManager.getString("label.pir") + " ");
417 JPanel jPanel11 = new JPanel();
418 jPanel11.setFont(LABEL_FONT);
419 TitledBorder titledBorder2 = new TitledBorder(
420 MessageManager.getString("label.file_output"));
421 jPanel11.setBorder(titledBorder2);
422 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
423 GridLayout gridLayout3 = new GridLayout();
424 jPanel11.setLayout(gridLayout3);
425 gridLayout3.setRows(8);
426 blcjv.setFont(LABEL_FONT);
427 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
428 clustaljv.setFont(LABEL_FONT);
429 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
430 pfamjv.setFont(LABEL_FONT);
431 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
432 pileupjv.setFont(LABEL_FONT);
433 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
434 pirjv.setFont(LABEL_FONT);
435 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
436 autoIdWidth.setFont(LABEL_FONT);
438 MessageManager.getString("label.automatically_set_id_width"));
439 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
440 .getString("label.adjusts_width_generated_eps_png")));
441 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
442 autoIdWidth.addActionListener(new ActionListener()
446 public void actionPerformed(ActionEvent e)
448 autoIdWidth_actionPerformed();
451 userIdWidthlabel.setFont(LABEL_FONT);
452 userIdWidthlabel.setText(
453 MessageManager.getString("label.figure_id_column_width"));
454 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
455 .getString("label.manually_specify_width_left_column")));
456 userIdWidthlabel.setToolTipText(
457 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
458 "label.manually_specify_width_left_column")));
459 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
460 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
461 userIdWidth.setText("");
462 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
463 userIdWidth.addActionListener(new ActionListener()
467 public void actionPerformed(ActionEvent e)
469 userIdWidth_actionPerformed();
472 modellerOutput.setFont(LABEL_FONT);
474 .setText(MessageManager.getString("label.use_modeller_output"));
475 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
476 embbedBioJSON.setFont(LABEL_FONT);
477 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
478 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
480 jPanel11.add(jLabel1);
482 jPanel11.add(clustaljv);
483 jPanel11.add(fastajv);
485 jPanel11.add(pfamjv);
486 jPanel11.add(pileupjv);
488 outputTab.add(autoIdWidth);
489 outputTab.add(userIdWidth);
490 outputTab.add(userIdWidthlabel);
491 outputTab.add(modellerOutput);
492 outputTab.add(embbedBioJSON);
493 outputTab.add(epsLabel);
494 outputTab.add(epsRendering);
495 outputTab.add(jPanel11);
500 * Initialises the Connections tabbed panel.
504 private JPanel initConnectionsTab()
506 JPanel connectTab = new JPanel();
507 connectTab.setLayout(new GridBagLayout());
509 // Label for browser text box
510 JLabel browserLabel = new JLabel();
511 browserLabel.setFont(LABEL_FONT);
512 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
513 browserLabel.setText(
514 MessageManager.getString("label.default_browser_unix"));
515 defaultBrowser.setFont(LABEL_FONT);
516 defaultBrowser.setText("");
517 final String tooltip = JvSwingUtils.wrapTooltip(true,
518 MessageManager.getString("label.double_click_to_browse"));
519 defaultBrowser.setToolTipText(tooltip);
520 defaultBrowser.addMouseListener(new MouseAdapter()
523 public void mouseClicked(MouseEvent e)
525 if (e.getClickCount() > 1)
527 defaultBrowser_mouseClicked(e);
532 JPanel proxyPanel = initConnTabProxyPanel();
533 initConnTabCheckboxes();
535 // Add default Browser text box
536 connectTab.add(browserLabel,
537 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
538 GridBagConstraints.WEST, GridBagConstraints.NONE,
539 new Insets(10, 0, 5, 5), 5, 1));
540 defaultBrowser.setFont(LABEL_FONT);
541 defaultBrowser.setText("");
543 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
544 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
545 new Insets(10, 0, 5, 10), 30, 1));
547 // Add proxy server panel
548 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
549 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
550 new Insets(10, 0, 5, 12), 4, 10));
552 // Add usage stats, version check and questionnaire checkboxes
553 connectTab.add(usagestats,
554 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
555 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
556 new Insets(0, 2, 5, 5), 70, 1));
557 connectTab.add(questionnaire,
558 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
559 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
560 new Insets(0, 2, 5, 10), 70, 1));
561 connectTab.add(versioncheck,
562 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
563 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
564 new Insets(0, 2, 5, 5), 70, 1));
566 // Add padding so the panel doesn't look ridiculous
567 JPanel spacePanel = new JPanel();
568 connectTab.add(spacePanel,
569 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
570 GridBagConstraints.WEST, GridBagConstraints.BOTH,
571 new Insets(0, 0, 0, 5), 70, 1));
577 * Initialises the Links tabbed panel.
581 private JPanel initLinksTab()
583 JPanel linkTab = new JPanel();
584 linkTab.setLayout(new GridBagLayout());
586 // Set up table for Url links
587 linkUrlTable.setFillsViewportHeight(true);
588 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
589 linkUrlTable.setAutoCreateRowSorter(true);
590 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
592 // adjust row height so radio buttons actually fit
593 // don't do this in the renderer, it causes the awt thread to activate
595 JRadioButton temp = new JRadioButton();
596 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
598 // Table in scrollpane so that the table is given a scrollbar
599 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
600 linkScrollPane.setBorder(null);
602 // Panel for links functionality
603 JPanel linkPanel = new JPanel(new GridBagLayout());
604 linkPanel.setBorder(new TitledBorder(
605 MessageManager.getString("label.url_linkfrom_sequence_id")));
607 // Put the Url links panel together
609 // Buttons go at top right, resizing only resizes the blank space vertically
610 JPanel buttonPanel = initLinkTabUrlButtons();
611 GridBagConstraints linkConstraints1 = new GridBagConstraints();
612 linkConstraints1.insets = new Insets(0, 0, 5, 0);
613 linkConstraints1.gridx = 0;
614 linkConstraints1.gridy = 0;
615 linkConstraints1.weightx = 1.0;
616 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
617 linkTab.add(buttonPanel, linkConstraints1);
619 // Links table goes at top left, resizing resizes the table
620 GridBagConstraints linkConstraints2 = new GridBagConstraints();
621 linkConstraints2.insets = new Insets(0, 0, 5, 5);
622 linkConstraints2.gridx = 0;
623 linkConstraints2.gridy = 1;
624 linkConstraints2.weightx = 1.0;
625 linkConstraints2.weighty = 1.0;
626 linkConstraints2.fill = GridBagConstraints.BOTH;
627 linkTab.add(linkScrollPane, linkConstraints2);
629 // Filter box and buttons goes at bottom left, resizing resizes the text box
630 JPanel filterPanel = initLinkTabFilterPanel();
631 GridBagConstraints linkConstraints3 = new GridBagConstraints();
632 linkConstraints3.insets = new Insets(0, 0, 0, 5);
633 linkConstraints3.gridx = 0;
634 linkConstraints3.gridy = 2;
635 linkConstraints3.weightx = 1.0;
636 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
637 linkTab.add(filterPanel, linkConstraints3);
642 private JPanel initLinkTabFilterPanel()
644 // Filter textbox and reset button
645 JLabel filterLabel = new JLabel(
646 MessageManager.getString("label.filter"));
647 filterLabel.setFont(LABEL_FONT);
648 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
649 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
651 filterTB.setFont(LABEL_FONT);
652 filterTB.setText("");
654 doReset.setText(MessageManager.getString("action.showall"));
655 userOnly.setText(MessageManager.getString("action.customfilter"));
657 // Panel for filter functionality
658 JPanel filterPanel = new JPanel(new GridBagLayout());
659 filterPanel.setBorder(new TitledBorder("Filter"));
660 GridBagConstraints gbc = new GridBagConstraints();
663 gbc.fill = GridBagConstraints.NONE;
664 gbc.anchor = GridBagConstraints.WEST;
666 filterPanel.add(filterLabel, gbc);
668 GridBagConstraints gbc1 = new GridBagConstraints();
671 gbc1.fill = GridBagConstraints.HORIZONTAL;
672 gbc1.anchor = GridBagConstraints.WEST;
674 filterPanel.add(filterTB, gbc1);
676 GridBagConstraints gbc2 = new GridBagConstraints();
678 gbc2.fill = GridBagConstraints.NONE;
679 gbc2.anchor = GridBagConstraints.WEST;
680 filterPanel.add(doReset, gbc2);
682 GridBagConstraints gbc3 = new GridBagConstraints();
684 gbc3.fill = GridBagConstraints.NONE;
685 gbc3.anchor = GridBagConstraints.WEST;
686 filterPanel.add(userOnly, gbc3);
691 private JPanel initLinkTabUrlButtons()
693 // Buttons for new / edit / delete Url links
694 JButton newLink = new JButton();
695 newLink.setText(MessageManager.getString("action.new"));
697 editLink.setText(MessageManager.getString("action.edit"));
699 deleteLink.setText(MessageManager.getString("action.delete"));
701 // no current selection, so initially disable delete/edit buttons
702 editLink.setEnabled(false);
703 deleteLink.setEnabled(false);
705 newLink.addActionListener(new java.awt.event.ActionListener()
708 public void actionPerformed(ActionEvent e)
710 newLink_actionPerformed(e);
714 editLink.setText(MessageManager.getString("action.edit"));
715 editLink.addActionListener(new java.awt.event.ActionListener()
718 public void actionPerformed(ActionEvent e)
720 editLink_actionPerformed(e);
724 deleteLink.setText(MessageManager.getString("action.delete"));
725 deleteLink.addActionListener(new java.awt.event.ActionListener()
728 public void actionPerformed(ActionEvent e)
730 deleteLink_actionPerformed(e);
734 JPanel buttonPanel = new JPanel(new GridBagLayout());
735 buttonPanel.setBorder(new TitledBorder("Edit links"));
736 GridBagConstraints gbc = new GridBagConstraints();
739 gbc.fill = GridBagConstraints.NONE;
740 buttonPanel.add(newLink, gbc);
742 GridBagConstraints gbc1 = new GridBagConstraints();
745 gbc1.fill = GridBagConstraints.NONE;
746 buttonPanel.add(editLink, gbc1);
748 GridBagConstraints gbc2 = new GridBagConstraints();
751 gbc2.fill = GridBagConstraints.NONE;
752 buttonPanel.add(deleteLink, gbc2);
754 GridBagConstraints gbc3 = new GridBagConstraints();
757 gbc3.fill = GridBagConstraints.HORIZONTAL;
759 JPanel spacePanel = new JPanel();
760 spacePanel.setBorder(null);
761 buttonPanel.add(spacePanel, gbc3);
767 * Initialises the proxy server panel in the Connections tab
769 * @return the proxy server panel
771 private JPanel initConnTabProxyPanel()
773 // Label for server text box
774 serverLabel.setText(MessageManager.getString("label.address"));
775 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
776 serverLabel.setFont(LABEL_FONT);
778 // Proxy server and port text boxes
779 proxyServerTB.setFont(LABEL_FONT);
780 proxyPortTB.setFont(LABEL_FONT);
782 // Label for Port text box
783 portLabel.setFont(LABEL_FONT);
784 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
785 portLabel.setText(MessageManager.getString("label.port"));
787 // Use proxy server checkbox
788 useProxy.setFont(LABEL_FONT);
789 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
790 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
791 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
792 useProxy.addActionListener(new ActionListener()
795 public void actionPerformed(ActionEvent e)
797 useProxy_actionPerformed();
801 // Make proxy server panel
802 JPanel proxyPanel = new JPanel();
803 TitledBorder titledBorder1 = new TitledBorder(
804 MessageManager.getString("label.proxy_server"));
805 proxyPanel.setBorder(titledBorder1);
806 proxyPanel.setLayout(new GridBagLayout());
807 proxyPanel.add(serverLabel,
808 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
809 GridBagConstraints.WEST, GridBagConstraints.NONE,
810 new Insets(0, 2, 2, 0), 5, 0));
811 proxyPanel.add(portLabel,
812 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
813 GridBagConstraints.WEST, GridBagConstraints.NONE,
814 new Insets(0, 0, 2, 0), 11, 0));
815 proxyPanel.add(useProxy,
816 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
817 GridBagConstraints.WEST, GridBagConstraints.NONE,
818 new Insets(0, 2, 5, 185), 2, -4));
819 proxyPanel.add(proxyPortTB,
820 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
821 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
822 new Insets(0, 2, 2, 2), 54, 1));
823 proxyPanel.add(proxyServerTB,
824 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
825 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
826 new Insets(0, 2, 2, 0), 263, 1));
832 * Initialises the checkboxes in the Connections tab
834 private void initConnTabCheckboxes()
836 // Usage stats checkbox label
838 MessageManager.getString("label.send_usage_statistics"));
839 usagestats.setFont(LABEL_FONT);
840 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
841 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
843 // Questionnaire checkbox label
844 questionnaire.setText(
845 MessageManager.getString("label.check_for_questionnaires"));
846 questionnaire.setFont(LABEL_FONT);
847 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
848 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
850 // Check for latest version checkbox label
851 versioncheck.setText(
852 MessageManager.getString("label.check_for_latest_version"));
853 versioncheck.setFont(LABEL_FONT);
854 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
855 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
859 * Initialises the parent panel which contains the tabbed sections.
863 private JPanel initOkCancelPanel()
865 JButton ok = new JButton();
866 ok.setText(MessageManager.getString("action.ok"));
867 ok.addActionListener(new ActionListener()
870 public void actionPerformed(ActionEvent e)
872 ok_actionPerformed(e);
875 JButton cancel = new JButton();
876 cancel.setText(MessageManager.getString("action.cancel"));
877 cancel.addActionListener(new ActionListener()
880 public void actionPerformed(ActionEvent e)
882 cancel_actionPerformed(e);
885 JPanel okCancelPanel = new JPanel();
886 okCancelPanel.add(ok);
887 okCancelPanel.add(cancel);
888 return okCancelPanel;
892 * Initialises the Colours tabbed panel.
896 private JPanel initColoursTab()
898 JPanel coloursTab = new JPanel();
899 coloursTab.setBorder(new TitledBorder(
900 MessageManager.getString("action.open_new_alignment")));
901 coloursTab.setLayout(new FlowLayout());
902 JLabel mincolourLabel = new JLabel();
903 mincolourLabel.setFont(LABEL_FONT);
904 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
905 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
906 minColour.setFont(LABEL_FONT);
907 minColour.setBorder(BorderFactory.createEtchedBorder());
908 minColour.setPreferredSize(new Dimension(40, 20));
909 minColour.addMouseListener(new MouseAdapter()
912 public void mousePressed(MouseEvent e)
914 minColour_actionPerformed(minColour);
917 JLabel maxcolourLabel = new JLabel();
918 maxcolourLabel.setFont(LABEL_FONT);
919 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
920 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
921 maxColour.setFont(LABEL_FONT);
922 maxColour.setBorder(BorderFactory.createEtchedBorder());
923 maxColour.setPreferredSize(new Dimension(40, 20));
924 maxColour.addMouseListener(new MouseAdapter()
927 public void mousePressed(MouseEvent e)
929 maxColour_actionPerformed(maxColour);
933 protColour.setFont(LABEL_FONT);
934 protColour.setBounds(new Rectangle(172, 225, 155, 21));
935 JLabel protColourLabel = new JLabel();
936 protColourLabel.setFont(LABEL_FONT);
937 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
938 protColourLabel.setText(
939 MessageManager.getString("label.prot_alignment_colour") + " ");
940 JvSwingUtils.addtoLayout(coloursTab,
942 .getString("label.default_colour_scheme_for_alignment"),
943 protColourLabel, protColour);
945 nucColour.setFont(LABEL_FONT);
946 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
947 JLabel nucColourLabel = new JLabel();
948 nucColourLabel.setFont(LABEL_FONT);
949 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
950 nucColourLabel.setText(
951 MessageManager.getString("label.nuc_alignment_colour") + " ");
952 JvSwingUtils.addtoLayout(coloursTab,
954 .getString("label.default_colour_scheme_for_alignment"),
955 nucColourLabel, nucColour);
957 JPanel annotationShding = new JPanel();
958 annotationShding.setBorder(new TitledBorder(
959 MessageManager.getString("label.annotation_shading_default")));
960 annotationShding.setLayout(new GridLayout(1, 2));
961 JvSwingUtils.addtoLayout(annotationShding,
962 MessageManager.getString(
963 "label.default_minimum_colour_annotation_shading"),
964 mincolourLabel, minColour);
965 JvSwingUtils.addtoLayout(annotationShding,
966 MessageManager.getString(
967 "label.default_maximum_colour_annotation_shading"),
968 maxcolourLabel, maxColour);
969 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
974 * Initialises the Overview tabbed panel.
978 private JPanel initOverviewTab()
980 JPanel overviewPanel = new JPanel();
981 overviewPanel.setBorder(new TitledBorder(
982 MessageManager.getString("label.overview_settings")));
984 gapColour.setFont(LABEL_FONT);
985 // fixing the border colours stops apparent colour bleed from the panel
987 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
988 gapColour.setPreferredSize(new Dimension(40, 20));
989 gapColour.addMouseListener(new MouseAdapter()
992 public void mousePressed(MouseEvent e)
994 gapColour_actionPerformed(gapColour);
998 hiddenColour.setFont(LABEL_FONT);
999 // fixing the border colours stops apparent colour bleed from the panel
1000 hiddenColour.setBorder(
1001 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1002 hiddenColour.setPreferredSize(new Dimension(40, 20));
1003 hiddenColour.addMouseListener(new MouseAdapter()
1006 public void mousePressed(MouseEvent e)
1008 hiddenColour_actionPerformed(hiddenColour);
1012 useLegacyGap = new JCheckBox(
1013 MessageManager.getString("label.ov_legacy_gap"));
1014 useLegacyGap.setFont(LABEL_FONT);
1015 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1016 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1017 gapLabel = new JLabel(
1018 MessageManager.getString("label.gap_colour"));
1019 gapLabel.setFont(LABEL_FONT);
1020 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1021 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1022 showHiddenAtStart = new JCheckBox(
1023 MessageManager.getString("label.ov_show_hide_default"));
1024 showHiddenAtStart.setFont(LABEL_FONT);
1025 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1026 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1027 JLabel hiddenLabel = new JLabel(
1028 MessageManager.getString("label.hidden_colour"));
1029 hiddenLabel.setFont(LABEL_FONT);
1030 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1031 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1033 useLegacyGap.addActionListener(new ActionListener()
1036 public void actionPerformed(ActionEvent e)
1038 useLegacyGaps_actionPerformed(e);
1042 overviewPanel.setLayout(new GridBagLayout());
1043 GridBagConstraints c1 = new GridBagConstraints();
1045 c1.fill = GridBagConstraints.HORIZONTAL;
1050 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1051 overviewPanel.add(useLegacyGap, c1);
1053 GridBagConstraints c2 = new GridBagConstraints();
1054 c2.fill = GridBagConstraints.HORIZONTAL;
1057 c2.insets = new Insets(0, 15, 0, 10);
1058 overviewPanel.add(gapLabel, c2);
1060 GridBagConstraints c3 = new GridBagConstraints();
1061 c3.fill = GridBagConstraints.HORIZONTAL;
1064 c3.insets = new Insets(0, 0, 0, 15);
1065 overviewPanel.add(gapColour, c3);
1067 GridBagConstraints c4 = new GridBagConstraints();
1068 c4.fill = GridBagConstraints.HORIZONTAL;
1072 overviewPanel.add(showHiddenAtStart, c4);
1074 GridBagConstraints c5 = new GridBagConstraints();
1075 c5.fill = GridBagConstraints.HORIZONTAL;
1078 c5.insets = new Insets(0, 15, 0, 10);
1079 overviewPanel.add(hiddenLabel, c5);
1081 GridBagConstraints c6 = new GridBagConstraints();
1082 c6.fill = GridBagConstraints.HORIZONTAL;
1085 c6.insets = new Insets(0, 0, 0, 15);
1086 overviewPanel.add(hiddenColour, c6);
1088 JButton resetButton = new JButton(
1089 MessageManager.getString("label.reset_to_defaults"));
1091 resetButton.addActionListener(new ActionListener()
1094 public void actionPerformed(ActionEvent e)
1096 resetOvDefaults_actionPerformed(e);
1100 GridBagConstraints c7 = new GridBagConstraints();
1101 c7.fill = GridBagConstraints.NONE;
1104 c7.insets = new Insets(10, 0, 0, 0);
1105 c7.anchor = GridBagConstraints.WEST;
1106 overviewPanel.add(resetButton, c7);
1108 // Add padding so the panel doesn't look ridiculous
1109 JPanel spacePanel = new JPanel();
1110 overviewPanel.add(spacePanel,
1111 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1112 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1113 new Insets(0, 0, 0, 5), 0, 0));
1115 return overviewPanel;
1119 * Initialises the Structure tabbed panel.
1123 private JPanel initStructureTab()
1125 structureTab = new JPanel();
1127 structureTab.setBorder(new TitledBorder(
1128 MessageManager.getString("label.structure_options")));
1129 structureTab.setLayout(null);
1130 final int width = 400;
1131 final int height = 22;
1132 final int lineSpacing = 25;
1135 structFromPdb.setFont(LABEL_FONT);
1137 .setText(MessageManager.getString("label.struct_from_pdb"));
1138 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1139 structFromPdb.addActionListener(new ActionListener()
1142 public void actionPerformed(ActionEvent e)
1144 boolean selected = structFromPdb.isSelected();
1145 // enable other options only when the first is checked
1146 useRnaView.setEnabled(selected);
1147 addSecondaryStructure.setEnabled(selected);
1148 addTempFactor.setEnabled(selected);
1151 structureTab.add(structFromPdb);
1153 // indent checkboxes that are conditional on the first one
1154 ypos += lineSpacing;
1155 useRnaView.setFont(LABEL_FONT);
1156 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1157 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1158 structureTab.add(useRnaView);
1160 ypos += lineSpacing;
1161 addSecondaryStructure.setFont(LABEL_FONT);
1162 addSecondaryStructure
1163 .setText(MessageManager.getString("label.autoadd_secstr"));
1164 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1165 structureTab.add(addSecondaryStructure);
1167 ypos += lineSpacing;
1168 addTempFactor.setFont(LABEL_FONT);
1169 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1170 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1171 structureTab.add(addTempFactor);
1173 ypos += lineSpacing;
1174 JLabel viewerLabel = new JLabel();
1175 viewerLabel.setFont(LABEL_FONT);
1176 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1177 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1178 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1179 structureTab.add(viewerLabel);
1181 structViewer.setFont(LABEL_FONT);
1182 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1183 structViewer.addItem(ViewerType.JMOL.name());
1184 structViewer.addItem(ViewerType.CHIMERA.name());
1185 structViewer.addActionListener(new ActionListener()
1188 public void actionPerformed(ActionEvent e)
1190 structureViewer_actionPerformed(
1191 (String) structViewer.getSelectedItem());
1194 structureTab.add(structViewer);
1196 ypos += lineSpacing;
1197 JLabel pathLabel = new JLabel();
1198 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1199 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1200 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1201 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1202 structureTab.add(pathLabel);
1204 chimeraPath.setFont(LABEL_FONT);
1205 chimeraPath.setText("");
1206 final String tooltip = JvSwingUtils.wrapTooltip(true,
1207 MessageManager.getString("label.chimera_path_tip"));
1208 chimeraPath.setToolTipText(tooltip);
1209 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1210 chimeraPath.addMouseListener(new MouseAdapter()
1213 public void mouseClicked(MouseEvent e)
1215 if (e.getClickCount() == 2)
1217 String chosen = openFileChooser();
1220 chimeraPath.setText(chosen);
1225 structureTab.add(chimeraPath);
1227 ypos += lineSpacing;
1228 nwMapping.setFont(LABEL_FONT);
1229 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1230 siftsMapping.setFont(LABEL_FONT);
1231 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1232 mappingMethod.add(nwMapping);
1233 mappingMethod.add(siftsMapping);
1234 JPanel mappingPanel = new JPanel();
1235 mappingPanel.setFont(LABEL_FONT);
1236 TitledBorder mmTitledBorder = new TitledBorder(
1237 MessageManager.getString("label.mapping_method"));
1238 mmTitledBorder.setTitleFont(LABEL_FONT);
1239 mappingPanel.setBorder(mmTitledBorder);
1240 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1241 // GridLayout mappingLayout = new GridLayout();
1242 mappingPanel.setLayout(new GridLayout());
1243 mappingPanel.add(nwMapping);
1244 mappingPanel.add(siftsMapping);
1245 structureTab.add(mappingPanel);
1247 ypos += lineSpacing;
1248 ypos += lineSpacing;
1249 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1250 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1251 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1252 structureTab.add(docFieldPref);
1254 return structureTab;
1258 * Action on choosing a structure viewer from combobox options.
1260 * @param selectedItem
1262 protected void structureViewer_actionPerformed(String selectedItem)
1267 * Show a dialog for the user to choose a file. Returns the chosen path, or
1272 protected String openFileChooser()
1274 String choice = null;
1275 JFileChooser chooser = new JFileChooser();
1277 // chooser.setFileView(new JalviewFileView());
1278 chooser.setDialogTitle(
1279 MessageManager.getString("label.open_local_file"));
1280 chooser.setToolTipText(MessageManager.getString("action.open"));
1282 int value = chooser.showOpenDialog(this);
1284 if (value == JFileChooser.APPROVE_OPTION)
1286 choice = chooser.getSelectedFile().getPath();
1292 * Validate the structure tab preferences; if invalid, set focus on this tab.
1296 protected boolean validateStructure(FocusEvent e)
1298 if (!validateStructure())
1300 e.getComponent().requestFocusInWindow();
1306 protected boolean validateStructure()
1312 * Initialises the Visual tabbed panel.
1316 private JPanel initVisualTab()
1318 JPanel visualTab = new JPanel();
1319 visualTab.setBorder(new TitledBorder(
1320 MessageManager.getString("action.open_new_alignment")));
1321 visualTab.setLayout(null);
1322 fullScreen.setFont(LABEL_FONT);
1323 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1324 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1325 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1326 quality.setEnabled(false);
1327 quality.setFont(LABEL_FONT);
1328 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1329 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1330 quality.setSelected(true);
1331 quality.setText(MessageManager.getString("label.quality"));
1332 conservation.setEnabled(false);
1333 conservation.setFont(LABEL_FONT);
1334 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1335 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1336 conservation.setSelected(true);
1337 conservation.setText(MessageManager.getString("label.conservation"));
1338 identity.setEnabled(false);
1339 identity.setFont(LABEL_FONT);
1340 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1341 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1342 identity.setSelected(true);
1343 identity.setText(MessageManager.getString("label.consensus"));
1344 showOccupancy.setFont(LABEL_FONT);
1345 showOccupancy.setEnabled(false);
1346 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1347 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1348 showOccupancy.setSelected(true);
1349 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1351 JLabel showGroupbits = new JLabel();
1352 showGroupbits.setFont(LABEL_FONT);
1353 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1354 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1356 .setText(MessageManager.getString("action.show_group") + ":");
1357 JLabel showConsensbits = new JLabel();
1358 showConsensbits.setFont(LABEL_FONT);
1359 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1360 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1362 .setText(MessageManager.getString("label.consensus") + ":");
1363 showConsensHistogram.setEnabled(false);
1364 showConsensHistogram.setFont(LABEL_FONT);
1365 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1366 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1367 showConsensHistogram.setSelected(true);
1368 showConsensHistogram
1369 .setText(MessageManager.getString("label.histogram"));
1370 showConsensLogo.setEnabled(false);
1371 showConsensLogo.setFont(LABEL_FONT);
1372 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1373 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1374 showConsensLogo.setSelected(true);
1375 showConsensLogo.setText(MessageManager.getString("label.logo"));
1376 showGroupConsensus.setEnabled(false);
1377 showGroupConsensus.setFont(LABEL_FONT);
1378 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1379 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1380 showGroupConsensus.setSelected(true);
1381 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1382 showGroupConservation.setEnabled(false);
1383 showGroupConservation.setFont(LABEL_FONT);
1384 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1385 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1386 showGroupConservation.setSelected(true);
1387 showGroupConservation
1388 .setText(MessageManager.getString("label.conservation"));
1389 showNpTooltip.setEnabled(true);
1390 showNpTooltip.setFont(LABEL_FONT);
1391 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1392 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1393 showNpTooltip.setSelected(true);
1394 showNpTooltip.setText(
1395 MessageManager.getString("label.non_positional_features"));
1396 showDbRefTooltip.setEnabled(true);
1397 showDbRefTooltip.setFont(LABEL_FONT);
1398 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1399 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1400 showDbRefTooltip.setSelected(true);
1402 .setText(MessageManager.getString("label.database_references"));
1403 annotations.setFont(LABEL_FONT);
1404 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1405 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1406 annotations.setSelected(true);
1407 annotations.setText(MessageManager.getString("label.show_annotations"));
1408 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1409 annotations.addActionListener(new ActionListener()
1412 public void actionPerformed(ActionEvent e)
1414 annotations_actionPerformed(e);
1417 identity.addActionListener(new ActionListener()
1420 public void actionPerformed(ActionEvent e)
1422 annotations_actionPerformed(e);
1425 showGroupConsensus.addActionListener(new ActionListener()
1428 public void actionPerformed(ActionEvent e)
1430 annotations_actionPerformed(e);
1433 showUnconserved.setFont(LABEL_FONT);
1434 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1435 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1436 showUnconserved.setSelected(true);
1438 .setText(MessageManager.getString("action.show_unconserved"));
1439 showUnconserved.addActionListener(new ActionListener()
1442 public void actionPerformed(ActionEvent e)
1444 showunconserved_actionPerformed(e);
1448 // TODO these are not yet added to / action from Preferences
1449 // JCheckBox shareSelections = new JCheckBox();
1450 // shareSelections.setFont(verdana11);
1451 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1452 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1453 // shareSelections.setSelected(true);
1454 // shareSelections.setText(MessageManager
1455 // .getString("label.share_selection_across_views"));
1456 // JCheckBox followHighlight = new JCheckBox();
1457 // followHighlight.setFont(verdana11);
1458 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1459 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1460 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1461 // followHighlight.setSelected(true);
1462 // followHighlight.setText(MessageManager
1463 // .getString("label.scroll_highlighted_regions"));
1465 seqLimit.setFont(LABEL_FONT);
1466 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1467 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1468 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1469 smoothFont.setFont(LABEL_FONT);
1470 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1471 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1472 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1473 scaleProteinToCdna.setFont(LABEL_FONT);
1474 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1475 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1476 scaleProteinToCdna.setText(
1477 MessageManager.getString("label.scale_protein_to_cdna"));
1478 scaleProteinToCdna.setToolTipText(
1479 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1480 JLabel gapLabel = new JLabel();
1481 gapLabel.setFont(LABEL_FONT);
1482 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1483 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1484 JLabel fontLabel = new JLabel();
1485 fontLabel.setFont(LABEL_FONT);
1486 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1487 fontLabel.setText(MessageManager.getString("label.font"));
1488 fontSizeCB.setFont(LABEL_FONT);
1489 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1490 fontStyleCB.setFont(LABEL_FONT);
1491 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1492 fontNameCB.setFont(LABEL_FONT);
1493 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1494 gapSymbolCB.setFont(LABEL_FONT);
1495 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1496 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1497 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1498 gapSymbolCB.setRenderer(dlcr);
1500 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1501 startupCheckbox.setFont(LABEL_FONT);
1502 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1503 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1504 startupCheckbox.setSelected(true);
1505 startupFileTextfield.setFont(LABEL_FONT);
1506 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1507 final String tooltip = JvSwingUtils.wrapTooltip(true,
1508 MessageManager.getString("label.double_click_to_browse"));
1509 startupFileTextfield.setToolTipText(tooltip);
1510 startupFileTextfield.addMouseListener(new MouseAdapter()
1513 public void mouseClicked(MouseEvent e)
1515 if (e.getClickCount() > 1)
1517 startupFileTextfield_mouseClicked();
1522 sortby.setFont(LABEL_FONT);
1523 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1524 JLabel sortLabel = new JLabel();
1525 sortLabel.setFont(LABEL_FONT);
1526 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1527 sortLabel.setText(MessageManager.getString("label.sort_by"));
1528 sortAnnBy.setFont(LABEL_FONT);
1529 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1530 JLabel sortAnnLabel = new JLabel();
1531 sortAnnLabel.setFont(LABEL_FONT);
1532 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1533 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1534 sortAutocalc.setFont(LABEL_FONT);
1535 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1537 JPanel annsettingsPanel = new JPanel();
1538 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1539 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1540 annsettingsPanel.setBorder(new EtchedBorder());
1541 visualTab.add(annsettingsPanel);
1542 Border jb = new EmptyBorder(1, 1, 4, 5);
1543 annotations.setBorder(jb);
1544 showOccupancy.setBorder(jb);
1545 quality.setBorder(jb);
1546 conservation.setBorder(jb);
1547 identity.setBorder(jb);
1548 showConsensbits.setBorder(jb);
1549 showGroupbits.setBorder(jb);
1550 showGroupConsensus.setBorder(jb);
1551 showGroupConservation.setBorder(jb);
1552 showConsensHistogram.setBorder(jb);
1553 showConsensLogo.setBorder(jb);
1555 JPanel autoAnnotSettings = new JPanel();
1556 annsettingsPanel.add(autoAnnotSettings);
1557 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1558 autoAnnotSettings.add(annotations);
1559 autoAnnotSettings.add(quality);
1560 // second row of autoannotation box
1561 autoAnnotSettings = new JPanel();
1562 annsettingsPanel.add(autoAnnotSettings);
1564 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1565 autoAnnotSettings.add(conservation);
1566 autoAnnotSettings.add(identity);
1567 autoAnnotSettings.add(showOccupancy);
1568 autoAnnotSettings.add(showGroupbits);
1569 autoAnnotSettings.add(showGroupConservation);
1570 autoAnnotSettings.add(showGroupConsensus);
1571 autoAnnotSettings.add(showConsensbits);
1572 autoAnnotSettings.add(showConsensHistogram);
1573 autoAnnotSettings.add(showConsensLogo);
1575 JPanel tooltipSettings = new JPanel();
1576 tooltipSettings.setBorder(new TitledBorder(
1577 MessageManager.getString("label.sequence_id_tooltip")));
1578 tooltipSettings.setBounds(173, 140, 220, 62);
1579 tooltipSettings.setLayout(new GridLayout(2, 1));
1580 tooltipSettings.add(showDbRefTooltip);
1581 tooltipSettings.add(showNpTooltip);
1582 visualTab.add(tooltipSettings);
1584 wrap.setFont(LABEL_FONT);
1585 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1586 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1587 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1588 rightAlign.setFont(LABEL_FONT);
1589 rightAlign.setForeground(Color.black);
1590 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1591 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1592 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1593 idItalics.setFont(LABEL_FONT_ITALIC);
1594 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1595 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1597 MessageManager.getString("label.sequence_name_italics"));
1598 openoverv.setFont(LABEL_FONT);
1599 openoverv.setActionCommand(
1600 MessageManager.getString("label.open_overview"));
1601 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1602 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1603 openoverv.setText(MessageManager.getString("label.open_overview"));
1604 JPanel jPanel2 = new JPanel();
1605 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1606 jPanel2.setLayout(new GridLayout(14, 1));
1607 jPanel2.add(fullScreen);
1608 jPanel2.add(openoverv);
1609 jPanel2.add(seqLimit);
1610 jPanel2.add(rightAlign);
1611 jPanel2.add(fontLabel);
1612 jPanel2.add(showUnconserved);
1613 jPanel2.add(idItalics);
1614 jPanel2.add(smoothFont);
1615 jPanel2.add(scaleProteinToCdna);
1616 jPanel2.add(gapLabel);
1618 jPanel2.add(sortLabel);
1619 jPanel2.add(sortAnnLabel);
1620 jPanel2.add(startupCheckbox);
1621 visualTab.add(jPanel2);
1622 visualTab.add(startupFileTextfield);
1623 visualTab.add(sortby);
1624 visualTab.add(sortAnnBy);
1625 visualTab.add(sortAutocalc);
1626 visualTab.add(gapSymbolCB);
1627 visualTab.add(fontNameCB);
1628 visualTab.add(fontSizeCB);
1629 visualTab.add(fontStyleCB);
1633 protected void autoIdWidth_actionPerformed()
1635 // TODO Auto-generated method stub
1639 protected void userIdWidth_actionPerformed()
1641 // TODO Auto-generated method stub
1645 protected void maxColour_actionPerformed(JPanel panel)
1649 protected void minColour_actionPerformed(JPanel panel)
1653 protected void gapColour_actionPerformed(JPanel panel)
1657 protected void hiddenColour_actionPerformed(JPanel panel)
1661 protected void showunconserved_actionPerformed(ActionEvent e)
1663 // TODO Auto-generated method stub
1667 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1671 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1681 public void ok_actionPerformed(ActionEvent e)
1691 public void cancel_actionPerformed(ActionEvent e)
1701 public void annotations_actionPerformed(ActionEvent e)
1708 public void startupFileTextfield_mouseClicked()
1712 public void newLink_actionPerformed(ActionEvent e)
1717 public void editLink_actionPerformed(ActionEvent e)
1722 public void deleteLink_actionPerformed(ActionEvent e)
1727 public void defaultBrowser_mouseClicked(MouseEvent e)
1732 public void linkURLList_keyTyped(KeyEvent e)
1737 public void useProxy_actionPerformed()
1739 boolean enabled = useProxy.isSelected();
1740 portLabel.setEnabled(enabled);
1741 serverLabel.setEnabled(enabled);
1742 proxyServerTB.setEnabled(enabled);
1743 proxyPortTB.setEnabled(enabled);
1747 * Customer renderer for JTable: supports column of radio buttons
1749 public class RadioButtonRenderer extends JRadioButton
1750 implements TableCellRenderer
1752 public RadioButtonRenderer()
1754 setHorizontalAlignment(CENTER);
1755 setToolTipText(MessageManager.getString("label.urltooltip"));
1759 public Component getTableCellRendererComponent(JTable table,
1760 Object value, boolean isSelected, boolean hasFocus, int row,
1763 setSelected((boolean) value);
1765 // set colours to match rest of table
1768 setBackground(table.getSelectionBackground());
1769 setForeground(table.getSelectionForeground());
1773 setBackground(table.getBackground());
1774 setForeground(table.getForeground());
1781 * Customer cell editor for JTable: supports column of radio buttons in
1782 * conjunction with renderer
1784 public class RadioButtonEditor extends AbstractCellEditor
1785 implements TableCellEditor
1787 private JRadioButton button = new JRadioButton();
1789 public RadioButtonEditor()
1791 button.setHorizontalAlignment(SwingConstants.CENTER);
1792 this.button.addActionListener(new ActionListener()
1795 public void actionPerformed(ActionEvent e)
1797 fireEditingStopped();
1803 public Component getTableCellEditorComponent(JTable table, Object value,
1804 boolean isSelected, int row, int column)
1806 button.setSelected((boolean) value);
1811 public Object getCellEditorValue()
1813 return button.isSelected();