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.getTableHeader().setReorderingAllowed(false);
588 linkUrlTable.setFillsViewportHeight(true);
589 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
590 linkUrlTable.setAutoCreateRowSorter(true);
591 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
593 // adjust row height so radio buttons actually fit
594 // don't do this in the renderer, it causes the awt thread to activate
596 JRadioButton temp = new JRadioButton();
597 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
599 // Table in scrollpane so that the table is given a scrollbar
600 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
601 linkScrollPane.setBorder(null);
603 // Panel for links functionality
604 JPanel linkPanel = new JPanel(new GridBagLayout());
605 linkPanel.setBorder(new TitledBorder(
606 MessageManager.getString("label.url_linkfrom_sequence_id")));
608 // Put the Url links panel together
610 // Buttons go at top right, resizing only resizes the blank space vertically
611 JPanel buttonPanel = initLinkTabUrlButtons();
612 GridBagConstraints linkConstraints1 = new GridBagConstraints();
613 linkConstraints1.insets = new Insets(0, 0, 5, 0);
614 linkConstraints1.gridx = 0;
615 linkConstraints1.gridy = 0;
616 linkConstraints1.weightx = 1.0;
617 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
618 linkTab.add(buttonPanel, linkConstraints1);
620 // Links table goes at top left, resizing resizes the table
621 GridBagConstraints linkConstraints2 = new GridBagConstraints();
622 linkConstraints2.insets = new Insets(0, 0, 5, 5);
623 linkConstraints2.gridx = 0;
624 linkConstraints2.gridy = 1;
625 linkConstraints2.weightx = 1.0;
626 linkConstraints2.weighty = 1.0;
627 linkConstraints2.fill = GridBagConstraints.BOTH;
628 linkTab.add(linkScrollPane, linkConstraints2);
630 // Filter box and buttons goes at bottom left, resizing resizes the text box
631 JPanel filterPanel = initLinkTabFilterPanel();
632 GridBagConstraints linkConstraints3 = new GridBagConstraints();
633 linkConstraints3.insets = new Insets(0, 0, 0, 5);
634 linkConstraints3.gridx = 0;
635 linkConstraints3.gridy = 2;
636 linkConstraints3.weightx = 1.0;
637 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
638 linkTab.add(filterPanel, linkConstraints3);
643 private JPanel initLinkTabFilterPanel()
645 // Filter textbox and reset button
646 JLabel filterLabel = new JLabel(
647 MessageManager.getString("label.filter"));
648 filterLabel.setFont(LABEL_FONT);
649 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
650 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
652 filterTB.setFont(LABEL_FONT);
653 filterTB.setText("");
655 doReset.setText(MessageManager.getString("action.showall"));
656 userOnly.setText(MessageManager.getString("action.customfilter"));
658 // Panel for filter functionality
659 JPanel filterPanel = new JPanel(new GridBagLayout());
660 filterPanel.setBorder(new TitledBorder("Filter"));
661 GridBagConstraints gbc = new GridBagConstraints();
664 gbc.fill = GridBagConstraints.NONE;
665 gbc.anchor = GridBagConstraints.WEST;
667 filterPanel.add(filterLabel, gbc);
669 GridBagConstraints gbc1 = new GridBagConstraints();
672 gbc1.fill = GridBagConstraints.HORIZONTAL;
673 gbc1.anchor = GridBagConstraints.WEST;
675 filterPanel.add(filterTB, gbc1);
677 GridBagConstraints gbc2 = new GridBagConstraints();
679 gbc2.fill = GridBagConstraints.NONE;
680 gbc2.anchor = GridBagConstraints.WEST;
681 filterPanel.add(doReset, gbc2);
683 GridBagConstraints gbc3 = new GridBagConstraints();
685 gbc3.fill = GridBagConstraints.NONE;
686 gbc3.anchor = GridBagConstraints.WEST;
687 filterPanel.add(userOnly, gbc3);
692 private JPanel initLinkTabUrlButtons()
694 // Buttons for new / edit / delete Url links
695 JButton newLink = new JButton();
696 newLink.setText(MessageManager.getString("action.new"));
698 editLink.setText(MessageManager.getString("action.edit"));
700 deleteLink.setText(MessageManager.getString("action.delete"));
702 // no current selection, so initially disable delete/edit buttons
703 editLink.setEnabled(false);
704 deleteLink.setEnabled(false);
706 newLink.addActionListener(new java.awt.event.ActionListener()
709 public void actionPerformed(ActionEvent e)
711 newLink_actionPerformed(e);
715 editLink.setText(MessageManager.getString("action.edit"));
716 editLink.addActionListener(new java.awt.event.ActionListener()
719 public void actionPerformed(ActionEvent e)
721 editLink_actionPerformed(e);
725 deleteLink.setText(MessageManager.getString("action.delete"));
726 deleteLink.addActionListener(new java.awt.event.ActionListener()
729 public void actionPerformed(ActionEvent e)
731 deleteLink_actionPerformed(e);
735 JPanel buttonPanel = new JPanel(new GridBagLayout());
736 buttonPanel.setBorder(new TitledBorder("Edit links"));
737 GridBagConstraints gbc = new GridBagConstraints();
740 gbc.fill = GridBagConstraints.NONE;
741 buttonPanel.add(newLink, gbc);
743 GridBagConstraints gbc1 = new GridBagConstraints();
746 gbc1.fill = GridBagConstraints.NONE;
747 buttonPanel.add(editLink, gbc1);
749 GridBagConstraints gbc2 = new GridBagConstraints();
752 gbc2.fill = GridBagConstraints.NONE;
753 buttonPanel.add(deleteLink, gbc2);
755 GridBagConstraints gbc3 = new GridBagConstraints();
758 gbc3.fill = GridBagConstraints.HORIZONTAL;
760 JPanel spacePanel = new JPanel();
761 spacePanel.setBorder(null);
762 buttonPanel.add(spacePanel, gbc3);
768 * Initialises the proxy server panel in the Connections tab
770 * @return the proxy server panel
772 private JPanel initConnTabProxyPanel()
774 // Label for server text box
775 serverLabel.setText(MessageManager.getString("label.address"));
776 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
777 serverLabel.setFont(LABEL_FONT);
779 // Proxy server and port text boxes
780 proxyServerTB.setFont(LABEL_FONT);
781 proxyPortTB.setFont(LABEL_FONT);
783 // Label for Port text box
784 portLabel.setFont(LABEL_FONT);
785 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
786 portLabel.setText(MessageManager.getString("label.port"));
788 // Use proxy server checkbox
789 useProxy.setFont(LABEL_FONT);
790 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
791 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
792 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
793 useProxy.addActionListener(new ActionListener()
796 public void actionPerformed(ActionEvent e)
798 useProxy_actionPerformed();
802 // Make proxy server panel
803 JPanel proxyPanel = new JPanel();
804 TitledBorder titledBorder1 = new TitledBorder(
805 MessageManager.getString("label.proxy_server"));
806 proxyPanel.setBorder(titledBorder1);
807 proxyPanel.setLayout(new GridBagLayout());
808 proxyPanel.add(serverLabel,
809 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
810 GridBagConstraints.WEST, GridBagConstraints.NONE,
811 new Insets(0, 2, 2, 0), 5, 0));
812 proxyPanel.add(portLabel,
813 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
814 GridBagConstraints.WEST, GridBagConstraints.NONE,
815 new Insets(0, 0, 2, 0), 11, 0));
816 proxyPanel.add(useProxy,
817 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
818 GridBagConstraints.WEST, GridBagConstraints.NONE,
819 new Insets(0, 2, 5, 185), 2, -4));
820 proxyPanel.add(proxyPortTB,
821 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
822 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
823 new Insets(0, 2, 2, 2), 54, 1));
824 proxyPanel.add(proxyServerTB,
825 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
826 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
827 new Insets(0, 2, 2, 0), 263, 1));
833 * Initialises the checkboxes in the Connections tab
835 private void initConnTabCheckboxes()
837 // Usage stats checkbox label
839 MessageManager.getString("label.send_usage_statistics"));
840 usagestats.setFont(LABEL_FONT);
841 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
842 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
844 // Questionnaire checkbox label
845 questionnaire.setText(
846 MessageManager.getString("label.check_for_questionnaires"));
847 questionnaire.setFont(LABEL_FONT);
848 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
849 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
851 // Check for latest version checkbox label
852 versioncheck.setText(
853 MessageManager.getString("label.check_for_latest_version"));
854 versioncheck.setFont(LABEL_FONT);
855 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
856 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
860 * Initialises the parent panel which contains the tabbed sections.
864 private JPanel initOkCancelPanel()
866 JButton ok = new JButton();
867 ok.setText(MessageManager.getString("action.ok"));
868 ok.addActionListener(new ActionListener()
871 public void actionPerformed(ActionEvent e)
873 ok_actionPerformed(e);
876 JButton cancel = new JButton();
877 cancel.setText(MessageManager.getString("action.cancel"));
878 cancel.addActionListener(new ActionListener()
881 public void actionPerformed(ActionEvent e)
883 cancel_actionPerformed(e);
886 JPanel okCancelPanel = new JPanel();
887 okCancelPanel.add(ok);
888 okCancelPanel.add(cancel);
889 return okCancelPanel;
893 * Initialises the Colours tabbed panel.
897 private JPanel initColoursTab()
899 JPanel coloursTab = new JPanel();
900 coloursTab.setBorder(new TitledBorder(
901 MessageManager.getString("action.open_new_alignment")));
902 coloursTab.setLayout(new FlowLayout());
903 JLabel mincolourLabel = new JLabel();
904 mincolourLabel.setFont(LABEL_FONT);
905 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
906 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
907 minColour.setFont(LABEL_FONT);
908 minColour.setBorder(BorderFactory.createEtchedBorder());
909 minColour.setPreferredSize(new Dimension(40, 20));
910 minColour.addMouseListener(new MouseAdapter()
913 public void mousePressed(MouseEvent e)
915 minColour_actionPerformed(minColour);
918 JLabel maxcolourLabel = new JLabel();
919 maxcolourLabel.setFont(LABEL_FONT);
920 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
921 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
922 maxColour.setFont(LABEL_FONT);
923 maxColour.setBorder(BorderFactory.createEtchedBorder());
924 maxColour.setPreferredSize(new Dimension(40, 20));
925 maxColour.addMouseListener(new MouseAdapter()
928 public void mousePressed(MouseEvent e)
930 maxColour_actionPerformed(maxColour);
934 protColour.setFont(LABEL_FONT);
935 protColour.setBounds(new Rectangle(172, 225, 155, 21));
936 JLabel protColourLabel = new JLabel();
937 protColourLabel.setFont(LABEL_FONT);
938 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
939 protColourLabel.setText(
940 MessageManager.getString("label.prot_alignment_colour") + " ");
941 JvSwingUtils.addtoLayout(coloursTab,
943 .getString("label.default_colour_scheme_for_alignment"),
944 protColourLabel, protColour);
946 nucColour.setFont(LABEL_FONT);
947 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
948 JLabel nucColourLabel = new JLabel();
949 nucColourLabel.setFont(LABEL_FONT);
950 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
951 nucColourLabel.setText(
952 MessageManager.getString("label.nuc_alignment_colour") + " ");
953 JvSwingUtils.addtoLayout(coloursTab,
955 .getString("label.default_colour_scheme_for_alignment"),
956 nucColourLabel, nucColour);
958 JPanel annotationShding = new JPanel();
959 annotationShding.setBorder(new TitledBorder(
960 MessageManager.getString("label.annotation_shading_default")));
961 annotationShding.setLayout(new GridLayout(1, 2));
962 JvSwingUtils.addtoLayout(annotationShding,
963 MessageManager.getString(
964 "label.default_minimum_colour_annotation_shading"),
965 mincolourLabel, minColour);
966 JvSwingUtils.addtoLayout(annotationShding,
967 MessageManager.getString(
968 "label.default_maximum_colour_annotation_shading"),
969 maxcolourLabel, maxColour);
970 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
975 * Initialises the Overview tabbed panel.
979 private JPanel initOverviewTab()
981 JPanel overviewPanel = new JPanel();
982 overviewPanel.setBorder(new TitledBorder(
983 MessageManager.getString("label.overview_settings")));
985 gapColour.setFont(LABEL_FONT);
986 // fixing the border colours stops apparent colour bleed from the panel
988 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
989 gapColour.setPreferredSize(new Dimension(40, 20));
990 gapColour.addMouseListener(new MouseAdapter()
993 public void mousePressed(MouseEvent e)
995 gapColour_actionPerformed(gapColour);
999 hiddenColour.setFont(LABEL_FONT);
1000 // fixing the border colours stops apparent colour bleed from the panel
1001 hiddenColour.setBorder(
1002 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1003 hiddenColour.setPreferredSize(new Dimension(40, 20));
1004 hiddenColour.addMouseListener(new MouseAdapter()
1007 public void mousePressed(MouseEvent e)
1009 hiddenColour_actionPerformed(hiddenColour);
1013 useLegacyGap = new JCheckBox(
1014 MessageManager.getString("label.ov_legacy_gap"));
1015 useLegacyGap.setFont(LABEL_FONT);
1016 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1017 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1018 gapLabel = new JLabel(
1019 MessageManager.getString("label.gap_colour"));
1020 gapLabel.setFont(LABEL_FONT);
1021 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1022 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1023 showHiddenAtStart = new JCheckBox(
1024 MessageManager.getString("label.ov_show_hide_default"));
1025 showHiddenAtStart.setFont(LABEL_FONT);
1026 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1027 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1028 JLabel hiddenLabel = new JLabel(
1029 MessageManager.getString("label.hidden_colour"));
1030 hiddenLabel.setFont(LABEL_FONT);
1031 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1032 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1034 useLegacyGap.addActionListener(new ActionListener()
1037 public void actionPerformed(ActionEvent e)
1039 useLegacyGaps_actionPerformed(e);
1043 overviewPanel.setLayout(new GridBagLayout());
1044 GridBagConstraints c1 = new GridBagConstraints();
1046 c1.fill = GridBagConstraints.HORIZONTAL;
1051 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1052 overviewPanel.add(useLegacyGap, c1);
1054 GridBagConstraints c2 = new GridBagConstraints();
1055 c2.fill = GridBagConstraints.HORIZONTAL;
1058 c2.insets = new Insets(0, 15, 0, 10);
1059 overviewPanel.add(gapLabel, c2);
1061 GridBagConstraints c3 = new GridBagConstraints();
1062 c3.fill = GridBagConstraints.HORIZONTAL;
1065 c3.insets = new Insets(0, 0, 0, 15);
1066 overviewPanel.add(gapColour, c3);
1068 GridBagConstraints c4 = new GridBagConstraints();
1069 c4.fill = GridBagConstraints.HORIZONTAL;
1073 overviewPanel.add(showHiddenAtStart, c4);
1075 GridBagConstraints c5 = new GridBagConstraints();
1076 c5.fill = GridBagConstraints.HORIZONTAL;
1079 c5.insets = new Insets(0, 15, 0, 10);
1080 overviewPanel.add(hiddenLabel, c5);
1082 GridBagConstraints c6 = new GridBagConstraints();
1083 c6.fill = GridBagConstraints.HORIZONTAL;
1086 c6.insets = new Insets(0, 0, 0, 15);
1087 overviewPanel.add(hiddenColour, c6);
1089 JButton resetButton = new JButton(
1090 MessageManager.getString("label.reset_to_defaults"));
1092 resetButton.addActionListener(new ActionListener()
1095 public void actionPerformed(ActionEvent e)
1097 resetOvDefaults_actionPerformed(e);
1101 GridBagConstraints c7 = new GridBagConstraints();
1102 c7.fill = GridBagConstraints.NONE;
1105 c7.insets = new Insets(10, 0, 0, 0);
1106 c7.anchor = GridBagConstraints.WEST;
1107 overviewPanel.add(resetButton, c7);
1109 // Add padding so the panel doesn't look ridiculous
1110 JPanel spacePanel = new JPanel();
1111 overviewPanel.add(spacePanel,
1112 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1113 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1114 new Insets(0, 0, 0, 5), 0, 0));
1116 return overviewPanel;
1120 * Initialises the Structure tabbed panel.
1124 private JPanel initStructureTab()
1126 structureTab = new JPanel();
1128 structureTab.setBorder(new TitledBorder(
1129 MessageManager.getString("label.structure_options")));
1130 structureTab.setLayout(null);
1131 final int width = 400;
1132 final int height = 22;
1133 final int lineSpacing = 25;
1136 structFromPdb.setFont(LABEL_FONT);
1138 .setText(MessageManager.getString("label.struct_from_pdb"));
1139 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1140 structFromPdb.addActionListener(new ActionListener()
1143 public void actionPerformed(ActionEvent e)
1145 boolean selected = structFromPdb.isSelected();
1146 // enable other options only when the first is checked
1147 useRnaView.setEnabled(selected);
1148 addSecondaryStructure.setEnabled(selected);
1149 addTempFactor.setEnabled(selected);
1152 structureTab.add(structFromPdb);
1154 // indent checkboxes that are conditional on the first one
1155 ypos += lineSpacing;
1156 useRnaView.setFont(LABEL_FONT);
1157 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1158 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1159 structureTab.add(useRnaView);
1161 ypos += lineSpacing;
1162 addSecondaryStructure.setFont(LABEL_FONT);
1163 addSecondaryStructure
1164 .setText(MessageManager.getString("label.autoadd_secstr"));
1165 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1166 structureTab.add(addSecondaryStructure);
1168 ypos += lineSpacing;
1169 addTempFactor.setFont(LABEL_FONT);
1170 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1171 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1172 structureTab.add(addTempFactor);
1174 ypos += lineSpacing;
1175 JLabel viewerLabel = new JLabel();
1176 viewerLabel.setFont(LABEL_FONT);
1177 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1178 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1179 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1180 structureTab.add(viewerLabel);
1182 structViewer.setFont(LABEL_FONT);
1183 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1184 structViewer.addItem(ViewerType.JMOL.name());
1185 structViewer.addItem(ViewerType.CHIMERA.name());
1186 structViewer.addActionListener(new ActionListener()
1189 public void actionPerformed(ActionEvent e)
1191 structureViewer_actionPerformed(
1192 (String) structViewer.getSelectedItem());
1195 structureTab.add(structViewer);
1197 ypos += lineSpacing;
1198 JLabel pathLabel = new JLabel();
1199 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1200 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1201 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1202 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1203 structureTab.add(pathLabel);
1205 chimeraPath.setFont(LABEL_FONT);
1206 chimeraPath.setText("");
1207 final String tooltip = JvSwingUtils.wrapTooltip(true,
1208 MessageManager.getString("label.chimera_path_tip"));
1209 chimeraPath.setToolTipText(tooltip);
1210 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1211 chimeraPath.addMouseListener(new MouseAdapter()
1214 public void mouseClicked(MouseEvent e)
1216 if (e.getClickCount() == 2)
1218 String chosen = openFileChooser();
1221 chimeraPath.setText(chosen);
1226 structureTab.add(chimeraPath);
1228 ypos += lineSpacing;
1229 nwMapping.setFont(LABEL_FONT);
1230 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1231 siftsMapping.setFont(LABEL_FONT);
1232 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1233 mappingMethod.add(nwMapping);
1234 mappingMethod.add(siftsMapping);
1235 JPanel mappingPanel = new JPanel();
1236 mappingPanel.setFont(LABEL_FONT);
1237 TitledBorder mmTitledBorder = new TitledBorder(
1238 MessageManager.getString("label.mapping_method"));
1239 mmTitledBorder.setTitleFont(LABEL_FONT);
1240 mappingPanel.setBorder(mmTitledBorder);
1241 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1242 // GridLayout mappingLayout = new GridLayout();
1243 mappingPanel.setLayout(new GridLayout());
1244 mappingPanel.add(nwMapping);
1245 mappingPanel.add(siftsMapping);
1246 structureTab.add(mappingPanel);
1248 ypos += lineSpacing;
1249 ypos += lineSpacing;
1250 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1251 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1252 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1253 structureTab.add(docFieldPref);
1255 return structureTab;
1259 * Action on choosing a structure viewer from combobox options.
1261 * @param selectedItem
1263 protected void structureViewer_actionPerformed(String selectedItem)
1268 * Show a dialog for the user to choose a file. Returns the chosen path, or
1273 protected String openFileChooser()
1275 String choice = null;
1276 JFileChooser chooser = new JFileChooser();
1278 // chooser.setFileView(new JalviewFileView());
1279 chooser.setDialogTitle(
1280 MessageManager.getString("label.open_local_file"));
1281 chooser.setToolTipText(MessageManager.getString("action.open"));
1283 int value = chooser.showOpenDialog(this);
1285 if (value == JFileChooser.APPROVE_OPTION)
1287 choice = chooser.getSelectedFile().getPath();
1293 * Validate the structure tab preferences; if invalid, set focus on this tab.
1297 protected boolean validateStructure(FocusEvent e)
1299 if (!validateStructure())
1301 e.getComponent().requestFocusInWindow();
1307 protected boolean validateStructure()
1313 * Initialises the Visual tabbed panel.
1317 private JPanel initVisualTab()
1319 JPanel visualTab = new JPanel();
1320 visualTab.setBorder(new TitledBorder(
1321 MessageManager.getString("action.open_new_alignment")));
1322 visualTab.setLayout(null);
1323 fullScreen.setFont(LABEL_FONT);
1324 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1325 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1326 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1327 quality.setEnabled(false);
1328 quality.setFont(LABEL_FONT);
1329 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1330 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1331 quality.setSelected(true);
1332 quality.setText(MessageManager.getString("label.quality"));
1333 conservation.setEnabled(false);
1334 conservation.setFont(LABEL_FONT);
1335 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1336 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1337 conservation.setSelected(true);
1338 conservation.setText(MessageManager.getString("label.conservation"));
1339 identity.setEnabled(false);
1340 identity.setFont(LABEL_FONT);
1341 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1342 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1343 identity.setSelected(true);
1344 identity.setText(MessageManager.getString("label.consensus"));
1345 showOccupancy.setFont(LABEL_FONT);
1346 showOccupancy.setEnabled(false);
1347 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1348 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1349 showOccupancy.setSelected(true);
1350 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1352 JLabel showGroupbits = new JLabel();
1353 showGroupbits.setFont(LABEL_FONT);
1354 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1355 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1357 .setText(MessageManager.getString("action.show_group") + ":");
1358 JLabel showConsensbits = new JLabel();
1359 showConsensbits.setFont(LABEL_FONT);
1360 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1361 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1363 .setText(MessageManager.getString("label.consensus") + ":");
1364 showConsensHistogram.setEnabled(false);
1365 showConsensHistogram.setFont(LABEL_FONT);
1366 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1367 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1368 showConsensHistogram.setSelected(true);
1369 showConsensHistogram
1370 .setText(MessageManager.getString("label.histogram"));
1371 showConsensLogo.setEnabled(false);
1372 showConsensLogo.setFont(LABEL_FONT);
1373 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1374 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1375 showConsensLogo.setSelected(true);
1376 showConsensLogo.setText(MessageManager.getString("label.logo"));
1377 showGroupConsensus.setEnabled(false);
1378 showGroupConsensus.setFont(LABEL_FONT);
1379 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1380 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1381 showGroupConsensus.setSelected(true);
1382 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1383 showGroupConservation.setEnabled(false);
1384 showGroupConservation.setFont(LABEL_FONT);
1385 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1386 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1387 showGroupConservation.setSelected(true);
1388 showGroupConservation
1389 .setText(MessageManager.getString("label.conservation"));
1390 showNpTooltip.setEnabled(true);
1391 showNpTooltip.setFont(LABEL_FONT);
1392 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1393 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1394 showNpTooltip.setSelected(true);
1395 showNpTooltip.setText(
1396 MessageManager.getString("label.non_positional_features"));
1397 showDbRefTooltip.setEnabled(true);
1398 showDbRefTooltip.setFont(LABEL_FONT);
1399 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1400 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1401 showDbRefTooltip.setSelected(true);
1403 .setText(MessageManager.getString("label.database_references"));
1404 annotations.setFont(LABEL_FONT);
1405 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1406 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1407 annotations.setSelected(true);
1408 annotations.setText(MessageManager.getString("label.show_annotations"));
1409 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1410 annotations.addActionListener(new ActionListener()
1413 public void actionPerformed(ActionEvent e)
1415 annotations_actionPerformed(e);
1418 identity.addActionListener(new ActionListener()
1421 public void actionPerformed(ActionEvent e)
1423 annotations_actionPerformed(e);
1426 showGroupConsensus.addActionListener(new ActionListener()
1429 public void actionPerformed(ActionEvent e)
1431 annotations_actionPerformed(e);
1434 showUnconserved.setFont(LABEL_FONT);
1435 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1436 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1437 showUnconserved.setSelected(true);
1439 .setText(MessageManager.getString("action.show_unconserved"));
1440 showUnconserved.addActionListener(new ActionListener()
1443 public void actionPerformed(ActionEvent e)
1445 showunconserved_actionPerformed(e);
1449 // TODO these are not yet added to / action from Preferences
1450 // JCheckBox shareSelections = new JCheckBox();
1451 // shareSelections.setFont(verdana11);
1452 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1453 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1454 // shareSelections.setSelected(true);
1455 // shareSelections.setText(MessageManager
1456 // .getString("label.share_selection_across_views"));
1457 // JCheckBox followHighlight = new JCheckBox();
1458 // followHighlight.setFont(verdana11);
1459 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1460 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1461 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1462 // followHighlight.setSelected(true);
1463 // followHighlight.setText(MessageManager
1464 // .getString("label.scroll_highlighted_regions"));
1466 seqLimit.setFont(LABEL_FONT);
1467 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1468 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1469 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1470 smoothFont.setFont(LABEL_FONT);
1471 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1472 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1473 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1474 scaleProteinToCdna.setFont(LABEL_FONT);
1475 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1476 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1477 scaleProteinToCdna.setText(
1478 MessageManager.getString("label.scale_protein_to_cdna"));
1479 scaleProteinToCdna.setToolTipText(
1480 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1481 JLabel gapLabel = new JLabel();
1482 gapLabel.setFont(LABEL_FONT);
1483 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1484 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1485 JLabel fontLabel = new JLabel();
1486 fontLabel.setFont(LABEL_FONT);
1487 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1488 fontLabel.setText(MessageManager.getString("label.font"));
1489 fontSizeCB.setFont(LABEL_FONT);
1490 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1491 fontStyleCB.setFont(LABEL_FONT);
1492 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1493 fontNameCB.setFont(LABEL_FONT);
1494 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1495 gapSymbolCB.setFont(LABEL_FONT);
1496 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1497 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1498 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1499 gapSymbolCB.setRenderer(dlcr);
1501 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1502 startupCheckbox.setFont(LABEL_FONT);
1503 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1504 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1505 startupCheckbox.setSelected(true);
1506 startupFileTextfield.setFont(LABEL_FONT);
1507 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1508 final String tooltip = JvSwingUtils.wrapTooltip(true,
1509 MessageManager.getString("label.double_click_to_browse"));
1510 startupFileTextfield.setToolTipText(tooltip);
1511 startupFileTextfield.addMouseListener(new MouseAdapter()
1514 public void mouseClicked(MouseEvent e)
1516 if (e.getClickCount() > 1)
1518 startupFileTextfield_mouseClicked();
1523 sortby.setFont(LABEL_FONT);
1524 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1525 JLabel sortLabel = new JLabel();
1526 sortLabel.setFont(LABEL_FONT);
1527 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1528 sortLabel.setText(MessageManager.getString("label.sort_by"));
1529 sortAnnBy.setFont(LABEL_FONT);
1530 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1531 JLabel sortAnnLabel = new JLabel();
1532 sortAnnLabel.setFont(LABEL_FONT);
1533 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1534 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1535 sortAutocalc.setFont(LABEL_FONT);
1536 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1538 JPanel annsettingsPanel = new JPanel();
1539 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1540 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1541 annsettingsPanel.setBorder(new EtchedBorder());
1542 visualTab.add(annsettingsPanel);
1543 Border jb = new EmptyBorder(1, 1, 4, 5);
1544 annotations.setBorder(jb);
1545 showOccupancy.setBorder(jb);
1546 quality.setBorder(jb);
1547 conservation.setBorder(jb);
1548 identity.setBorder(jb);
1549 showConsensbits.setBorder(jb);
1550 showGroupbits.setBorder(jb);
1551 showGroupConsensus.setBorder(jb);
1552 showGroupConservation.setBorder(jb);
1553 showConsensHistogram.setBorder(jb);
1554 showConsensLogo.setBorder(jb);
1556 JPanel autoAnnotSettings = new JPanel();
1557 annsettingsPanel.add(autoAnnotSettings);
1558 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1559 autoAnnotSettings.add(annotations);
1560 autoAnnotSettings.add(quality);
1561 // second row of autoannotation box
1562 autoAnnotSettings = new JPanel();
1563 annsettingsPanel.add(autoAnnotSettings);
1565 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1566 autoAnnotSettings.add(conservation);
1567 autoAnnotSettings.add(identity);
1568 autoAnnotSettings.add(showOccupancy);
1569 autoAnnotSettings.add(showGroupbits);
1570 autoAnnotSettings.add(showGroupConservation);
1571 autoAnnotSettings.add(showGroupConsensus);
1572 autoAnnotSettings.add(showConsensbits);
1573 autoAnnotSettings.add(showConsensHistogram);
1574 autoAnnotSettings.add(showConsensLogo);
1576 JPanel tooltipSettings = new JPanel();
1577 tooltipSettings.setBorder(new TitledBorder(
1578 MessageManager.getString("label.sequence_id_tooltip")));
1579 tooltipSettings.setBounds(173, 140, 220, 62);
1580 tooltipSettings.setLayout(new GridLayout(2, 1));
1581 tooltipSettings.add(showDbRefTooltip);
1582 tooltipSettings.add(showNpTooltip);
1583 visualTab.add(tooltipSettings);
1585 wrap.setFont(LABEL_FONT);
1586 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1587 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1588 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1589 rightAlign.setFont(LABEL_FONT);
1590 rightAlign.setForeground(Color.black);
1591 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1592 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1593 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1594 idItalics.setFont(LABEL_FONT_ITALIC);
1595 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1596 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1598 MessageManager.getString("label.sequence_name_italics"));
1599 openoverv.setFont(LABEL_FONT);
1600 openoverv.setActionCommand(
1601 MessageManager.getString("label.open_overview"));
1602 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1603 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1604 openoverv.setText(MessageManager.getString("label.open_overview"));
1605 JPanel jPanel2 = new JPanel();
1606 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1607 jPanel2.setLayout(new GridLayout(14, 1));
1608 jPanel2.add(fullScreen);
1609 jPanel2.add(openoverv);
1610 jPanel2.add(seqLimit);
1611 jPanel2.add(rightAlign);
1612 jPanel2.add(fontLabel);
1613 jPanel2.add(showUnconserved);
1614 jPanel2.add(idItalics);
1615 jPanel2.add(smoothFont);
1616 jPanel2.add(scaleProteinToCdna);
1617 jPanel2.add(gapLabel);
1619 jPanel2.add(sortLabel);
1620 jPanel2.add(sortAnnLabel);
1621 jPanel2.add(startupCheckbox);
1622 visualTab.add(jPanel2);
1623 visualTab.add(startupFileTextfield);
1624 visualTab.add(sortby);
1625 visualTab.add(sortAnnBy);
1626 visualTab.add(sortAutocalc);
1627 visualTab.add(gapSymbolCB);
1628 visualTab.add(fontNameCB);
1629 visualTab.add(fontSizeCB);
1630 visualTab.add(fontStyleCB);
1634 protected void autoIdWidth_actionPerformed()
1636 // TODO Auto-generated method stub
1640 protected void userIdWidth_actionPerformed()
1642 // TODO Auto-generated method stub
1646 protected void maxColour_actionPerformed(JPanel panel)
1650 protected void minColour_actionPerformed(JPanel panel)
1654 protected void gapColour_actionPerformed(JPanel panel)
1658 protected void hiddenColour_actionPerformed(JPanel panel)
1662 protected void showunconserved_actionPerformed(ActionEvent e)
1664 // TODO Auto-generated method stub
1668 protected void useLegacyGaps_actionPerformed(ActionEvent e)
1672 protected void resetOvDefaults_actionPerformed(ActionEvent e)
1682 public void ok_actionPerformed(ActionEvent e)
1692 public void cancel_actionPerformed(ActionEvent e)
1702 public void annotations_actionPerformed(ActionEvent e)
1709 public void startupFileTextfield_mouseClicked()
1713 public void newLink_actionPerformed(ActionEvent e)
1718 public void editLink_actionPerformed(ActionEvent e)
1723 public void deleteLink_actionPerformed(ActionEvent e)
1728 public void defaultBrowser_mouseClicked(MouseEvent e)
1733 public void linkURLList_keyTyped(KeyEvent e)
1738 public void useProxy_actionPerformed()
1740 boolean enabled = useProxy.isSelected();
1741 portLabel.setEnabled(enabled);
1742 serverLabel.setEnabled(enabled);
1743 proxyServerTB.setEnabled(enabled);
1744 proxyPortTB.setEnabled(enabled);
1748 * Customer renderer for JTable: supports column of radio buttons
1750 public class RadioButtonRenderer extends JRadioButton
1751 implements TableCellRenderer
1753 public RadioButtonRenderer()
1755 setHorizontalAlignment(CENTER);
1756 setToolTipText(MessageManager.getString("label.urltooltip"));
1760 public Component getTableCellRendererComponent(JTable table,
1761 Object value, boolean isSelected, boolean hasFocus, int row,
1764 setSelected((boolean) value);
1766 // set colours to match rest of table
1769 setBackground(table.getSelectionBackground());
1770 setForeground(table.getSelectionForeground());
1774 setBackground(table.getBackground());
1775 setForeground(table.getForeground());
1782 * Customer cell editor for JTable: supports column of radio buttons in
1783 * conjunction with renderer
1785 public class RadioButtonEditor extends AbstractCellEditor
1786 implements TableCellEditor
1788 private JRadioButton button = new JRadioButton();
1790 public RadioButtonEditor()
1792 button.setHorizontalAlignment(SwingConstants.CENTER);
1793 this.button.addActionListener(new ActionListener()
1796 public void actionPerformed(ActionEvent e)
1798 fireEditingStopped();
1804 public Component getTableCellEditorComponent(JTable table, Object value,
1805 boolean isSelected, int row, int column)
1807 button.setSelected((boolean) value);
1812 public Object getCellEditorValue()
1814 return button.isSelected();