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 // adjust row height so radio buttons actually fit
658 // don't do this in the renderer, it causes the awt thread to activate
660 JRadioButton temp = new JRadioButton();
661 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
663 // Table in scrollpane so that the table is given a scrollbar
664 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
665 linkScrollPane.setBorder(null);
667 // Panel for links functionality
668 JPanel linkPanel = new JPanel(new GridBagLayout());
669 linkPanel.setBorder(new TitledBorder(MessageManager
670 .getString("label.url_linkfrom_sequence_id")));
672 // Put the Url links panel together
674 // Buttons go at top right, resizing only resizes the blank space vertically
675 JPanel buttonPanel = initConnTabUrlButtons();
676 GridBagConstraints linkConstraints1 = new GridBagConstraints();
677 linkConstraints1.gridx = 1;
678 linkConstraints1.gridy = 0;
679 linkConstraints1.fill = GridBagConstraints.VERTICAL;
680 linkPanel.add(buttonPanel, linkConstraints1);
682 // Links table goes at top left, resizing resizes the table
683 GridBagConstraints linkConstraints2 = new GridBagConstraints();
684 linkConstraints2.gridx = 0;
685 linkConstraints2.gridy = 0;
686 linkConstraints2.weightx = 1.0;
687 linkConstraints2.weighty = 1.0;
688 linkConstraints2.fill = GridBagConstraints.BOTH;
689 linkPanel.add(linkScrollPane, linkConstraints2);
691 // Filter box and buttons goes at bottom left, resizing resizes the text box
692 JPanel filterPanel = initConnTabFilterPanel();
693 GridBagConstraints linkConstraints3 = new GridBagConstraints();
694 linkConstraints3.gridx = 0;
695 linkConstraints3.gridy = 1;
696 linkConstraints3.weightx = 1.0;
697 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
698 linkPanel.add(filterPanel, linkConstraints3);
703 private JPanel initConnTabFilterPanel()
705 // Filter textbox and reset button
706 JLabel filterLabel = new JLabel(
707 MessageManager.getString("label.filter"));
708 filterLabel.setFont(LABEL_FONT);
709 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
710 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
712 filterTB.setFont(LABEL_FONT);
713 filterTB.setText("");
715 doReset.setText(MessageManager.getString("action.showall"));
716 userOnly.setText(MessageManager.getString("action.customfilter"));
718 // Panel for filter functionality
719 JPanel filterPanel = new JPanel(new GridBagLayout());
720 GridBagConstraints gbc = new GridBagConstraints();
723 gbc.fill = GridBagConstraints.NONE;
724 gbc.anchor = GridBagConstraints.WEST;
726 filterPanel.add(filterLabel, gbc);
728 GridBagConstraints gbc1 = new GridBagConstraints();
731 gbc1.fill = GridBagConstraints.HORIZONTAL;
732 gbc1.anchor = GridBagConstraints.WEST;
734 filterPanel.add(filterTB, gbc1);
736 GridBagConstraints gbc2 = new GridBagConstraints();
738 gbc2.fill = GridBagConstraints.NONE;
739 gbc2.anchor = GridBagConstraints.WEST;
740 filterPanel.add(doReset, gbc2);
742 GridBagConstraints gbc3 = new GridBagConstraints();
744 gbc3.fill = GridBagConstraints.NONE;
745 gbc3.anchor = GridBagConstraints.WEST;
746 filterPanel.add(userOnly, gbc3);
751 private JPanel initConnTabUrlButtons()
753 // Buttons for new / edit / delete Url links
754 JButton newLink = new JButton();
755 newLink.setText(MessageManager.getString("action.new"));
756 newLink.addActionListener(new java.awt.event.ActionListener()
759 public void actionPerformed(ActionEvent e)
761 newLink_actionPerformed(e);
765 editLink.setText(MessageManager.getString("action.edit"));
766 editLink.addActionListener(new java.awt.event.ActionListener()
769 public void actionPerformed(ActionEvent e)
771 editLink_actionPerformed(e);
775 deleteLink.setText(MessageManager.getString("action.delete"));
776 deleteLink.addActionListener(new java.awt.event.ActionListener()
779 public void actionPerformed(ActionEvent e)
781 deleteLink_actionPerformed(e);
785 // no current selection, so initially disable delete/edit buttons
786 editLink.setEnabled(false);
787 deleteLink.setEnabled(false);
789 // Panels for new/edit/delete link buttons
790 // buttonContent prevents the buttons from being resized when the window is
791 JPanel buttonContent = new JPanel(new GridLayout(0, 1, 0, 0));
792 JPanel buttonPanel = new JPanel(new BorderLayout());
794 buttonContent.add(newLink, null);
795 buttonContent.add(editLink, null);
796 buttonContent.add(deleteLink, null);
797 buttonPanel.add(buttonContent, BorderLayout.NORTH);
803 * Initialises the parent panel which contains the tabbed sections.
807 private JPanel initOkCancelPanel()
809 JButton ok = new JButton();
810 ok.setText(MessageManager.getString("action.ok"));
811 ok.addActionListener(new ActionListener()
814 public void actionPerformed(ActionEvent e)
816 ok_actionPerformed(e);
819 JButton cancel = new JButton();
820 cancel.setText(MessageManager.getString("action.cancel"));
821 cancel.addActionListener(new ActionListener()
824 public void actionPerformed(ActionEvent e)
826 cancel_actionPerformed(e);
829 JPanel okCancelPanel = new JPanel();
830 okCancelPanel.add(ok);
831 okCancelPanel.add(cancel);
832 return okCancelPanel;
836 * Initialises the Colours tabbed panel.
840 private JPanel initColoursTab()
842 JPanel coloursTab = new JPanel();
843 coloursTab.setBorder(new TitledBorder(MessageManager
844 .getString("action.open_new_alignment")));
845 coloursTab.setLayout(new FlowLayout());
846 JLabel mincolourLabel = new JLabel();
847 mincolourLabel.setFont(LABEL_FONT);
848 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
849 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
850 minColour.setFont(LABEL_FONT);
851 minColour.setBorder(BorderFactory.createEtchedBorder());
852 minColour.setPreferredSize(new Dimension(40, 20));
853 minColour.addMouseListener(new MouseAdapter()
856 public void mousePressed(MouseEvent e)
858 minColour_actionPerformed(minColour);
861 JLabel maxcolourLabel = new JLabel();
862 maxcolourLabel.setFont(LABEL_FONT);
863 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
864 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
865 maxColour.setFont(LABEL_FONT);
866 maxColour.setBorder(BorderFactory.createEtchedBorder());
867 maxColour.setPreferredSize(new Dimension(40, 20));
868 maxColour.addMouseListener(new MouseAdapter()
871 public void mousePressed(MouseEvent e)
873 maxColour_actionPerformed(maxColour);
877 protColour.setFont(LABEL_FONT);
878 protColour.setBounds(new Rectangle(172, 225, 155, 21));
879 JLabel protColourLabel = new JLabel();
880 protColourLabel.setFont(LABEL_FONT);
881 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
882 protColourLabel.setText(MessageManager
883 .getString("label.prot_alignment_colour") + " ");
884 JvSwingUtils.addtoLayout(coloursTab, MessageManager
885 .getString("label.default_colour_scheme_for_alignment"),
886 protColourLabel, protColour);
888 nucColour.setFont(LABEL_FONT);
889 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
890 JLabel nucColourLabel = new JLabel();
891 nucColourLabel.setFont(LABEL_FONT);
892 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
893 nucColourLabel.setText(MessageManager
894 .getString("label.nuc_alignment_colour") + " ");
895 JvSwingUtils.addtoLayout(coloursTab, MessageManager
896 .getString("label.default_colour_scheme_for_alignment"),
897 nucColourLabel, nucColour);
899 JPanel annotationShding = new JPanel();
900 annotationShding.setBorder(new TitledBorder(MessageManager
901 .getString("label.annotation_shading_default")));
902 annotationShding.setLayout(new GridLayout(1, 2));
903 JvSwingUtils.addtoLayout(annotationShding, MessageManager
904 .getString("label.default_minimum_colour_annotation_shading"),
905 mincolourLabel, minColour);
906 JvSwingUtils.addtoLayout(annotationShding, MessageManager
907 .getString("label.default_maximum_colour_annotation_shading"),
908 maxcolourLabel, maxColour);
909 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
914 * Initialises the Structure tabbed panel.
918 private JPanel initStructureTab()
920 structureTab = new JPanel();
922 structureTab.setBorder(new TitledBorder(MessageManager
923 .getString("label.structure_options")));
924 structureTab.setLayout(null);
925 final int width = 400;
926 final int height = 22;
927 final int lineSpacing = 25;
930 structFromPdb.setFont(LABEL_FONT);
932 .setText(MessageManager.getString("label.struct_from_pdb"));
933 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
934 structFromPdb.addActionListener(new ActionListener()
937 public void actionPerformed(ActionEvent e)
939 boolean selected = structFromPdb.isSelected();
940 // enable other options only when the first is checked
941 useRnaView.setEnabled(selected);
942 addSecondaryStructure.setEnabled(selected);
943 addTempFactor.setEnabled(selected);
946 structureTab.add(structFromPdb);
948 // indent checkboxes that are conditional on the first one
950 useRnaView.setFont(LABEL_FONT);
951 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
952 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
953 structureTab.add(useRnaView);
956 addSecondaryStructure.setFont(LABEL_FONT);
957 addSecondaryStructure.setText(MessageManager
958 .getString("label.autoadd_secstr"));
959 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
960 structureTab.add(addSecondaryStructure);
963 addTempFactor.setFont(LABEL_FONT);
964 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
965 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
966 structureTab.add(addTempFactor);
969 JLabel viewerLabel = new JLabel();
970 viewerLabel.setFont(LABEL_FONT);
971 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
972 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
973 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
974 structureTab.add(viewerLabel);
976 structViewer.setFont(LABEL_FONT);
977 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
978 structViewer.addItem(ViewerType.JMOL.name());
979 structViewer.addItem(ViewerType.CHIMERA.name());
980 structViewer.addActionListener(new ActionListener()
983 public void actionPerformed(ActionEvent e)
985 structureViewer_actionPerformed((String) structViewer
989 structureTab.add(structViewer);
992 JLabel pathLabel = new JLabel();
993 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
994 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
995 pathLabel.setText(MessageManager.getString("label.chimera_path"));
996 final String tooltip = JvSwingUtils.wrapTooltip(true,
997 MessageManager.getString("label.chimera_path_tip"));
998 pathLabel.setToolTipText(tooltip);
999 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1000 structureTab.add(pathLabel);
1002 chimeraPath.setFont(LABEL_FONT);
1003 chimeraPath.setText("");
1004 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1005 chimeraPath.addMouseListener(new MouseAdapter()
1008 public void mouseClicked(MouseEvent e)
1010 if (e.getClickCount() == 2)
1012 String chosen = openFileChooser();
1015 chimeraPath.setText(chosen);
1020 structureTab.add(chimeraPath);
1022 ypos += lineSpacing;
1023 nwMapping.setFont(LABEL_FONT);
1024 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1025 siftsMapping.setFont(LABEL_FONT);
1026 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1027 mappingMethod.add(nwMapping);
1028 mappingMethod.add(siftsMapping);
1029 JPanel mappingPanel = new JPanel();
1030 mappingPanel.setFont(LABEL_FONT);
1031 TitledBorder mmTitledBorder = new TitledBorder(
1032 MessageManager.getString("label.mapping_method"));
1033 mmTitledBorder.setTitleFont(LABEL_FONT);
1034 mappingPanel.setBorder(mmTitledBorder);
1035 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1036 // GridLayout mappingLayout = new GridLayout();
1037 mappingPanel.setLayout(new GridLayout());
1038 mappingPanel.add(nwMapping);
1039 mappingPanel.add(siftsMapping);
1040 structureTab.add(mappingPanel);
1042 ypos += lineSpacing;
1043 ypos += lineSpacing;
1044 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1045 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1046 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1047 structureTab.add(docFieldPref);
1049 return structureTab;
1053 * Action on choosing a structure viewer from combobox options.
1055 * @param selectedItem
1057 protected void structureViewer_actionPerformed(String selectedItem)
1062 * Show a dialog for the user to choose a file. Returns the chosen path, or
1067 protected String openFileChooser()
1069 String choice = null;
1070 JFileChooser chooser = new JFileChooser();
1072 // chooser.setFileView(new JalviewFileView());
1073 chooser.setDialogTitle(MessageManager
1074 .getString("label.open_local_file"));
1075 chooser.setToolTipText(MessageManager.getString("action.open"));
1077 int value = chooser.showOpenDialog(this);
1079 if (value == JFileChooser.APPROVE_OPTION)
1081 choice = chooser.getSelectedFile().getPath();
1087 * Validate the structure tab preferences; if invalid, set focus on this tab.
1091 protected boolean validateStructure(FocusEvent e)
1093 if (!validateStructure())
1095 e.getComponent().requestFocusInWindow();
1101 protected boolean validateStructure()
1107 * Initialises the Visual tabbed panel.
1111 private JPanel initVisualTab()
1113 JPanel visualTab = new JPanel();
1114 visualTab.setBorder(new TitledBorder(MessageManager
1115 .getString("action.open_new_alignment")));
1116 visualTab.setLayout(null);
1117 fullScreen.setFont(LABEL_FONT);
1118 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1119 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1120 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1121 quality.setEnabled(false);
1122 quality.setFont(LABEL_FONT);
1123 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1124 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1125 quality.setSelected(true);
1126 quality.setText(MessageManager.getString("label.quality"));
1127 conservation.setEnabled(false);
1128 conservation.setFont(LABEL_FONT);
1129 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1130 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1131 conservation.setSelected(true);
1132 conservation.setText(MessageManager.getString("label.conservation"));
1133 identity.setEnabled(false);
1134 identity.setFont(LABEL_FONT);
1135 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1136 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1137 identity.setSelected(true);
1138 identity.setText(MessageManager.getString("label.consensus"));
1139 JLabel showGroupbits = new JLabel();
1140 showGroupbits.setFont(LABEL_FONT);
1141 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1142 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1143 showGroupbits.setText(MessageManager.getString("action.show_group")
1145 JLabel showConsensbits = new JLabel();
1146 showConsensbits.setFont(LABEL_FONT);
1147 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1148 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1149 showConsensbits.setText(MessageManager.getString("label.consensus")
1151 showConsensHistogram.setEnabled(false);
1152 showConsensHistogram.setFont(LABEL_FONT);
1153 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1154 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1155 showConsensHistogram.setSelected(true);
1156 showConsensHistogram.setText(MessageManager
1157 .getString("label.histogram"));
1158 showConsensLogo.setEnabled(false);
1159 showConsensLogo.setFont(LABEL_FONT);
1160 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1161 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1162 showConsensLogo.setSelected(true);
1163 showConsensLogo.setText(MessageManager.getString("label.logo"));
1164 showGroupConsensus.setEnabled(false);
1165 showGroupConsensus.setFont(LABEL_FONT);
1166 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1167 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1168 showGroupConsensus.setSelected(true);
1169 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1170 showGroupConservation.setEnabled(false);
1171 showGroupConservation.setFont(LABEL_FONT);
1172 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1173 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1174 showGroupConservation.setSelected(true);
1175 showGroupConservation.setText(MessageManager
1176 .getString("label.conservation"));
1177 showNpTooltip.setEnabled(true);
1178 showNpTooltip.setFont(LABEL_FONT);
1179 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1180 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1181 showNpTooltip.setSelected(true);
1182 showNpTooltip.setText(MessageManager
1183 .getString("label.non_positional_features"));
1184 showDbRefTooltip.setEnabled(true);
1185 showDbRefTooltip.setFont(LABEL_FONT);
1186 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1187 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1188 showDbRefTooltip.setSelected(true);
1189 showDbRefTooltip.setText(MessageManager
1190 .getString("label.database_references"));
1191 annotations.setFont(LABEL_FONT);
1192 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1193 annotations.setHorizontalTextPosition(SwingConstants.LEADING);
1194 annotations.setSelected(true);
1195 annotations.setText(MessageManager.getString("label.show_annotations"));
1196 annotations.setBounds(new Rectangle(169, 12, 200, 23));
1197 annotations.addActionListener(new ActionListener()
1200 public void actionPerformed(ActionEvent e)
1202 annotations_actionPerformed(e);
1205 identity.addActionListener(new ActionListener()
1208 public void actionPerformed(ActionEvent e)
1210 annotations_actionPerformed(e);
1213 showGroupConsensus.addActionListener(new ActionListener()
1216 public void actionPerformed(ActionEvent e)
1218 annotations_actionPerformed(e);
1221 showUnconserved.setFont(LABEL_FONT);
1222 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1223 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1224 showUnconserved.setSelected(true);
1225 showUnconserved.setText(MessageManager
1226 .getString("action.show_unconserved"));
1227 showUnconserved.addActionListener(new ActionListener()
1230 public void actionPerformed(ActionEvent e)
1232 showunconserved_actionPerformed(e);
1236 // TODO these are not yet added to / action from Preferences
1237 // JCheckBox shareSelections = new JCheckBox();
1238 // shareSelections.setFont(verdana11);
1239 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1240 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1241 // shareSelections.setSelected(true);
1242 // shareSelections.setText(MessageManager
1243 // .getString("label.share_selection_across_views"));
1244 // JCheckBox followHighlight = new JCheckBox();
1245 // followHighlight.setFont(verdana11);
1246 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1247 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1248 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1249 // followHighlight.setSelected(true);
1250 // followHighlight.setText(MessageManager
1251 // .getString("label.scroll_highlighted_regions"));
1253 seqLimit.setFont(LABEL_FONT);
1254 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1255 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1256 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1257 smoothFont.setFont(LABEL_FONT);
1258 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1259 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1260 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1261 scaleProteinToCdna.setFont(LABEL_FONT);
1262 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1263 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1264 scaleProteinToCdna.setText(MessageManager
1265 .getString("label.scale_protein_to_cdna"));
1266 scaleProteinToCdna.setToolTipText(MessageManager
1267 .getString("label.scale_protein_to_cdna_tip"));
1268 JLabel gapLabel = new JLabel();
1269 gapLabel.setFont(LABEL_FONT);
1270 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1271 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1272 JLabel fontLabel = new JLabel();
1273 fontLabel.setFont(LABEL_FONT);
1274 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1275 fontLabel.setText(MessageManager.getString("label.font"));
1276 fontSizeCB.setFont(LABEL_FONT);
1277 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1278 fontStyleCB.setFont(LABEL_FONT);
1279 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1280 fontNameCB.setFont(LABEL_FONT);
1281 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1282 gapSymbolCB.setFont(LABEL_FONT);
1283 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1284 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1285 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1286 gapSymbolCB.setRenderer(dlcr);
1288 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1289 startupCheckbox.setFont(LABEL_FONT);
1290 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1291 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1292 startupCheckbox.setSelected(true);
1293 startupFileTextfield.setFont(LABEL_FONT);
1294 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1295 startupFileTextfield.addMouseListener(new MouseAdapter()
1298 public void mouseClicked(MouseEvent e)
1300 if (e.getClickCount() > 1)
1302 startupFileTextfield_mouseClicked();
1307 sortby.setFont(LABEL_FONT);
1308 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1309 JLabel sortLabel = new JLabel();
1310 sortLabel.setFont(LABEL_FONT);
1311 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1312 sortLabel.setText(MessageManager.getString("label.sort_by"));
1313 sortAnnBy.setFont(LABEL_FONT);
1314 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1315 JLabel sortAnnLabel = new JLabel();
1316 sortAnnLabel.setFont(LABEL_FONT);
1317 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1318 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1319 sortAutocalc.setFont(LABEL_FONT);
1320 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1322 JPanel annsettingsPanel = new JPanel();
1323 annsettingsPanel.setBounds(new Rectangle(173, 34, 320, 75));
1324 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1325 annsettingsPanel.setBorder(new EtchedBorder());
1326 visualTab.add(annsettingsPanel);
1327 Border jb = new EmptyBorder(1, 1, 4, 5);
1328 quality.setBorder(jb);
1329 conservation.setBorder(jb);
1330 identity.setBorder(jb);
1331 showConsensbits.setBorder(jb);
1332 showGroupbits.setBorder(jb);
1333 showGroupConsensus.setBorder(jb);
1334 showGroupConservation.setBorder(jb);
1335 showConsensHistogram.setBorder(jb);
1336 showConsensLogo.setBorder(jb);
1338 JPanel autoAnnotSettings = new JPanel();
1339 autoAnnotSettings.setLayout(new GridLayout(3, 3));
1340 annsettingsPanel.add(autoAnnotSettings);
1341 autoAnnotSettings.add(quality);
1342 autoAnnotSettings.add(conservation);
1343 autoAnnotSettings.add(identity);
1344 autoAnnotSettings.add(showGroupbits);
1345 autoAnnotSettings.add(showGroupConservation);
1346 autoAnnotSettings.add(showGroupConsensus);
1347 autoAnnotSettings.add(showConsensbits);
1348 autoAnnotSettings.add(showConsensHistogram);
1349 autoAnnotSettings.add(showConsensLogo);
1351 JPanel tooltipSettings = new JPanel();
1352 tooltipSettings.setBorder(new TitledBorder(MessageManager
1353 .getString("label.sequence_id_tooltip")));
1354 tooltipSettings.setBounds(173, 140, 220, 62);
1355 tooltipSettings.setLayout(new GridLayout(2, 1));
1356 tooltipSettings.add(showDbRefTooltip);
1357 tooltipSettings.add(showNpTooltip);
1358 visualTab.add(tooltipSettings);
1360 wrap.setFont(LABEL_FONT);
1361 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1362 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1363 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1364 rightAlign.setFont(LABEL_FONT);
1365 rightAlign.setForeground(Color.black);
1366 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1367 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1368 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1369 idItalics.setFont(LABEL_FONT_ITALIC);
1370 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1371 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1372 idItalics.setText(MessageManager
1373 .getString("label.sequence_name_italics"));
1374 openoverv.setFont(LABEL_FONT);
1375 openoverv.setActionCommand(MessageManager
1376 .getString("label.open_overview"));
1377 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1378 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1379 openoverv.setText(MessageManager.getString("label.open_overview"));
1380 JPanel jPanel2 = new JPanel();
1381 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1382 jPanel2.setLayout(new GridLayout(14, 1));
1383 jPanel2.add(fullScreen);
1384 jPanel2.add(openoverv);
1385 jPanel2.add(seqLimit);
1386 jPanel2.add(rightAlign);
1387 jPanel2.add(fontLabel);
1388 jPanel2.add(showUnconserved);
1389 jPanel2.add(idItalics);
1390 jPanel2.add(smoothFont);
1391 jPanel2.add(scaleProteinToCdna);
1392 jPanel2.add(gapLabel);
1394 jPanel2.add(sortLabel);
1395 jPanel2.add(sortAnnLabel);
1396 jPanel2.add(startupCheckbox);
1397 visualTab.add(jPanel2);
1398 visualTab.add(annotations);
1399 visualTab.add(startupFileTextfield);
1400 visualTab.add(sortby);
1401 visualTab.add(sortAnnBy);
1402 visualTab.add(sortAutocalc);
1403 visualTab.add(gapSymbolCB);
1404 visualTab.add(fontNameCB);
1405 visualTab.add(fontSizeCB);
1406 visualTab.add(fontStyleCB);
1410 protected void autoIdWidth_actionPerformed()
1412 // TODO Auto-generated method stub
1416 protected void userIdWidth_actionPerformed()
1418 // TODO Auto-generated method stub
1422 protected void maxColour_actionPerformed(JPanel panel)
1426 protected void minColour_actionPerformed(JPanel panel)
1430 protected void showunconserved_actionPerformed(ActionEvent e)
1432 // TODO Auto-generated method stub
1442 public void ok_actionPerformed(ActionEvent e)
1452 public void cancel_actionPerformed(ActionEvent e)
1462 public void annotations_actionPerformed(ActionEvent e)
1469 public void startupFileTextfield_mouseClicked()
1473 public void newLink_actionPerformed(ActionEvent e)
1478 public void editLink_actionPerformed(ActionEvent e)
1483 public void deleteLink_actionPerformed(ActionEvent e)
1488 public void defaultBrowser_mouseClicked(MouseEvent e)
1493 public void linkURLList_keyTyped(KeyEvent e)
1498 public void useProxy_actionPerformed()
1500 boolean enabled = useProxy.isSelected();
1501 portLabel.setEnabled(enabled);
1502 serverLabel.setEnabled(enabled);
1503 proxyServerTB.setEnabled(enabled);
1504 proxyPortTB.setEnabled(enabled);
1508 * Customer renderer for JTable: supports column of radio buttons
1510 public class RadioButtonRenderer extends JRadioButton implements
1513 public RadioButtonRenderer()
1515 setHorizontalAlignment(CENTER);
1516 setToolTipText(MessageManager.getString("label.urltooltip"));
1520 public Component getTableCellRendererComponent(JTable table,
1521 Object value, boolean isSelected, boolean hasFocus, int row,
1524 setSelected((boolean) value);
1526 // set colours to match rest of table
1529 setBackground(table.getSelectionBackground());
1530 setForeground(table.getSelectionForeground());
1534 setBackground(table.getBackground());
1535 setForeground(table.getForeground());
1542 * Customer cell editor for JTable: supports column of radio buttons in
1543 * conjunction with renderer
1545 public class RadioButtonEditor extends AbstractCellEditor implements
1548 private JRadioButton button = new JRadioButton();
1550 public RadioButtonEditor()
1552 button.setHorizontalAlignment(SwingConstants.CENTER);
1553 this.button.addActionListener(new ActionListener()
1556 public void actionPerformed(ActionEvent e)
1558 fireEditingStopped();
1564 public Component getTableCellEditorComponent(JTable table,
1565 Object value, boolean isSelected, int row, int column)
1567 button.setSelected((boolean) value);
1572 public Object getCellEditorValue()
1574 return button.isSelected();