2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.fts.core.FTSDataColumnPreferences;
24 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
25 import jalview.fts.service.pdb.PDBFTSRestClient;
26 import jalview.gui.JvSwingUtils;
27 import jalview.gui.StructureViewer.ViewerType;
28 import jalview.util.MessageManager;
30 import java.awt.BorderLayout;
31 import java.awt.Color;
32 import java.awt.Component;
33 import java.awt.Dimension;
34 import java.awt.FlowLayout;
36 import java.awt.GridBagConstraints;
37 import java.awt.GridBagLayout;
38 import java.awt.GridLayout;
39 import java.awt.Insets;
40 import java.awt.Rectangle;
41 import java.awt.event.ActionEvent;
42 import java.awt.event.ActionListener;
43 import java.awt.event.FocusEvent;
44 import java.awt.event.KeyEvent;
45 import java.awt.event.MouseAdapter;
46 import java.awt.event.MouseEvent;
48 import javax.swing.AbstractCellEditor;
49 import javax.swing.BorderFactory;
50 import javax.swing.ButtonGroup;
51 import javax.swing.DefaultListCellRenderer;
52 import javax.swing.JButton;
53 import javax.swing.JCheckBox;
54 import javax.swing.JComboBox;
55 import javax.swing.JFileChooser;
56 import javax.swing.JLabel;
57 import javax.swing.JPanel;
58 import javax.swing.JRadioButton;
59 import javax.swing.JScrollPane;
60 import javax.swing.JTabbedPane;
61 import javax.swing.JTable;
62 import javax.swing.JTextField;
63 import javax.swing.ListSelectionModel;
64 import javax.swing.SwingConstants;
65 import javax.swing.border.Border;
66 import javax.swing.border.EmptyBorder;
67 import javax.swing.border.EtchedBorder;
68 import javax.swing.border.TitledBorder;
69 import javax.swing.event.ChangeEvent;
70 import javax.swing.event.ChangeListener;
71 import javax.swing.table.TableCellEditor;
72 import javax.swing.table.TableCellRenderer;
75 * Base class for the Preferences panel.
80 public class GPreferences extends JPanel
82 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
84 private static final Font LABEL_FONT_ITALIC = JvSwingUtils.getLabelFont(
88 * Visual tab components
90 protected JCheckBox fullScreen = new JCheckBox();
92 protected JCheckBox openoverv = new JCheckBox();
94 protected JCheckBox seqLimit = new JCheckBox();
96 protected JCheckBox rightAlign = new JCheckBox();
98 protected JComboBox<String> fontSizeCB = new JComboBox<String>();
100 protected JComboBox<String> fontStyleCB = new JComboBox<String>();
102 protected JComboBox<String> fontNameCB = new JComboBox<String>();
104 protected JCheckBox showUnconserved = new JCheckBox();
106 protected JCheckBox idItalics = new JCheckBox();
108 protected JCheckBox smoothFont = new JCheckBox();
110 protected JCheckBox scaleProteinToCdna = new JCheckBox();
112 protected JComboBox<String> gapSymbolCB = new JComboBox<String>();
114 protected JCheckBox wrap = new JCheckBox();
116 protected JComboBox<String> sortby = new JComboBox<String>();
118 protected JComboBox<String> sortAnnBy = new JComboBox<String>();
120 protected JComboBox<String> sortAutocalc = new JComboBox<String>();
122 protected JCheckBox startupCheckbox = new JCheckBox();
124 protected JTextField startupFileTextfield = new JTextField();
126 // below are in the 'second column'
127 protected JCheckBox annotations = new JCheckBox();
129 protected JCheckBox quality = new JCheckBox();
131 protected JCheckBox conservation = new JCheckBox();
133 protected JCheckBox identity = new JCheckBox();
135 protected JCheckBox showGroupConsensus = new JCheckBox();
137 protected JCheckBox showGroupConservation = new JCheckBox();
139 protected JCheckBox showConsensHistogram = new JCheckBox();
141 protected JCheckBox showConsensLogo = new JCheckBox();
143 protected JCheckBox showDbRefTooltip = new JCheckBox();
145 protected JCheckBox showNpTooltip = new JCheckBox();
148 * Structure tab and components
150 protected JPanel structureTab;
152 protected JCheckBox structFromPdb = new JCheckBox();
154 protected JCheckBox useRnaView = new JCheckBox();
156 protected JCheckBox addSecondaryStructure = new JCheckBox();
158 protected JCheckBox addTempFactor = new JCheckBox();
160 protected JComboBox<String> structViewer = new JComboBox<String>();
162 protected JTextField chimeraPath = new JTextField();
164 protected ButtonGroup mappingMethod = new ButtonGroup();
166 protected JRadioButton siftsMapping = new JRadioButton();
168 protected JRadioButton nwMapping = new JRadioButton();
171 * Colours tab components
173 protected JPanel minColour = new JPanel();
175 protected JPanel maxColour = new JPanel();
177 protected JComboBox<String> protColour = new JComboBox<String>();
179 protected JComboBox<String> nucColour = new JComboBox<String>();
182 * Connections tab components
184 protected JTable linkUrlTable = new JTable();
186 protected JButton editLink = new JButton();
188 protected JButton deleteLink = new JButton();
190 protected JTextField filterTB = new JTextField();
192 protected JButton doReset = new JButton();
194 protected JButton userOnly = new JButton();
196 protected JLabel portLabel = new JLabel();
198 protected JLabel serverLabel = new JLabel();
200 protected JTextField proxyServerTB = new JTextField();
202 protected JTextField proxyPortTB = new JTextField();
204 protected JTextField defaultBrowser = new JTextField();
206 protected JCheckBox useProxy = new JCheckBox();
208 protected JCheckBox usagestats = new JCheckBox();
210 protected JCheckBox questionnaire = new JCheckBox();
212 protected JCheckBox versioncheck = new JCheckBox();
215 * Output tab components
217 protected JComboBox<Object> epsRendering = new JComboBox<Object>();
219 protected JLabel userIdWidthlabel = new JLabel();
221 protected JCheckBox autoIdWidth = new JCheckBox();
223 protected JTextField userIdWidth = new JTextField();
225 protected JCheckBox blcjv = new JCheckBox();
227 protected JCheckBox pileupjv = new JCheckBox();
229 protected JCheckBox clustaljv = new JCheckBox();
231 protected JCheckBox msfjv = new JCheckBox();
233 protected JCheckBox fastajv = new JCheckBox();
235 protected JCheckBox pfamjv = new JCheckBox();
237 protected JCheckBox pirjv = new JCheckBox();
239 protected JCheckBox modellerOutput = new JCheckBox();
241 protected JCheckBox embbedBioJSON = new JCheckBox();
244 * Editing tab components
246 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
248 protected JCheckBox padGaps = new JCheckBox();
250 protected JCheckBox sortByTree = new JCheckBox();
255 protected JPanel dasTab = new JPanel();
260 protected JPanel wsTab = new JPanel();
263 * Creates a new GPreferences object.
265 public GPreferences()
270 } catch (Exception ex)
272 ex.printStackTrace();
277 * Construct the panel and its tabbed sub-panels.
281 private void jbInit() throws Exception
283 final JTabbedPane tabbedPane = new JTabbedPane();
284 this.setLayout(new BorderLayout());
285 JPanel okCancelPanel = initOkCancelPanel();
286 this.add(tabbedPane, BorderLayout.CENTER);
287 this.add(okCancelPanel, BorderLayout.SOUTH);
289 tabbedPane.add(initVisualTab(),
290 MessageManager.getString("label.visual"));
292 tabbedPane.add(initColoursTab(),
293 MessageManager.getString("label.colours"));
295 tabbedPane.add(initStructureTab(),
296 MessageManager.getString("label.structure"));
298 tabbedPane.add(initConnectionsTab(),
299 MessageManager.getString("label.connections"));
301 tabbedPane.add(initOutputTab(),
302 MessageManager.getString("label.output"));
304 tabbedPane.add(initEditingTab(),
305 MessageManager.getString("label.editing"));
308 * See DasSourceBrowser for the real work of configuring this tab.
310 dasTab.setLayout(new BorderLayout());
311 tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
314 * See WsPreferences for the real work of configuring this tab.
316 wsTab.setLayout(new BorderLayout());
317 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
320 * Handler to validate a tab before leaving it - currently only for
323 tabbedPane.addChangeListener(new ChangeListener()
325 private Component lastTab;
328 public void stateChanged(ChangeEvent e)
330 if (lastTab == structureTab
331 && tabbedPane.getSelectedComponent() != structureTab)
333 if (!validateStructure())
335 tabbedPane.setSelectedComponent(structureTab);
339 lastTab = tabbedPane.getSelectedComponent();
346 * Initialises the Editing tabbed panel.
350 private JPanel initEditingTab()
352 JPanel editingTab = new JPanel();
353 editingTab.setLayout(null);
354 autoCalculateConsCheck.setFont(LABEL_FONT);
355 autoCalculateConsCheck.setText(MessageManager
356 .getString("label.autocalculate_consensus"));
357 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
358 padGaps.setFont(LABEL_FONT);
359 padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
360 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
361 sortByTree.setFont(LABEL_FONT);
363 .setText(MessageManager.getString("label.sort_with_new_tree"));
365 .setToolTipText(MessageManager
366 .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
367 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
368 editingTab.add(autoCalculateConsCheck);
369 editingTab.add(padGaps);
370 editingTab.add(sortByTree);
375 * Initialises the Output tabbed panel.
379 private JPanel initOutputTab()
381 JPanel outputTab = new JPanel();
382 outputTab.setLayout(null);
383 JLabel epsLabel = new JLabel();
384 epsLabel.setFont(LABEL_FONT);
385 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
386 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
387 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
388 epsRendering.setFont(LABEL_FONT);
389 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
390 JLabel jLabel1 = new JLabel();
391 jLabel1.setFont(LABEL_FONT);
392 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
393 jLabel1.setText(MessageManager.getString("label.append_start_end"));
394 jLabel1.setFont(LABEL_FONT);
395 fastajv.setFont(LABEL_FONT);
396 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
397 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
398 blcjv.setText(MessageManager.getString("label.blc") + " ");
399 fastajv.setText(MessageManager.getString("label.fasta") + " ");
400 msfjv.setText(MessageManager.getString("label.msf") + " ");
401 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
402 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
403 msfjv.setFont(LABEL_FONT);
404 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
405 pirjv.setText(MessageManager.getString("label.pir") + " ");
406 JPanel jPanel11 = new JPanel();
407 jPanel11.setFont(LABEL_FONT);
408 TitledBorder titledBorder2 = new TitledBorder(
409 MessageManager.getString("label.file_output"));
410 jPanel11.setBorder(titledBorder2);
411 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
412 GridLayout gridLayout3 = new GridLayout();
413 jPanel11.setLayout(gridLayout3);
414 gridLayout3.setRows(8);
415 blcjv.setFont(LABEL_FONT);
416 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
417 clustaljv.setFont(LABEL_FONT);
418 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
419 pfamjv.setFont(LABEL_FONT);
420 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
421 pileupjv.setFont(LABEL_FONT);
422 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
423 pirjv.setFont(LABEL_FONT);
424 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
425 autoIdWidth.setFont(LABEL_FONT);
426 autoIdWidth.setText(MessageManager
427 .getString("label.automatically_set_id_width"));
428 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true,
430 .getString("label.adjusts_width_generated_eps_png")));
431 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
432 autoIdWidth.addActionListener(new ActionListener()
436 public void actionPerformed(ActionEvent e)
438 autoIdWidth_actionPerformed();
441 userIdWidthlabel.setFont(LABEL_FONT);
442 userIdWidthlabel.setText(MessageManager
443 .getString("label.figure_id_column_width"));
445 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
446 .getString("label.manually_specify_width_left_column")));
448 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
449 .getString("label.manually_specify_width_left_column")));
450 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
451 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
452 userIdWidth.setText("");
453 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
454 userIdWidth.addActionListener(new ActionListener()
458 public void actionPerformed(ActionEvent e)
460 userIdWidth_actionPerformed();
463 modellerOutput.setFont(LABEL_FONT);
464 modellerOutput.setText(MessageManager
465 .getString("label.use_modeller_output"));
466 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
467 embbedBioJSON.setFont(LABEL_FONT);
468 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
469 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
471 jPanel11.add(jLabel1);
473 jPanel11.add(clustaljv);
474 jPanel11.add(fastajv);
476 jPanel11.add(pfamjv);
477 jPanel11.add(pileupjv);
479 outputTab.add(autoIdWidth);
480 outputTab.add(userIdWidth);
481 outputTab.add(userIdWidthlabel);
482 outputTab.add(modellerOutput);
483 outputTab.add(embbedBioJSON);
484 outputTab.add(epsLabel);
485 outputTab.add(epsRendering);
486 outputTab.add(jPanel11);
491 * Initialises the Connections tabbed panel.
495 private JPanel initConnectionsTab()
497 JPanel connectTab = new JPanel();
498 connectTab.setLayout(new GridBagLayout());
500 // Label for browser text box
501 JLabel browserLabel = new JLabel();
502 browserLabel.setFont(LABEL_FONT);
503 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
504 browserLabel.setText(MessageManager
505 .getString("label.default_browser_unix"));
506 defaultBrowser.setFont(LABEL_FONT);
507 defaultBrowser.setText("");
509 defaultBrowser.addMouseListener(new MouseAdapter()
512 public void mouseClicked(MouseEvent e)
514 if (e.getClickCount() > 1)
516 defaultBrowser_mouseClicked(e);
521 JPanel proxyPanel = initConnTabProxyPanel();
522 JPanel linkPanel = initConnTabUrlLinks();
523 initConnTabCheckboxes();
525 // Add URL link panel
526 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 2.0, 2.0,
527 GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(
528 16, 0, 0, 12), 359, 32));
530 // Add default Browser text box
531 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
532 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
533 new Insets(10, 0, 0, 0), 5, 1));
535 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
536 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
537 new Insets(10, 0, 0, 10), 307, 1));
539 // Add proxy server panel
540 connectTab.add(proxyPanel, new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0,
541 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
542 new Insets(10, 0, 0, 12), 4, 10));
544 // Add usage stats, version check and questionnaire checkboxes
545 connectTab.add(usagestats, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
546 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
547 new Insets(0, 2, 4, 2), 70, 1));
548 connectTab.add(questionnaire, new GridBagConstraints(1, 3, 1, 1, 1.0,
549 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
550 new Insets(0, 2, 4, 10), 70, 1));
551 connectTab.add(versioncheck, new GridBagConstraints(0, 4, 1, 1, 1.0,
552 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
553 new Insets(0, 2, 4, 2), 70, 1));
558 * Initialises the proxy server panel in the Connections tab
560 * @return the proxy server panel
562 private JPanel initConnTabProxyPanel()
564 // Label for server text box
565 serverLabel.setText(MessageManager.getString("label.address"));
566 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
567 serverLabel.setFont(LABEL_FONT);
569 // Proxy server and port text boxes
570 proxyServerTB.setFont(LABEL_FONT);
571 proxyPortTB.setFont(LABEL_FONT);
573 // Label for Port text box
574 portLabel.setFont(LABEL_FONT);
575 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
576 portLabel.setText(MessageManager.getString("label.port"));
578 // Use proxy server checkbox
579 useProxy.setFont(LABEL_FONT);
580 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
581 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
582 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
583 useProxy.addActionListener(new ActionListener()
586 public void actionPerformed(ActionEvent e)
588 useProxy_actionPerformed();
592 // Make proxy server panel
593 JPanel proxyPanel = new JPanel();
594 TitledBorder titledBorder1 = new TitledBorder(
595 MessageManager.getString("label.proxy_server"));
596 proxyPanel.setBorder(titledBorder1);
597 proxyPanel.setLayout(new GridBagLayout());
598 proxyPanel.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
599 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
600 new Insets(0, 2, 2, 0), 5, 0));
601 proxyPanel.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
602 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
604 proxyPanel.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
605 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
607 proxyPanel.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0,
608 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
609 new Insets(0, 2, 2, 2), 54, 1));
610 proxyPanel.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0,
611 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
612 new Insets(0, 2, 2, 0), 263, 1));
618 * Initialises the checkboxes in the Connections tab
620 private void initConnTabCheckboxes()
622 // Usage stats checkbox label
623 usagestats.setText(MessageManager
624 .getString("label.send_usage_statistics"));
625 usagestats.setFont(LABEL_FONT);
626 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
627 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
629 // Questionnaire checkbox label
630 questionnaire.setText(MessageManager
631 .getString("label.check_for_questionnaires"));
632 questionnaire.setFont(LABEL_FONT);
633 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
634 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
636 // Check for latest version checkbox label
637 versioncheck.setText(MessageManager
638 .getString("label.check_for_latest_version"));
639 versioncheck.setFont(LABEL_FONT);
640 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
641 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
645 * Initialises the URL links panel in the Connection tab
647 * @return the URL links panel
649 private JPanel initConnTabUrlLinks()
651 // Set up table for Url links
652 linkUrlTable.setFillsViewportHeight(true);
653 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
654 linkUrlTable.setAutoCreateRowSorter(true);
655 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
657 // Table in scrollpane so that the table is given a scrollbar
658 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
659 linkScrollPane.setBorder(null);
661 // Panel for links functionality
662 JPanel linkPanel = new JPanel(new GridBagLayout());
663 linkPanel.setBorder(new TitledBorder(MessageManager
664 .getString("label.url_linkfrom_sequence_id")));
666 // Put the Url links panel together
668 // Buttons go at top right, resizing only resizes the blank space vertically
669 JPanel buttonPanel = initConnTabUrlButtons();
670 GridBagConstraints linkConstraints1 = new GridBagConstraints();
671 linkConstraints1.gridx = 1;
672 linkConstraints1.gridy = 0;
673 linkConstraints1.fill = GridBagConstraints.VERTICAL;
674 linkPanel.add(buttonPanel, linkConstraints1);
676 // Links table goes at top left, resizing resizes the table
677 GridBagConstraints linkConstraints2 = new GridBagConstraints();
678 linkConstraints2.gridx = 0;
679 linkConstraints2.gridy = 0;
680 linkConstraints2.weightx = 1.0;
681 linkConstraints2.weighty = 1.0;
682 linkConstraints2.fill = GridBagConstraints.BOTH;
683 linkPanel.add(linkScrollPane, linkConstraints2);
685 // Filter box and buttons goes at bottom left, resizing resizes the text box
686 JPanel filterPanel = initConnTabFilterPanel();
687 GridBagConstraints linkConstraints3 = new GridBagConstraints();
688 linkConstraints3.gridx = 0;
689 linkConstraints3.gridy = 1;
690 linkConstraints3.weightx = 1.0;
691 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
692 linkPanel.add(filterPanel, linkConstraints3);
697 private JPanel initConnTabFilterPanel()
699 // Filter textbox and reset button
700 JLabel filterLabel = new JLabel(
701 MessageManager.getString("label.filter"));
702 filterLabel.setFont(LABEL_FONT);
703 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
704 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
706 filterTB.setFont(LABEL_FONT);
707 filterTB.setText("");
709 doReset.setText(MessageManager.getString("action.reset"));
710 userOnly.setText(MessageManager.getString("action.customfilter"));
712 // Panel for filter functionality
713 JPanel filterPanel = new JPanel(new GridBagLayout());
714 GridBagConstraints gbc = new GridBagConstraints();
717 gbc.fill = GridBagConstraints.NONE;
718 gbc.anchor = GridBagConstraints.WEST;
720 filterPanel.add(filterLabel, gbc);
722 GridBagConstraints gbc1 = new GridBagConstraints();
725 gbc1.fill = GridBagConstraints.HORIZONTAL;
726 gbc1.anchor = GridBagConstraints.WEST;
728 filterPanel.add(filterTB, gbc1);
730 GridBagConstraints gbc2 = new GridBagConstraints();
732 gbc2.fill = GridBagConstraints.NONE;
733 gbc2.anchor = GridBagConstraints.WEST;
734 filterPanel.add(doReset, gbc2);
736 GridBagConstraints gbc3 = new GridBagConstraints();
738 gbc3.fill = GridBagConstraints.NONE;
739 gbc3.anchor = GridBagConstraints.WEST;
740 filterPanel.add(userOnly, gbc3);
745 private JPanel initConnTabUrlButtons()
747 // Buttons for new / edit / delete Url links
748 JButton newLink = new JButton();
749 newLink.setText(MessageManager.getString("action.new"));
750 newLink.addActionListener(new java.awt.event.ActionListener()
753 public void actionPerformed(ActionEvent e)
755 newLink_actionPerformed(e);
759 editLink.setText(MessageManager.getString("action.edit"));
760 editLink.addActionListener(new java.awt.event.ActionListener()
763 public void actionPerformed(ActionEvent e)
765 editLink_actionPerformed(e);
769 deleteLink.setText(MessageManager.getString("action.delete"));
770 deleteLink.addActionListener(new java.awt.event.ActionListener()
773 public void actionPerformed(ActionEvent e)
775 deleteLink_actionPerformed(e);
779 // no current selection, so initially disable delete/edit buttons
780 editLink.setEnabled(false);
781 deleteLink.setEnabled(false);
783 // Panels for new/edit/delete link buttons
784 // buttonContent prevents the buttons from being resized when the window is
785 JPanel buttonContent = new JPanel(new GridLayout(0, 1, 0, 0));
786 JPanel buttonPanel = new JPanel(new BorderLayout());
788 buttonContent.add(newLink, null);
789 buttonContent.add(editLink, null);
790 buttonContent.add(deleteLink, null);
791 buttonPanel.add(buttonContent, BorderLayout.NORTH);
797 * Initialises the parent panel which contains the tabbed sections.
801 private JPanel initOkCancelPanel()
803 JButton ok = new JButton();
804 ok.setText(MessageManager.getString("action.ok"));
805 ok.addActionListener(new ActionListener()
808 public void actionPerformed(ActionEvent e)
810 ok_actionPerformed(e);
813 JButton cancel = new JButton();
814 cancel.setText(MessageManager.getString("action.cancel"));
815 cancel.addActionListener(new ActionListener()
818 public void actionPerformed(ActionEvent e)
820 cancel_actionPerformed(e);
823 JPanel okCancelPanel = new JPanel();
824 okCancelPanel.add(ok);
825 okCancelPanel.add(cancel);
826 return okCancelPanel;
830 * Initialises the Colours tabbed panel.
834 private JPanel initColoursTab()
836 JPanel coloursTab = new JPanel();
837 coloursTab.setBorder(new TitledBorder(MessageManager
838 .getString("action.open_new_alignment")));
839 coloursTab.setLayout(new FlowLayout());
840 JLabel mincolourLabel = new JLabel();
841 mincolourLabel.setFont(LABEL_FONT);
842 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
843 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
844 minColour.setFont(LABEL_FONT);
845 minColour.setBorder(BorderFactory.createEtchedBorder());
846 minColour.setPreferredSize(new Dimension(40, 20));
847 minColour.addMouseListener(new MouseAdapter()
850 public void mousePressed(MouseEvent e)
852 minColour_actionPerformed(minColour);
855 JLabel maxcolourLabel = new JLabel();
856 maxcolourLabel.setFont(LABEL_FONT);
857 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
858 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
859 maxColour.setFont(LABEL_FONT);
860 maxColour.setBorder(BorderFactory.createEtchedBorder());
861 maxColour.setPreferredSize(new Dimension(40, 20));
862 maxColour.addMouseListener(new MouseAdapter()
865 public void mousePressed(MouseEvent e)
867 maxColour_actionPerformed(maxColour);
871 protColour.setFont(LABEL_FONT);
872 protColour.setBounds(new Rectangle(172, 225, 155, 21));
873 JLabel protColourLabel = new JLabel();
874 protColourLabel.setFont(LABEL_FONT);
875 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
876 protColourLabel.setText(MessageManager
877 .getString("label.prot_alignment_colour") + " ");
878 JvSwingUtils.addtoLayout(coloursTab, MessageManager
879 .getString("label.default_colour_scheme_for_alignment"),
880 protColourLabel, protColour);
882 nucColour.setFont(LABEL_FONT);
883 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
884 JLabel nucColourLabel = new JLabel();
885 nucColourLabel.setFont(LABEL_FONT);
886 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
887 nucColourLabel.setText(MessageManager
888 .getString("label.nuc_alignment_colour") + " ");
889 JvSwingUtils.addtoLayout(coloursTab, MessageManager
890 .getString("label.default_colour_scheme_for_alignment"),
891 nucColourLabel, nucColour);
893 JPanel annotationShding = new JPanel();
894 annotationShding.setBorder(new TitledBorder(MessageManager
895 .getString("label.annotation_shading_default")));
896 annotationShding.setLayout(new GridLayout(1, 2));
897 JvSwingUtils.addtoLayout(annotationShding, MessageManager
898 .getString("label.default_minimum_colour_annotation_shading"),
899 mincolourLabel, minColour);
900 JvSwingUtils.addtoLayout(annotationShding, MessageManager
901 .getString("label.default_maximum_colour_annotation_shading"),
902 maxcolourLabel, maxColour);
903 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
908 * Initialises the Structure tabbed panel.
912 private JPanel initStructureTab()
914 structureTab = new JPanel();
916 structureTab.setBorder(new TitledBorder(MessageManager
917 .getString("label.structure_options")));
918 structureTab.setLayout(null);
919 final int width = 400;
920 final int height = 22;
921 final int lineSpacing = 25;
924 structFromPdb.setFont(LABEL_FONT);
926 .setText(MessageManager.getString("label.struct_from_pdb"));
927 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
928 structFromPdb.addActionListener(new ActionListener()
931 public void actionPerformed(ActionEvent e)
933 boolean selected = structFromPdb.isSelected();
934 // enable other options only when the first is checked
935 useRnaView.setEnabled(selected);
936 addSecondaryStructure.setEnabled(selected);
937 addTempFactor.setEnabled(selected);
940 structureTab.add(structFromPdb);
942 // indent checkboxes that are conditional on the first one
944 useRnaView.setFont(LABEL_FONT);
945 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
946 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
947 structureTab.add(useRnaView);
950 addSecondaryStructure.setFont(LABEL_FONT);
951 addSecondaryStructure.setText(MessageManager
952 .getString("label.autoadd_secstr"));
953 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
954 structureTab.add(addSecondaryStructure);
957 addTempFactor.setFont(LABEL_FONT);
958 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
959 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
960 structureTab.add(addTempFactor);
963 JLabel viewerLabel = new JLabel();
964 viewerLabel.setFont(LABEL_FONT);
965 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
966 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
967 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
968 structureTab.add(viewerLabel);
970 structViewer.setFont(LABEL_FONT);
971 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
972 structViewer.addItem(ViewerType.JMOL.name());
973 structViewer.addItem(ViewerType.CHIMERA.name());
974 structViewer.addActionListener(new ActionListener()
977 public void actionPerformed(ActionEvent e)
979 structureViewer_actionPerformed((String) structViewer
983 structureTab.add(structViewer);
986 JLabel pathLabel = new JLabel();
987 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
988 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
989 pathLabel.setText(MessageManager.getString("label.chimera_path"));
990 final String tooltip = JvSwingUtils.wrapTooltip(true,
991 MessageManager.getString("label.chimera_path_tip"));
992 pathLabel.setToolTipText(tooltip);
993 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
994 structureTab.add(pathLabel);
996 chimeraPath.setFont(LABEL_FONT);
997 chimeraPath.setText("");
998 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
999 chimeraPath.addMouseListener(new MouseAdapter()
1002 public void mouseClicked(MouseEvent e)
1004 if (e.getClickCount() == 2)
1006 String chosen = openFileChooser();
1009 chimeraPath.setText(chosen);
1014 structureTab.add(chimeraPath);
1016 ypos += lineSpacing;
1017 nwMapping.setFont(LABEL_FONT);
1018 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1019 siftsMapping.setFont(LABEL_FONT);
1020 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1021 mappingMethod.add(nwMapping);
1022 mappingMethod.add(siftsMapping);
1023 JPanel mappingPanel = new JPanel();
1024 mappingPanel.setFont(LABEL_FONT);
1025 TitledBorder mmTitledBorder = new TitledBorder(
1026 MessageManager.getString("label.mapping_method"));
1027 mmTitledBorder.setTitleFont(LABEL_FONT);
1028 mappingPanel.setBorder(mmTitledBorder);
1029 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1030 // GridLayout mappingLayout = new GridLayout();
1031 mappingPanel.setLayout(new GridLayout());
1032 mappingPanel.add(nwMapping);
1033 mappingPanel.add(siftsMapping);
1034 structureTab.add(mappingPanel);
1036 ypos += lineSpacing;
1037 ypos += lineSpacing;
1038 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1039 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1040 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1041 structureTab.add(docFieldPref);
1043 return structureTab;
1047 * Action on choosing a structure viewer from combobox options.
1049 * @param selectedItem
1051 protected void structureViewer_actionPerformed(String selectedItem)
1056 * Show a dialog for the user to choose a file. Returns the chosen path, or
1061 protected String openFileChooser()
1063 String choice = null;
1064 JFileChooser chooser = new JFileChooser();
1066 // chooser.setFileView(new JalviewFileView());
1067 chooser.setDialogTitle(MessageManager
1068 .getString("label.open_local_file"));
1069 chooser.setToolTipText(MessageManager.getString("action.open"));
1071 int value = chooser.showOpenDialog(this);
1073 if (value == JFileChooser.APPROVE_OPTION)
1075 choice = chooser.getSelectedFile().getPath();
1081 * Validate the structure tab preferences; if invalid, set focus on this tab.
1085 protected boolean validateStructure(FocusEvent e)
1087 if (!validateStructure())
1089 e.getComponent().requestFocusInWindow();
1095 protected boolean validateStructure()
1101 * Initialises the Visual tabbed panel.
1105 private JPanel initVisualTab()
1107 JPanel visualTab = new JPanel();
1108 visualTab.setBorder(new TitledBorder(MessageManager
1109 .getString("action.open_new_alignment")));
1110 visualTab.setLayout(null);
1111 fullScreen.setFont(LABEL_FONT);
1112 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1113 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1114 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1115 quality.setEnabled(false);
1116 quality.setFont(LABEL_FONT);
1117 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1118 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1119 quality.setSelected(true);
1120 quality.setText(MessageManager.getString("label.quality"));
1121 conservation.setEnabled(false);
1122 conservation.setFont(LABEL_FONT);
1123 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1124 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1125 conservation.setSelected(true);
1126 conservation.setText(MessageManager.getString("label.conservation"));
1127 identity.setEnabled(false);
1128 identity.setFont(LABEL_FONT);
1129 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1130 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1131 identity.setSelected(true);
1132 identity.setText(MessageManager.getString("label.consensus"));
1133 JLabel showGroupbits = new JLabel();
1134 showGroupbits.setFont(LABEL_FONT);
1135 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1136 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1137 showGroupbits.setText(MessageManager.getString("action.show_group")
1139 JLabel showConsensbits = new JLabel();
1140 showConsensbits.setFont(LABEL_FONT);
1141 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1142 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1143 showConsensbits.setText(MessageManager.getString("label.consensus")
1145 showConsensHistogram.setEnabled(false);
1146 showConsensHistogram.setFont(LABEL_FONT);
1147 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1148 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1149 showConsensHistogram.setSelected(true);
1150 showConsensHistogram.setText(MessageManager
1151 .getString("label.histogram"));
1152 showConsensLogo.setEnabled(false);
1153 showConsensLogo.setFont(LABEL_FONT);
1154 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1155 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1156 showConsensLogo.setSelected(true);
1157 showConsensLogo.setText(MessageManager.getString("label.logo"));
1158 showGroupConsensus.setEnabled(false);
1159 showGroupConsensus.setFont(LABEL_FONT);
1160 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1161 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1162 showGroupConsensus.setSelected(true);
1163 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1164 showGroupConservation.setEnabled(false);
1165 showGroupConservation.setFont(LABEL_FONT);
1166 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1167 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1168 showGroupConservation.setSelected(true);
1169 showGroupConservation.setText(MessageManager
1170 .getString("label.conservation"));
1171 showNpTooltip.setEnabled(true);
1172 showNpTooltip.setFont(LABEL_FONT);
1173 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1174 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1175 showNpTooltip.setSelected(true);
1176 showNpTooltip.setText(MessageManager
1177 .getString("label.non_positional_features"));
1178 showDbRefTooltip.setEnabled(true);
1179 showDbRefTooltip.setFont(LABEL_FONT);
1180 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1181 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1182 showDbRefTooltip.setSelected(true);
1183 showDbRefTooltip.setText(MessageManager
1184 .getString("label.database_references"));
1185 annotations.setFont(LABEL_FONT);
1186 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1187 annotations.setHorizontalTextPosition(SwingConstants.LEADING);
1188 annotations.setSelected(true);
1189 annotations.setText(MessageManager.getString("label.show_annotations"));
1190 annotations.setBounds(new Rectangle(169, 12, 200, 23));
1191 annotations.addActionListener(new ActionListener()
1194 public void actionPerformed(ActionEvent e)
1196 annotations_actionPerformed(e);
1199 identity.addActionListener(new ActionListener()
1202 public void actionPerformed(ActionEvent e)
1204 annotations_actionPerformed(e);
1207 showGroupConsensus.addActionListener(new ActionListener()
1210 public void actionPerformed(ActionEvent e)
1212 annotations_actionPerformed(e);
1215 showUnconserved.setFont(LABEL_FONT);
1216 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1217 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1218 showUnconserved.setSelected(true);
1219 showUnconserved.setText(MessageManager
1220 .getString("action.show_unconserved"));
1221 showUnconserved.addActionListener(new ActionListener()
1224 public void actionPerformed(ActionEvent e)
1226 showunconserved_actionPerformed(e);
1230 // TODO these are not yet added to / action from Preferences
1231 // JCheckBox shareSelections = new JCheckBox();
1232 // shareSelections.setFont(verdana11);
1233 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1234 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1235 // shareSelections.setSelected(true);
1236 // shareSelections.setText(MessageManager
1237 // .getString("label.share_selection_across_views"));
1238 // JCheckBox followHighlight = new JCheckBox();
1239 // followHighlight.setFont(verdana11);
1240 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1241 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1242 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1243 // followHighlight.setSelected(true);
1244 // followHighlight.setText(MessageManager
1245 // .getString("label.scroll_highlighted_regions"));
1247 seqLimit.setFont(LABEL_FONT);
1248 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1249 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1250 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1251 smoothFont.setFont(LABEL_FONT);
1252 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1253 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1254 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1255 scaleProteinToCdna.setFont(LABEL_FONT);
1256 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1257 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1258 scaleProteinToCdna.setText(MessageManager
1259 .getString("label.scale_protein_to_cdna"));
1260 scaleProteinToCdna.setToolTipText(MessageManager
1261 .getString("label.scale_protein_to_cdna_tip"));
1262 JLabel gapLabel = new JLabel();
1263 gapLabel.setFont(LABEL_FONT);
1264 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1265 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1266 JLabel fontLabel = new JLabel();
1267 fontLabel.setFont(LABEL_FONT);
1268 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1269 fontLabel.setText(MessageManager.getString("label.font"));
1270 fontSizeCB.setFont(LABEL_FONT);
1271 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1272 fontStyleCB.setFont(LABEL_FONT);
1273 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1274 fontNameCB.setFont(LABEL_FONT);
1275 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1276 gapSymbolCB.setFont(LABEL_FONT);
1277 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1278 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1279 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1280 gapSymbolCB.setRenderer(dlcr);
1282 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1283 startupCheckbox.setFont(LABEL_FONT);
1284 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1285 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1286 startupCheckbox.setSelected(true);
1287 startupFileTextfield.setFont(LABEL_FONT);
1288 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1289 startupFileTextfield.addMouseListener(new MouseAdapter()
1292 public void mouseClicked(MouseEvent e)
1294 if (e.getClickCount() > 1)
1296 startupFileTextfield_mouseClicked();
1301 sortby.setFont(LABEL_FONT);
1302 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1303 JLabel sortLabel = new JLabel();
1304 sortLabel.setFont(LABEL_FONT);
1305 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1306 sortLabel.setText(MessageManager.getString("label.sort_by"));
1307 sortAnnBy.setFont(LABEL_FONT);
1308 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1309 JLabel sortAnnLabel = new JLabel();
1310 sortAnnLabel.setFont(LABEL_FONT);
1311 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1312 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1313 sortAutocalc.setFont(LABEL_FONT);
1314 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1316 JPanel annsettingsPanel = new JPanel();
1317 annsettingsPanel.setBounds(new Rectangle(173, 34, 320, 75));
1318 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1319 annsettingsPanel.setBorder(new EtchedBorder());
1320 visualTab.add(annsettingsPanel);
1321 Border jb = new EmptyBorder(1, 1, 4, 5);
1322 quality.setBorder(jb);
1323 conservation.setBorder(jb);
1324 identity.setBorder(jb);
1325 showConsensbits.setBorder(jb);
1326 showGroupbits.setBorder(jb);
1327 showGroupConsensus.setBorder(jb);
1328 showGroupConservation.setBorder(jb);
1329 showConsensHistogram.setBorder(jb);
1330 showConsensLogo.setBorder(jb);
1332 JPanel autoAnnotSettings = new JPanel();
1333 autoAnnotSettings.setLayout(new GridLayout(3, 3));
1334 annsettingsPanel.add(autoAnnotSettings);
1335 autoAnnotSettings.add(quality);
1336 autoAnnotSettings.add(conservation);
1337 autoAnnotSettings.add(identity);
1338 autoAnnotSettings.add(showGroupbits);
1339 autoAnnotSettings.add(showGroupConservation);
1340 autoAnnotSettings.add(showGroupConsensus);
1341 autoAnnotSettings.add(showConsensbits);
1342 autoAnnotSettings.add(showConsensHistogram);
1343 autoAnnotSettings.add(showConsensLogo);
1345 JPanel tooltipSettings = new JPanel();
1346 tooltipSettings.setBorder(new TitledBorder(MessageManager
1347 .getString("label.sequence_id_tooltip")));
1348 tooltipSettings.setBounds(173, 140, 220, 62);
1349 tooltipSettings.setLayout(new GridLayout(2, 1));
1350 tooltipSettings.add(showDbRefTooltip);
1351 tooltipSettings.add(showNpTooltip);
1352 visualTab.add(tooltipSettings);
1354 wrap.setFont(LABEL_FONT);
1355 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1356 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1357 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1358 rightAlign.setFont(LABEL_FONT);
1359 rightAlign.setForeground(Color.black);
1360 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1361 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1362 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1363 idItalics.setFont(LABEL_FONT_ITALIC);
1364 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1365 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1366 idItalics.setText(MessageManager
1367 .getString("label.sequence_name_italics"));
1368 openoverv.setFont(LABEL_FONT);
1369 openoverv.setActionCommand(MessageManager
1370 .getString("label.open_overview"));
1371 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1372 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1373 openoverv.setText(MessageManager.getString("label.open_overview"));
1374 JPanel jPanel2 = new JPanel();
1375 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1376 jPanel2.setLayout(new GridLayout(14, 1));
1377 jPanel2.add(fullScreen);
1378 jPanel2.add(openoverv);
1379 jPanel2.add(seqLimit);
1380 jPanel2.add(rightAlign);
1381 jPanel2.add(fontLabel);
1382 jPanel2.add(showUnconserved);
1383 jPanel2.add(idItalics);
1384 jPanel2.add(smoothFont);
1385 jPanel2.add(scaleProteinToCdna);
1386 jPanel2.add(gapLabel);
1388 jPanel2.add(sortLabel);
1389 jPanel2.add(sortAnnLabel);
1390 jPanel2.add(startupCheckbox);
1391 visualTab.add(jPanel2);
1392 visualTab.add(annotations);
1393 visualTab.add(startupFileTextfield);
1394 visualTab.add(sortby);
1395 visualTab.add(sortAnnBy);
1396 visualTab.add(sortAutocalc);
1397 visualTab.add(gapSymbolCB);
1398 visualTab.add(fontNameCB);
1399 visualTab.add(fontSizeCB);
1400 visualTab.add(fontStyleCB);
1404 protected void autoIdWidth_actionPerformed()
1406 // TODO Auto-generated method stub
1410 protected void userIdWidth_actionPerformed()
1412 // TODO Auto-generated method stub
1416 protected void maxColour_actionPerformed(JPanel panel)
1420 protected void minColour_actionPerformed(JPanel panel)
1424 protected void showunconserved_actionPerformed(ActionEvent e)
1426 // TODO Auto-generated method stub
1436 public void ok_actionPerformed(ActionEvent e)
1446 public void cancel_actionPerformed(ActionEvent e)
1456 public void annotations_actionPerformed(ActionEvent e)
1463 public void startupFileTextfield_mouseClicked()
1467 public void newLink_actionPerformed(ActionEvent e)
1472 public void editLink_actionPerformed(ActionEvent e)
1477 public void deleteLink_actionPerformed(ActionEvent e)
1482 public void defaultBrowser_mouseClicked(MouseEvent e)
1487 public void linkURLList_keyTyped(KeyEvent e)
1492 public void useProxy_actionPerformed()
1494 boolean enabled = useProxy.isSelected();
1495 portLabel.setEnabled(enabled);
1496 serverLabel.setEnabled(enabled);
1497 proxyServerTB.setEnabled(enabled);
1498 proxyPortTB.setEnabled(enabled);
1501 public class RadioButtonRenderer extends JRadioButton implements
1504 public RadioButtonRenderer()
1506 setHorizontalAlignment(CENTER);
1510 public Component getTableCellRendererComponent(JTable table,
1511 Object value, boolean isSelected, boolean hasFocus, int row,
1514 setSelected((boolean) value);
1516 // set colours to match rest of table
1519 setBackground(table.getSelectionBackground());
1520 setForeground(table.getSelectionForeground());
1524 setBackground(table.getBackground());
1525 setForeground(table.getForeground());
1528 // adjust row height so radio buttons actually fit
1529 table.setRowHeight(row, getMinimumSize().height);
1535 public class RadioButtonEditor extends AbstractCellEditor implements
1538 private JRadioButton button = new JRadioButton();
1540 public RadioButtonEditor()
1542 this.button.setHorizontalAlignment(SwingConstants.CENTER);
1543 this.button.addActionListener(new ActionListener()
1546 public void actionPerformed(ActionEvent e)
1548 fireEditingStopped();
1554 public Component getTableCellEditorComponent(JTable table,
1555 Object value, boolean isSelected, int row, int column)
1557 button.setSelected((boolean) value);
1562 public Object getCellEditorValue()
1564 return button.isSelected();