2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.fts.core.FTSDataColumnPreferences;
24 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
25 import jalview.fts.service.pdb.PDBFTSRestClient;
26 import jalview.gui.JvSwingUtils;
27 import jalview.gui.StructureViewer.ViewerType;
28 import jalview.util.MessageManager;
30 import java.awt.BorderLayout;
31 import java.awt.Color;
32 import java.awt.Component;
33 import java.awt.Dimension;
34 import java.awt.FlowLayout;
36 import java.awt.GridBagConstraints;
37 import java.awt.GridBagLayout;
38 import java.awt.GridLayout;
39 import java.awt.Insets;
40 import java.awt.Rectangle;
41 import java.awt.event.ActionEvent;
42 import java.awt.event.ActionListener;
43 import java.awt.event.FocusEvent;
44 import java.awt.event.KeyEvent;
45 import java.awt.event.MouseAdapter;
46 import java.awt.event.MouseEvent;
48 import javax.swing.AbstractCellEditor;
49 import javax.swing.BorderFactory;
50 import javax.swing.ButtonGroup;
51 import javax.swing.DefaultListCellRenderer;
52 import javax.swing.JButton;
53 import javax.swing.JCheckBox;
54 import javax.swing.JComboBox;
55 import javax.swing.JFileChooser;
56 import javax.swing.JLabel;
57 import javax.swing.JPanel;
58 import javax.swing.JRadioButton;
59 import javax.swing.JScrollPane;
60 import javax.swing.JTabbedPane;
61 import javax.swing.JTable;
62 import javax.swing.JTextField;
63 import javax.swing.ListSelectionModel;
64 import javax.swing.SwingConstants;
65 import javax.swing.border.Border;
66 import javax.swing.border.EmptyBorder;
67 import javax.swing.border.EtchedBorder;
68 import javax.swing.border.TitledBorder;
69 import javax.swing.event.ChangeEvent;
70 import javax.swing.event.ChangeListener;
71 import javax.swing.table.TableCellEditor;
72 import javax.swing.table.TableCellRenderer;
75 * Base class for the Preferences panel.
80 public class GPreferences extends JPanel
82 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
84 private static final Font LABEL_FONT_ITALIC = JvSwingUtils.getLabelFont(
88 * Visual tab components
90 protected JCheckBox fullScreen = new JCheckBox();
92 protected JCheckBox openoverv = new JCheckBox();
94 protected JCheckBox seqLimit = new JCheckBox();
96 protected JCheckBox rightAlign = new JCheckBox();
98 protected JComboBox<String> fontSizeCB = new JComboBox<String>();
100 protected JComboBox<String> fontStyleCB = new JComboBox<String>();
102 protected JComboBox<String> fontNameCB = new JComboBox<String>();
104 protected JCheckBox 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(MessageManager
361 .getString("label.autocalculate_consensus"));
362 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
363 padGaps.setFont(LABEL_FONT);
364 padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
365 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
366 sortByTree.setFont(LABEL_FONT);
368 .setText(MessageManager.getString("label.sort_with_new_tree"));
370 .setToolTipText(MessageManager
371 .getString("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);
431 autoIdWidth.setText(MessageManager
432 .getString("label.automatically_set_id_width"));
433 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true,
435 .getString("label.adjusts_width_generated_eps_png")));
436 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
437 autoIdWidth.addActionListener(new ActionListener()
441 public void actionPerformed(ActionEvent e)
443 autoIdWidth_actionPerformed();
446 userIdWidthlabel.setFont(LABEL_FONT);
447 userIdWidthlabel.setText(MessageManager
448 .getString("label.figure_id_column_width"));
450 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
451 .getString("label.manually_specify_width_left_column")));
453 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
454 .getString("label.manually_specify_width_left_column")));
455 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
456 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
457 userIdWidth.setText("");
458 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
459 userIdWidth.addActionListener(new ActionListener()
463 public void actionPerformed(ActionEvent e)
465 userIdWidth_actionPerformed();
468 modellerOutput.setFont(LABEL_FONT);
469 modellerOutput.setText(MessageManager
470 .getString("label.use_modeller_output"));
471 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
472 embbedBioJSON.setFont(LABEL_FONT);
473 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
474 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
476 jPanel11.add(jLabel1);
478 jPanel11.add(clustaljv);
479 jPanel11.add(fastajv);
481 jPanel11.add(pfamjv);
482 jPanel11.add(pileupjv);
484 outputTab.add(autoIdWidth);
485 outputTab.add(userIdWidth);
486 outputTab.add(userIdWidthlabel);
487 outputTab.add(modellerOutput);
488 outputTab.add(embbedBioJSON);
489 outputTab.add(epsLabel);
490 outputTab.add(epsRendering);
491 outputTab.add(jPanel11);
496 * Initialises the Connections tabbed panel.
500 private JPanel initConnectionsTab()
502 JPanel connectTab = new JPanel();
503 connectTab.setLayout(new GridBagLayout());
505 // Label for browser text box
506 JLabel browserLabel = new JLabel();
507 browserLabel.setFont(LABEL_FONT);
508 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
509 browserLabel.setText(MessageManager
510 .getString("label.default_browser_unix"));
511 defaultBrowser.setFont(LABEL_FONT);
512 defaultBrowser.setText("");
514 defaultBrowser.addMouseListener(new MouseAdapter()
517 public void mouseClicked(MouseEvent e)
519 if (e.getClickCount() > 1)
521 defaultBrowser_mouseClicked(e);
526 JPanel proxyPanel = initConnTabProxyPanel();
527 initConnTabCheckboxes();
529 // Add default Browser text box
530 connectTab.add(browserLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,
531 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
532 new Insets(10, 0, 5, 5), 5, 1));
533 defaultBrowser.setFont(LABEL_FONT);
534 defaultBrowser.setText("");
536 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
537 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
538 new Insets(10, 0, 5, 10), 30, 1));
540 // Add proxy server panel
541 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
542 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
543 new Insets(10, 0, 5, 12), 4, 10));
545 // Add usage stats, version check and questionnaire checkboxes
546 connectTab.add(usagestats, 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, new GridBagConstraints(1, 2, 1, 1, 1.0,
550 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
551 new Insets(0, 2, 5, 10), 70, 1));
552 connectTab.add(versioncheck, new GridBagConstraints(0, 3, 1, 1, 1.0,
553 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
554 new Insets(0, 2, 5, 5), 70, 1));
556 // Add padding so the panel doesn't look ridiculous
557 JPanel spacePanel = new JPanel();
558 connectTab.add(spacePanel, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
559 GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0,
566 * Initialises the Links tabbed panel.
570 private JPanel initLinksTab()
572 JPanel linkTab = new JPanel();
573 linkTab.setLayout(new GridBagLayout());
575 // Set up table for Url links
576 linkUrlTable.setFillsViewportHeight(true);
577 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
578 linkUrlTable.setAutoCreateRowSorter(true);
579 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
581 // adjust row height so radio buttons actually fit
582 // don't do this in the renderer, it causes the awt thread to activate
584 JRadioButton temp = new JRadioButton();
585 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
587 // Table in scrollpane so that the table is given a scrollbar
588 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
589 linkScrollPane.setBorder(null);
591 // Panel for links functionality
592 JPanel linkPanel = new JPanel(new GridBagLayout());
593 linkPanel.setBorder(new TitledBorder(MessageManager
594 .getString("label.url_linkfrom_sequence_id")));
596 // Put the Url links panel together
598 // Buttons go at top right, resizing only resizes the blank space vertically
599 JPanel buttonPanel = initLinkTabUrlButtons();
600 GridBagConstraints linkConstraints1 = new GridBagConstraints();
601 linkConstraints1.insets = new Insets(0, 0, 5, 0);
602 linkConstraints1.gridx = 0;
603 linkConstraints1.gridy = 0;
604 linkConstraints1.weightx = 1.0;
605 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
606 linkTab.add(buttonPanel, linkConstraints1);
608 // Links table goes at top left, resizing resizes the table
609 GridBagConstraints linkConstraints2 = new GridBagConstraints();
610 linkConstraints2.insets = new Insets(0, 0, 5, 5);
611 linkConstraints2.gridx = 0;
612 linkConstraints2.gridy = 1;
613 linkConstraints2.weightx = 1.0;
614 linkConstraints2.weighty = 1.0;
615 linkConstraints2.fill = GridBagConstraints.BOTH;
616 linkTab.add(linkScrollPane, linkConstraints2);
618 // Filter box and buttons goes at bottom left, resizing resizes the text box
619 JPanel filterPanel = initLinkTabFilterPanel();
620 GridBagConstraints linkConstraints3 = new GridBagConstraints();
621 linkConstraints3.insets = new Insets(0, 0, 0, 5);
622 linkConstraints3.gridx = 0;
623 linkConstraints3.gridy = 2;
624 linkConstraints3.weightx = 1.0;
625 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
626 linkTab.add(filterPanel, linkConstraints3);
631 private JPanel initLinkTabFilterPanel()
633 // Filter textbox and reset button
634 JLabel filterLabel = new JLabel(
635 MessageManager.getString("label.filter"));
636 filterLabel.setFont(LABEL_FONT);
637 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
638 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
640 filterTB.setFont(LABEL_FONT);
641 filterTB.setText("");
643 doReset.setText(MessageManager.getString("action.showall"));
644 userOnly.setText(MessageManager.getString("action.customfilter"));
646 // Panel for filter functionality
647 JPanel filterPanel = new JPanel(new GridBagLayout());
648 filterPanel.setBorder(new TitledBorder("Filter"));
649 GridBagConstraints gbc = new GridBagConstraints();
652 gbc.fill = GridBagConstraints.NONE;
653 gbc.anchor = GridBagConstraints.WEST;
655 filterPanel.add(filterLabel, gbc);
657 GridBagConstraints gbc1 = new GridBagConstraints();
660 gbc1.fill = GridBagConstraints.HORIZONTAL;
661 gbc1.anchor = GridBagConstraints.WEST;
663 filterPanel.add(filterTB, gbc1);
665 GridBagConstraints gbc2 = new GridBagConstraints();
667 gbc2.fill = GridBagConstraints.NONE;
668 gbc2.anchor = GridBagConstraints.WEST;
669 filterPanel.add(doReset, gbc2);
671 GridBagConstraints gbc3 = new GridBagConstraints();
673 gbc3.fill = GridBagConstraints.NONE;
674 gbc3.anchor = GridBagConstraints.WEST;
675 filterPanel.add(userOnly, gbc3);
680 private JPanel initLinkTabUrlButtons()
682 // Buttons for new / edit / delete Url links
683 JButton newLink = new JButton();
684 newLink.setText(MessageManager.getString("action.new"));
686 editLink.setText(MessageManager.getString("action.edit"));
688 deleteLink.setText(MessageManager.getString("action.delete"));
690 // no current selection, so initially disable delete/edit buttons
691 editLink.setEnabled(false);
692 deleteLink.setEnabled(false);
694 newLink.addActionListener(new java.awt.event.ActionListener()
697 public void actionPerformed(ActionEvent e)
699 newLink_actionPerformed(e);
703 editLink.setText(MessageManager.getString("action.edit"));
704 editLink.addActionListener(new java.awt.event.ActionListener()
707 public void actionPerformed(ActionEvent e)
709 editLink_actionPerformed(e);
713 deleteLink.setText(MessageManager.getString("action.delete"));
714 deleteLink.addActionListener(new java.awt.event.ActionListener()
717 public void actionPerformed(ActionEvent e)
719 deleteLink_actionPerformed(e);
723 JPanel buttonPanel = new JPanel(new GridBagLayout());
724 buttonPanel.setBorder(new TitledBorder("Edit links"));
725 GridBagConstraints gbc = new GridBagConstraints();
728 gbc.fill = GridBagConstraints.NONE;
729 buttonPanel.add(newLink, gbc);
731 GridBagConstraints gbc1 = new GridBagConstraints();
734 gbc1.fill = GridBagConstraints.NONE;
735 buttonPanel.add(editLink, gbc1);
737 GridBagConstraints gbc2 = new GridBagConstraints();
740 gbc2.fill = GridBagConstraints.NONE;
741 buttonPanel.add(deleteLink, gbc2);
743 GridBagConstraints gbc3 = new GridBagConstraints();
746 gbc3.fill = GridBagConstraints.HORIZONTAL;
748 JPanel spacePanel = new JPanel();
749 spacePanel.setBorder(null);
750 buttonPanel.add(spacePanel, gbc3);
756 * Initialises the proxy server panel in the Connections tab
758 * @return the proxy server panel
760 private JPanel initConnTabProxyPanel()
762 // Label for server text box
763 serverLabel.setText(MessageManager.getString("label.address"));
764 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
765 serverLabel.setFont(LABEL_FONT);
767 // Proxy server and port text boxes
768 proxyServerTB.setFont(LABEL_FONT);
769 proxyPortTB.setFont(LABEL_FONT);
771 // Label for Port text box
772 portLabel.setFont(LABEL_FONT);
773 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
774 portLabel.setText(MessageManager.getString("label.port"));
776 // Use proxy server checkbox
777 useProxy.setFont(LABEL_FONT);
778 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
779 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
780 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
781 useProxy.addActionListener(new ActionListener()
784 public void actionPerformed(ActionEvent e)
786 useProxy_actionPerformed();
790 // Make proxy server panel
791 JPanel proxyPanel = new JPanel();
792 TitledBorder titledBorder1 = new TitledBorder(
793 MessageManager.getString("label.proxy_server"));
794 proxyPanel.setBorder(titledBorder1);
795 proxyPanel.setLayout(new GridBagLayout());
796 proxyPanel.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
797 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
798 new Insets(0, 2, 2, 0), 5, 0));
799 proxyPanel.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
800 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
802 proxyPanel.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
803 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
805 proxyPanel.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0,
806 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
807 new Insets(0, 2, 2, 2), 54, 1));
808 proxyPanel.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0,
809 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
810 new Insets(0, 2, 2, 0), 263, 1));
816 * Initialises the checkboxes in the Connections tab
818 private void initConnTabCheckboxes()
820 // Usage stats checkbox label
821 usagestats.setText(MessageManager
822 .getString("label.send_usage_statistics"));
823 usagestats.setFont(LABEL_FONT);
824 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
825 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
827 // Questionnaire checkbox label
828 questionnaire.setText(MessageManager
829 .getString("label.check_for_questionnaires"));
830 questionnaire.setFont(LABEL_FONT);
831 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
832 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
834 // Check for latest version checkbox label
835 versioncheck.setText(MessageManager
836 .getString("label.check_for_latest_version"));
837 versioncheck.setFont(LABEL_FONT);
838 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
839 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
843 * Initialises the parent panel which contains the tabbed sections.
847 private JPanel initOkCancelPanel()
849 JButton ok = new JButton();
850 ok.setText(MessageManager.getString("action.ok"));
851 ok.addActionListener(new ActionListener()
854 public void actionPerformed(ActionEvent e)
856 ok_actionPerformed(e);
859 JButton cancel = new JButton();
860 cancel.setText(MessageManager.getString("action.cancel"));
861 cancel.addActionListener(new ActionListener()
864 public void actionPerformed(ActionEvent e)
866 cancel_actionPerformed(e);
869 JPanel okCancelPanel = new JPanel();
870 okCancelPanel.add(ok);
871 okCancelPanel.add(cancel);
872 return okCancelPanel;
876 * Initialises the Colours tabbed panel.
880 private JPanel initColoursTab()
882 JPanel coloursTab = new JPanel();
883 coloursTab.setBorder(new TitledBorder(MessageManager
884 .getString("action.open_new_alignment")));
885 coloursTab.setLayout(new FlowLayout());
886 JLabel mincolourLabel = new JLabel();
887 mincolourLabel.setFont(LABEL_FONT);
888 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
889 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
890 minColour.setFont(LABEL_FONT);
891 minColour.setBorder(BorderFactory.createEtchedBorder());
892 minColour.setPreferredSize(new Dimension(40, 20));
893 minColour.addMouseListener(new MouseAdapter()
896 public void mousePressed(MouseEvent e)
898 minColour_actionPerformed(minColour);
901 JLabel maxcolourLabel = new JLabel();
902 maxcolourLabel.setFont(LABEL_FONT);
903 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
904 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
905 maxColour.setFont(LABEL_FONT);
906 maxColour.setBorder(BorderFactory.createEtchedBorder());
907 maxColour.setPreferredSize(new Dimension(40, 20));
908 maxColour.addMouseListener(new MouseAdapter()
911 public void mousePressed(MouseEvent e)
913 maxColour_actionPerformed(maxColour);
917 protColour.setFont(LABEL_FONT);
918 protColour.setBounds(new Rectangle(172, 225, 155, 21));
919 JLabel protColourLabel = new JLabel();
920 protColourLabel.setFont(LABEL_FONT);
921 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
922 protColourLabel.setText(MessageManager
923 .getString("label.prot_alignment_colour") + " ");
924 JvSwingUtils.addtoLayout(coloursTab, MessageManager
925 .getString("label.default_colour_scheme_for_alignment"),
926 protColourLabel, protColour);
928 nucColour.setFont(LABEL_FONT);
929 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
930 JLabel nucColourLabel = new JLabel();
931 nucColourLabel.setFont(LABEL_FONT);
932 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
933 nucColourLabel.setText(MessageManager
934 .getString("label.nuc_alignment_colour") + " ");
935 JvSwingUtils.addtoLayout(coloursTab, MessageManager
936 .getString("label.default_colour_scheme_for_alignment"),
937 nucColourLabel, nucColour);
939 JPanel annotationShding = new JPanel();
940 annotationShding.setBorder(new TitledBorder(MessageManager
941 .getString("label.annotation_shading_default")));
942 annotationShding.setLayout(new GridLayout(1, 2));
943 JvSwingUtils.addtoLayout(annotationShding, MessageManager
944 .getString("label.default_minimum_colour_annotation_shading"),
945 mincolourLabel, minColour);
946 JvSwingUtils.addtoLayout(annotationShding, MessageManager
947 .getString("label.default_maximum_colour_annotation_shading"),
948 maxcolourLabel, maxColour);
949 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
954 * Initialises the Structure tabbed panel.
958 private JPanel initStructureTab()
960 structureTab = new JPanel();
962 structureTab.setBorder(new TitledBorder(MessageManager
963 .getString("label.structure_options")));
964 structureTab.setLayout(null);
965 final int width = 400;
966 final int height = 22;
967 final int lineSpacing = 25;
970 structFromPdb.setFont(LABEL_FONT);
972 .setText(MessageManager.getString("label.struct_from_pdb"));
973 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
974 structFromPdb.addActionListener(new ActionListener()
977 public void actionPerformed(ActionEvent e)
979 boolean selected = structFromPdb.isSelected();
980 // enable other options only when the first is checked
981 useRnaView.setEnabled(selected);
982 addSecondaryStructure.setEnabled(selected);
983 addTempFactor.setEnabled(selected);
986 structureTab.add(structFromPdb);
988 // indent checkboxes that are conditional on the first one
990 useRnaView.setFont(LABEL_FONT);
991 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
992 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
993 structureTab.add(useRnaView);
996 addSecondaryStructure.setFont(LABEL_FONT);
997 addSecondaryStructure.setText(MessageManager
998 .getString("label.autoadd_secstr"));
999 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1000 structureTab.add(addSecondaryStructure);
1002 ypos += lineSpacing;
1003 addTempFactor.setFont(LABEL_FONT);
1004 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1005 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1006 structureTab.add(addTempFactor);
1008 ypos += lineSpacing;
1009 JLabel viewerLabel = new JLabel();
1010 viewerLabel.setFont(LABEL_FONT);
1011 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1012 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1013 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1014 structureTab.add(viewerLabel);
1016 structViewer.setFont(LABEL_FONT);
1017 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1018 structViewer.addItem(ViewerType.JMOL.name());
1019 structViewer.addItem(ViewerType.CHIMERA.name());
1020 structViewer.addActionListener(new ActionListener()
1023 public void actionPerformed(ActionEvent e)
1025 structureViewer_actionPerformed((String) structViewer
1026 .getSelectedItem());
1029 structureTab.add(structViewer);
1031 ypos += lineSpacing;
1032 JLabel pathLabel = new JLabel();
1033 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1034 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1035 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1036 final String tooltip = JvSwingUtils.wrapTooltip(true,
1037 MessageManager.getString("label.chimera_path_tip"));
1038 pathLabel.setToolTipText(tooltip);
1039 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1040 structureTab.add(pathLabel);
1042 chimeraPath.setFont(LABEL_FONT);
1043 chimeraPath.setText("");
1044 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1045 chimeraPath.addMouseListener(new MouseAdapter()
1048 public void mouseClicked(MouseEvent e)
1050 if (e.getClickCount() == 2)
1052 String chosen = openFileChooser();
1055 chimeraPath.setText(chosen);
1060 structureTab.add(chimeraPath);
1062 ypos += lineSpacing;
1063 nwMapping.setFont(LABEL_FONT);
1064 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1065 siftsMapping.setFont(LABEL_FONT);
1066 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1067 mappingMethod.add(nwMapping);
1068 mappingMethod.add(siftsMapping);
1069 JPanel mappingPanel = new JPanel();
1070 mappingPanel.setFont(LABEL_FONT);
1071 TitledBorder mmTitledBorder = new TitledBorder(
1072 MessageManager.getString("label.mapping_method"));
1073 mmTitledBorder.setTitleFont(LABEL_FONT);
1074 mappingPanel.setBorder(mmTitledBorder);
1075 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1076 // GridLayout mappingLayout = new GridLayout();
1077 mappingPanel.setLayout(new GridLayout());
1078 mappingPanel.add(nwMapping);
1079 mappingPanel.add(siftsMapping);
1080 structureTab.add(mappingPanel);
1082 ypos += lineSpacing;
1083 ypos += lineSpacing;
1084 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1085 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1086 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1087 structureTab.add(docFieldPref);
1089 return structureTab;
1093 * Action on choosing a structure viewer from combobox options.
1095 * @param selectedItem
1097 protected void structureViewer_actionPerformed(String selectedItem)
1102 * Show a dialog for the user to choose a file. Returns the chosen path, or
1107 protected String openFileChooser()
1109 String choice = null;
1110 JFileChooser chooser = new JFileChooser();
1112 // chooser.setFileView(new JalviewFileView());
1113 chooser.setDialogTitle(MessageManager
1114 .getString("label.open_local_file"));
1115 chooser.setToolTipText(MessageManager.getString("action.open"));
1117 int value = chooser.showOpenDialog(this);
1119 if (value == JFileChooser.APPROVE_OPTION)
1121 choice = chooser.getSelectedFile().getPath();
1127 * Validate the structure tab preferences; if invalid, set focus on this tab.
1131 protected boolean validateStructure(FocusEvent e)
1133 if (!validateStructure())
1135 e.getComponent().requestFocusInWindow();
1141 protected boolean validateStructure()
1147 * Initialises the Visual tabbed panel.
1151 private JPanel initVisualTab()
1153 JPanel visualTab = new JPanel();
1154 visualTab.setBorder(new TitledBorder(MessageManager
1155 .getString("action.open_new_alignment")));
1156 visualTab.setLayout(null);
1157 fullScreen.setFont(LABEL_FONT);
1158 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1159 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1160 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1161 quality.setEnabled(false);
1162 quality.setFont(LABEL_FONT);
1163 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1164 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1165 quality.setSelected(true);
1166 quality.setText(MessageManager.getString("label.quality"));
1167 conservation.setEnabled(false);
1168 conservation.setFont(LABEL_FONT);
1169 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1170 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1171 conservation.setSelected(true);
1172 conservation.setText(MessageManager.getString("label.conservation"));
1173 identity.setEnabled(false);
1174 identity.setFont(LABEL_FONT);
1175 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1176 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1177 identity.setSelected(true);
1178 identity.setText(MessageManager.getString("label.consensus"));
1179 showOccupancy.setFont(LABEL_FONT);
1180 showOccupancy.setEnabled(false);
1181 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1182 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1183 showOccupancy.setSelected(true);
1184 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1186 JLabel showGroupbits = new JLabel();
1187 showGroupbits.setFont(LABEL_FONT);
1188 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1189 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1190 showGroupbits.setText(MessageManager.getString("action.show_group")
1192 JLabel showConsensbits = new JLabel();
1193 showConsensbits.setFont(LABEL_FONT);
1194 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1195 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1196 showConsensbits.setText(MessageManager.getString("label.consensus")
1198 showConsensHistogram.setEnabled(false);
1199 showConsensHistogram.setFont(LABEL_FONT);
1200 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1201 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1202 showConsensHistogram.setSelected(true);
1203 showConsensHistogram.setText(MessageManager
1204 .getString("label.histogram"));
1205 showConsensLogo.setEnabled(false);
1206 showConsensLogo.setFont(LABEL_FONT);
1207 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1208 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1209 showConsensLogo.setSelected(true);
1210 showConsensLogo.setText(MessageManager.getString("label.logo"));
1211 showGroupConsensus.setEnabled(false);
1212 showGroupConsensus.setFont(LABEL_FONT);
1213 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1214 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1215 showGroupConsensus.setSelected(true);
1216 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1217 showGroupConservation.setEnabled(false);
1218 showGroupConservation.setFont(LABEL_FONT);
1219 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1220 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1221 showGroupConservation.setSelected(true);
1222 showGroupConservation.setText(MessageManager
1223 .getString("label.conservation"));
1224 showNpTooltip.setEnabled(true);
1225 showNpTooltip.setFont(LABEL_FONT);
1226 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1227 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1228 showNpTooltip.setSelected(true);
1229 showNpTooltip.setText(MessageManager
1230 .getString("label.non_positional_features"));
1231 showDbRefTooltip.setEnabled(true);
1232 showDbRefTooltip.setFont(LABEL_FONT);
1233 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1234 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1235 showDbRefTooltip.setSelected(true);
1236 showDbRefTooltip.setText(MessageManager
1237 .getString("label.database_references"));
1238 annotations.setFont(LABEL_FONT);
1239 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1240 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1241 annotations.setSelected(true);
1242 annotations.setText(MessageManager.getString("label.show_annotations"));
1243 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1244 annotations.addActionListener(new ActionListener()
1247 public void actionPerformed(ActionEvent e)
1249 annotations_actionPerformed(e);
1252 identity.addActionListener(new ActionListener()
1255 public void actionPerformed(ActionEvent e)
1257 annotations_actionPerformed(e);
1260 showGroupConsensus.addActionListener(new ActionListener()
1263 public void actionPerformed(ActionEvent e)
1265 annotations_actionPerformed(e);
1268 showUnconserved.setFont(LABEL_FONT);
1269 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1270 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1271 showUnconserved.setSelected(true);
1272 showUnconserved.setText(MessageManager
1273 .getString("action.show_unconserved"));
1274 showUnconserved.addActionListener(new ActionListener()
1277 public void actionPerformed(ActionEvent e)
1279 showunconserved_actionPerformed(e);
1283 // TODO these are not yet added to / action from Preferences
1284 // JCheckBox shareSelections = new JCheckBox();
1285 // shareSelections.setFont(verdana11);
1286 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1287 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1288 // shareSelections.setSelected(true);
1289 // shareSelections.setText(MessageManager
1290 // .getString("label.share_selection_across_views"));
1291 // JCheckBox followHighlight = new JCheckBox();
1292 // followHighlight.setFont(verdana11);
1293 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1294 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1295 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1296 // followHighlight.setSelected(true);
1297 // followHighlight.setText(MessageManager
1298 // .getString("label.scroll_highlighted_regions"));
1300 seqLimit.setFont(LABEL_FONT);
1301 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1302 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1303 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1304 smoothFont.setFont(LABEL_FONT);
1305 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1306 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1307 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1308 scaleProteinToCdna.setFont(LABEL_FONT);
1309 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1310 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1311 scaleProteinToCdna.setText(MessageManager
1312 .getString("label.scale_protein_to_cdna"));
1313 scaleProteinToCdna.setToolTipText(MessageManager
1314 .getString("label.scale_protein_to_cdna_tip"));
1315 JLabel gapLabel = new JLabel();
1316 gapLabel.setFont(LABEL_FONT);
1317 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1318 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1319 JLabel fontLabel = new JLabel();
1320 fontLabel.setFont(LABEL_FONT);
1321 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1322 fontLabel.setText(MessageManager.getString("label.font"));
1323 fontSizeCB.setFont(LABEL_FONT);
1324 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1325 fontStyleCB.setFont(LABEL_FONT);
1326 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1327 fontNameCB.setFont(LABEL_FONT);
1328 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1329 gapSymbolCB.setFont(LABEL_FONT);
1330 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1331 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1332 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1333 gapSymbolCB.setRenderer(dlcr);
1335 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1336 startupCheckbox.setFont(LABEL_FONT);
1337 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1338 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1339 startupCheckbox.setSelected(true);
1340 startupFileTextfield.setFont(LABEL_FONT);
1341 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1342 startupFileTextfield.addMouseListener(new MouseAdapter()
1345 public void mouseClicked(MouseEvent e)
1347 if (e.getClickCount() > 1)
1349 startupFileTextfield_mouseClicked();
1354 sortby.setFont(LABEL_FONT);
1355 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1356 JLabel sortLabel = new JLabel();
1357 sortLabel.setFont(LABEL_FONT);
1358 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1359 sortLabel.setText(MessageManager.getString("label.sort_by"));
1360 sortAnnBy.setFont(LABEL_FONT);
1361 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1362 JLabel sortAnnLabel = new JLabel();
1363 sortAnnLabel.setFont(LABEL_FONT);
1364 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1365 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1366 sortAutocalc.setFont(LABEL_FONT);
1367 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1369 JPanel annsettingsPanel = new JPanel();
1370 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1371 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1372 annsettingsPanel.setBorder(new EtchedBorder());
1373 visualTab.add(annsettingsPanel);
1374 Border jb = new EmptyBorder(1, 1, 4, 5);
1375 annotations.setBorder(jb);
1376 showOccupancy.setBorder(jb);
1377 quality.setBorder(jb);
1378 conservation.setBorder(jb);
1379 identity.setBorder(jb);
1380 showConsensbits.setBorder(jb);
1381 showGroupbits.setBorder(jb);
1382 showGroupConsensus.setBorder(jb);
1383 showGroupConservation.setBorder(jb);
1384 showConsensHistogram.setBorder(jb);
1385 showConsensLogo.setBorder(jb);
1387 JPanel autoAnnotSettings = new JPanel();
1388 annsettingsPanel.add(autoAnnotSettings);
1389 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1390 autoAnnotSettings.add(annotations);
1391 autoAnnotSettings.add(quality);
1392 // second row of autoannotation box
1393 autoAnnotSettings = new JPanel();
1394 annsettingsPanel.add(autoAnnotSettings);
1396 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1397 autoAnnotSettings.add(conservation);
1398 autoAnnotSettings.add(identity);
1399 autoAnnotSettings.add(showOccupancy);
1400 autoAnnotSettings.add(showGroupbits);
1401 autoAnnotSettings.add(showGroupConservation);
1402 autoAnnotSettings.add(showGroupConsensus);
1403 autoAnnotSettings.add(showConsensbits);
1404 autoAnnotSettings.add(showConsensHistogram);
1405 autoAnnotSettings.add(showConsensLogo);
1409 JPanel tooltipSettings = new JPanel();
1410 tooltipSettings.setBorder(new TitledBorder(MessageManager
1411 .getString("label.sequence_id_tooltip")));
1412 tooltipSettings.setBounds(173, 140, 220, 62);
1413 tooltipSettings.setLayout(new GridLayout(2, 1));
1414 tooltipSettings.add(showDbRefTooltip);
1415 tooltipSettings.add(showNpTooltip);
1416 visualTab.add(tooltipSettings);
1418 wrap.setFont(LABEL_FONT);
1419 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1420 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1421 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1422 rightAlign.setFont(LABEL_FONT);
1423 rightAlign.setForeground(Color.black);
1424 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1425 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1426 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1427 idItalics.setFont(LABEL_FONT_ITALIC);
1428 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1429 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1430 idItalics.setText(MessageManager
1431 .getString("label.sequence_name_italics"));
1432 openoverv.setFont(LABEL_FONT);
1433 openoverv.setActionCommand(MessageManager
1434 .getString("label.open_overview"));
1435 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1436 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1437 openoverv.setText(MessageManager.getString("label.open_overview"));
1438 JPanel jPanel2 = new JPanel();
1439 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1440 jPanel2.setLayout(new GridLayout(14, 1));
1441 jPanel2.add(fullScreen);
1442 jPanel2.add(openoverv);
1443 jPanel2.add(seqLimit);
1444 jPanel2.add(rightAlign);
1445 jPanel2.add(fontLabel);
1446 jPanel2.add(showUnconserved);
1447 jPanel2.add(idItalics);
1448 jPanel2.add(smoothFont);
1449 jPanel2.add(scaleProteinToCdna);
1450 jPanel2.add(gapLabel);
1452 jPanel2.add(sortLabel);
1453 jPanel2.add(sortAnnLabel);
1454 jPanel2.add(startupCheckbox);
1455 visualTab.add(jPanel2);
1456 visualTab.add(startupFileTextfield);
1457 visualTab.add(sortby);
1458 visualTab.add(sortAnnBy);
1459 visualTab.add(sortAutocalc);
1460 visualTab.add(gapSymbolCB);
1461 visualTab.add(fontNameCB);
1462 visualTab.add(fontSizeCB);
1463 visualTab.add(fontStyleCB);
1467 protected void autoIdWidth_actionPerformed()
1469 // TODO Auto-generated method stub
1473 protected void userIdWidth_actionPerformed()
1475 // TODO Auto-generated method stub
1479 protected void maxColour_actionPerformed(JPanel panel)
1483 protected void minColour_actionPerformed(JPanel panel)
1487 protected void showunconserved_actionPerformed(ActionEvent e)
1489 // TODO Auto-generated method stub
1499 public void ok_actionPerformed(ActionEvent e)
1509 public void cancel_actionPerformed(ActionEvent e)
1519 public void annotations_actionPerformed(ActionEvent e)
1526 public void startupFileTextfield_mouseClicked()
1530 public void newLink_actionPerformed(ActionEvent e)
1535 public void editLink_actionPerformed(ActionEvent e)
1540 public void deleteLink_actionPerformed(ActionEvent e)
1545 public void defaultBrowser_mouseClicked(MouseEvent e)
1550 public void linkURLList_keyTyped(KeyEvent e)
1555 public void useProxy_actionPerformed()
1557 boolean enabled = useProxy.isSelected();
1558 portLabel.setEnabled(enabled);
1559 serverLabel.setEnabled(enabled);
1560 proxyServerTB.setEnabled(enabled);
1561 proxyPortTB.setEnabled(enabled);
1565 * Customer renderer for JTable: supports column of radio buttons
1567 public class RadioButtonRenderer extends JRadioButton implements
1570 public RadioButtonRenderer()
1572 setHorizontalAlignment(CENTER);
1573 setToolTipText(MessageManager.getString("label.urltooltip"));
1577 public Component getTableCellRendererComponent(JTable table,
1578 Object value, boolean isSelected, boolean hasFocus, int row,
1581 setSelected((boolean) value);
1583 // set colours to match rest of table
1586 setBackground(table.getSelectionBackground());
1587 setForeground(table.getSelectionForeground());
1591 setBackground(table.getBackground());
1592 setForeground(table.getForeground());
1599 * Customer cell editor for JTable: supports column of radio buttons in
1600 * conjunction with renderer
1602 public class RadioButtonEditor extends AbstractCellEditor implements
1605 private JRadioButton button = new JRadioButton();
1607 public RadioButtonEditor()
1609 button.setHorizontalAlignment(SwingConstants.CENTER);
1610 this.button.addActionListener(new ActionListener()
1613 public void actionPerformed(ActionEvent e)
1615 fireEditingStopped();
1621 public Component getTableCellEditorComponent(JTable table,
1622 Object value, boolean isSelected, int row, int column)
1624 button.setSelected((boolean) value);
1629 public Object getCellEditorValue()
1631 return button.isSelected();