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.getLabelFont(
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<String>();
100 protected JComboBox<String> fontStyleCB = new JComboBox<String>();
102 protected JComboBox<String> fontNameCB = new JComboBox<String>();
104 protected JCheckBox showUnconserved = new JCheckBox();
106 protected JCheckBox idItalics = new JCheckBox();
108 protected JCheckBox smoothFont = new JCheckBox();
110 protected JCheckBox scaleProteinToCdna = new JCheckBox();
112 protected JComboBox<String> gapSymbolCB = new JComboBox<String>();
114 protected JCheckBox wrap = new JCheckBox();
116 protected JComboBox<String> sortby = new JComboBox<String>();
118 protected JComboBox<String> sortAnnBy = new JComboBox<String>();
120 protected JComboBox<String> sortAutocalc = new JComboBox<String>();
122 protected JCheckBox startupCheckbox = new JCheckBox();
124 protected JTextField startupFileTextfield = new JTextField();
126 // below are in the 'second column'
127 protected JCheckBox annotations = new JCheckBox();
129 protected JCheckBox quality = new JCheckBox();
131 protected JCheckBox conservation = new JCheckBox();
133 protected JCheckBox identity = new JCheckBox();
135 protected JCheckBox showGroupConsensus = new JCheckBox();
137 protected JCheckBox showGroupConservation = new JCheckBox();
139 protected JCheckBox showConsensHistogram = new JCheckBox();
141 protected JCheckBox showConsensLogo = new JCheckBox();
143 protected JCheckBox showDbRefTooltip = new JCheckBox();
145 protected JCheckBox showNpTooltip = new JCheckBox();
148 * Structure tab and components
150 protected JPanel structureTab;
152 protected JCheckBox structFromPdb = new JCheckBox();
154 protected JCheckBox useRnaView = new JCheckBox();
156 protected JCheckBox addSecondaryStructure = new JCheckBox();
158 protected JCheckBox addTempFactor = new JCheckBox();
160 protected JComboBox<String> structViewer = new JComboBox<String>();
162 protected JTextField chimeraPath = new JTextField();
164 protected ButtonGroup mappingMethod = new ButtonGroup();
166 protected JRadioButton siftsMapping = new JRadioButton();
168 protected JRadioButton nwMapping = new JRadioButton();
171 * Colours tab components
173 protected JPanel minColour = new JPanel();
175 protected JPanel maxColour = new JPanel();
177 protected JComboBox<String> protColour = new JComboBox<String>();
179 protected JComboBox<String> nucColour = new JComboBox<String>();
182 * Connections tab components
184 protected JTable linkUrlTable = new JTable();
186 protected JButton editLink = new JButton();
188 protected JButton deleteLink = new JButton();
190 protected JTextField filterTB = new JTextField();
192 protected JButton doReset = new JButton();
194 protected JButton userOnly = new JButton();
196 protected JLabel portLabel = new JLabel();
198 protected JLabel serverLabel = new JLabel();
200 protected JTextField proxyServerTB = new JTextField();
202 protected JTextField proxyPortTB = new JTextField();
204 protected JTextField defaultBrowser = new JTextField();
206 protected JCheckBox useProxy = new JCheckBox();
208 protected JCheckBox usagestats = new JCheckBox();
210 protected JCheckBox questionnaire = new JCheckBox();
212 protected JCheckBox versioncheck = new JCheckBox();
215 * Output tab components
217 protected JComboBox<Object> epsRendering = new JComboBox<Object>();
219 protected JLabel userIdWidthlabel = new JLabel();
221 protected JCheckBox autoIdWidth = new JCheckBox();
223 protected JTextField userIdWidth = new JTextField();
225 protected JCheckBox blcjv = new JCheckBox();
227 protected JCheckBox pileupjv = new JCheckBox();
229 protected JCheckBox clustaljv = new JCheckBox();
231 protected JCheckBox msfjv = new JCheckBox();
233 protected JCheckBox fastajv = new JCheckBox();
235 protected JCheckBox pfamjv = new JCheckBox();
237 protected JCheckBox pirjv = new JCheckBox();
239 protected JCheckBox modellerOutput = new JCheckBox();
241 protected JCheckBox embbedBioJSON = new JCheckBox();
244 * Editing tab components
246 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
248 protected JCheckBox padGaps = new JCheckBox();
250 protected JCheckBox sortByTree = new JCheckBox();
255 protected JPanel dasTab = new JPanel();
260 protected JPanel wsTab = new JPanel();
263 * Creates a new GPreferences object.
265 public GPreferences()
270 } catch (Exception ex)
272 ex.printStackTrace();
277 * Construct the panel and its tabbed sub-panels.
281 private void jbInit() throws Exception
283 final JTabbedPane tabbedPane = new JTabbedPane();
284 this.setLayout(new BorderLayout());
285 JPanel okCancelPanel = initOkCancelPanel();
286 this.add(tabbedPane, BorderLayout.CENTER);
287 this.add(okCancelPanel, BorderLayout.SOUTH);
289 tabbedPane.add(initVisualTab(),
290 MessageManager.getString("label.visual"));
292 tabbedPane.add(initColoursTab(),
293 MessageManager.getString("label.colours"));
295 tabbedPane.add(initStructureTab(),
296 MessageManager.getString("label.structure"));
298 tabbedPane.add(initConnectionsTab(),
299 MessageManager.getString("label.connections"));
301 tabbedPane.add(initLinksTab(),
302 MessageManager.getString("label.urllinks"));
304 tabbedPane.add(initOutputTab(),
305 MessageManager.getString("label.output"));
307 tabbedPane.add(initEditingTab(),
308 MessageManager.getString("label.editing"));
311 * See DasSourceBrowser for the real work of configuring this tab.
313 dasTab.setLayout(new BorderLayout());
314 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
317 * See WsPreferences for the real work of configuring this tab.
319 wsTab.setLayout(new BorderLayout());
320 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
323 * Handler to validate a tab before leaving it - currently only for
326 tabbedPane.addChangeListener(new ChangeListener()
328 private Component lastTab;
331 public void stateChanged(ChangeEvent e)
333 if (lastTab == structureTab
334 && tabbedPane.getSelectedComponent() != structureTab)
336 if (!validateStructure())
338 tabbedPane.setSelectedComponent(structureTab);
342 lastTab = tabbedPane.getSelectedComponent();
349 * Initialises the Editing tabbed panel.
353 private JPanel initEditingTab()
355 JPanel editingTab = new JPanel();
356 editingTab.setLayout(null);
357 autoCalculateConsCheck.setFont(LABEL_FONT);
358 autoCalculateConsCheck.setText(MessageManager
359 .getString("label.autocalculate_consensus"));
360 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
361 padGaps.setFont(LABEL_FONT);
362 padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
363 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
364 sortByTree.setFont(LABEL_FONT);
366 .setText(MessageManager.getString("label.sort_with_new_tree"));
368 .setToolTipText(MessageManager
369 .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
370 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
371 editingTab.add(autoCalculateConsCheck);
372 editingTab.add(padGaps);
373 editingTab.add(sortByTree);
378 * Initialises the Output tabbed panel.
382 private JPanel initOutputTab()
384 JPanel outputTab = new JPanel();
385 outputTab.setLayout(null);
386 JLabel epsLabel = new JLabel();
387 epsLabel.setFont(LABEL_FONT);
388 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
389 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
390 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
391 epsRendering.setFont(LABEL_FONT);
392 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
393 JLabel jLabel1 = new JLabel();
394 jLabel1.setFont(LABEL_FONT);
395 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
396 jLabel1.setText(MessageManager.getString("label.append_start_end"));
397 jLabel1.setFont(LABEL_FONT);
398 fastajv.setFont(LABEL_FONT);
399 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
400 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
401 blcjv.setText(MessageManager.getString("label.blc") + " ");
402 fastajv.setText(MessageManager.getString("label.fasta") + " ");
403 msfjv.setText(MessageManager.getString("label.msf") + " ");
404 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
405 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
406 msfjv.setFont(LABEL_FONT);
407 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
408 pirjv.setText(MessageManager.getString("label.pir") + " ");
409 JPanel jPanel11 = new JPanel();
410 jPanel11.setFont(LABEL_FONT);
411 TitledBorder titledBorder2 = new TitledBorder(
412 MessageManager.getString("label.file_output"));
413 jPanel11.setBorder(titledBorder2);
414 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
415 GridLayout gridLayout3 = new GridLayout();
416 jPanel11.setLayout(gridLayout3);
417 gridLayout3.setRows(8);
418 blcjv.setFont(LABEL_FONT);
419 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
420 clustaljv.setFont(LABEL_FONT);
421 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
422 pfamjv.setFont(LABEL_FONT);
423 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
424 pileupjv.setFont(LABEL_FONT);
425 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
426 pirjv.setFont(LABEL_FONT);
427 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
428 autoIdWidth.setFont(LABEL_FONT);
429 autoIdWidth.setText(MessageManager
430 .getString("label.automatically_set_id_width"));
431 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true,
433 .getString("label.adjusts_width_generated_eps_png")));
434 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
435 autoIdWidth.addActionListener(new ActionListener()
439 public void actionPerformed(ActionEvent e)
441 autoIdWidth_actionPerformed();
444 userIdWidthlabel.setFont(LABEL_FONT);
445 userIdWidthlabel.setText(MessageManager
446 .getString("label.figure_id_column_width"));
448 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
449 .getString("label.manually_specify_width_left_column")));
451 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
452 .getString("label.manually_specify_width_left_column")));
453 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
454 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
455 userIdWidth.setText("");
456 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
457 userIdWidth.addActionListener(new ActionListener()
461 public void actionPerformed(ActionEvent e)
463 userIdWidth_actionPerformed();
466 modellerOutput.setFont(LABEL_FONT);
467 modellerOutput.setText(MessageManager
468 .getString("label.use_modeller_output"));
469 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
470 embbedBioJSON.setFont(LABEL_FONT);
471 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
472 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
474 jPanel11.add(jLabel1);
476 jPanel11.add(clustaljv);
477 jPanel11.add(fastajv);
479 jPanel11.add(pfamjv);
480 jPanel11.add(pileupjv);
482 outputTab.add(autoIdWidth);
483 outputTab.add(userIdWidth);
484 outputTab.add(userIdWidthlabel);
485 outputTab.add(modellerOutput);
486 outputTab.add(embbedBioJSON);
487 outputTab.add(epsLabel);
488 outputTab.add(epsRendering);
489 outputTab.add(jPanel11);
494 * Initialises the Connections tabbed panel.
498 private JPanel initConnectionsTab()
500 JPanel connectTab = new JPanel();
501 connectTab.setLayout(new GridBagLayout());
503 // Label for browser text box
504 JLabel browserLabel = new JLabel();
505 browserLabel.setFont(LABEL_FONT);
506 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
507 browserLabel.setText(MessageManager
508 .getString("label.default_browser_unix"));
509 defaultBrowser.setFont(LABEL_FONT);
510 defaultBrowser.setText("");
512 defaultBrowser.addMouseListener(new MouseAdapter()
515 public void mouseClicked(MouseEvent e)
517 if (e.getClickCount() > 1)
519 defaultBrowser_mouseClicked(e);
524 JPanel proxyPanel = initConnTabProxyPanel();
525 initConnTabCheckboxes();
527 // Add default Browser text box
528 connectTab.add(browserLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,
529 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
530 new Insets(10, 0, 5, 5), 5, 1));
531 defaultBrowser.setFont(LABEL_FONT);
532 defaultBrowser.setText("");
534 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
535 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
536 new Insets(10, 0, 5, 10), 30, 1));
538 // Add proxy server panel
539 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
540 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
541 new Insets(10, 0, 5, 12), 4, 10));
543 // Add usage stats, version check and questionnaire checkboxes
544 connectTab.add(usagestats, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
545 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
546 new Insets(0, 2, 5, 5), 70, 1));
547 connectTab.add(questionnaire, new GridBagConstraints(1, 2, 1, 1, 1.0,
548 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
549 new Insets(0, 2, 5, 10), 70, 1));
550 connectTab.add(versioncheck, new GridBagConstraints(0, 3, 1, 1, 1.0,
551 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
552 new Insets(0, 2, 5, 5), 70, 1));
554 // Add padding so the panel doesn't look ridiculous
555 JPanel spacePanel = new JPanel();
556 connectTab.add(spacePanel, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
557 GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0,
564 * Initialises the Links tabbed panel.
568 private JPanel initLinksTab()
570 JPanel linkTab = new JPanel();
571 linkTab.setLayout(new GridBagLayout());
573 // Set up table for Url links
574 linkUrlTable.setFillsViewportHeight(true);
575 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
576 linkUrlTable.setAutoCreateRowSorter(true);
577 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
579 // adjust row height so radio buttons actually fit
580 // don't do this in the renderer, it causes the awt thread to activate
582 JRadioButton temp = new JRadioButton();
583 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
585 // Table in scrollpane so that the table is given a scrollbar
586 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
587 linkScrollPane.setBorder(null);
589 // Panel for links functionality
590 JPanel linkPanel = new JPanel(new GridBagLayout());
591 linkPanel.setBorder(new TitledBorder(MessageManager
592 .getString("label.url_linkfrom_sequence_id")));
594 // Put the Url links panel together
596 // Buttons go at top right, resizing only resizes the blank space vertically
597 JPanel buttonPanel = initLinkTabUrlButtons();
598 GridBagConstraints linkConstraints1 = new GridBagConstraints();
599 linkConstraints1.insets = new Insets(0, 0, 5, 0);
600 linkConstraints1.gridx = 0;
601 linkConstraints1.gridy = 0;
602 linkConstraints1.weightx = 1.0;
603 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
604 linkTab.add(buttonPanel, linkConstraints1);
606 // Links table goes at top left, resizing resizes the table
607 GridBagConstraints linkConstraints2 = new GridBagConstraints();
608 linkConstraints2.insets = new Insets(0, 0, 5, 5);
609 linkConstraints2.gridx = 0;
610 linkConstraints2.gridy = 1;
611 linkConstraints2.weightx = 1.0;
612 linkConstraints2.weighty = 1.0;
613 linkConstraints2.fill = GridBagConstraints.BOTH;
614 linkTab.add(linkScrollPane, linkConstraints2);
616 // Filter box and buttons goes at bottom left, resizing resizes the text box
617 JPanel filterPanel = initLinkTabFilterPanel();
618 GridBagConstraints linkConstraints3 = new GridBagConstraints();
619 linkConstraints3.insets = new Insets(0, 0, 0, 5);
620 linkConstraints3.gridx = 0;
621 linkConstraints3.gridy = 2;
622 linkConstraints3.weightx = 1.0;
623 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
624 linkTab.add(filterPanel, linkConstraints3);
629 private JPanel initLinkTabFilterPanel()
631 // Filter textbox and reset button
632 JLabel filterLabel = new JLabel(
633 MessageManager.getString("label.filter"));
634 filterLabel.setFont(LABEL_FONT);
635 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
636 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
638 filterTB.setFont(LABEL_FONT);
639 filterTB.setText("");
641 doReset.setText(MessageManager.getString("action.showall"));
642 userOnly.setText(MessageManager.getString("action.customfilter"));
644 // Panel for filter functionality
645 JPanel filterPanel = new JPanel(new GridBagLayout());
646 filterPanel.setBorder(new TitledBorder("Filter"));
647 GridBagConstraints gbc = new GridBagConstraints();
650 gbc.fill = GridBagConstraints.NONE;
651 gbc.anchor = GridBagConstraints.WEST;
653 filterPanel.add(filterLabel, gbc);
655 GridBagConstraints gbc1 = new GridBagConstraints();
658 gbc1.fill = GridBagConstraints.HORIZONTAL;
659 gbc1.anchor = GridBagConstraints.WEST;
661 filterPanel.add(filterTB, gbc1);
663 GridBagConstraints gbc2 = new GridBagConstraints();
665 gbc2.fill = GridBagConstraints.NONE;
666 gbc2.anchor = GridBagConstraints.WEST;
667 filterPanel.add(doReset, gbc2);
669 GridBagConstraints gbc3 = new GridBagConstraints();
671 gbc3.fill = GridBagConstraints.NONE;
672 gbc3.anchor = GridBagConstraints.WEST;
673 filterPanel.add(userOnly, gbc3);
678 private JPanel initLinkTabUrlButtons()
680 // Buttons for new / edit / delete Url links
681 JButton newLink = new JButton();
682 newLink.setText(MessageManager.getString("action.new"));
684 editLink.setText(MessageManager.getString("action.edit"));
686 deleteLink.setText(MessageManager.getString("action.delete"));
688 // no current selection, so initially disable delete/edit buttons
689 editLink.setEnabled(false);
690 deleteLink.setEnabled(false);
692 newLink.addActionListener(new java.awt.event.ActionListener()
695 public void actionPerformed(ActionEvent e)
697 newLink_actionPerformed(e);
701 editLink.setText(MessageManager.getString("action.edit"));
702 editLink.addActionListener(new java.awt.event.ActionListener()
705 public void actionPerformed(ActionEvent e)
707 editLink_actionPerformed(e);
711 deleteLink.setText(MessageManager.getString("action.delete"));
712 deleteLink.addActionListener(new java.awt.event.ActionListener()
715 public void actionPerformed(ActionEvent e)
717 deleteLink_actionPerformed(e);
721 JPanel buttonPanel = new JPanel(new GridBagLayout());
722 buttonPanel.setBorder(new TitledBorder("Edit links"));
723 GridBagConstraints gbc = new GridBagConstraints();
726 gbc.fill = GridBagConstraints.NONE;
727 buttonPanel.add(newLink, gbc);
729 GridBagConstraints gbc1 = new GridBagConstraints();
732 gbc1.fill = GridBagConstraints.NONE;
733 buttonPanel.add(editLink, gbc1);
735 GridBagConstraints gbc2 = new GridBagConstraints();
738 gbc2.fill = GridBagConstraints.NONE;
739 buttonPanel.add(deleteLink, gbc2);
741 GridBagConstraints gbc3 = new GridBagConstraints();
744 gbc3.fill = GridBagConstraints.HORIZONTAL;
746 JPanel spacePanel = new JPanel();
747 spacePanel.setBorder(null);
748 buttonPanel.add(spacePanel, gbc3);
754 * Initialises the proxy server panel in the Connections tab
756 * @return the proxy server panel
758 private JPanel initConnTabProxyPanel()
760 // Label for server text box
761 serverLabel.setText(MessageManager.getString("label.address"));
762 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
763 serverLabel.setFont(LABEL_FONT);
765 // Proxy server and port text boxes
766 proxyServerTB.setFont(LABEL_FONT);
767 proxyPortTB.setFont(LABEL_FONT);
769 // Label for Port text box
770 portLabel.setFont(LABEL_FONT);
771 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
772 portLabel.setText(MessageManager.getString("label.port"));
774 // Use proxy server checkbox
775 useProxy.setFont(LABEL_FONT);
776 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
777 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
778 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
779 useProxy.addActionListener(new ActionListener()
782 public void actionPerformed(ActionEvent e)
784 useProxy_actionPerformed();
788 // Make proxy server panel
789 JPanel proxyPanel = new JPanel();
790 TitledBorder titledBorder1 = new TitledBorder(
791 MessageManager.getString("label.proxy_server"));
792 proxyPanel.setBorder(titledBorder1);
793 proxyPanel.setLayout(new GridBagLayout());
794 proxyPanel.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
795 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
796 new Insets(0, 2, 2, 0), 5, 0));
797 proxyPanel.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
798 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
800 proxyPanel.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
801 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
803 proxyPanel.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0,
804 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
805 new Insets(0, 2, 2, 2), 54, 1));
806 proxyPanel.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0,
807 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
808 new Insets(0, 2, 2, 0), 263, 1));
814 * Initialises the checkboxes in the Connections tab
816 private void initConnTabCheckboxes()
818 // Usage stats checkbox label
819 usagestats.setText(MessageManager
820 .getString("label.send_usage_statistics"));
821 usagestats.setFont(LABEL_FONT);
822 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
823 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
825 // Questionnaire checkbox label
826 questionnaire.setText(MessageManager
827 .getString("label.check_for_questionnaires"));
828 questionnaire.setFont(LABEL_FONT);
829 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
830 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
832 // Check for latest version checkbox label
833 versioncheck.setText(MessageManager
834 .getString("label.check_for_latest_version"));
835 versioncheck.setFont(LABEL_FONT);
836 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
837 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
841 * Initialises the parent panel which contains the tabbed sections.
845 private JPanel initOkCancelPanel()
847 JButton ok = new JButton();
848 ok.setText(MessageManager.getString("action.ok"));
849 ok.addActionListener(new ActionListener()
852 public void actionPerformed(ActionEvent e)
854 ok_actionPerformed(e);
857 JButton cancel = new JButton();
858 cancel.setText(MessageManager.getString("action.cancel"));
859 cancel.addActionListener(new ActionListener()
862 public void actionPerformed(ActionEvent e)
864 cancel_actionPerformed(e);
867 JPanel okCancelPanel = new JPanel();
868 okCancelPanel.add(ok);
869 okCancelPanel.add(cancel);
870 return okCancelPanel;
874 * Initialises the Colours tabbed panel.
878 private JPanel initColoursTab()
880 JPanel coloursTab = new JPanel();
881 coloursTab.setBorder(new TitledBorder(MessageManager
882 .getString("action.open_new_alignment")));
883 coloursTab.setLayout(new FlowLayout());
884 JLabel mincolourLabel = new JLabel();
885 mincolourLabel.setFont(LABEL_FONT);
886 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
887 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
888 minColour.setFont(LABEL_FONT);
889 minColour.setBorder(BorderFactory.createEtchedBorder());
890 minColour.setPreferredSize(new Dimension(40, 20));
891 minColour.addMouseListener(new MouseAdapter()
894 public void mousePressed(MouseEvent e)
896 minColour_actionPerformed(minColour);
899 JLabel maxcolourLabel = new JLabel();
900 maxcolourLabel.setFont(LABEL_FONT);
901 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
902 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
903 maxColour.setFont(LABEL_FONT);
904 maxColour.setBorder(BorderFactory.createEtchedBorder());
905 maxColour.setPreferredSize(new Dimension(40, 20));
906 maxColour.addMouseListener(new MouseAdapter()
909 public void mousePressed(MouseEvent e)
911 maxColour_actionPerformed(maxColour);
915 protColour.setFont(LABEL_FONT);
916 protColour.setBounds(new Rectangle(172, 225, 155, 21));
917 JLabel protColourLabel = new JLabel();
918 protColourLabel.setFont(LABEL_FONT);
919 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
920 protColourLabel.setText(MessageManager
921 .getString("label.prot_alignment_colour") + " ");
922 JvSwingUtils.addtoLayout(coloursTab, MessageManager
923 .getString("label.default_colour_scheme_for_alignment"),
924 protColourLabel, protColour);
926 nucColour.setFont(LABEL_FONT);
927 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
928 JLabel nucColourLabel = new JLabel();
929 nucColourLabel.setFont(LABEL_FONT);
930 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
931 nucColourLabel.setText(MessageManager
932 .getString("label.nuc_alignment_colour") + " ");
933 JvSwingUtils.addtoLayout(coloursTab, MessageManager
934 .getString("label.default_colour_scheme_for_alignment"),
935 nucColourLabel, nucColour);
937 JPanel annotationShding = new JPanel();
938 annotationShding.setBorder(new TitledBorder(MessageManager
939 .getString("label.annotation_shading_default")));
940 annotationShding.setLayout(new GridLayout(1, 2));
941 JvSwingUtils.addtoLayout(annotationShding, MessageManager
942 .getString("label.default_minimum_colour_annotation_shading"),
943 mincolourLabel, minColour);
944 JvSwingUtils.addtoLayout(annotationShding, MessageManager
945 .getString("label.default_maximum_colour_annotation_shading"),
946 maxcolourLabel, maxColour);
947 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
952 * Initialises the Structure tabbed panel.
956 private JPanel initStructureTab()
958 structureTab = new JPanel();
960 structureTab.setBorder(new TitledBorder(MessageManager
961 .getString("label.structure_options")));
962 structureTab.setLayout(null);
963 final int width = 400;
964 final int height = 22;
965 final int lineSpacing = 25;
968 structFromPdb.setFont(LABEL_FONT);
970 .setText(MessageManager.getString("label.struct_from_pdb"));
971 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
972 structFromPdb.addActionListener(new ActionListener()
975 public void actionPerformed(ActionEvent e)
977 boolean selected = structFromPdb.isSelected();
978 // enable other options only when the first is checked
979 useRnaView.setEnabled(selected);
980 addSecondaryStructure.setEnabled(selected);
981 addTempFactor.setEnabled(selected);
984 structureTab.add(structFromPdb);
986 // indent checkboxes that are conditional on the first one
988 useRnaView.setFont(LABEL_FONT);
989 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
990 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
991 structureTab.add(useRnaView);
994 addSecondaryStructure.setFont(LABEL_FONT);
995 addSecondaryStructure.setText(MessageManager
996 .getString("label.autoadd_secstr"));
997 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
998 structureTab.add(addSecondaryStructure);
1000 ypos += lineSpacing;
1001 addTempFactor.setFont(LABEL_FONT);
1002 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1003 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1004 structureTab.add(addTempFactor);
1006 ypos += lineSpacing;
1007 JLabel viewerLabel = new JLabel();
1008 viewerLabel.setFont(LABEL_FONT);
1009 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1010 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1011 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1012 structureTab.add(viewerLabel);
1014 structViewer.setFont(LABEL_FONT);
1015 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1016 structViewer.addItem(ViewerType.JMOL.name());
1017 structViewer.addItem(ViewerType.CHIMERA.name());
1018 structViewer.addActionListener(new ActionListener()
1021 public void actionPerformed(ActionEvent e)
1023 structureViewer_actionPerformed((String) structViewer
1024 .getSelectedItem());
1027 structureTab.add(structViewer);
1029 ypos += lineSpacing;
1030 JLabel pathLabel = new JLabel();
1031 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1032 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1033 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1034 final String tooltip = JvSwingUtils.wrapTooltip(true,
1035 MessageManager.getString("label.chimera_path_tip"));
1036 pathLabel.setToolTipText(tooltip);
1037 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1038 structureTab.add(pathLabel);
1040 chimeraPath.setFont(LABEL_FONT);
1041 chimeraPath.setText("");
1042 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1043 chimeraPath.addMouseListener(new MouseAdapter()
1046 public void mouseClicked(MouseEvent e)
1048 if (e.getClickCount() == 2)
1050 String chosen = openFileChooser();
1053 chimeraPath.setText(chosen);
1058 structureTab.add(chimeraPath);
1060 ypos += lineSpacing;
1061 nwMapping.setFont(LABEL_FONT);
1062 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1063 siftsMapping.setFont(LABEL_FONT);
1064 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1065 mappingMethod.add(nwMapping);
1066 mappingMethod.add(siftsMapping);
1067 JPanel mappingPanel = new JPanel();
1068 mappingPanel.setFont(LABEL_FONT);
1069 TitledBorder mmTitledBorder = new TitledBorder(
1070 MessageManager.getString("label.mapping_method"));
1071 mmTitledBorder.setTitleFont(LABEL_FONT);
1072 mappingPanel.setBorder(mmTitledBorder);
1073 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1074 // GridLayout mappingLayout = new GridLayout();
1075 mappingPanel.setLayout(new GridLayout());
1076 mappingPanel.add(nwMapping);
1077 mappingPanel.add(siftsMapping);
1078 structureTab.add(mappingPanel);
1080 ypos += lineSpacing;
1081 ypos += lineSpacing;
1082 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1083 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1084 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1085 structureTab.add(docFieldPref);
1087 return structureTab;
1091 * Action on choosing a structure viewer from combobox options.
1093 * @param selectedItem
1095 protected void structureViewer_actionPerformed(String selectedItem)
1100 * Show a dialog for the user to choose a file. Returns the chosen path, or
1105 protected String openFileChooser()
1107 String choice = null;
1108 JFileChooser chooser = new JFileChooser();
1110 // chooser.setFileView(new JalviewFileView());
1111 chooser.setDialogTitle(MessageManager
1112 .getString("label.open_local_file"));
1113 chooser.setToolTipText(MessageManager.getString("action.open"));
1115 int value = chooser.showOpenDialog(this);
1117 if (value == JFileChooser.APPROVE_OPTION)
1119 choice = chooser.getSelectedFile().getPath();
1125 * Validate the structure tab preferences; if invalid, set focus on this tab.
1129 protected boolean validateStructure(FocusEvent e)
1131 if (!validateStructure())
1133 e.getComponent().requestFocusInWindow();
1139 protected boolean validateStructure()
1145 * Initialises the Visual tabbed panel.
1149 private JPanel initVisualTab()
1151 JPanel visualTab = new JPanel();
1152 visualTab.setBorder(new TitledBorder(MessageManager
1153 .getString("action.open_new_alignment")));
1154 visualTab.setLayout(null);
1155 fullScreen.setFont(LABEL_FONT);
1156 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1157 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1158 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1159 quality.setEnabled(false);
1160 quality.setFont(LABEL_FONT);
1161 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1162 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1163 quality.setSelected(true);
1164 quality.setText(MessageManager.getString("label.quality"));
1165 conservation.setEnabled(false);
1166 conservation.setFont(LABEL_FONT);
1167 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1168 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1169 conservation.setSelected(true);
1170 conservation.setText(MessageManager.getString("label.conservation"));
1171 identity.setEnabled(false);
1172 identity.setFont(LABEL_FONT);
1173 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1174 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1175 identity.setSelected(true);
1176 identity.setText(MessageManager.getString("label.consensus"));
1177 JLabel showGroupbits = new JLabel();
1178 showGroupbits.setFont(LABEL_FONT);
1179 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1180 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1181 showGroupbits.setText(MessageManager.getString("action.show_group")
1183 JLabel showConsensbits = new JLabel();
1184 showConsensbits.setFont(LABEL_FONT);
1185 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1186 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1187 showConsensbits.setText(MessageManager.getString("label.consensus")
1189 showConsensHistogram.setEnabled(false);
1190 showConsensHistogram.setFont(LABEL_FONT);
1191 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1192 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1193 showConsensHistogram.setSelected(true);
1194 showConsensHistogram.setText(MessageManager
1195 .getString("label.histogram"));
1196 showConsensLogo.setEnabled(false);
1197 showConsensLogo.setFont(LABEL_FONT);
1198 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1199 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1200 showConsensLogo.setSelected(true);
1201 showConsensLogo.setText(MessageManager.getString("label.logo"));
1202 showGroupConsensus.setEnabled(false);
1203 showGroupConsensus.setFont(LABEL_FONT);
1204 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1205 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1206 showGroupConsensus.setSelected(true);
1207 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1208 showGroupConservation.setEnabled(false);
1209 showGroupConservation.setFont(LABEL_FONT);
1210 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1211 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1212 showGroupConservation.setSelected(true);
1213 showGroupConservation.setText(MessageManager
1214 .getString("label.conservation"));
1215 showNpTooltip.setEnabled(true);
1216 showNpTooltip.setFont(LABEL_FONT);
1217 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1218 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1219 showNpTooltip.setSelected(true);
1220 showNpTooltip.setText(MessageManager
1221 .getString("label.non_positional_features"));
1222 showDbRefTooltip.setEnabled(true);
1223 showDbRefTooltip.setFont(LABEL_FONT);
1224 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1225 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1226 showDbRefTooltip.setSelected(true);
1227 showDbRefTooltip.setText(MessageManager
1228 .getString("label.database_references"));
1229 annotations.setFont(LABEL_FONT);
1230 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1231 annotations.setHorizontalTextPosition(SwingConstants.LEADING);
1232 annotations.setSelected(true);
1233 annotations.setText(MessageManager.getString("label.show_annotations"));
1234 annotations.setBounds(new Rectangle(169, 12, 200, 23));
1235 annotations.addActionListener(new ActionListener()
1238 public void actionPerformed(ActionEvent e)
1240 annotations_actionPerformed(e);
1243 identity.addActionListener(new ActionListener()
1246 public void actionPerformed(ActionEvent e)
1248 annotations_actionPerformed(e);
1251 showGroupConsensus.addActionListener(new ActionListener()
1254 public void actionPerformed(ActionEvent e)
1256 annotations_actionPerformed(e);
1259 showUnconserved.setFont(LABEL_FONT);
1260 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1261 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1262 showUnconserved.setSelected(true);
1263 showUnconserved.setText(MessageManager
1264 .getString("action.show_unconserved"));
1265 showUnconserved.addActionListener(new ActionListener()
1268 public void actionPerformed(ActionEvent e)
1270 showunconserved_actionPerformed(e);
1274 // TODO these are not yet added to / action from Preferences
1275 // JCheckBox shareSelections = new JCheckBox();
1276 // shareSelections.setFont(verdana11);
1277 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1278 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1279 // shareSelections.setSelected(true);
1280 // shareSelections.setText(MessageManager
1281 // .getString("label.share_selection_across_views"));
1282 // JCheckBox followHighlight = new JCheckBox();
1283 // followHighlight.setFont(verdana11);
1284 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1285 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1286 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1287 // followHighlight.setSelected(true);
1288 // followHighlight.setText(MessageManager
1289 // .getString("label.scroll_highlighted_regions"));
1291 seqLimit.setFont(LABEL_FONT);
1292 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1293 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1294 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1295 smoothFont.setFont(LABEL_FONT);
1296 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1297 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1298 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1299 scaleProteinToCdna.setFont(LABEL_FONT);
1300 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1301 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1302 scaleProteinToCdna.setText(MessageManager
1303 .getString("label.scale_protein_to_cdna"));
1304 scaleProteinToCdna.setToolTipText(MessageManager
1305 .getString("label.scale_protein_to_cdna_tip"));
1306 JLabel gapLabel = new JLabel();
1307 gapLabel.setFont(LABEL_FONT);
1308 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1309 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1310 JLabel fontLabel = new JLabel();
1311 fontLabel.setFont(LABEL_FONT);
1312 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1313 fontLabel.setText(MessageManager.getString("label.font"));
1314 fontSizeCB.setFont(LABEL_FONT);
1315 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1316 fontStyleCB.setFont(LABEL_FONT);
1317 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1318 fontNameCB.setFont(LABEL_FONT);
1319 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1320 gapSymbolCB.setFont(LABEL_FONT);
1321 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1322 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1323 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1324 gapSymbolCB.setRenderer(dlcr);
1326 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1327 startupCheckbox.setFont(LABEL_FONT);
1328 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1329 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1330 startupCheckbox.setSelected(true);
1331 startupFileTextfield.setFont(LABEL_FONT);
1332 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1333 startupFileTextfield.addMouseListener(new MouseAdapter()
1336 public void mouseClicked(MouseEvent e)
1338 if (e.getClickCount() > 1)
1340 startupFileTextfield_mouseClicked();
1345 sortby.setFont(LABEL_FONT);
1346 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1347 JLabel sortLabel = new JLabel();
1348 sortLabel.setFont(LABEL_FONT);
1349 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1350 sortLabel.setText(MessageManager.getString("label.sort_by"));
1351 sortAnnBy.setFont(LABEL_FONT);
1352 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1353 JLabel sortAnnLabel = new JLabel();
1354 sortAnnLabel.setFont(LABEL_FONT);
1355 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1356 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1357 sortAutocalc.setFont(LABEL_FONT);
1358 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1360 JPanel annsettingsPanel = new JPanel();
1361 annsettingsPanel.setBounds(new Rectangle(173, 34, 320, 75));
1362 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1363 annsettingsPanel.setBorder(new EtchedBorder());
1364 visualTab.add(annsettingsPanel);
1365 Border jb = new EmptyBorder(1, 1, 4, 5);
1366 quality.setBorder(jb);
1367 conservation.setBorder(jb);
1368 identity.setBorder(jb);
1369 showConsensbits.setBorder(jb);
1370 showGroupbits.setBorder(jb);
1371 showGroupConsensus.setBorder(jb);
1372 showGroupConservation.setBorder(jb);
1373 showConsensHistogram.setBorder(jb);
1374 showConsensLogo.setBorder(jb);
1376 JPanel autoAnnotSettings = new JPanel();
1377 autoAnnotSettings.setLayout(new GridLayout(3, 3));
1378 annsettingsPanel.add(autoAnnotSettings);
1379 autoAnnotSettings.add(quality);
1380 autoAnnotSettings.add(conservation);
1381 autoAnnotSettings.add(identity);
1382 autoAnnotSettings.add(showGroupbits);
1383 autoAnnotSettings.add(showGroupConservation);
1384 autoAnnotSettings.add(showGroupConsensus);
1385 autoAnnotSettings.add(showConsensbits);
1386 autoAnnotSettings.add(showConsensHistogram);
1387 autoAnnotSettings.add(showConsensLogo);
1389 JPanel tooltipSettings = new JPanel();
1390 tooltipSettings.setBorder(new TitledBorder(MessageManager
1391 .getString("label.sequence_id_tooltip")));
1392 tooltipSettings.setBounds(173, 140, 220, 62);
1393 tooltipSettings.setLayout(new GridLayout(2, 1));
1394 tooltipSettings.add(showDbRefTooltip);
1395 tooltipSettings.add(showNpTooltip);
1396 visualTab.add(tooltipSettings);
1398 wrap.setFont(LABEL_FONT);
1399 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1400 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1401 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1402 rightAlign.setFont(LABEL_FONT);
1403 rightAlign.setForeground(Color.black);
1404 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1405 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1406 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1407 idItalics.setFont(LABEL_FONT_ITALIC);
1408 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1409 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1410 idItalics.setText(MessageManager
1411 .getString("label.sequence_name_italics"));
1412 openoverv.setFont(LABEL_FONT);
1413 openoverv.setActionCommand(MessageManager
1414 .getString("label.open_overview"));
1415 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1416 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1417 openoverv.setText(MessageManager.getString("label.open_overview"));
1418 JPanel jPanel2 = new JPanel();
1419 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1420 jPanel2.setLayout(new GridLayout(14, 1));
1421 jPanel2.add(fullScreen);
1422 jPanel2.add(openoverv);
1423 jPanel2.add(seqLimit);
1424 jPanel2.add(rightAlign);
1425 jPanel2.add(fontLabel);
1426 jPanel2.add(showUnconserved);
1427 jPanel2.add(idItalics);
1428 jPanel2.add(smoothFont);
1429 jPanel2.add(scaleProteinToCdna);
1430 jPanel2.add(gapLabel);
1432 jPanel2.add(sortLabel);
1433 jPanel2.add(sortAnnLabel);
1434 jPanel2.add(startupCheckbox);
1435 visualTab.add(jPanel2);
1436 visualTab.add(annotations);
1437 visualTab.add(startupFileTextfield);
1438 visualTab.add(sortby);
1439 visualTab.add(sortAnnBy);
1440 visualTab.add(sortAutocalc);
1441 visualTab.add(gapSymbolCB);
1442 visualTab.add(fontNameCB);
1443 visualTab.add(fontSizeCB);
1444 visualTab.add(fontStyleCB);
1448 protected void autoIdWidth_actionPerformed()
1450 // TODO Auto-generated method stub
1454 protected void userIdWidth_actionPerformed()
1456 // TODO Auto-generated method stub
1460 protected void maxColour_actionPerformed(JPanel panel)
1464 protected void minColour_actionPerformed(JPanel panel)
1468 protected void showunconserved_actionPerformed(ActionEvent e)
1470 // TODO Auto-generated method stub
1480 public void ok_actionPerformed(ActionEvent e)
1490 public void cancel_actionPerformed(ActionEvent e)
1500 public void annotations_actionPerformed(ActionEvent e)
1507 public void startupFileTextfield_mouseClicked()
1511 public void newLink_actionPerformed(ActionEvent e)
1516 public void editLink_actionPerformed(ActionEvent e)
1521 public void deleteLink_actionPerformed(ActionEvent e)
1526 public void defaultBrowser_mouseClicked(MouseEvent e)
1531 public void linkURLList_keyTyped(KeyEvent e)
1536 public void useProxy_actionPerformed()
1538 boolean enabled = useProxy.isSelected();
1539 portLabel.setEnabled(enabled);
1540 serverLabel.setEnabled(enabled);
1541 proxyServerTB.setEnabled(enabled);
1542 proxyPortTB.setEnabled(enabled);
1546 * Customer renderer for JTable: supports column of radio buttons
1548 public class RadioButtonRenderer extends JRadioButton implements
1551 public RadioButtonRenderer()
1553 setHorizontalAlignment(CENTER);
1554 setToolTipText(MessageManager.getString("label.urltooltip"));
1558 public Component getTableCellRendererComponent(JTable table,
1559 Object value, boolean isSelected, boolean hasFocus, int row,
1562 setSelected((boolean) value);
1564 // set colours to match rest of table
1567 setBackground(table.getSelectionBackground());
1568 setForeground(table.getSelectionForeground());
1572 setBackground(table.getBackground());
1573 setForeground(table.getForeground());
1580 * Customer cell editor for JTable: supports column of radio buttons in
1581 * conjunction with renderer
1583 public class RadioButtonEditor extends AbstractCellEditor implements
1586 private JRadioButton button = new JRadioButton();
1588 public RadioButtonEditor()
1590 button.setHorizontalAlignment(SwingConstants.CENTER);
1591 this.button.addActionListener(new ActionListener()
1594 public void actionPerformed(ActionEvent e)
1596 fireEditingStopped();
1602 public Component getTableCellEditorComponent(JTable table,
1603 Object value, boolean isSelected, int row, int column)
1605 button.setSelected((boolean) value);
1610 public Object getCellEditorValue()
1612 return button.isSelected();