2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.fts.core.FTSDataColumnPreferences;
24 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
25 import jalview.fts.service.pdb.PDBFTSRestClient;
26 import jalview.gui.JvSwingUtils;
27 import jalview.gui.StructureViewer.ViewerType;
28 import jalview.util.MessageManager;
30 import java.awt.BorderLayout;
31 import java.awt.Color;
32 import java.awt.Component;
33 import java.awt.Dimension;
34 import java.awt.FlowLayout;
36 import java.awt.GridBagConstraints;
37 import java.awt.GridBagLayout;
38 import java.awt.GridLayout;
39 import java.awt.Insets;
40 import java.awt.Rectangle;
41 import java.awt.event.ActionEvent;
42 import java.awt.event.ActionListener;
43 import java.awt.event.FocusEvent;
44 import java.awt.event.KeyEvent;
45 import java.awt.event.MouseAdapter;
46 import java.awt.event.MouseEvent;
48 import javax.swing.AbstractCellEditor;
49 import javax.swing.BorderFactory;
50 import javax.swing.ButtonGroup;
51 import javax.swing.DefaultListCellRenderer;
52 import javax.swing.JButton;
53 import javax.swing.JCheckBox;
54 import javax.swing.JComboBox;
55 import javax.swing.JFileChooser;
56 import javax.swing.JLabel;
57 import javax.swing.JPanel;
58 import javax.swing.JRadioButton;
59 import javax.swing.JScrollPane;
60 import javax.swing.JTabbedPane;
61 import javax.swing.JTable;
62 import javax.swing.JTextField;
63 import javax.swing.ListSelectionModel;
64 import javax.swing.SwingConstants;
65 import javax.swing.border.Border;
66 import javax.swing.border.EmptyBorder;
67 import javax.swing.border.EtchedBorder;
68 import javax.swing.border.TitledBorder;
69 import javax.swing.event.ChangeEvent;
70 import javax.swing.event.ChangeListener;
71 import javax.swing.table.TableCellEditor;
72 import javax.swing.table.TableCellRenderer;
75 * Base class for the Preferences panel.
80 public class GPreferences extends JPanel
82 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
84 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
85 .getLabelFont(false, true);
88 * Visual tab components
90 protected JCheckBox fullScreen = new JCheckBox();
92 protected JCheckBox openoverv = new JCheckBox();
94 protected JCheckBox seqLimit = new JCheckBox();
96 protected JCheckBox rightAlign = new JCheckBox();
98 protected JComboBox<String> fontSizeCB = new JComboBox<String>();
100 protected JComboBox<String> fontStyleCB = new JComboBox<String>();
102 protected JComboBox<String> fontNameCB = new JComboBox<String>();
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<String>();
116 protected JCheckBox wrap = new JCheckBox();
118 protected JComboBox<String> sortby = new JComboBox<String>();
120 protected JComboBox<String> sortAnnBy = new JComboBox<String>();
122 protected JComboBox<String> sortAutocalc = new JComboBox<String>();
124 protected JCheckBox startupCheckbox = new JCheckBox();
126 protected JTextField startupFileTextfield = new JTextField();
128 // below are in the 'second column'
129 protected JCheckBox annotations = new JCheckBox();
131 protected JCheckBox quality = new JCheckBox();
133 protected JCheckBox conservation = new JCheckBox();
135 protected JCheckBox identity = new JCheckBox();
137 protected JCheckBox showGroupConsensus = new JCheckBox();
139 protected JCheckBox showGroupConservation = new JCheckBox();
141 protected JCheckBox showConsensHistogram = new JCheckBox();
143 protected JCheckBox showConsensLogo = new JCheckBox();
145 protected JCheckBox showDbRefTooltip = new JCheckBox();
147 protected JCheckBox showNpTooltip = new JCheckBox();
150 * Structure tab and components
152 protected JPanel structureTab;
154 protected JCheckBox structFromPdb = new JCheckBox();
156 protected JCheckBox useRnaView = new JCheckBox();
158 protected JCheckBox addSecondaryStructure = new JCheckBox();
160 protected JCheckBox addTempFactor = new JCheckBox();
162 protected JComboBox<String> structViewer = new JComboBox<String>();
164 protected JTextField chimeraPath = new JTextField();
166 protected ButtonGroup mappingMethod = new ButtonGroup();
168 protected JRadioButton siftsMapping = new JRadioButton();
170 protected JRadioButton nwMapping = new JRadioButton();
173 * Colours tab components
175 protected JPanel minColour = new JPanel();
177 protected JPanel maxColour = new JPanel();
179 protected JComboBox<String> protColour = new JComboBox<String>();
181 protected JComboBox<String> nucColour = new JComboBox<String>();
184 * Connections tab components
186 protected JTable linkUrlTable = new JTable();
188 protected JButton editLink = new JButton();
190 protected JButton deleteLink = new JButton();
192 protected JTextField filterTB = new JTextField();
194 protected JButton doReset = new JButton();
196 protected JButton userOnly = new JButton();
198 protected JLabel portLabel = new JLabel();
200 protected JLabel serverLabel = new JLabel();
202 protected JTextField proxyServerTB = new JTextField();
204 protected JTextField proxyPortTB = new JTextField();
206 protected JTextField defaultBrowser = new JTextField();
208 protected JCheckBox useProxy = new JCheckBox();
210 protected JCheckBox usagestats = new JCheckBox();
212 protected JCheckBox questionnaire = new JCheckBox();
214 protected JCheckBox versioncheck = new JCheckBox();
217 * Output tab components
219 protected JComboBox<Object> epsRendering = new JComboBox<Object>();
221 protected JLabel userIdWidthlabel = new JLabel();
223 protected JCheckBox autoIdWidth = new JCheckBox();
225 protected JTextField userIdWidth = new JTextField();
227 protected JCheckBox blcjv = new JCheckBox();
229 protected JCheckBox pileupjv = new JCheckBox();
231 protected JCheckBox clustaljv = new JCheckBox();
233 protected JCheckBox msfjv = new JCheckBox();
235 protected JCheckBox fastajv = new JCheckBox();
237 protected JCheckBox pfamjv = new JCheckBox();
239 protected JCheckBox pirjv = new JCheckBox();
241 protected JCheckBox modellerOutput = new JCheckBox();
243 protected JCheckBox embbedBioJSON = new JCheckBox();
246 * Editing tab components
248 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
250 protected JCheckBox padGaps = new JCheckBox();
252 protected JCheckBox sortByTree = new JCheckBox();
257 protected JPanel dasTab = new JPanel();
262 protected JPanel wsTab = new JPanel();
265 * Creates a new GPreferences object.
267 public GPreferences()
272 } catch (Exception ex)
274 ex.printStackTrace();
279 * Construct the panel and its tabbed sub-panels.
283 private void jbInit() throws Exception
285 final JTabbedPane tabbedPane = new JTabbedPane();
286 this.setLayout(new BorderLayout());
287 JPanel okCancelPanel = initOkCancelPanel();
288 this.add(tabbedPane, BorderLayout.CENTER);
289 this.add(okCancelPanel, BorderLayout.SOUTH);
291 tabbedPane.add(initVisualTab(),
292 MessageManager.getString("label.visual"));
294 tabbedPane.add(initColoursTab(),
295 MessageManager.getString("label.colours"));
297 tabbedPane.add(initStructureTab(),
298 MessageManager.getString("label.structure"));
300 tabbedPane.add(initConnectionsTab(),
301 MessageManager.getString("label.connections"));
303 tabbedPane.add(initLinksTab(),
304 MessageManager.getString("label.urllinks"));
306 tabbedPane.add(initOutputTab(),
307 MessageManager.getString("label.output"));
309 tabbedPane.add(initEditingTab(),
310 MessageManager.getString("label.editing"));
313 * See DasSourceBrowser for the real work of configuring this tab.
315 dasTab.setLayout(new BorderLayout());
316 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
319 * See WsPreferences for the real work of configuring this tab.
321 wsTab.setLayout(new BorderLayout());
322 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
325 * Handler to validate a tab before leaving it - currently only for
328 tabbedPane.addChangeListener(new ChangeListener()
330 private Component lastTab;
333 public void stateChanged(ChangeEvent e)
335 if (lastTab == structureTab
336 && tabbedPane.getSelectedComponent() != structureTab)
338 if (!validateStructure())
340 tabbedPane.setSelectedComponent(structureTab);
344 lastTab = tabbedPane.getSelectedComponent();
351 * Initialises the Editing tabbed panel.
355 private JPanel initEditingTab()
357 JPanel editingTab = new JPanel();
358 editingTab.setLayout(null);
359 autoCalculateConsCheck.setFont(LABEL_FONT);
360 autoCalculateConsCheck.setText(
361 MessageManager.getString("label.autocalculate_consensus"));
362 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
363 padGaps.setFont(LABEL_FONT);
365 MessageManager.getString("label.pad_gaps_when_editing"));
366 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
367 sortByTree.setFont(LABEL_FONT);
369 .setText(MessageManager.getString("label.sort_with_new_tree"));
370 sortByTree.setToolTipText(MessageManager.getString(
371 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
372 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
373 editingTab.add(autoCalculateConsCheck);
374 editingTab.add(padGaps);
375 editingTab.add(sortByTree);
380 * Initialises the Output tabbed panel.
384 private JPanel initOutputTab()
386 JPanel outputTab = new JPanel();
387 outputTab.setLayout(null);
388 JLabel epsLabel = new JLabel();
389 epsLabel.setFont(LABEL_FONT);
390 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
391 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
392 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
393 epsRendering.setFont(LABEL_FONT);
394 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
395 JLabel jLabel1 = new JLabel();
396 jLabel1.setFont(LABEL_FONT);
397 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
398 jLabel1.setText(MessageManager.getString("label.append_start_end"));
399 jLabel1.setFont(LABEL_FONT);
400 fastajv.setFont(LABEL_FONT);
401 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
402 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
403 blcjv.setText(MessageManager.getString("label.blc") + " ");
404 fastajv.setText(MessageManager.getString("label.fasta") + " ");
405 msfjv.setText(MessageManager.getString("label.msf") + " ");
406 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
407 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
408 msfjv.setFont(LABEL_FONT);
409 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
410 pirjv.setText(MessageManager.getString("label.pir") + " ");
411 JPanel jPanel11 = new JPanel();
412 jPanel11.setFont(LABEL_FONT);
413 TitledBorder titledBorder2 = new TitledBorder(
414 MessageManager.getString("label.file_output"));
415 jPanel11.setBorder(titledBorder2);
416 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
417 GridLayout gridLayout3 = new GridLayout();
418 jPanel11.setLayout(gridLayout3);
419 gridLayout3.setRows(8);
420 blcjv.setFont(LABEL_FONT);
421 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
422 clustaljv.setFont(LABEL_FONT);
423 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
424 pfamjv.setFont(LABEL_FONT);
425 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
426 pileupjv.setFont(LABEL_FONT);
427 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
428 pirjv.setFont(LABEL_FONT);
429 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
430 autoIdWidth.setFont(LABEL_FONT);
432 MessageManager.getString("label.automatically_set_id_width"));
433 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
434 .getString("label.adjusts_width_generated_eps_png")));
435 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
436 autoIdWidth.addActionListener(new ActionListener()
440 public void actionPerformed(ActionEvent e)
442 autoIdWidth_actionPerformed();
445 userIdWidthlabel.setFont(LABEL_FONT);
446 userIdWidthlabel.setText(
447 MessageManager.getString("label.figure_id_column_width"));
448 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
449 .getString("label.manually_specify_width_left_column")));
450 userIdWidthlabel.setToolTipText(
451 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
452 "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);
468 .setText(MessageManager.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(
508 MessageManager.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,
529 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
530 GridBagConstraints.WEST, GridBagConstraints.NONE,
531 new Insets(10, 0, 5, 5), 5, 1));
532 defaultBrowser.setFont(LABEL_FONT);
533 defaultBrowser.setText("");
535 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
536 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
537 new Insets(10, 0, 5, 10), 30, 1));
539 // Add proxy server panel
540 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
541 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
542 new Insets(10, 0, 5, 12), 4, 10));
544 // Add usage stats, version check and questionnaire checkboxes
545 connectTab.add(usagestats,
546 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
547 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
548 new Insets(0, 2, 5, 5), 70, 1));
549 connectTab.add(questionnaire,
550 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
551 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
552 new Insets(0, 2, 5, 10), 70, 1));
553 connectTab.add(versioncheck,
554 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
555 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
556 new Insets(0, 2, 5, 5), 70, 1));
558 // Add padding so the panel doesn't look ridiculous
559 JPanel spacePanel = new JPanel();
560 connectTab.add(spacePanel,
561 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
562 GridBagConstraints.WEST, GridBagConstraints.BOTH,
563 new Insets(0, 0, 0, 5), 70, 1));
569 * Initialises the Links tabbed panel.
573 private JPanel initLinksTab()
575 JPanel linkTab = new JPanel();
576 linkTab.setLayout(new GridBagLayout());
578 // Set up table for Url links
579 linkUrlTable.setFillsViewportHeight(true);
580 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
581 linkUrlTable.setAutoCreateRowSorter(true);
582 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
584 // adjust row height so radio buttons actually fit
585 // don't do this in the renderer, it causes the awt thread to activate
587 JRadioButton temp = new JRadioButton();
588 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
590 // Table in scrollpane so that the table is given a scrollbar
591 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
592 linkScrollPane.setBorder(null);
594 // Panel for links functionality
595 JPanel linkPanel = new JPanel(new GridBagLayout());
596 linkPanel.setBorder(new TitledBorder(
597 MessageManager.getString("label.url_linkfrom_sequence_id")));
599 // Put the Url links panel together
601 // Buttons go at top right, resizing only resizes the blank space vertically
602 JPanel buttonPanel = initLinkTabUrlButtons();
603 GridBagConstraints linkConstraints1 = new GridBagConstraints();
604 linkConstraints1.insets = new Insets(0, 0, 5, 0);
605 linkConstraints1.gridx = 0;
606 linkConstraints1.gridy = 0;
607 linkConstraints1.weightx = 1.0;
608 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
609 linkTab.add(buttonPanel, linkConstraints1);
611 // Links table goes at top left, resizing resizes the table
612 GridBagConstraints linkConstraints2 = new GridBagConstraints();
613 linkConstraints2.insets = new Insets(0, 0, 5, 5);
614 linkConstraints2.gridx = 0;
615 linkConstraints2.gridy = 1;
616 linkConstraints2.weightx = 1.0;
617 linkConstraints2.weighty = 1.0;
618 linkConstraints2.fill = GridBagConstraints.BOTH;
619 linkTab.add(linkScrollPane, linkConstraints2);
621 // Filter box and buttons goes at bottom left, resizing resizes the text box
622 JPanel filterPanel = initLinkTabFilterPanel();
623 GridBagConstraints linkConstraints3 = new GridBagConstraints();
624 linkConstraints3.insets = new Insets(0, 0, 0, 5);
625 linkConstraints3.gridx = 0;
626 linkConstraints3.gridy = 2;
627 linkConstraints3.weightx = 1.0;
628 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
629 linkTab.add(filterPanel, linkConstraints3);
634 private JPanel initLinkTabFilterPanel()
636 // Filter textbox and reset button
637 JLabel filterLabel = new JLabel(
638 MessageManager.getString("label.filter"));
639 filterLabel.setFont(LABEL_FONT);
640 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
641 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
643 filterTB.setFont(LABEL_FONT);
644 filterTB.setText("");
646 doReset.setText(MessageManager.getString("action.showall"));
647 userOnly.setText(MessageManager.getString("action.customfilter"));
649 // Panel for filter functionality
650 JPanel filterPanel = new JPanel(new GridBagLayout());
651 filterPanel.setBorder(new TitledBorder("Filter"));
652 GridBagConstraints gbc = new GridBagConstraints();
655 gbc.fill = GridBagConstraints.NONE;
656 gbc.anchor = GridBagConstraints.WEST;
658 filterPanel.add(filterLabel, gbc);
660 GridBagConstraints gbc1 = new GridBagConstraints();
663 gbc1.fill = GridBagConstraints.HORIZONTAL;
664 gbc1.anchor = GridBagConstraints.WEST;
666 filterPanel.add(filterTB, gbc1);
668 GridBagConstraints gbc2 = new GridBagConstraints();
670 gbc2.fill = GridBagConstraints.NONE;
671 gbc2.anchor = GridBagConstraints.WEST;
672 filterPanel.add(doReset, gbc2);
674 GridBagConstraints gbc3 = new GridBagConstraints();
676 gbc3.fill = GridBagConstraints.NONE;
677 gbc3.anchor = GridBagConstraints.WEST;
678 filterPanel.add(userOnly, gbc3);
683 private JPanel initLinkTabUrlButtons()
685 // Buttons for new / edit / delete Url links
686 JButton newLink = new JButton();
687 newLink.setText(MessageManager.getString("action.new"));
689 editLink.setText(MessageManager.getString("action.edit"));
691 deleteLink.setText(MessageManager.getString("action.delete"));
693 // no current selection, so initially disable delete/edit buttons
694 editLink.setEnabled(false);
695 deleteLink.setEnabled(false);
697 newLink.addActionListener(new java.awt.event.ActionListener()
700 public void actionPerformed(ActionEvent e)
702 newLink_actionPerformed(e);
706 editLink.setText(MessageManager.getString("action.edit"));
707 editLink.addActionListener(new java.awt.event.ActionListener()
710 public void actionPerformed(ActionEvent e)
712 editLink_actionPerformed(e);
716 deleteLink.setText(MessageManager.getString("action.delete"));
717 deleteLink.addActionListener(new java.awt.event.ActionListener()
720 public void actionPerformed(ActionEvent e)
722 deleteLink_actionPerformed(e);
726 JPanel buttonPanel = new JPanel(new GridBagLayout());
727 buttonPanel.setBorder(new TitledBorder("Edit links"));
728 GridBagConstraints gbc = new GridBagConstraints();
731 gbc.fill = GridBagConstraints.NONE;
732 buttonPanel.add(newLink, gbc);
734 GridBagConstraints gbc1 = new GridBagConstraints();
737 gbc1.fill = GridBagConstraints.NONE;
738 buttonPanel.add(editLink, gbc1);
740 GridBagConstraints gbc2 = new GridBagConstraints();
743 gbc2.fill = GridBagConstraints.NONE;
744 buttonPanel.add(deleteLink, gbc2);
746 GridBagConstraints gbc3 = new GridBagConstraints();
749 gbc3.fill = GridBagConstraints.HORIZONTAL;
751 JPanel spacePanel = new JPanel();
752 spacePanel.setBorder(null);
753 buttonPanel.add(spacePanel, gbc3);
759 * Initialises the proxy server panel in the Connections tab
761 * @return the proxy server panel
763 private JPanel initConnTabProxyPanel()
765 // Label for server text box
766 serverLabel.setText(MessageManager.getString("label.address"));
767 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
768 serverLabel.setFont(LABEL_FONT);
770 // Proxy server and port text boxes
771 proxyServerTB.setFont(LABEL_FONT);
772 proxyPortTB.setFont(LABEL_FONT);
774 // Label for Port text box
775 portLabel.setFont(LABEL_FONT);
776 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
777 portLabel.setText(MessageManager.getString("label.port"));
779 // Use proxy server checkbox
780 useProxy.setFont(LABEL_FONT);
781 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
782 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
783 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
784 useProxy.addActionListener(new ActionListener()
787 public void actionPerformed(ActionEvent e)
789 useProxy_actionPerformed();
793 // Make proxy server panel
794 JPanel proxyPanel = new JPanel();
795 TitledBorder titledBorder1 = new TitledBorder(
796 MessageManager.getString("label.proxy_server"));
797 proxyPanel.setBorder(titledBorder1);
798 proxyPanel.setLayout(new GridBagLayout());
799 proxyPanel.add(serverLabel,
800 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
801 GridBagConstraints.WEST, GridBagConstraints.NONE,
802 new Insets(0, 2, 2, 0), 5, 0));
803 proxyPanel.add(portLabel,
804 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
805 GridBagConstraints.WEST, GridBagConstraints.NONE,
806 new Insets(0, 0, 2, 0), 11, 0));
807 proxyPanel.add(useProxy,
808 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
809 GridBagConstraints.WEST, GridBagConstraints.NONE,
810 new Insets(0, 2, 5, 185), 2, -4));
811 proxyPanel.add(proxyPortTB,
812 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
813 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
814 new Insets(0, 2, 2, 2), 54, 1));
815 proxyPanel.add(proxyServerTB,
816 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
817 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
818 new Insets(0, 2, 2, 0), 263, 1));
824 * Initialises the checkboxes in the Connections tab
826 private void initConnTabCheckboxes()
828 // Usage stats checkbox label
830 MessageManager.getString("label.send_usage_statistics"));
831 usagestats.setFont(LABEL_FONT);
832 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
833 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
835 // Questionnaire checkbox label
836 questionnaire.setText(
837 MessageManager.getString("label.check_for_questionnaires"));
838 questionnaire.setFont(LABEL_FONT);
839 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
840 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
842 // Check for latest version checkbox label
843 versioncheck.setText(
844 MessageManager.getString("label.check_for_latest_version"));
845 versioncheck.setFont(LABEL_FONT);
846 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
847 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
851 * Initialises the parent panel which contains the tabbed sections.
855 private JPanel initOkCancelPanel()
857 JButton ok = new JButton();
858 ok.setText(MessageManager.getString("action.ok"));
859 ok.addActionListener(new ActionListener()
862 public void actionPerformed(ActionEvent e)
864 ok_actionPerformed(e);
867 JButton cancel = new JButton();
868 cancel.setText(MessageManager.getString("action.cancel"));
869 cancel.addActionListener(new ActionListener()
872 public void actionPerformed(ActionEvent e)
874 cancel_actionPerformed(e);
877 JPanel okCancelPanel = new JPanel();
878 okCancelPanel.add(ok);
879 okCancelPanel.add(cancel);
880 return okCancelPanel;
884 * Initialises the Colours tabbed panel.
888 private JPanel initColoursTab()
890 JPanel coloursTab = new JPanel();
891 coloursTab.setBorder(new TitledBorder(
892 MessageManager.getString("action.open_new_alignment")));
893 coloursTab.setLayout(new FlowLayout());
894 JLabel mincolourLabel = new JLabel();
895 mincolourLabel.setFont(LABEL_FONT);
896 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
897 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
898 minColour.setFont(LABEL_FONT);
899 minColour.setBorder(BorderFactory.createEtchedBorder());
900 minColour.setPreferredSize(new Dimension(40, 20));
901 minColour.addMouseListener(new MouseAdapter()
904 public void mousePressed(MouseEvent e)
906 minColour_actionPerformed(minColour);
909 JLabel maxcolourLabel = new JLabel();
910 maxcolourLabel.setFont(LABEL_FONT);
911 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
912 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
913 maxColour.setFont(LABEL_FONT);
914 maxColour.setBorder(BorderFactory.createEtchedBorder());
915 maxColour.setPreferredSize(new Dimension(40, 20));
916 maxColour.addMouseListener(new MouseAdapter()
919 public void mousePressed(MouseEvent e)
921 maxColour_actionPerformed(maxColour);
925 protColour.setFont(LABEL_FONT);
926 protColour.setBounds(new Rectangle(172, 225, 155, 21));
927 JLabel protColourLabel = new JLabel();
928 protColourLabel.setFont(LABEL_FONT);
929 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
930 protColourLabel.setText(
931 MessageManager.getString("label.prot_alignment_colour") + " ");
932 JvSwingUtils.addtoLayout(coloursTab,
934 .getString("label.default_colour_scheme_for_alignment"),
935 protColourLabel, protColour);
937 nucColour.setFont(LABEL_FONT);
938 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
939 JLabel nucColourLabel = new JLabel();
940 nucColourLabel.setFont(LABEL_FONT);
941 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
942 nucColourLabel.setText(
943 MessageManager.getString("label.nuc_alignment_colour") + " ");
944 JvSwingUtils.addtoLayout(coloursTab,
946 .getString("label.default_colour_scheme_for_alignment"),
947 nucColourLabel, nucColour);
949 JPanel annotationShding = new JPanel();
950 annotationShding.setBorder(new TitledBorder(
951 MessageManager.getString("label.annotation_shading_default")));
952 annotationShding.setLayout(new GridLayout(1, 2));
953 JvSwingUtils.addtoLayout(annotationShding,
954 MessageManager.getString(
955 "label.default_minimum_colour_annotation_shading"),
956 mincolourLabel, minColour);
957 JvSwingUtils.addtoLayout(annotationShding,
958 MessageManager.getString(
959 "label.default_maximum_colour_annotation_shading"),
960 maxcolourLabel, maxColour);
961 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
966 * Initialises the Structure tabbed panel.
970 private JPanel initStructureTab()
972 structureTab = new JPanel();
974 structureTab.setBorder(new TitledBorder(
975 MessageManager.getString("label.structure_options")));
976 structureTab.setLayout(null);
977 final int width = 400;
978 final int height = 22;
979 final int lineSpacing = 25;
982 structFromPdb.setFont(LABEL_FONT);
984 .setText(MessageManager.getString("label.struct_from_pdb"));
985 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
986 structFromPdb.addActionListener(new ActionListener()
989 public void actionPerformed(ActionEvent e)
991 boolean selected = structFromPdb.isSelected();
992 // enable other options only when the first is checked
993 useRnaView.setEnabled(selected);
994 addSecondaryStructure.setEnabled(selected);
995 addTempFactor.setEnabled(selected);
998 structureTab.add(structFromPdb);
1000 // indent checkboxes that are conditional on the first one
1001 ypos += lineSpacing;
1002 useRnaView.setFont(LABEL_FONT);
1003 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1004 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1005 structureTab.add(useRnaView);
1007 ypos += lineSpacing;
1008 addSecondaryStructure.setFont(LABEL_FONT);
1009 addSecondaryStructure
1010 .setText(MessageManager.getString("label.autoadd_secstr"));
1011 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1012 structureTab.add(addSecondaryStructure);
1014 ypos += lineSpacing;
1015 addTempFactor.setFont(LABEL_FONT);
1016 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1017 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1018 structureTab.add(addTempFactor);
1020 ypos += lineSpacing;
1021 JLabel viewerLabel = new JLabel();
1022 viewerLabel.setFont(LABEL_FONT);
1023 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1024 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1025 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1026 structureTab.add(viewerLabel);
1028 structViewer.setFont(LABEL_FONT);
1029 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1030 structViewer.addItem(ViewerType.JMOL.name());
1031 structViewer.addItem(ViewerType.CHIMERA.name());
1032 structViewer.addActionListener(new ActionListener()
1035 public void actionPerformed(ActionEvent e)
1037 structureViewer_actionPerformed(
1038 (String) structViewer.getSelectedItem());
1041 structureTab.add(structViewer);
1043 ypos += lineSpacing;
1044 JLabel pathLabel = new JLabel();
1045 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1046 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1047 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1048 final String tooltip = JvSwingUtils.wrapTooltip(true,
1049 MessageManager.getString("label.chimera_path_tip"));
1050 pathLabel.setToolTipText(tooltip);
1051 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1052 structureTab.add(pathLabel);
1054 chimeraPath.setFont(LABEL_FONT);
1055 chimeraPath.setText("");
1056 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1057 chimeraPath.addMouseListener(new MouseAdapter()
1060 public void mouseClicked(MouseEvent e)
1062 if (e.getClickCount() == 2)
1064 String chosen = openFileChooser();
1067 chimeraPath.setText(chosen);
1072 structureTab.add(chimeraPath);
1074 ypos += lineSpacing;
1075 nwMapping.setFont(LABEL_FONT);
1076 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1077 siftsMapping.setFont(LABEL_FONT);
1078 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1079 mappingMethod.add(nwMapping);
1080 mappingMethod.add(siftsMapping);
1081 JPanel mappingPanel = new JPanel();
1082 mappingPanel.setFont(LABEL_FONT);
1083 TitledBorder mmTitledBorder = new TitledBorder(
1084 MessageManager.getString("label.mapping_method"));
1085 mmTitledBorder.setTitleFont(LABEL_FONT);
1086 mappingPanel.setBorder(mmTitledBorder);
1087 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1088 // GridLayout mappingLayout = new GridLayout();
1089 mappingPanel.setLayout(new GridLayout());
1090 mappingPanel.add(nwMapping);
1091 mappingPanel.add(siftsMapping);
1092 structureTab.add(mappingPanel);
1094 ypos += lineSpacing;
1095 ypos += lineSpacing;
1096 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1097 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1098 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1099 structureTab.add(docFieldPref);
1101 return structureTab;
1105 * Action on choosing a structure viewer from combobox options.
1107 * @param selectedItem
1109 protected void structureViewer_actionPerformed(String selectedItem)
1114 * Show a dialog for the user to choose a file. Returns the chosen path, or
1119 protected String openFileChooser()
1121 String choice = null;
1122 JFileChooser chooser = new JFileChooser();
1124 // chooser.setFileView(new JalviewFileView());
1125 chooser.setDialogTitle(
1126 MessageManager.getString("label.open_local_file"));
1127 chooser.setToolTipText(MessageManager.getString("action.open"));
1129 int value = chooser.showOpenDialog(this);
1131 if (value == JFileChooser.APPROVE_OPTION)
1133 choice = chooser.getSelectedFile().getPath();
1139 * Validate the structure tab preferences; if invalid, set focus on this tab.
1143 protected boolean validateStructure(FocusEvent e)
1145 if (!validateStructure())
1147 e.getComponent().requestFocusInWindow();
1153 protected boolean validateStructure()
1159 * Initialises the Visual tabbed panel.
1163 private JPanel initVisualTab()
1165 JPanel visualTab = new JPanel();
1166 visualTab.setBorder(new TitledBorder(
1167 MessageManager.getString("action.open_new_alignment")));
1168 visualTab.setLayout(null);
1169 fullScreen.setFont(LABEL_FONT);
1170 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1171 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1172 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1173 quality.setEnabled(false);
1174 quality.setFont(LABEL_FONT);
1175 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1176 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1177 quality.setSelected(true);
1178 quality.setText(MessageManager.getString("label.quality"));
1179 conservation.setEnabled(false);
1180 conservation.setFont(LABEL_FONT);
1181 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1182 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1183 conservation.setSelected(true);
1184 conservation.setText(MessageManager.getString("label.conservation"));
1185 identity.setEnabled(false);
1186 identity.setFont(LABEL_FONT);
1187 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1188 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1189 identity.setSelected(true);
1190 identity.setText(MessageManager.getString("label.consensus"));
1191 showOccupancy.setFont(LABEL_FONT);
1192 showOccupancy.setEnabled(false);
1193 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1194 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1195 showOccupancy.setSelected(true);
1196 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1198 JLabel showGroupbits = new JLabel();
1199 showGroupbits.setFont(LABEL_FONT);
1200 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1201 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1203 .setText(MessageManager.getString("action.show_group") + ":");
1204 JLabel showConsensbits = new JLabel();
1205 showConsensbits.setFont(LABEL_FONT);
1206 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1207 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1209 .setText(MessageManager.getString("label.consensus") + ":");
1210 showConsensHistogram.setEnabled(false);
1211 showConsensHistogram.setFont(LABEL_FONT);
1212 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1213 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1214 showConsensHistogram.setSelected(true);
1215 showConsensHistogram
1216 .setText(MessageManager.getString("label.histogram"));
1217 showConsensLogo.setEnabled(false);
1218 showConsensLogo.setFont(LABEL_FONT);
1219 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1220 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1221 showConsensLogo.setSelected(true);
1222 showConsensLogo.setText(MessageManager.getString("label.logo"));
1223 showGroupConsensus.setEnabled(false);
1224 showGroupConsensus.setFont(LABEL_FONT);
1225 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1226 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1227 showGroupConsensus.setSelected(true);
1228 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1229 showGroupConservation.setEnabled(false);
1230 showGroupConservation.setFont(LABEL_FONT);
1231 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1232 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1233 showGroupConservation.setSelected(true);
1234 showGroupConservation
1235 .setText(MessageManager.getString("label.conservation"));
1236 showNpTooltip.setEnabled(true);
1237 showNpTooltip.setFont(LABEL_FONT);
1238 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1239 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1240 showNpTooltip.setSelected(true);
1241 showNpTooltip.setText(
1242 MessageManager.getString("label.non_positional_features"));
1243 showDbRefTooltip.setEnabled(true);
1244 showDbRefTooltip.setFont(LABEL_FONT);
1245 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1246 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1247 showDbRefTooltip.setSelected(true);
1249 .setText(MessageManager.getString("label.database_references"));
1250 annotations.setFont(LABEL_FONT);
1251 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1252 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1253 annotations.setSelected(true);
1254 annotations.setText(MessageManager.getString("label.show_annotations"));
1255 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1256 annotations.addActionListener(new ActionListener()
1259 public void actionPerformed(ActionEvent e)
1261 annotations_actionPerformed(e);
1264 identity.addActionListener(new ActionListener()
1267 public void actionPerformed(ActionEvent e)
1269 annotations_actionPerformed(e);
1272 showGroupConsensus.addActionListener(new ActionListener()
1275 public void actionPerformed(ActionEvent e)
1277 annotations_actionPerformed(e);
1280 showUnconserved.setFont(LABEL_FONT);
1281 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1282 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1283 showUnconserved.setSelected(true);
1285 .setText(MessageManager.getString("action.show_unconserved"));
1286 showUnconserved.addActionListener(new ActionListener()
1289 public void actionPerformed(ActionEvent e)
1291 showunconserved_actionPerformed(e);
1295 // TODO these are not yet added to / action from Preferences
1296 // JCheckBox shareSelections = new JCheckBox();
1297 // shareSelections.setFont(verdana11);
1298 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1299 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1300 // shareSelections.setSelected(true);
1301 // shareSelections.setText(MessageManager
1302 // .getString("label.share_selection_across_views"));
1303 // JCheckBox followHighlight = new JCheckBox();
1304 // followHighlight.setFont(verdana11);
1305 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1306 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1307 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1308 // followHighlight.setSelected(true);
1309 // followHighlight.setText(MessageManager
1310 // .getString("label.scroll_highlighted_regions"));
1312 seqLimit.setFont(LABEL_FONT);
1313 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1314 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1315 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1316 smoothFont.setFont(LABEL_FONT);
1317 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1318 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1319 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1320 scaleProteinToCdna.setFont(LABEL_FONT);
1321 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1322 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1323 scaleProteinToCdna.setText(
1324 MessageManager.getString("label.scale_protein_to_cdna"));
1325 scaleProteinToCdna.setToolTipText(
1326 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1327 JLabel gapLabel = new JLabel();
1328 gapLabel.setFont(LABEL_FONT);
1329 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1330 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1331 JLabel fontLabel = new JLabel();
1332 fontLabel.setFont(LABEL_FONT);
1333 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1334 fontLabel.setText(MessageManager.getString("label.font"));
1335 fontSizeCB.setFont(LABEL_FONT);
1336 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1337 fontStyleCB.setFont(LABEL_FONT);
1338 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1339 fontNameCB.setFont(LABEL_FONT);
1340 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1341 gapSymbolCB.setFont(LABEL_FONT);
1342 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1343 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1344 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1345 gapSymbolCB.setRenderer(dlcr);
1347 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1348 startupCheckbox.setFont(LABEL_FONT);
1349 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1350 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1351 startupCheckbox.setSelected(true);
1352 startupFileTextfield.setFont(LABEL_FONT);
1353 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1354 startupFileTextfield.addMouseListener(new MouseAdapter()
1357 public void mouseClicked(MouseEvent e)
1359 if (e.getClickCount() > 1)
1361 startupFileTextfield_mouseClicked();
1366 sortby.setFont(LABEL_FONT);
1367 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1368 JLabel sortLabel = new JLabel();
1369 sortLabel.setFont(LABEL_FONT);
1370 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1371 sortLabel.setText(MessageManager.getString("label.sort_by"));
1372 sortAnnBy.setFont(LABEL_FONT);
1373 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1374 JLabel sortAnnLabel = new JLabel();
1375 sortAnnLabel.setFont(LABEL_FONT);
1376 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1377 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1378 sortAutocalc.setFont(LABEL_FONT);
1379 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1381 JPanel annsettingsPanel = new JPanel();
1382 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1383 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1384 annsettingsPanel.setBorder(new EtchedBorder());
1385 visualTab.add(annsettingsPanel);
1386 Border jb = new EmptyBorder(1, 1, 4, 5);
1387 annotations.setBorder(jb);
1388 showOccupancy.setBorder(jb);
1389 quality.setBorder(jb);
1390 conservation.setBorder(jb);
1391 identity.setBorder(jb);
1392 showConsensbits.setBorder(jb);
1393 showGroupbits.setBorder(jb);
1394 showGroupConsensus.setBorder(jb);
1395 showGroupConservation.setBorder(jb);
1396 showConsensHistogram.setBorder(jb);
1397 showConsensLogo.setBorder(jb);
1399 JPanel autoAnnotSettings = new JPanel();
1400 annsettingsPanel.add(autoAnnotSettings);
1401 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1402 autoAnnotSettings.add(annotations);
1403 autoAnnotSettings.add(quality);
1404 // second row of autoannotation box
1405 autoAnnotSettings = new JPanel();
1406 annsettingsPanel.add(autoAnnotSettings);
1408 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1409 autoAnnotSettings.add(conservation);
1410 autoAnnotSettings.add(identity);
1411 autoAnnotSettings.add(showOccupancy);
1412 autoAnnotSettings.add(showGroupbits);
1413 autoAnnotSettings.add(showGroupConservation);
1414 autoAnnotSettings.add(showGroupConsensus);
1415 autoAnnotSettings.add(showConsensbits);
1416 autoAnnotSettings.add(showConsensHistogram);
1417 autoAnnotSettings.add(showConsensLogo);
1419 JPanel tooltipSettings = new JPanel();
1420 tooltipSettings.setBorder(new TitledBorder(
1421 MessageManager.getString("label.sequence_id_tooltip")));
1422 tooltipSettings.setBounds(173, 140, 220, 62);
1423 tooltipSettings.setLayout(new GridLayout(2, 1));
1424 tooltipSettings.add(showDbRefTooltip);
1425 tooltipSettings.add(showNpTooltip);
1426 visualTab.add(tooltipSettings);
1428 wrap.setFont(LABEL_FONT);
1429 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1430 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1431 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1432 rightAlign.setFont(LABEL_FONT);
1433 rightAlign.setForeground(Color.black);
1434 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1435 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1436 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1437 idItalics.setFont(LABEL_FONT_ITALIC);
1438 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1439 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1441 MessageManager.getString("label.sequence_name_italics"));
1442 openoverv.setFont(LABEL_FONT);
1443 openoverv.setActionCommand(
1444 MessageManager.getString("label.open_overview"));
1445 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1446 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1447 openoverv.setText(MessageManager.getString("label.open_overview"));
1448 JPanel jPanel2 = new JPanel();
1449 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1450 jPanel2.setLayout(new GridLayout(14, 1));
1451 jPanel2.add(fullScreen);
1452 jPanel2.add(openoverv);
1453 jPanel2.add(seqLimit);
1454 jPanel2.add(rightAlign);
1455 jPanel2.add(fontLabel);
1456 jPanel2.add(showUnconserved);
1457 jPanel2.add(idItalics);
1458 jPanel2.add(smoothFont);
1459 jPanel2.add(scaleProteinToCdna);
1460 jPanel2.add(gapLabel);
1462 jPanel2.add(sortLabel);
1463 jPanel2.add(sortAnnLabel);
1464 jPanel2.add(startupCheckbox);
1465 visualTab.add(jPanel2);
1466 visualTab.add(startupFileTextfield);
1467 visualTab.add(sortby);
1468 visualTab.add(sortAnnBy);
1469 visualTab.add(sortAutocalc);
1470 visualTab.add(gapSymbolCB);
1471 visualTab.add(fontNameCB);
1472 visualTab.add(fontSizeCB);
1473 visualTab.add(fontStyleCB);
1477 protected void autoIdWidth_actionPerformed()
1479 // TODO Auto-generated method stub
1483 protected void userIdWidth_actionPerformed()
1485 // TODO Auto-generated method stub
1489 protected void maxColour_actionPerformed(JPanel panel)
1493 protected void minColour_actionPerformed(JPanel panel)
1497 protected void showunconserved_actionPerformed(ActionEvent e)
1499 // TODO Auto-generated method stub
1509 public void ok_actionPerformed(ActionEvent e)
1519 public void cancel_actionPerformed(ActionEvent e)
1529 public void annotations_actionPerformed(ActionEvent e)
1536 public void startupFileTextfield_mouseClicked()
1540 public void newLink_actionPerformed(ActionEvent e)
1545 public void editLink_actionPerformed(ActionEvent e)
1550 public void deleteLink_actionPerformed(ActionEvent e)
1555 public void defaultBrowser_mouseClicked(MouseEvent e)
1560 public void linkURLList_keyTyped(KeyEvent e)
1565 public void useProxy_actionPerformed()
1567 boolean enabled = useProxy.isSelected();
1568 portLabel.setEnabled(enabled);
1569 serverLabel.setEnabled(enabled);
1570 proxyServerTB.setEnabled(enabled);
1571 proxyPortTB.setEnabled(enabled);
1575 * Customer renderer for JTable: supports column of radio buttons
1577 public class RadioButtonRenderer extends JRadioButton
1578 implements TableCellRenderer
1580 public RadioButtonRenderer()
1582 setHorizontalAlignment(CENTER);
1583 setToolTipText(MessageManager.getString("label.urltooltip"));
1587 public Component getTableCellRendererComponent(JTable table,
1588 Object value, boolean isSelected, boolean hasFocus, int row,
1591 setSelected((boolean) value);
1593 // set colours to match rest of table
1596 setBackground(table.getSelectionBackground());
1597 setForeground(table.getSelectionForeground());
1601 setBackground(table.getBackground());
1602 setForeground(table.getForeground());
1609 * Customer cell editor for JTable: supports column of radio buttons in
1610 * conjunction with renderer
1612 public class RadioButtonEditor extends AbstractCellEditor
1613 implements TableCellEditor
1615 private JRadioButton button = new JRadioButton();
1617 public RadioButtonEditor()
1619 button.setHorizontalAlignment(SwingConstants.CENTER);
1620 this.button.addActionListener(new ActionListener()
1623 public void actionPerformed(ActionEvent e)
1625 fireEditingStopped();
1631 public Component getTableCellEditorComponent(JTable table, Object value,
1632 boolean isSelected, int row, int column)
1634 button.setSelected((boolean) value);
1639 public Object getCellEditorValue()
1641 return button.isSelected();