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<>();
183 protected JButton gapColour = new JButton();
185 protected JButton hiddenColour = new JButton();
188 * Connections tab components
190 protected JTable linkUrlTable = new JTable();
192 protected JButton editLink = new JButton();
194 protected JButton deleteLink = new JButton();
196 protected JTextField filterTB = new JTextField();
198 protected JButton doReset = new JButton();
200 protected JButton userOnly = new JButton();
202 protected JLabel portLabel = new JLabel();
204 protected JLabel serverLabel = new JLabel();
206 protected JTextField proxyServerTB = new JTextField();
208 protected JTextField proxyPortTB = new JTextField();
210 protected JTextField defaultBrowser = new JTextField();
212 protected JCheckBox useProxy = new JCheckBox();
214 protected JCheckBox usagestats = new JCheckBox();
216 protected JCheckBox questionnaire = new JCheckBox();
218 protected JCheckBox versioncheck = new JCheckBox();
221 * Output tab components
223 protected JComboBox<Object> epsRendering = new JComboBox<>();
225 protected JLabel userIdWidthlabel = new JLabel();
227 protected JCheckBox autoIdWidth = new JCheckBox();
229 protected JTextField userIdWidth = new JTextField();
231 protected JCheckBox blcjv = new JCheckBox();
233 protected JCheckBox pileupjv = new JCheckBox();
235 protected JCheckBox clustaljv = new JCheckBox();
237 protected JCheckBox msfjv = new JCheckBox();
239 protected JCheckBox fastajv = new JCheckBox();
241 protected JCheckBox pfamjv = new JCheckBox();
243 protected JCheckBox pirjv = new JCheckBox();
245 protected JCheckBox modellerOutput = new JCheckBox();
247 protected JCheckBox embbedBioJSON = new JCheckBox();
250 * Editing tab components
252 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
254 protected JCheckBox padGaps = new JCheckBox();
256 protected JCheckBox sortByTree = new JCheckBox();
261 protected JPanel dasTab = new JPanel();
266 protected JPanel wsTab = new JPanel();
269 * Creates a new GPreferences object.
271 public GPreferences()
276 } catch (Exception ex)
278 ex.printStackTrace();
283 * Construct the panel and its tabbed sub-panels.
287 private void jbInit() throws Exception
289 final JTabbedPane tabbedPane = new JTabbedPane();
290 this.setLayout(new BorderLayout());
291 JPanel okCancelPanel = initOkCancelPanel();
292 this.add(tabbedPane, BorderLayout.CENTER);
293 this.add(okCancelPanel, BorderLayout.SOUTH);
295 tabbedPane.add(initVisualTab(),
296 MessageManager.getString("label.visual"));
298 tabbedPane.add(initColoursTab(),
299 MessageManager.getString("label.colours"));
301 tabbedPane.add(initStructureTab(),
302 MessageManager.getString("label.structure"));
304 tabbedPane.add(initConnectionsTab(),
305 MessageManager.getString("label.connections"));
307 tabbedPane.add(initLinksTab(),
308 MessageManager.getString("label.urllinks"));
310 tabbedPane.add(initOutputTab(),
311 MessageManager.getString("label.output"));
313 tabbedPane.add(initEditingTab(),
314 MessageManager.getString("label.editing"));
317 * See DasSourceBrowser for the real work of configuring this tab.
319 dasTab.setLayout(new BorderLayout());
320 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
323 * See WsPreferences for the real work of configuring this tab.
325 wsTab.setLayout(new BorderLayout());
326 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
329 * Handler to validate a tab before leaving it - currently only for
332 tabbedPane.addChangeListener(new ChangeListener()
334 private Component lastTab;
337 public void stateChanged(ChangeEvent e)
339 if (lastTab == structureTab
340 && tabbedPane.getSelectedComponent() != structureTab)
342 if (!validateStructure())
344 tabbedPane.setSelectedComponent(structureTab);
348 lastTab = tabbedPane.getSelectedComponent();
355 * Initialises the Editing tabbed panel.
359 private JPanel initEditingTab()
361 JPanel editingTab = new JPanel();
362 editingTab.setLayout(null);
363 autoCalculateConsCheck.setFont(LABEL_FONT);
364 autoCalculateConsCheck.setText(
365 MessageManager.getString("label.autocalculate_consensus"));
366 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
367 padGaps.setFont(LABEL_FONT);
369 MessageManager.getString("label.pad_gaps_when_editing"));
370 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
371 sortByTree.setFont(LABEL_FONT);
373 .setText(MessageManager.getString("label.sort_with_new_tree"));
374 sortByTree.setToolTipText(MessageManager.getString(
375 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
376 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
377 editingTab.add(autoCalculateConsCheck);
378 editingTab.add(padGaps);
379 editingTab.add(sortByTree);
384 * Initialises the Output tabbed panel.
388 private JPanel initOutputTab()
390 JPanel outputTab = new JPanel();
391 outputTab.setLayout(null);
392 JLabel epsLabel = new JLabel();
393 epsLabel.setFont(LABEL_FONT);
394 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
395 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
396 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
397 epsRendering.setFont(LABEL_FONT);
398 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
399 JLabel jLabel1 = new JLabel();
400 jLabel1.setFont(LABEL_FONT);
401 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
402 jLabel1.setText(MessageManager.getString("label.append_start_end"));
403 jLabel1.setFont(LABEL_FONT);
404 fastajv.setFont(LABEL_FONT);
405 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
406 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
407 blcjv.setText(MessageManager.getString("label.blc") + " ");
408 fastajv.setText(MessageManager.getString("label.fasta") + " ");
409 msfjv.setText(MessageManager.getString("label.msf") + " ");
410 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
411 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
412 msfjv.setFont(LABEL_FONT);
413 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
414 pirjv.setText(MessageManager.getString("label.pir") + " ");
415 JPanel jPanel11 = new JPanel();
416 jPanel11.setFont(LABEL_FONT);
417 TitledBorder titledBorder2 = new TitledBorder(
418 MessageManager.getString("label.file_output"));
419 jPanel11.setBorder(titledBorder2);
420 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
421 GridLayout gridLayout3 = new GridLayout();
422 jPanel11.setLayout(gridLayout3);
423 gridLayout3.setRows(8);
424 blcjv.setFont(LABEL_FONT);
425 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
426 clustaljv.setFont(LABEL_FONT);
427 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
428 pfamjv.setFont(LABEL_FONT);
429 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
430 pileupjv.setFont(LABEL_FONT);
431 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
432 pirjv.setFont(LABEL_FONT);
433 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
434 autoIdWidth.setFont(LABEL_FONT);
436 MessageManager.getString("label.automatically_set_id_width"));
437 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
438 .getString("label.adjusts_width_generated_eps_png")));
439 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
440 autoIdWidth.addActionListener(new ActionListener()
444 public void actionPerformed(ActionEvent e)
446 autoIdWidth_actionPerformed();
449 userIdWidthlabel.setFont(LABEL_FONT);
450 userIdWidthlabel.setText(
451 MessageManager.getString("label.figure_id_column_width"));
452 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
453 .getString("label.manually_specify_width_left_column")));
454 userIdWidthlabel.setToolTipText(
455 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
456 "label.manually_specify_width_left_column")));
457 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
458 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
459 userIdWidth.setText("");
460 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
461 userIdWidth.addActionListener(new ActionListener()
465 public void actionPerformed(ActionEvent e)
467 userIdWidth_actionPerformed();
470 modellerOutput.setFont(LABEL_FONT);
472 .setText(MessageManager.getString("label.use_modeller_output"));
473 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
474 embbedBioJSON.setFont(LABEL_FONT);
475 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
476 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
478 jPanel11.add(jLabel1);
480 jPanel11.add(clustaljv);
481 jPanel11.add(fastajv);
483 jPanel11.add(pfamjv);
484 jPanel11.add(pileupjv);
486 outputTab.add(autoIdWidth);
487 outputTab.add(userIdWidth);
488 outputTab.add(userIdWidthlabel);
489 outputTab.add(modellerOutput);
490 outputTab.add(embbedBioJSON);
491 outputTab.add(epsLabel);
492 outputTab.add(epsRendering);
493 outputTab.add(jPanel11);
498 * Initialises the Connections tabbed panel.
502 private JPanel initConnectionsTab()
504 JPanel connectTab = new JPanel();
505 connectTab.setLayout(new GridBagLayout());
507 // Label for browser text box
508 JLabel browserLabel = new JLabel();
509 browserLabel.setFont(LABEL_FONT);
510 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
511 browserLabel.setText(
512 MessageManager.getString("label.default_browser_unix"));
513 defaultBrowser.setFont(LABEL_FONT);
514 defaultBrowser.setText("");
516 defaultBrowser.addMouseListener(new MouseAdapter()
519 public void mouseClicked(MouseEvent e)
521 if (e.getClickCount() > 1)
523 defaultBrowser_mouseClicked(e);
528 JPanel proxyPanel = initConnTabProxyPanel();
529 initConnTabCheckboxes();
531 // Add default Browser text box
532 connectTab.add(browserLabel,
533 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
534 GridBagConstraints.WEST, GridBagConstraints.NONE,
535 new Insets(10, 0, 5, 5), 5, 1));
536 defaultBrowser.setFont(LABEL_FONT);
537 defaultBrowser.setText("");
539 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
540 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
541 new Insets(10, 0, 5, 10), 30, 1));
543 // Add proxy server panel
544 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
545 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
546 new Insets(10, 0, 5, 12), 4, 10));
548 // Add usage stats, version check and questionnaire checkboxes
549 connectTab.add(usagestats,
550 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
551 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
552 new Insets(0, 2, 5, 5), 70, 1));
553 connectTab.add(questionnaire,
554 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
555 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
556 new Insets(0, 2, 5, 10), 70, 1));
557 connectTab.add(versioncheck,
558 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
559 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
560 new Insets(0, 2, 5, 5), 70, 1));
562 // Add padding so the panel doesn't look ridiculous
563 JPanel spacePanel = new JPanel();
564 connectTab.add(spacePanel,
565 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
566 GridBagConstraints.WEST, GridBagConstraints.BOTH,
567 new Insets(0, 0, 0, 5), 70, 1));
573 * Initialises the Links tabbed panel.
577 private JPanel initLinksTab()
579 JPanel linkTab = new JPanel();
580 linkTab.setLayout(new GridBagLayout());
582 // Set up table for Url links
583 linkUrlTable.setFillsViewportHeight(true);
584 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
585 linkUrlTable.setAutoCreateRowSorter(true);
586 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
588 // adjust row height so radio buttons actually fit
589 // don't do this in the renderer, it causes the awt thread to activate
591 JRadioButton temp = new JRadioButton();
592 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
594 // Table in scrollpane so that the table is given a scrollbar
595 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
596 linkScrollPane.setBorder(null);
598 // Panel for links functionality
599 JPanel linkPanel = new JPanel(new GridBagLayout());
600 linkPanel.setBorder(new TitledBorder(
601 MessageManager.getString("label.url_linkfrom_sequence_id")));
603 // Put the Url links panel together
605 // Buttons go at top right, resizing only resizes the blank space vertically
606 JPanel buttonPanel = initLinkTabUrlButtons();
607 GridBagConstraints linkConstraints1 = new GridBagConstraints();
608 linkConstraints1.insets = new Insets(0, 0, 5, 0);
609 linkConstraints1.gridx = 0;
610 linkConstraints1.gridy = 0;
611 linkConstraints1.weightx = 1.0;
612 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
613 linkTab.add(buttonPanel, linkConstraints1);
615 // Links table goes at top left, resizing resizes the table
616 GridBagConstraints linkConstraints2 = new GridBagConstraints();
617 linkConstraints2.insets = new Insets(0, 0, 5, 5);
618 linkConstraints2.gridx = 0;
619 linkConstraints2.gridy = 1;
620 linkConstraints2.weightx = 1.0;
621 linkConstraints2.weighty = 1.0;
622 linkConstraints2.fill = GridBagConstraints.BOTH;
623 linkTab.add(linkScrollPane, linkConstraints2);
625 // Filter box and buttons goes at bottom left, resizing resizes the text box
626 JPanel filterPanel = initLinkTabFilterPanel();
627 GridBagConstraints linkConstraints3 = new GridBagConstraints();
628 linkConstraints3.insets = new Insets(0, 0, 0, 5);
629 linkConstraints3.gridx = 0;
630 linkConstraints3.gridy = 2;
631 linkConstraints3.weightx = 1.0;
632 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
633 linkTab.add(filterPanel, linkConstraints3);
638 private JPanel initLinkTabFilterPanel()
640 // Filter textbox and reset button
641 JLabel filterLabel = new JLabel(
642 MessageManager.getString("label.filter"));
643 filterLabel.setFont(LABEL_FONT);
644 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
645 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
647 filterTB.setFont(LABEL_FONT);
648 filterTB.setText("");
650 doReset.setText(MessageManager.getString("action.showall"));
651 userOnly.setText(MessageManager.getString("action.customfilter"));
653 // Panel for filter functionality
654 JPanel filterPanel = new JPanel(new GridBagLayout());
655 filterPanel.setBorder(new TitledBorder("Filter"));
656 GridBagConstraints gbc = new GridBagConstraints();
659 gbc.fill = GridBagConstraints.NONE;
660 gbc.anchor = GridBagConstraints.WEST;
662 filterPanel.add(filterLabel, gbc);
664 GridBagConstraints gbc1 = new GridBagConstraints();
667 gbc1.fill = GridBagConstraints.HORIZONTAL;
668 gbc1.anchor = GridBagConstraints.WEST;
670 filterPanel.add(filterTB, gbc1);
672 GridBagConstraints gbc2 = new GridBagConstraints();
674 gbc2.fill = GridBagConstraints.NONE;
675 gbc2.anchor = GridBagConstraints.WEST;
676 filterPanel.add(doReset, gbc2);
678 GridBagConstraints gbc3 = new GridBagConstraints();
680 gbc3.fill = GridBagConstraints.NONE;
681 gbc3.anchor = GridBagConstraints.WEST;
682 filterPanel.add(userOnly, gbc3);
687 private JPanel initLinkTabUrlButtons()
689 // Buttons for new / edit / delete Url links
690 JButton newLink = new JButton();
691 newLink.setText(MessageManager.getString("action.new"));
693 editLink.setText(MessageManager.getString("action.edit"));
695 deleteLink.setText(MessageManager.getString("action.delete"));
697 // no current selection, so initially disable delete/edit buttons
698 editLink.setEnabled(false);
699 deleteLink.setEnabled(false);
701 newLink.addActionListener(new java.awt.event.ActionListener()
704 public void actionPerformed(ActionEvent e)
706 newLink_actionPerformed(e);
710 editLink.setText(MessageManager.getString("action.edit"));
711 editLink.addActionListener(new java.awt.event.ActionListener()
714 public void actionPerformed(ActionEvent e)
716 editLink_actionPerformed(e);
720 deleteLink.setText(MessageManager.getString("action.delete"));
721 deleteLink.addActionListener(new java.awt.event.ActionListener()
724 public void actionPerformed(ActionEvent e)
726 deleteLink_actionPerformed(e);
730 JPanel buttonPanel = new JPanel(new GridBagLayout());
731 buttonPanel.setBorder(new TitledBorder("Edit links"));
732 GridBagConstraints gbc = new GridBagConstraints();
735 gbc.fill = GridBagConstraints.NONE;
736 buttonPanel.add(newLink, gbc);
738 GridBagConstraints gbc1 = new GridBagConstraints();
741 gbc1.fill = GridBagConstraints.NONE;
742 buttonPanel.add(editLink, gbc1);
744 GridBagConstraints gbc2 = new GridBagConstraints();
747 gbc2.fill = GridBagConstraints.NONE;
748 buttonPanel.add(deleteLink, gbc2);
750 GridBagConstraints gbc3 = new GridBagConstraints();
753 gbc3.fill = GridBagConstraints.HORIZONTAL;
755 JPanel spacePanel = new JPanel();
756 spacePanel.setBorder(null);
757 buttonPanel.add(spacePanel, gbc3);
763 * Initialises the proxy server panel in the Connections tab
765 * @return the proxy server panel
767 private JPanel initConnTabProxyPanel()
769 // Label for server text box
770 serverLabel.setText(MessageManager.getString("label.address"));
771 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
772 serverLabel.setFont(LABEL_FONT);
774 // Proxy server and port text boxes
775 proxyServerTB.setFont(LABEL_FONT);
776 proxyPortTB.setFont(LABEL_FONT);
778 // Label for Port text box
779 portLabel.setFont(LABEL_FONT);
780 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
781 portLabel.setText(MessageManager.getString("label.port"));
783 // Use proxy server checkbox
784 useProxy.setFont(LABEL_FONT);
785 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
786 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
787 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
788 useProxy.addActionListener(new ActionListener()
791 public void actionPerformed(ActionEvent e)
793 useProxy_actionPerformed();
797 // Make proxy server panel
798 JPanel proxyPanel = new JPanel();
799 TitledBorder titledBorder1 = new TitledBorder(
800 MessageManager.getString("label.proxy_server"));
801 proxyPanel.setBorder(titledBorder1);
802 proxyPanel.setLayout(new GridBagLayout());
803 proxyPanel.add(serverLabel,
804 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
805 GridBagConstraints.WEST, GridBagConstraints.NONE,
806 new Insets(0, 2, 2, 0), 5, 0));
807 proxyPanel.add(portLabel,
808 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
809 GridBagConstraints.WEST, GridBagConstraints.NONE,
810 new Insets(0, 0, 2, 0), 11, 0));
811 proxyPanel.add(useProxy,
812 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
813 GridBagConstraints.WEST, GridBagConstraints.NONE,
814 new Insets(0, 2, 5, 185), 2, -4));
815 proxyPanel.add(proxyPortTB,
816 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
817 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
818 new Insets(0, 2, 2, 2), 54, 1));
819 proxyPanel.add(proxyServerTB,
820 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
821 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
822 new Insets(0, 2, 2, 0), 263, 1));
828 * Initialises the checkboxes in the Connections tab
830 private void initConnTabCheckboxes()
832 // Usage stats checkbox label
834 MessageManager.getString("label.send_usage_statistics"));
835 usagestats.setFont(LABEL_FONT);
836 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
837 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
839 // Questionnaire checkbox label
840 questionnaire.setText(
841 MessageManager.getString("label.check_for_questionnaires"));
842 questionnaire.setFont(LABEL_FONT);
843 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
844 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
846 // Check for latest version checkbox label
847 versioncheck.setText(
848 MessageManager.getString("label.check_for_latest_version"));
849 versioncheck.setFont(LABEL_FONT);
850 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
851 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
855 * Initialises the parent panel which contains the tabbed sections.
859 private JPanel initOkCancelPanel()
861 JButton ok = new JButton();
862 ok.setText(MessageManager.getString("action.ok"));
863 ok.addActionListener(new ActionListener()
866 public void actionPerformed(ActionEvent e)
868 ok_actionPerformed(e);
871 JButton cancel = new JButton();
872 cancel.setText(MessageManager.getString("action.cancel"));
873 cancel.addActionListener(new ActionListener()
876 public void actionPerformed(ActionEvent e)
878 cancel_actionPerformed(e);
881 JPanel okCancelPanel = new JPanel();
882 okCancelPanel.add(ok);
883 okCancelPanel.add(cancel);
884 return okCancelPanel;
888 * Initialises the Colours tabbed panel.
892 private JPanel initColoursTab()
894 JPanel coloursTab = new JPanel();
895 JPanel alignmentPanel = new JPanel();
896 alignmentPanel.setBorder(new TitledBorder(
897 MessageManager.getString("action.open_new_alignment")));
898 alignmentPanel.setLayout(new FlowLayout());
899 JLabel mincolourLabel = new JLabel();
900 mincolourLabel.setFont(LABEL_FONT);
901 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
902 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
903 minColour.setFont(LABEL_FONT);
904 minColour.setBorder(BorderFactory.createEtchedBorder());
905 minColour.setPreferredSize(new Dimension(40, 20));
906 minColour.addMouseListener(new MouseAdapter()
909 public void mousePressed(MouseEvent e)
911 minColour_actionPerformed(minColour);
914 JLabel maxcolourLabel = new JLabel();
915 maxcolourLabel.setFont(LABEL_FONT);
916 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
917 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
918 maxColour.setFont(LABEL_FONT);
919 maxColour.setBorder(BorderFactory.createEtchedBorder());
920 maxColour.setPreferredSize(new Dimension(40, 20));
921 maxColour.addMouseListener(new MouseAdapter()
924 public void mousePressed(MouseEvent e)
926 maxColour_actionPerformed(maxColour);
930 protColour.setFont(LABEL_FONT);
931 protColour.setBounds(new Rectangle(172, 225, 155, 21));
932 JLabel protColourLabel = new JLabel();
933 protColourLabel.setFont(LABEL_FONT);
934 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
935 protColourLabel.setText(
936 MessageManager.getString("label.prot_alignment_colour") + " ");
937 JvSwingUtils.addtoLayout(alignmentPanel,
939 .getString("label.default_colour_scheme_for_alignment"),
940 protColourLabel, protColour);
942 nucColour.setFont(LABEL_FONT);
943 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
944 JLabel nucColourLabel = new JLabel();
945 nucColourLabel.setFont(LABEL_FONT);
946 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
947 nucColourLabel.setText(
948 MessageManager.getString("label.nuc_alignment_colour") + " ");
949 JvSwingUtils.addtoLayout(alignmentPanel,
951 .getString("label.default_colour_scheme_for_alignment"),
952 nucColourLabel, nucColour);
954 JPanel annotationShding = new JPanel();
955 annotationShding.setBorder(new TitledBorder(
956 MessageManager.getString("label.annotation_shading_default")));
957 annotationShding.setLayout(new GridLayout(1, 2));
958 JvSwingUtils.addtoLayout(annotationShding,
959 MessageManager.getString(
960 "label.default_minimum_colour_annotation_shading"),
961 mincolourLabel, minColour);
962 JvSwingUtils.addtoLayout(annotationShding,
963 MessageManager.getString(
964 "label.default_maximum_colour_annotation_shading"),
965 maxcolourLabel, maxColour);
966 alignmentPanel.add(annotationShding); // , FlowLayout.LEFT);
968 JPanel overviewPanel = new JPanel();
969 overviewPanel.setBorder(new TitledBorder(
970 MessageManager.getString("label.overview_settings")));
971 overviewPanel.setLayout(new FlowLayout());
973 gapColour.setFont(LABEL_FONT);
974 gapColour.setBorder(BorderFactory.createEtchedBorder());
975 gapColour.setPreferredSize(new Dimension(40, 20));
976 gapColour.addMouseListener(new MouseAdapter()
979 public void mousePressed(MouseEvent e)
981 gapColour_actionPerformed(gapColour);
985 hiddenColour.setFont(LABEL_FONT);
986 hiddenColour.setBorder(BorderFactory.createEtchedBorder());
987 hiddenColour.setPreferredSize(new Dimension(40, 20));
988 hiddenColour.addMouseListener(new MouseAdapter()
991 public void mousePressed(MouseEvent e)
993 hiddenColour_actionPerformed(hiddenColour);
997 JCheckBox gapSetting = new JCheckBox(
998 MessageManager.getString("label.ov_legacy_gap"));
999 gapSetting.setFont(LABEL_FONT);
1000 gapSetting.setHorizontalAlignment(SwingConstants.LEFT);
1001 JLabel gapLabel = new JLabel(
1002 MessageManager.getString("label.gap_colour"));
1003 gapLabel.setFont(LABEL_FONT);
1004 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1005 JCheckBox hiddenSetting = new JCheckBox(
1006 MessageManager.getString("label.ov_show_hide_default"));
1007 hiddenSetting.setFont(LABEL_FONT);
1008 hiddenSetting.setHorizontalAlignment(SwingConstants.LEFT);
1009 JLabel hiddenLabel = new JLabel(
1010 MessageManager.getString("label.hidden_colour"));
1011 hiddenLabel.setFont(LABEL_FONT);
1012 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1014 overviewPanel.setLayout(new GridBagLayout());
1015 GridBagConstraints c1 = new GridBagConstraints();
1017 c1.fill = GridBagConstraints.HORIZONTAL;
1021 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1022 overviewPanel.add(gapSetting, c1);
1024 GridBagConstraints c2 = new GridBagConstraints();
1025 c2.fill = GridBagConstraints.HORIZONTAL;
1028 c2.insets = new Insets(0, 5, 0, 5);
1029 overviewPanel.add(gapLabel, c2);
1031 GridBagConstraints c3 = new GridBagConstraints();
1032 c3.fill = GridBagConstraints.HORIZONTAL;
1035 overviewPanel.add(gapColour, c3);
1037 GridBagConstraints c4 = new GridBagConstraints();
1038 c4.fill = GridBagConstraints.HORIZONTAL;
1042 overviewPanel.add(hiddenSetting, c4);
1044 GridBagConstraints c5 = new GridBagConstraints();
1045 c5.fill = GridBagConstraints.HORIZONTAL;
1048 c5.insets = new Insets(0, 5, 0, 5);
1049 overviewPanel.add(hiddenLabel, c5);
1051 GridBagConstraints c6 = new GridBagConstraints();
1052 c6.fill = GridBagConstraints.HORIZONTAL;
1055 overviewPanel.add(hiddenColour, c6);
1057 // Add padding so the panel doesn't look ridiculous
1058 JPanel spacePanel = new JPanel();
1059 overviewPanel.add(spacePanel,
1060 new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0,
1061 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1062 new Insets(0, 0, 0, 5), 0, 0));
1064 coloursTab.setLayout(new GridLayout(2, 1));
1065 coloursTab.add(alignmentPanel);
1066 coloursTab.add(overviewPanel);
1071 * Initialises the Structure tabbed panel.
1075 private JPanel initStructureTab()
1077 structureTab = new JPanel();
1079 structureTab.setBorder(new TitledBorder(
1080 MessageManager.getString("label.structure_options")));
1081 structureTab.setLayout(null);
1082 final int width = 400;
1083 final int height = 22;
1084 final int lineSpacing = 25;
1087 structFromPdb.setFont(LABEL_FONT);
1089 .setText(MessageManager.getString("label.struct_from_pdb"));
1090 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1091 structFromPdb.addActionListener(new ActionListener()
1094 public void actionPerformed(ActionEvent e)
1096 boolean selected = structFromPdb.isSelected();
1097 // enable other options only when the first is checked
1098 useRnaView.setEnabled(selected);
1099 addSecondaryStructure.setEnabled(selected);
1100 addTempFactor.setEnabled(selected);
1103 structureTab.add(structFromPdb);
1105 // indent checkboxes that are conditional on the first one
1106 ypos += lineSpacing;
1107 useRnaView.setFont(LABEL_FONT);
1108 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1109 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1110 structureTab.add(useRnaView);
1112 ypos += lineSpacing;
1113 addSecondaryStructure.setFont(LABEL_FONT);
1114 addSecondaryStructure
1115 .setText(MessageManager.getString("label.autoadd_secstr"));
1116 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1117 structureTab.add(addSecondaryStructure);
1119 ypos += lineSpacing;
1120 addTempFactor.setFont(LABEL_FONT);
1121 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1122 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1123 structureTab.add(addTempFactor);
1125 ypos += lineSpacing;
1126 JLabel viewerLabel = new JLabel();
1127 viewerLabel.setFont(LABEL_FONT);
1128 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1129 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1130 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1131 structureTab.add(viewerLabel);
1133 structViewer.setFont(LABEL_FONT);
1134 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1135 structViewer.addItem(ViewerType.JMOL.name());
1136 structViewer.addItem(ViewerType.CHIMERA.name());
1137 structViewer.addActionListener(new ActionListener()
1140 public void actionPerformed(ActionEvent e)
1142 structureViewer_actionPerformed(
1143 (String) structViewer.getSelectedItem());
1146 structureTab.add(structViewer);
1148 ypos += lineSpacing;
1149 JLabel pathLabel = new JLabel();
1150 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1151 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1152 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1153 final String tooltip = JvSwingUtils.wrapTooltip(true,
1154 MessageManager.getString("label.chimera_path_tip"));
1155 pathLabel.setToolTipText(tooltip);
1156 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1157 structureTab.add(pathLabel);
1159 chimeraPath.setFont(LABEL_FONT);
1160 chimeraPath.setText("");
1161 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1162 chimeraPath.addMouseListener(new MouseAdapter()
1165 public void mouseClicked(MouseEvent e)
1167 if (e.getClickCount() == 2)
1169 String chosen = openFileChooser();
1172 chimeraPath.setText(chosen);
1177 structureTab.add(chimeraPath);
1179 ypos += lineSpacing;
1180 nwMapping.setFont(LABEL_FONT);
1181 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1182 siftsMapping.setFont(LABEL_FONT);
1183 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1184 mappingMethod.add(nwMapping);
1185 mappingMethod.add(siftsMapping);
1186 JPanel mappingPanel = new JPanel();
1187 mappingPanel.setFont(LABEL_FONT);
1188 TitledBorder mmTitledBorder = new TitledBorder(
1189 MessageManager.getString("label.mapping_method"));
1190 mmTitledBorder.setTitleFont(LABEL_FONT);
1191 mappingPanel.setBorder(mmTitledBorder);
1192 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1193 // GridLayout mappingLayout = new GridLayout();
1194 mappingPanel.setLayout(new GridLayout());
1195 mappingPanel.add(nwMapping);
1196 mappingPanel.add(siftsMapping);
1197 structureTab.add(mappingPanel);
1199 ypos += lineSpacing;
1200 ypos += lineSpacing;
1201 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1202 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1203 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1204 structureTab.add(docFieldPref);
1206 return structureTab;
1210 * Action on choosing a structure viewer from combobox options.
1212 * @param selectedItem
1214 protected void structureViewer_actionPerformed(String selectedItem)
1219 * Show a dialog for the user to choose a file. Returns the chosen path, or
1224 protected String openFileChooser()
1226 String choice = null;
1227 JFileChooser chooser = new JFileChooser();
1229 // chooser.setFileView(new JalviewFileView());
1230 chooser.setDialogTitle(
1231 MessageManager.getString("label.open_local_file"));
1232 chooser.setToolTipText(MessageManager.getString("action.open"));
1234 int value = chooser.showOpenDialog(this);
1236 if (value == JFileChooser.APPROVE_OPTION)
1238 choice = chooser.getSelectedFile().getPath();
1244 * Validate the structure tab preferences; if invalid, set focus on this tab.
1248 protected boolean validateStructure(FocusEvent e)
1250 if (!validateStructure())
1252 e.getComponent().requestFocusInWindow();
1258 protected boolean validateStructure()
1264 * Initialises the Visual tabbed panel.
1268 private JPanel initVisualTab()
1270 JPanel visualTab = new JPanel();
1271 visualTab.setBorder(new TitledBorder(
1272 MessageManager.getString("action.open_new_alignment")));
1273 visualTab.setLayout(null);
1274 fullScreen.setFont(LABEL_FONT);
1275 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1276 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1277 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1278 quality.setEnabled(false);
1279 quality.setFont(LABEL_FONT);
1280 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1281 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1282 quality.setSelected(true);
1283 quality.setText(MessageManager.getString("label.quality"));
1284 conservation.setEnabled(false);
1285 conservation.setFont(LABEL_FONT);
1286 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1287 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1288 conservation.setSelected(true);
1289 conservation.setText(MessageManager.getString("label.conservation"));
1290 identity.setEnabled(false);
1291 identity.setFont(LABEL_FONT);
1292 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1293 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1294 identity.setSelected(true);
1295 identity.setText(MessageManager.getString("label.consensus"));
1296 showOccupancy.setFont(LABEL_FONT);
1297 showOccupancy.setEnabled(false);
1298 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1299 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1300 showOccupancy.setSelected(true);
1301 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1303 JLabel showGroupbits = new JLabel();
1304 showGroupbits.setFont(LABEL_FONT);
1305 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1306 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1308 .setText(MessageManager.getString("action.show_group") + ":");
1309 JLabel showConsensbits = new JLabel();
1310 showConsensbits.setFont(LABEL_FONT);
1311 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1312 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1314 .setText(MessageManager.getString("label.consensus") + ":");
1315 showConsensHistogram.setEnabled(false);
1316 showConsensHistogram.setFont(LABEL_FONT);
1317 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1318 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1319 showConsensHistogram.setSelected(true);
1320 showConsensHistogram
1321 .setText(MessageManager.getString("label.histogram"));
1322 showConsensLogo.setEnabled(false);
1323 showConsensLogo.setFont(LABEL_FONT);
1324 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1325 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1326 showConsensLogo.setSelected(true);
1327 showConsensLogo.setText(MessageManager.getString("label.logo"));
1328 showGroupConsensus.setEnabled(false);
1329 showGroupConsensus.setFont(LABEL_FONT);
1330 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1331 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1332 showGroupConsensus.setSelected(true);
1333 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1334 showGroupConservation.setEnabled(false);
1335 showGroupConservation.setFont(LABEL_FONT);
1336 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1337 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1338 showGroupConservation.setSelected(true);
1339 showGroupConservation
1340 .setText(MessageManager.getString("label.conservation"));
1341 showNpTooltip.setEnabled(true);
1342 showNpTooltip.setFont(LABEL_FONT);
1343 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1344 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1345 showNpTooltip.setSelected(true);
1346 showNpTooltip.setText(
1347 MessageManager.getString("label.non_positional_features"));
1348 showDbRefTooltip.setEnabled(true);
1349 showDbRefTooltip.setFont(LABEL_FONT);
1350 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1351 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1352 showDbRefTooltip.setSelected(true);
1354 .setText(MessageManager.getString("label.database_references"));
1355 annotations.setFont(LABEL_FONT);
1356 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1357 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1358 annotations.setSelected(true);
1359 annotations.setText(MessageManager.getString("label.show_annotations"));
1360 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1361 annotations.addActionListener(new ActionListener()
1364 public void actionPerformed(ActionEvent e)
1366 annotations_actionPerformed(e);
1369 identity.addActionListener(new ActionListener()
1372 public void actionPerformed(ActionEvent e)
1374 annotations_actionPerformed(e);
1377 showGroupConsensus.addActionListener(new ActionListener()
1380 public void actionPerformed(ActionEvent e)
1382 annotations_actionPerformed(e);
1385 showUnconserved.setFont(LABEL_FONT);
1386 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1387 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1388 showUnconserved.setSelected(true);
1390 .setText(MessageManager.getString("action.show_unconserved"));
1391 showUnconserved.addActionListener(new ActionListener()
1394 public void actionPerformed(ActionEvent e)
1396 showunconserved_actionPerformed(e);
1400 // TODO these are not yet added to / action from Preferences
1401 // JCheckBox shareSelections = new JCheckBox();
1402 // shareSelections.setFont(verdana11);
1403 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1404 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1405 // shareSelections.setSelected(true);
1406 // shareSelections.setText(MessageManager
1407 // .getString("label.share_selection_across_views"));
1408 // JCheckBox followHighlight = new JCheckBox();
1409 // followHighlight.setFont(verdana11);
1410 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1411 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1412 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1413 // followHighlight.setSelected(true);
1414 // followHighlight.setText(MessageManager
1415 // .getString("label.scroll_highlighted_regions"));
1417 seqLimit.setFont(LABEL_FONT);
1418 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1419 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1420 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1421 smoothFont.setFont(LABEL_FONT);
1422 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1423 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1424 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1425 scaleProteinToCdna.setFont(LABEL_FONT);
1426 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1427 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1428 scaleProteinToCdna.setText(
1429 MessageManager.getString("label.scale_protein_to_cdna"));
1430 scaleProteinToCdna.setToolTipText(
1431 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1432 JLabel gapLabel = new JLabel();
1433 gapLabel.setFont(LABEL_FONT);
1434 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1435 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1436 JLabel fontLabel = new JLabel();
1437 fontLabel.setFont(LABEL_FONT);
1438 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1439 fontLabel.setText(MessageManager.getString("label.font"));
1440 fontSizeCB.setFont(LABEL_FONT);
1441 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1442 fontStyleCB.setFont(LABEL_FONT);
1443 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1444 fontNameCB.setFont(LABEL_FONT);
1445 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1446 gapSymbolCB.setFont(LABEL_FONT);
1447 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1448 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1449 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1450 gapSymbolCB.setRenderer(dlcr);
1452 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1453 startupCheckbox.setFont(LABEL_FONT);
1454 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1455 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1456 startupCheckbox.setSelected(true);
1457 startupFileTextfield.setFont(LABEL_FONT);
1458 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1459 startupFileTextfield.addMouseListener(new MouseAdapter()
1462 public void mouseClicked(MouseEvent e)
1464 if (e.getClickCount() > 1)
1466 startupFileTextfield_mouseClicked();
1471 sortby.setFont(LABEL_FONT);
1472 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1473 JLabel sortLabel = new JLabel();
1474 sortLabel.setFont(LABEL_FONT);
1475 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1476 sortLabel.setText(MessageManager.getString("label.sort_by"));
1477 sortAnnBy.setFont(LABEL_FONT);
1478 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1479 JLabel sortAnnLabel = new JLabel();
1480 sortAnnLabel.setFont(LABEL_FONT);
1481 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1482 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1483 sortAutocalc.setFont(LABEL_FONT);
1484 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1486 JPanel annsettingsPanel = new JPanel();
1487 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1488 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1489 annsettingsPanel.setBorder(new EtchedBorder());
1490 visualTab.add(annsettingsPanel);
1491 Border jb = new EmptyBorder(1, 1, 4, 5);
1492 annotations.setBorder(jb);
1493 showOccupancy.setBorder(jb);
1494 quality.setBorder(jb);
1495 conservation.setBorder(jb);
1496 identity.setBorder(jb);
1497 showConsensbits.setBorder(jb);
1498 showGroupbits.setBorder(jb);
1499 showGroupConsensus.setBorder(jb);
1500 showGroupConservation.setBorder(jb);
1501 showConsensHistogram.setBorder(jb);
1502 showConsensLogo.setBorder(jb);
1504 JPanel autoAnnotSettings = new JPanel();
1505 annsettingsPanel.add(autoAnnotSettings);
1506 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1507 autoAnnotSettings.add(annotations);
1508 autoAnnotSettings.add(quality);
1509 // second row of autoannotation box
1510 autoAnnotSettings = new JPanel();
1511 annsettingsPanel.add(autoAnnotSettings);
1513 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1514 autoAnnotSettings.add(conservation);
1515 autoAnnotSettings.add(identity);
1516 autoAnnotSettings.add(showOccupancy);
1517 autoAnnotSettings.add(showGroupbits);
1518 autoAnnotSettings.add(showGroupConservation);
1519 autoAnnotSettings.add(showGroupConsensus);
1520 autoAnnotSettings.add(showConsensbits);
1521 autoAnnotSettings.add(showConsensHistogram);
1522 autoAnnotSettings.add(showConsensLogo);
1524 JPanel tooltipSettings = new JPanel();
1525 tooltipSettings.setBorder(new TitledBorder(
1526 MessageManager.getString("label.sequence_id_tooltip")));
1527 tooltipSettings.setBounds(173, 140, 220, 62);
1528 tooltipSettings.setLayout(new GridLayout(2, 1));
1529 tooltipSettings.add(showDbRefTooltip);
1530 tooltipSettings.add(showNpTooltip);
1531 visualTab.add(tooltipSettings);
1533 wrap.setFont(LABEL_FONT);
1534 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1535 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1536 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1537 rightAlign.setFont(LABEL_FONT);
1538 rightAlign.setForeground(Color.black);
1539 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1540 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1541 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1542 idItalics.setFont(LABEL_FONT_ITALIC);
1543 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1544 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1546 MessageManager.getString("label.sequence_name_italics"));
1547 openoverv.setFont(LABEL_FONT);
1548 openoverv.setActionCommand(
1549 MessageManager.getString("label.open_overview"));
1550 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1551 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1552 openoverv.setText(MessageManager.getString("label.open_overview"));
1553 JPanel jPanel2 = new JPanel();
1554 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1555 jPanel2.setLayout(new GridLayout(14, 1));
1556 jPanel2.add(fullScreen);
1557 jPanel2.add(openoverv);
1558 jPanel2.add(seqLimit);
1559 jPanel2.add(rightAlign);
1560 jPanel2.add(fontLabel);
1561 jPanel2.add(showUnconserved);
1562 jPanel2.add(idItalics);
1563 jPanel2.add(smoothFont);
1564 jPanel2.add(scaleProteinToCdna);
1565 jPanel2.add(gapLabel);
1567 jPanel2.add(sortLabel);
1568 jPanel2.add(sortAnnLabel);
1569 jPanel2.add(startupCheckbox);
1570 visualTab.add(jPanel2);
1571 visualTab.add(startupFileTextfield);
1572 visualTab.add(sortby);
1573 visualTab.add(sortAnnBy);
1574 visualTab.add(sortAutocalc);
1575 visualTab.add(gapSymbolCB);
1576 visualTab.add(fontNameCB);
1577 visualTab.add(fontSizeCB);
1578 visualTab.add(fontStyleCB);
1582 protected void autoIdWidth_actionPerformed()
1584 // TODO Auto-generated method stub
1588 protected void userIdWidth_actionPerformed()
1590 // TODO Auto-generated method stub
1594 protected void maxColour_actionPerformed(JPanel panel)
1598 protected void minColour_actionPerformed(JPanel panel)
1602 protected void gapColour_actionPerformed(JButton btn)
1606 protected void hiddenColour_actionPerformed(JButton btn)
1610 protected void showunconserved_actionPerformed(ActionEvent e)
1612 // TODO Auto-generated method stub
1622 public void ok_actionPerformed(ActionEvent e)
1632 public void cancel_actionPerformed(ActionEvent e)
1642 public void annotations_actionPerformed(ActionEvent e)
1649 public void startupFileTextfield_mouseClicked()
1653 public void newLink_actionPerformed(ActionEvent e)
1658 public void editLink_actionPerformed(ActionEvent e)
1663 public void deleteLink_actionPerformed(ActionEvent e)
1668 public void defaultBrowser_mouseClicked(MouseEvent e)
1673 public void linkURLList_keyTyped(KeyEvent e)
1678 public void useProxy_actionPerformed()
1680 boolean enabled = useProxy.isSelected();
1681 portLabel.setEnabled(enabled);
1682 serverLabel.setEnabled(enabled);
1683 proxyServerTB.setEnabled(enabled);
1684 proxyPortTB.setEnabled(enabled);
1688 * Customer renderer for JTable: supports column of radio buttons
1690 public class RadioButtonRenderer extends JRadioButton
1691 implements TableCellRenderer
1693 public RadioButtonRenderer()
1695 setHorizontalAlignment(CENTER);
1696 setToolTipText(MessageManager.getString("label.urltooltip"));
1700 public Component getTableCellRendererComponent(JTable table,
1701 Object value, boolean isSelected, boolean hasFocus, int row,
1704 setSelected((boolean) value);
1706 // set colours to match rest of table
1709 setBackground(table.getSelectionBackground());
1710 setForeground(table.getSelectionForeground());
1714 setBackground(table.getBackground());
1715 setForeground(table.getForeground());
1722 * Customer cell editor for JTable: supports column of radio buttons in
1723 * conjunction with renderer
1725 public class RadioButtonEditor extends AbstractCellEditor
1726 implements TableCellEditor
1728 private JRadioButton button = new JRadioButton();
1730 public RadioButtonEditor()
1732 button.setHorizontalAlignment(SwingConstants.CENTER);
1733 this.button.addActionListener(new ActionListener()
1736 public void actionPerformed(ActionEvent e)
1738 fireEditingStopped();
1744 public Component getTableCellEditorComponent(JTable table, Object value,
1745 boolean isSelected, int row, int column)
1747 button.setSelected((boolean) value);
1752 public Object getCellEditorValue()
1754 return button.isSelected();