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<>();
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 showInformationHistogram = new JCheckBox();
147 protected JCheckBox showHMMLogo = new JCheckBox();
149 protected JCheckBox showDbRefTooltip = new JCheckBox();
151 protected JCheckBox showNpTooltip = new JCheckBox();
155 * Structure tab and components
157 protected JPanel structureTab;
159 protected JCheckBox structFromPdb = new JCheckBox();
161 protected JCheckBox useRnaView = new JCheckBox();
163 protected JCheckBox addSecondaryStructure = new JCheckBox();
165 protected JCheckBox addTempFactor = new JCheckBox();
167 protected JComboBox<String> structViewer = new JComboBox<>();
169 protected JTextField chimeraPath = new JTextField();
171 protected ButtonGroup mappingMethod = new ButtonGroup();
173 protected JRadioButton siftsMapping = new JRadioButton();
175 protected JRadioButton nwMapping = new JRadioButton();
178 * Colours tab components
180 protected JPanel minColour = new JPanel();
182 protected JPanel maxColour = new JPanel();
184 protected JComboBox<String> protColour = new JComboBox<>();
186 protected JComboBox<String> nucColour = new JComboBox<>();
189 * Connections tab components
191 protected JTable linkUrlTable = new JTable();
193 protected JButton editLink = new JButton();
195 protected JButton deleteLink = new JButton();
197 protected JTextField filterTB = new JTextField();
199 protected JButton doReset = new JButton();
201 protected JButton userOnly = new JButton();
203 protected JLabel portLabel = new JLabel();
205 protected JLabel serverLabel = new JLabel();
207 protected JTextField proxyServerTB = new JTextField();
209 protected JTextField proxyPortTB = new JTextField();
211 protected JTextField defaultBrowser = new JTextField();
213 protected JCheckBox useProxy = new JCheckBox();
215 protected JCheckBox usagestats = new JCheckBox();
217 protected JCheckBox questionnaire = new JCheckBox();
219 protected JCheckBox versioncheck = new JCheckBox();
222 * Output tab components
224 protected JComboBox<Object> epsRendering = new JComboBox<>();
226 protected JLabel userIdWidthlabel = new JLabel();
228 protected JCheckBox autoIdWidth = new JCheckBox();
230 protected JTextField userIdWidth = new JTextField();
232 protected JCheckBox blcjv = new JCheckBox();
234 protected JCheckBox pileupjv = new JCheckBox();
236 protected JCheckBox clustaljv = new JCheckBox();
238 protected JCheckBox msfjv = new JCheckBox();
240 protected JCheckBox fastajv = new JCheckBox();
242 protected JCheckBox pfamjv = new JCheckBox();
244 protected JCheckBox pirjv = new JCheckBox();
246 protected JCheckBox modellerOutput = new JCheckBox();
248 protected JCheckBox embbedBioJSON = new JCheckBox();
251 * Editing tab components
253 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
255 protected JCheckBox padGaps = new JCheckBox();
257 protected JCheckBox sortByTree = new JCheckBox();
262 protected JPanel dasTab = new JPanel();
267 protected JPanel wsTab = new JPanel();
270 * Creates a new GPreferences object.
272 public GPreferences()
277 } catch (Exception ex)
279 ex.printStackTrace();
284 * Construct the panel and its tabbed sub-panels.
288 private void jbInit() throws Exception
290 final JTabbedPane tabbedPane = new JTabbedPane();
291 this.setLayout(new BorderLayout());
292 JPanel okCancelPanel = initOkCancelPanel();
293 this.add(tabbedPane, BorderLayout.CENTER);
294 this.add(okCancelPanel, BorderLayout.SOUTH);
296 tabbedPane.add(initVisualTab(),
297 MessageManager.getString("label.visual"));
299 tabbedPane.add(initColoursTab(),
300 MessageManager.getString("label.colours"));
302 tabbedPane.add(initStructureTab(),
303 MessageManager.getString("label.structure"));
305 tabbedPane.add(initConnectionsTab(),
306 MessageManager.getString("label.connections"));
308 tabbedPane.add(initLinksTab(),
309 MessageManager.getString("label.urllinks"));
311 tabbedPane.add(initOutputTab(),
312 MessageManager.getString("label.output"));
314 tabbedPane.add(initEditingTab(),
315 MessageManager.getString("label.editing"));
318 * See DasSourceBrowser for the real work of configuring this tab.
320 dasTab.setLayout(new BorderLayout());
321 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
324 * See WsPreferences for the real work of configuring this tab.
326 wsTab.setLayout(new BorderLayout());
327 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
330 * Handler to validate a tab before leaving it - currently only for
333 tabbedPane.addChangeListener(new ChangeListener()
335 private Component lastTab;
338 public void stateChanged(ChangeEvent e)
340 if (lastTab == structureTab
341 && tabbedPane.getSelectedComponent() != structureTab)
343 if (!validateStructure())
345 tabbedPane.setSelectedComponent(structureTab);
349 lastTab = tabbedPane.getSelectedComponent();
356 * Initialises the Editing tabbed panel.
360 private JPanel initEditingTab()
362 JPanel editingTab = new JPanel();
363 editingTab.setLayout(null);
364 autoCalculateConsCheck.setFont(LABEL_FONT);
365 autoCalculateConsCheck.setText(MessageManager
366 .getString("label.autocalculate_consensus"));
367 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
368 padGaps.setFont(LABEL_FONT);
369 padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
370 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
371 sortByTree.setFont(LABEL_FONT);
373 .setText(MessageManager.getString("label.sort_with_new_tree"));
375 .setToolTipText(MessageManager
376 .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
377 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
378 editingTab.add(autoCalculateConsCheck);
379 editingTab.add(padGaps);
380 editingTab.add(sortByTree);
385 * Initialises the Output tabbed panel.
389 private JPanel initOutputTab()
391 JPanel outputTab = new JPanel();
392 outputTab.setLayout(null);
393 JLabel epsLabel = new JLabel();
394 epsLabel.setFont(LABEL_FONT);
395 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
396 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
397 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
398 epsRendering.setFont(LABEL_FONT);
399 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
400 JLabel jLabel1 = new JLabel();
401 jLabel1.setFont(LABEL_FONT);
402 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
403 jLabel1.setText(MessageManager.getString("label.append_start_end"));
404 jLabel1.setFont(LABEL_FONT);
405 fastajv.setFont(LABEL_FONT);
406 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
407 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
408 blcjv.setText(MessageManager.getString("label.blc") + " ");
409 fastajv.setText(MessageManager.getString("label.fasta") + " ");
410 msfjv.setText(MessageManager.getString("label.msf") + " ");
411 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
412 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
413 msfjv.setFont(LABEL_FONT);
414 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
415 pirjv.setText(MessageManager.getString("label.pir") + " ");
416 JPanel jPanel11 = new JPanel();
417 jPanel11.setFont(LABEL_FONT);
418 TitledBorder titledBorder2 = new TitledBorder(
419 MessageManager.getString("label.file_output"));
420 jPanel11.setBorder(titledBorder2);
421 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
422 GridLayout gridLayout3 = new GridLayout();
423 jPanel11.setLayout(gridLayout3);
424 gridLayout3.setRows(8);
425 blcjv.setFont(LABEL_FONT);
426 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
427 clustaljv.setFont(LABEL_FONT);
428 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
429 pfamjv.setFont(LABEL_FONT);
430 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
431 pileupjv.setFont(LABEL_FONT);
432 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
433 pirjv.setFont(LABEL_FONT);
434 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
435 autoIdWidth.setFont(LABEL_FONT);
436 autoIdWidth.setText(MessageManager
437 .getString("label.automatically_set_id_width"));
438 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true,
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(MessageManager
453 .getString("label.figure_id_column_width"));
455 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
456 .getString("label.manually_specify_width_left_column")));
458 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
459 .getString("label.manually_specify_width_left_column")));
460 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
461 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
462 userIdWidth.setText("");
463 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
464 userIdWidth.addActionListener(new ActionListener()
468 public void actionPerformed(ActionEvent e)
470 userIdWidth_actionPerformed();
473 modellerOutput.setFont(LABEL_FONT);
474 modellerOutput.setText(MessageManager
475 .getString("label.use_modeller_output"));
476 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
477 embbedBioJSON.setFont(LABEL_FONT);
478 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
479 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
481 jPanel11.add(jLabel1);
483 jPanel11.add(clustaljv);
484 jPanel11.add(fastajv);
486 jPanel11.add(pfamjv);
487 jPanel11.add(pileupjv);
489 outputTab.add(autoIdWidth);
490 outputTab.add(userIdWidth);
491 outputTab.add(userIdWidthlabel);
492 outputTab.add(modellerOutput);
493 outputTab.add(embbedBioJSON);
494 outputTab.add(epsLabel);
495 outputTab.add(epsRendering);
496 outputTab.add(jPanel11);
501 * Initialises the Connections tabbed panel.
505 private JPanel initConnectionsTab()
507 JPanel connectTab = new JPanel();
508 connectTab.setLayout(new GridBagLayout());
510 // Label for browser text box
511 JLabel browserLabel = new JLabel();
512 browserLabel.setFont(LABEL_FONT);
513 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
514 browserLabel.setText(MessageManager
515 .getString("label.default_browser_unix"));
516 defaultBrowser.setFont(LABEL_FONT);
517 defaultBrowser.setText("");
519 defaultBrowser.addMouseListener(new MouseAdapter()
522 public void mouseClicked(MouseEvent e)
524 if (e.getClickCount() > 1)
526 defaultBrowser_mouseClicked(e);
531 JPanel proxyPanel = initConnTabProxyPanel();
532 initConnTabCheckboxes();
534 // Add default Browser text box
535 connectTab.add(browserLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,
536 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
537 new Insets(10, 0, 5, 5), 5, 1));
538 defaultBrowser.setFont(LABEL_FONT);
539 defaultBrowser.setText("");
541 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
542 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
543 new Insets(10, 0, 5, 10), 30, 1));
545 // Add proxy server panel
546 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
547 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
548 new Insets(10, 0, 5, 12), 4, 10));
550 // Add usage stats, version check and questionnaire checkboxes
551 connectTab.add(usagestats, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
552 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
553 new Insets(0, 2, 5, 5), 70, 1));
554 connectTab.add(questionnaire, new GridBagConstraints(1, 2, 1, 1, 1.0,
555 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
556 new Insets(0, 2, 5, 10), 70, 1));
557 connectTab.add(versioncheck, new GridBagConstraints(0, 3, 1, 1, 1.0,
558 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
559 new Insets(0, 2, 5, 5), 70, 1));
561 // Add padding so the panel doesn't look ridiculous
562 JPanel spacePanel = new JPanel();
563 connectTab.add(spacePanel, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
564 GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0,
571 * Initialises the Links tabbed panel.
575 private JPanel initLinksTab()
577 JPanel linkTab = new JPanel();
578 linkTab.setLayout(new GridBagLayout());
580 // Set up table for Url links
581 linkUrlTable.setFillsViewportHeight(true);
582 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
583 linkUrlTable.setAutoCreateRowSorter(true);
584 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
586 // adjust row height so radio buttons actually fit
587 // don't do this in the renderer, it causes the awt thread to activate
589 JRadioButton temp = new JRadioButton();
590 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
592 // Table in scrollpane so that the table is given a scrollbar
593 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
594 linkScrollPane.setBorder(null);
596 // Panel for links functionality
597 JPanel linkPanel = new JPanel(new GridBagLayout());
598 linkPanel.setBorder(new TitledBorder(MessageManager
599 .getString("label.url_linkfrom_sequence_id")));
601 // Put the Url links panel together
603 // Buttons go at top right, resizing only resizes the blank space vertically
604 JPanel buttonPanel = initLinkTabUrlButtons();
605 GridBagConstraints linkConstraints1 = new GridBagConstraints();
606 linkConstraints1.insets = new Insets(0, 0, 5, 0);
607 linkConstraints1.gridx = 0;
608 linkConstraints1.gridy = 0;
609 linkConstraints1.weightx = 1.0;
610 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
611 linkTab.add(buttonPanel, linkConstraints1);
613 // Links table goes at top left, resizing resizes the table
614 GridBagConstraints linkConstraints2 = new GridBagConstraints();
615 linkConstraints2.insets = new Insets(0, 0, 5, 5);
616 linkConstraints2.gridx = 0;
617 linkConstraints2.gridy = 1;
618 linkConstraints2.weightx = 1.0;
619 linkConstraints2.weighty = 1.0;
620 linkConstraints2.fill = GridBagConstraints.BOTH;
621 linkTab.add(linkScrollPane, linkConstraints2);
623 // Filter box and buttons goes at bottom left, resizing resizes the text box
624 JPanel filterPanel = initLinkTabFilterPanel();
625 GridBagConstraints linkConstraints3 = new GridBagConstraints();
626 linkConstraints3.insets = new Insets(0, 0, 0, 5);
627 linkConstraints3.gridx = 0;
628 linkConstraints3.gridy = 2;
629 linkConstraints3.weightx = 1.0;
630 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
631 linkTab.add(filterPanel, linkConstraints3);
636 private JPanel initLinkTabFilterPanel()
638 // Filter textbox and reset button
639 JLabel filterLabel = new JLabel(
640 MessageManager.getString("label.filter"));
641 filterLabel.setFont(LABEL_FONT);
642 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
643 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
645 filterTB.setFont(LABEL_FONT);
646 filterTB.setText("");
648 doReset.setText(MessageManager.getString("action.showall"));
649 userOnly.setText(MessageManager.getString("action.customfilter"));
651 // Panel for filter functionality
652 JPanel filterPanel = new JPanel(new GridBagLayout());
653 filterPanel.setBorder(new TitledBorder("Filter"));
654 GridBagConstraints gbc = new GridBagConstraints();
657 gbc.fill = GridBagConstraints.NONE;
658 gbc.anchor = GridBagConstraints.WEST;
660 filterPanel.add(filterLabel, gbc);
662 GridBagConstraints gbc1 = new GridBagConstraints();
665 gbc1.fill = GridBagConstraints.HORIZONTAL;
666 gbc1.anchor = GridBagConstraints.WEST;
668 filterPanel.add(filterTB, gbc1);
670 GridBagConstraints gbc2 = new GridBagConstraints();
672 gbc2.fill = GridBagConstraints.NONE;
673 gbc2.anchor = GridBagConstraints.WEST;
674 filterPanel.add(doReset, gbc2);
676 GridBagConstraints gbc3 = new GridBagConstraints();
678 gbc3.fill = GridBagConstraints.NONE;
679 gbc3.anchor = GridBagConstraints.WEST;
680 filterPanel.add(userOnly, gbc3);
685 private JPanel initLinkTabUrlButtons()
687 // Buttons for new / edit / delete Url links
688 JButton newLink = new JButton();
689 newLink.setText(MessageManager.getString("action.new"));
691 editLink.setText(MessageManager.getString("action.edit"));
693 deleteLink.setText(MessageManager.getString("action.delete"));
695 // no current selection, so initially disable delete/edit buttons
696 editLink.setEnabled(false);
697 deleteLink.setEnabled(false);
699 newLink.addActionListener(new java.awt.event.ActionListener()
702 public void actionPerformed(ActionEvent e)
704 newLink_actionPerformed(e);
708 editLink.setText(MessageManager.getString("action.edit"));
709 editLink.addActionListener(new java.awt.event.ActionListener()
712 public void actionPerformed(ActionEvent e)
714 editLink_actionPerformed(e);
718 deleteLink.setText(MessageManager.getString("action.delete"));
719 deleteLink.addActionListener(new java.awt.event.ActionListener()
722 public void actionPerformed(ActionEvent e)
724 deleteLink_actionPerformed(e);
728 JPanel buttonPanel = new JPanel(new GridBagLayout());
729 buttonPanel.setBorder(new TitledBorder("Edit links"));
730 GridBagConstraints gbc = new GridBagConstraints();
733 gbc.fill = GridBagConstraints.NONE;
734 buttonPanel.add(newLink, gbc);
736 GridBagConstraints gbc1 = new GridBagConstraints();
739 gbc1.fill = GridBagConstraints.NONE;
740 buttonPanel.add(editLink, gbc1);
742 GridBagConstraints gbc2 = new GridBagConstraints();
745 gbc2.fill = GridBagConstraints.NONE;
746 buttonPanel.add(deleteLink, gbc2);
748 GridBagConstraints gbc3 = new GridBagConstraints();
751 gbc3.fill = GridBagConstraints.HORIZONTAL;
753 JPanel spacePanel = new JPanel();
754 spacePanel.setBorder(null);
755 buttonPanel.add(spacePanel, gbc3);
761 * Initialises the proxy server panel in the Connections tab
763 * @return the proxy server panel
765 private JPanel initConnTabProxyPanel()
767 // Label for server text box
768 serverLabel.setText(MessageManager.getString("label.address"));
769 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
770 serverLabel.setFont(LABEL_FONT);
772 // Proxy server and port text boxes
773 proxyServerTB.setFont(LABEL_FONT);
774 proxyPortTB.setFont(LABEL_FONT);
776 // Label for Port text box
777 portLabel.setFont(LABEL_FONT);
778 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
779 portLabel.setText(MessageManager.getString("label.port"));
781 // Use proxy server checkbox
782 useProxy.setFont(LABEL_FONT);
783 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
784 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
785 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
786 useProxy.addActionListener(new ActionListener()
789 public void actionPerformed(ActionEvent e)
791 useProxy_actionPerformed();
795 // Make proxy server panel
796 JPanel proxyPanel = new JPanel();
797 TitledBorder titledBorder1 = new TitledBorder(
798 MessageManager.getString("label.proxy_server"));
799 proxyPanel.setBorder(titledBorder1);
800 proxyPanel.setLayout(new GridBagLayout());
801 proxyPanel.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
802 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
803 new Insets(0, 2, 2, 0), 5, 0));
804 proxyPanel.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
805 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
807 proxyPanel.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
808 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
810 proxyPanel.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0,
811 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
812 new Insets(0, 2, 2, 2), 54, 1));
813 proxyPanel.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0,
814 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
815 new Insets(0, 2, 2, 0), 263, 1));
821 * Initialises the checkboxes in the Connections tab
823 private void initConnTabCheckboxes()
825 // Usage stats checkbox label
826 usagestats.setText(MessageManager
827 .getString("label.send_usage_statistics"));
828 usagestats.setFont(LABEL_FONT);
829 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
830 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
832 // Questionnaire checkbox label
833 questionnaire.setText(MessageManager
834 .getString("label.check_for_questionnaires"));
835 questionnaire.setFont(LABEL_FONT);
836 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
837 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
839 // Check for latest version checkbox label
840 versioncheck.setText(MessageManager
841 .getString("label.check_for_latest_version"));
842 versioncheck.setFont(LABEL_FONT);
843 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
844 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
848 * Initialises the parent panel which contains the tabbed sections.
852 private JPanel initOkCancelPanel()
854 JButton ok = new JButton();
855 ok.setText(MessageManager.getString("action.ok"));
856 ok.addActionListener(new ActionListener()
859 public void actionPerformed(ActionEvent e)
861 ok_actionPerformed(e);
864 JButton cancel = new JButton();
865 cancel.setText(MessageManager.getString("action.cancel"));
866 cancel.addActionListener(new ActionListener()
869 public void actionPerformed(ActionEvent e)
871 cancel_actionPerformed(e);
874 JPanel okCancelPanel = new JPanel();
875 okCancelPanel.add(ok);
876 okCancelPanel.add(cancel);
877 return okCancelPanel;
881 * Initialises the Colours tabbed panel.
885 private JPanel initColoursTab()
887 JPanel coloursTab = new JPanel();
888 coloursTab.setBorder(new TitledBorder(MessageManager
889 .getString("action.open_new_alignment")));
890 coloursTab.setLayout(new FlowLayout());
891 JLabel mincolourLabel = new JLabel();
892 mincolourLabel.setFont(LABEL_FONT);
893 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
894 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
895 minColour.setFont(LABEL_FONT);
896 minColour.setBorder(BorderFactory.createEtchedBorder());
897 minColour.setPreferredSize(new Dimension(40, 20));
898 minColour.addMouseListener(new MouseAdapter()
901 public void mousePressed(MouseEvent e)
903 minColour_actionPerformed(minColour);
906 JLabel maxcolourLabel = new JLabel();
907 maxcolourLabel.setFont(LABEL_FONT);
908 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
909 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
910 maxColour.setFont(LABEL_FONT);
911 maxColour.setBorder(BorderFactory.createEtchedBorder());
912 maxColour.setPreferredSize(new Dimension(40, 20));
913 maxColour.addMouseListener(new MouseAdapter()
916 public void mousePressed(MouseEvent e)
918 maxColour_actionPerformed(maxColour);
922 protColour.setFont(LABEL_FONT);
923 protColour.setBounds(new Rectangle(172, 225, 155, 21));
924 JLabel protColourLabel = new JLabel();
925 protColourLabel.setFont(LABEL_FONT);
926 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
927 protColourLabel.setText(MessageManager
928 .getString("label.prot_alignment_colour") + " ");
929 JvSwingUtils.addtoLayout(coloursTab, MessageManager
930 .getString("label.default_colour_scheme_for_alignment"),
931 protColourLabel, protColour);
933 nucColour.setFont(LABEL_FONT);
934 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
935 JLabel nucColourLabel = new JLabel();
936 nucColourLabel.setFont(LABEL_FONT);
937 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
938 nucColourLabel.setText(MessageManager
939 .getString("label.nuc_alignment_colour") + " ");
940 JvSwingUtils.addtoLayout(coloursTab, MessageManager
941 .getString("label.default_colour_scheme_for_alignment"),
942 nucColourLabel, nucColour);
944 JPanel annotationShding = new JPanel();
945 annotationShding.setBorder(new TitledBorder(MessageManager
946 .getString("label.annotation_shading_default")));
947 annotationShding.setLayout(new GridLayout(1, 2));
948 JvSwingUtils.addtoLayout(annotationShding, MessageManager
949 .getString("label.default_minimum_colour_annotation_shading"),
950 mincolourLabel, minColour);
951 JvSwingUtils.addtoLayout(annotationShding, MessageManager
952 .getString("label.default_maximum_colour_annotation_shading"),
953 maxcolourLabel, maxColour);
954 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
959 * Initialises the Structure tabbed panel.
963 private JPanel initStructureTab()
965 structureTab = new JPanel();
967 structureTab.setBorder(new TitledBorder(MessageManager
968 .getString("label.structure_options")));
969 structureTab.setLayout(null);
970 final int width = 400;
971 final int height = 22;
972 final int lineSpacing = 25;
975 structFromPdb.setFont(LABEL_FONT);
977 .setText(MessageManager.getString("label.struct_from_pdb"));
978 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
979 structFromPdb.addActionListener(new ActionListener()
982 public void actionPerformed(ActionEvent e)
984 boolean selected = structFromPdb.isSelected();
985 // enable other options only when the first is checked
986 useRnaView.setEnabled(selected);
987 addSecondaryStructure.setEnabled(selected);
988 addTempFactor.setEnabled(selected);
991 structureTab.add(structFromPdb);
993 // indent checkboxes that are conditional on the first one
995 useRnaView.setFont(LABEL_FONT);
996 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
997 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
998 structureTab.add(useRnaView);
1000 ypos += lineSpacing;
1001 addSecondaryStructure.setFont(LABEL_FONT);
1002 addSecondaryStructure.setText(MessageManager
1003 .getString("label.autoadd_secstr"));
1004 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1005 structureTab.add(addSecondaryStructure);
1007 ypos += lineSpacing;
1008 addTempFactor.setFont(LABEL_FONT);
1009 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1010 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1011 structureTab.add(addTempFactor);
1013 ypos += lineSpacing;
1014 JLabel viewerLabel = new JLabel();
1015 viewerLabel.setFont(LABEL_FONT);
1016 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1017 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1018 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1019 structureTab.add(viewerLabel);
1021 structViewer.setFont(LABEL_FONT);
1022 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1023 structViewer.addItem(ViewerType.JMOL.name());
1024 structViewer.addItem(ViewerType.CHIMERA.name());
1025 structViewer.addActionListener(new ActionListener()
1028 public void actionPerformed(ActionEvent e)
1030 structureViewer_actionPerformed((String) structViewer
1031 .getSelectedItem());
1034 structureTab.add(structViewer);
1036 ypos += lineSpacing;
1037 JLabel pathLabel = new JLabel();
1038 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1039 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1040 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1041 final String tooltip = JvSwingUtils.wrapTooltip(true,
1042 MessageManager.getString("label.chimera_path_tip"));
1043 pathLabel.setToolTipText(tooltip);
1044 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1045 structureTab.add(pathLabel);
1047 chimeraPath.setFont(LABEL_FONT);
1048 chimeraPath.setText("");
1049 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1050 chimeraPath.addMouseListener(new MouseAdapter()
1053 public void mouseClicked(MouseEvent e)
1055 if (e.getClickCount() == 2)
1057 String chosen = openFileChooser();
1060 chimeraPath.setText(chosen);
1065 structureTab.add(chimeraPath);
1067 ypos += lineSpacing;
1068 nwMapping.setFont(LABEL_FONT);
1069 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1070 siftsMapping.setFont(LABEL_FONT);
1071 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1072 mappingMethod.add(nwMapping);
1073 mappingMethod.add(siftsMapping);
1074 JPanel mappingPanel = new JPanel();
1075 mappingPanel.setFont(LABEL_FONT);
1076 TitledBorder mmTitledBorder = new TitledBorder(
1077 MessageManager.getString("label.mapping_method"));
1078 mmTitledBorder.setTitleFont(LABEL_FONT);
1079 mappingPanel.setBorder(mmTitledBorder);
1080 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1081 // GridLayout mappingLayout = new GridLayout();
1082 mappingPanel.setLayout(new GridLayout());
1083 mappingPanel.add(nwMapping);
1084 mappingPanel.add(siftsMapping);
1085 structureTab.add(mappingPanel);
1087 ypos += lineSpacing;
1088 ypos += lineSpacing;
1089 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1090 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1091 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1092 structureTab.add(docFieldPref);
1094 return structureTab;
1098 * Action on choosing a structure viewer from combobox options.
1100 * @param selectedItem
1102 protected void structureViewer_actionPerformed(String selectedItem)
1107 * Show a dialog for the user to choose a file. Returns the chosen path, or
1112 protected String openFileChooser()
1114 String choice = null;
1115 JFileChooser chooser = new JFileChooser();
1117 // chooser.setFileView(new JalviewFileView());
1118 chooser.setDialogTitle(MessageManager
1119 .getString("label.open_local_file"));
1120 chooser.setToolTipText(MessageManager.getString("action.open"));
1122 int value = chooser.showOpenDialog(this);
1124 if (value == JFileChooser.APPROVE_OPTION)
1126 choice = chooser.getSelectedFile().getPath();
1132 * Validate the structure tab preferences; if invalid, set focus on this tab.
1136 protected boolean validateStructure(FocusEvent e)
1138 if (!validateStructure())
1140 e.getComponent().requestFocusInWindow();
1146 protected boolean validateStructure()
1152 * Initialises the Visual tabbed panel.
1156 private JPanel initVisualTab()
1158 JPanel visualTab = new JPanel();
1159 visualTab.setBorder(new TitledBorder(MessageManager
1160 .getString("action.open_new_alignment")));
1161 visualTab.setLayout(null);
1162 fullScreen.setFont(LABEL_FONT);
1163 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1164 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1165 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1166 quality.setEnabled(false);
1167 quality.setFont(LABEL_FONT);
1168 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1169 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1170 quality.setSelected(true);
1171 quality.setText(MessageManager.getString("label.quality"));
1172 conservation.setEnabled(false);
1173 conservation.setFont(LABEL_FONT);
1174 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1175 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1176 conservation.setSelected(true);
1177 conservation.setText(MessageManager.getString("label.conservation"));
1178 identity.setEnabled(false);
1179 identity.setFont(LABEL_FONT);
1180 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1181 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1182 identity.setSelected(true);
1183 identity.setText(MessageManager.getString("label.consensus"));
1184 showOccupancy.setFont(LABEL_FONT);
1185 showOccupancy.setEnabled(false);
1186 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1187 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1188 showOccupancy.setSelected(true);
1189 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1191 JLabel showGroupbits = new JLabel();
1192 showGroupbits.setFont(LABEL_FONT);
1193 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1194 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1195 showGroupbits.setText(MessageManager.getString("action.show_group")
1197 JLabel showConsensbits = new JLabel();
1198 showConsensbits.setFont(LABEL_FONT);
1199 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1200 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1201 showConsensbits.setText(MessageManager.getString("label.consensus")
1203 showConsensHistogram.setEnabled(false);
1204 showConsensHistogram.setFont(LABEL_FONT);
1205 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1206 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1207 showConsensHistogram.setSelected(true);
1208 showConsensHistogram.setText(MessageManager
1209 .getString("label.histogram"));
1210 showConsensLogo.setEnabled(false);
1211 showConsensLogo.setFont(LABEL_FONT);
1212 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1213 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1214 showConsensLogo.setSelected(true);
1215 showConsensLogo.setText(MessageManager.getString("label.logo"));
1216 showGroupConsensus.setEnabled(false);
1217 showGroupConsensus.setFont(LABEL_FONT);
1218 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1219 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1220 showGroupConsensus.setSelected(true);
1221 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1222 showGroupConservation.setEnabled(false);
1223 showGroupConservation.setFont(LABEL_FONT);
1224 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1225 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1226 showGroupConservation.setSelected(true);
1227 showGroupConservation.setText(MessageManager
1228 .getString("label.conservation"));
1229 showNpTooltip.setEnabled(true);
1230 showNpTooltip.setFont(LABEL_FONT);
1231 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1232 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1233 showNpTooltip.setSelected(true);
1234 showNpTooltip.setText(MessageManager
1235 .getString("label.non_positional_features"));
1236 showDbRefTooltip.setEnabled(true);
1237 showDbRefTooltip.setFont(LABEL_FONT);
1238 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1239 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1240 showDbRefTooltip.setSelected(true);
1241 showDbRefTooltip.setText(MessageManager
1242 .getString("label.database_references"));
1243 annotations.setFont(LABEL_FONT);
1244 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1245 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1246 annotations.setSelected(true);
1247 annotations.setText(MessageManager.getString("label.show_annotations"));
1248 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1249 annotations.addActionListener(new ActionListener()
1252 public void actionPerformed(ActionEvent e)
1254 annotations_actionPerformed(e);
1257 identity.addActionListener(new ActionListener()
1260 public void actionPerformed(ActionEvent e)
1262 annotations_actionPerformed(e);
1265 showGroupConsensus.addActionListener(new ActionListener()
1268 public void actionPerformed(ActionEvent e)
1270 annotations_actionPerformed(e);
1273 showUnconserved.setFont(LABEL_FONT);
1274 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1275 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1276 showUnconserved.setSelected(true);
1277 showUnconserved.setText(MessageManager
1278 .getString("action.show_unconserved"));
1279 showUnconserved.addActionListener(new ActionListener()
1282 public void actionPerformed(ActionEvent e)
1284 showunconserved_actionPerformed(e);
1288 // TODO these are not yet added to / action from Preferences
1289 // JCheckBox shareSelections = new JCheckBox();
1290 // shareSelections.setFont(verdana11);
1291 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1292 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1293 // shareSelections.setSelected(true);
1294 // shareSelections.setText(MessageManager
1295 // .getString("label.share_selection_across_views"));
1296 // JCheckBox followHighlight = new JCheckBox();
1297 // followHighlight.setFont(verdana11);
1298 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1299 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1300 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1301 // followHighlight.setSelected(true);
1302 // followHighlight.setText(MessageManager
1303 // .getString("label.scroll_highlighted_regions"));
1305 seqLimit.setFont(LABEL_FONT);
1306 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1307 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1308 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1309 smoothFont.setFont(LABEL_FONT);
1310 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1311 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1312 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1313 scaleProteinToCdna.setFont(LABEL_FONT);
1314 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1315 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1316 scaleProteinToCdna.setText(MessageManager
1317 .getString("label.scale_protein_to_cdna"));
1318 scaleProteinToCdna.setToolTipText(MessageManager
1319 .getString("label.scale_protein_to_cdna_tip"));
1320 JLabel gapLabel = new JLabel();
1321 gapLabel.setFont(LABEL_FONT);
1322 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1323 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1324 JLabel fontLabel = new JLabel();
1325 fontLabel.setFont(LABEL_FONT);
1326 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1327 fontLabel.setText(MessageManager.getString("label.font"));
1328 fontSizeCB.setFont(LABEL_FONT);
1329 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1330 fontStyleCB.setFont(LABEL_FONT);
1331 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1332 fontNameCB.setFont(LABEL_FONT);
1333 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1334 gapSymbolCB.setFont(LABEL_FONT);
1335 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1336 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1337 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1338 gapSymbolCB.setRenderer(dlcr);
1340 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1341 startupCheckbox.setFont(LABEL_FONT);
1342 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1343 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1344 startupCheckbox.setSelected(true);
1345 startupFileTextfield.setFont(LABEL_FONT);
1346 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1347 startupFileTextfield.addMouseListener(new MouseAdapter()
1350 public void mouseClicked(MouseEvent e)
1352 if (e.getClickCount() > 1)
1354 startupFileTextfield_mouseClicked();
1359 sortby.setFont(LABEL_FONT);
1360 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1361 JLabel sortLabel = new JLabel();
1362 sortLabel.setFont(LABEL_FONT);
1363 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1364 sortLabel.setText(MessageManager.getString("label.sort_by"));
1365 sortAnnBy.setFont(LABEL_FONT);
1366 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1367 JLabel sortAnnLabel = new JLabel();
1368 sortAnnLabel.setFont(LABEL_FONT);
1369 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1370 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1371 sortAutocalc.setFont(LABEL_FONT);
1372 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1374 JPanel annsettingsPanel = new JPanel();
1375 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1376 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1377 annsettingsPanel.setBorder(new EtchedBorder());
1378 visualTab.add(annsettingsPanel);
1379 Border jb = new EmptyBorder(1, 1, 4, 5);
1380 annotations.setBorder(jb);
1381 showOccupancy.setBorder(jb);
1382 quality.setBorder(jb);
1383 conservation.setBorder(jb);
1384 identity.setBorder(jb);
1385 showConsensbits.setBorder(jb);
1386 showGroupbits.setBorder(jb);
1387 showGroupConsensus.setBorder(jb);
1388 showGroupConservation.setBorder(jb);
1389 showConsensHistogram.setBorder(jb);
1390 showConsensLogo.setBorder(jb);
1392 JPanel autoAnnotSettings = new JPanel();
1393 annsettingsPanel.add(autoAnnotSettings);
1394 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1395 autoAnnotSettings.add(annotations);
1396 autoAnnotSettings.add(quality);
1397 // second row of autoannotation box
1398 autoAnnotSettings = new JPanel();
1399 annsettingsPanel.add(autoAnnotSettings);
1401 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1402 autoAnnotSettings.add(conservation);
1403 autoAnnotSettings.add(identity);
1404 autoAnnotSettings.add(showOccupancy);
1405 autoAnnotSettings.add(showGroupbits);
1406 autoAnnotSettings.add(showGroupConservation);
1407 autoAnnotSettings.add(showGroupConsensus);
1408 autoAnnotSettings.add(showConsensbits);
1409 autoAnnotSettings.add(showConsensHistogram);
1410 autoAnnotSettings.add(showConsensLogo);
1414 JPanel tooltipSettings = new JPanel();
1415 tooltipSettings.setBorder(new TitledBorder(MessageManager
1416 .getString("label.sequence_id_tooltip")));
1417 tooltipSettings.setBounds(173, 140, 220, 62);
1418 tooltipSettings.setLayout(new GridLayout(2, 1));
1419 tooltipSettings.add(showDbRefTooltip);
1420 tooltipSettings.add(showNpTooltip);
1421 visualTab.add(tooltipSettings);
1423 wrap.setFont(LABEL_FONT);
1424 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1425 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1426 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1427 rightAlign.setFont(LABEL_FONT);
1428 rightAlign.setForeground(Color.black);
1429 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1430 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1431 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1432 idItalics.setFont(LABEL_FONT_ITALIC);
1433 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1434 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1435 idItalics.setText(MessageManager
1436 .getString("label.sequence_name_italics"));
1437 openoverv.setFont(LABEL_FONT);
1438 openoverv.setActionCommand(MessageManager
1439 .getString("label.open_overview"));
1440 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1441 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1442 openoverv.setText(MessageManager.getString("label.open_overview"));
1443 JPanel jPanel2 = new JPanel();
1444 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1445 jPanel2.setLayout(new GridLayout(14, 1));
1446 jPanel2.add(fullScreen);
1447 jPanel2.add(openoverv);
1448 jPanel2.add(seqLimit);
1449 jPanel2.add(rightAlign);
1450 jPanel2.add(fontLabel);
1451 jPanel2.add(showUnconserved);
1452 jPanel2.add(idItalics);
1453 jPanel2.add(smoothFont);
1454 jPanel2.add(scaleProteinToCdna);
1455 jPanel2.add(gapLabel);
1457 jPanel2.add(sortLabel);
1458 jPanel2.add(sortAnnLabel);
1459 jPanel2.add(startupCheckbox);
1460 visualTab.add(jPanel2);
1461 visualTab.add(startupFileTextfield);
1462 visualTab.add(sortby);
1463 visualTab.add(sortAnnBy);
1464 visualTab.add(sortAutocalc);
1465 visualTab.add(gapSymbolCB);
1466 visualTab.add(fontNameCB);
1467 visualTab.add(fontSizeCB);
1468 visualTab.add(fontStyleCB);
1472 protected void autoIdWidth_actionPerformed()
1474 // TODO Auto-generated method stub
1478 protected void userIdWidth_actionPerformed()
1480 // TODO Auto-generated method stub
1484 protected void maxColour_actionPerformed(JPanel panel)
1488 protected void minColour_actionPerformed(JPanel panel)
1492 protected void showunconserved_actionPerformed(ActionEvent e)
1494 // TODO Auto-generated method stub
1504 public void ok_actionPerformed(ActionEvent e)
1514 public void cancel_actionPerformed(ActionEvent e)
1524 public void annotations_actionPerformed(ActionEvent e)
1531 public void startupFileTextfield_mouseClicked()
1535 public void newLink_actionPerformed(ActionEvent e)
1540 public void editLink_actionPerformed(ActionEvent e)
1545 public void deleteLink_actionPerformed(ActionEvent e)
1550 public void defaultBrowser_mouseClicked(MouseEvent e)
1555 public void linkURLList_keyTyped(KeyEvent e)
1560 public void useProxy_actionPerformed()
1562 boolean enabled = useProxy.isSelected();
1563 portLabel.setEnabled(enabled);
1564 serverLabel.setEnabled(enabled);
1565 proxyServerTB.setEnabled(enabled);
1566 proxyPortTB.setEnabled(enabled);
1570 * Customer renderer for JTable: supports column of radio buttons
1572 public class RadioButtonRenderer extends JRadioButton implements
1575 public RadioButtonRenderer()
1577 setHorizontalAlignment(CENTER);
1578 setToolTipText(MessageManager.getString("label.urltooltip"));
1582 public Component getTableCellRendererComponent(JTable table,
1583 Object value, boolean isSelected, boolean hasFocus, int row,
1586 setSelected((boolean) value);
1588 // set colours to match rest of table
1591 setBackground(table.getSelectionBackground());
1592 setForeground(table.getSelectionForeground());
1596 setBackground(table.getBackground());
1597 setForeground(table.getForeground());
1604 * Customer cell editor for JTable: supports column of radio buttons in
1605 * conjunction with renderer
1607 public class RadioButtonEditor extends AbstractCellEditor implements
1610 private JRadioButton button = new JRadioButton();
1612 public RadioButtonEditor()
1614 button.setHorizontalAlignment(SwingConstants.CENTER);
1615 this.button.addActionListener(new ActionListener()
1618 public void actionPerformed(ActionEvent e)
1620 fireEditingStopped();
1626 public Component getTableCellEditorComponent(JTable table,
1627 Object value, boolean isSelected, int row, int column)
1629 button.setSelected((boolean) value);
1634 public Object getCellEditorValue()
1636 return button.isSelected();