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.JalviewBooleanRadioButtons;
27 import jalview.gui.JvSwingUtils;
28 import jalview.gui.StructureViewer.ViewerType;
29 import jalview.io.BackupFilenameFilter;
30 import jalview.util.MessageManager;
32 import java.awt.BorderLayout;
33 import java.awt.Color;
34 import java.awt.Component;
35 import java.awt.Dimension;
36 import java.awt.FlowLayout;
38 import java.awt.GridBagConstraints;
39 import java.awt.GridBagLayout;
40 import java.awt.GridLayout;
41 import java.awt.Insets;
42 import java.awt.Rectangle;
43 import java.awt.event.ActionEvent;
44 import java.awt.event.ActionListener;
45 import java.awt.event.FocusEvent;
46 import java.awt.event.KeyEvent;
47 import java.awt.event.KeyListener;
48 import java.awt.event.MouseAdapter;
49 import java.awt.event.MouseEvent;
51 import javax.swing.AbstractCellEditor;
52 import javax.swing.BorderFactory;
53 import javax.swing.ButtonGroup;
54 import javax.swing.DefaultListCellRenderer;
55 import javax.swing.JButton;
56 import javax.swing.JCheckBox;
57 import javax.swing.JComboBox;
58 import javax.swing.JFileChooser;
59 import javax.swing.JLabel;
60 import javax.swing.JPanel;
61 import javax.swing.JRadioButton;
62 import javax.swing.JScrollPane;
63 import javax.swing.JSpinner;
64 import javax.swing.JTabbedPane;
65 import javax.swing.JTable;
66 import javax.swing.JTextArea;
67 import javax.swing.JTextField;
68 import javax.swing.ListSelectionModel;
69 import javax.swing.SpinnerModel;
70 import javax.swing.SpinnerNumberModel;
71 import javax.swing.SwingConstants;
72 import javax.swing.border.Border;
73 import javax.swing.border.EmptyBorder;
74 import javax.swing.border.EtchedBorder;
75 import javax.swing.border.TitledBorder;
76 import javax.swing.event.ChangeEvent;
77 import javax.swing.event.ChangeListener;
78 import javax.swing.table.TableCellEditor;
79 import javax.swing.table.TableCellRenderer;
82 * Base class for the Preferences panel.
87 public class GPreferences extends JPanel
89 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
91 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
92 .getLabelFont(false, true);
95 * Visual tab components
97 protected JCheckBox fullScreen = new JCheckBox();
99 protected JCheckBox openoverv = new JCheckBox();
101 protected JCheckBox seqLimit = new JCheckBox();
103 protected JCheckBox rightAlign = new JCheckBox();
105 protected JComboBox<String> fontSizeCB = new JComboBox<>();
107 protected JComboBox<String> fontStyleCB = new JComboBox<>();
109 protected JComboBox<String> fontNameCB = new JComboBox<>();
111 protected JCheckBox showOccupancy = new JCheckBox();
113 protected JCheckBox showUnconserved = new JCheckBox();
115 protected JCheckBox idItalics = new JCheckBox();
117 protected JCheckBox smoothFont = new JCheckBox();
119 protected JCheckBox scaleProteinToCdna = new JCheckBox();
121 protected JComboBox<String> gapSymbolCB = new JComboBox<>();
123 protected JCheckBox wrap = new JCheckBox();
125 protected JComboBox<String> sortby = new JComboBox<>();
127 protected JComboBox<String> sortAnnBy = new JComboBox<>();
129 protected JComboBox<String> sortAutocalc = new JComboBox<>();
131 protected JCheckBox startupCheckbox = new JCheckBox();
133 protected JTextField startupFileTextfield = new JTextField();
135 // below are in the 'second column'
136 protected JCheckBox annotations = new JCheckBox();
138 protected JCheckBox quality = new JCheckBox();
140 protected JCheckBox conservation = new JCheckBox();
142 protected JCheckBox identity = new JCheckBox();
144 protected JCheckBox showGroupConsensus = new JCheckBox();
146 protected JCheckBox showGroupConservation = new JCheckBox();
148 protected JCheckBox showConsensHistogram = new JCheckBox();
150 protected JCheckBox showConsensLogo = new JCheckBox();
152 protected JCheckBox showDbRefTooltip = new JCheckBox();
154 protected JCheckBox showNpTooltip = new JCheckBox();
157 * Structure tab and components
159 protected JPanel structureTab;
161 protected JCheckBox structFromPdb = new JCheckBox();
163 protected JCheckBox useRnaView = new JCheckBox();
165 protected JCheckBox addSecondaryStructure = new JCheckBox();
167 protected JCheckBox addTempFactor = new JCheckBox();
169 protected JComboBox<String> structViewer = new JComboBox<>();
171 protected JTextField chimeraPath = new JTextField();
173 protected ButtonGroup mappingMethod = new ButtonGroup();
175 protected JRadioButton siftsMapping = new JRadioButton();
177 protected JRadioButton nwMapping = new JRadioButton();
180 * Colours tab components
182 protected JPanel minColour = new JPanel();
184 protected JPanel maxColour = new JPanel();
186 protected JComboBox<String> protColour = new JComboBox<>();
188 protected JComboBox<String> nucColour = new JComboBox<>();
191 * Overview tab components
193 protected JPanel gapColour = new JPanel();
195 protected JPanel hiddenColour = new JPanel();
197 protected JCheckBox useLegacyGap;
199 protected JCheckBox showHiddenAtStart;
201 protected JLabel gapLabel;
204 * Connections tab components
206 protected JTable linkUrlTable = new JTable();
208 protected JButton editLink = new JButton();
210 protected JButton deleteLink = new JButton();
212 protected JTextField filterTB = new JTextField();
214 protected JButton doReset = new JButton();
216 protected JButton userOnly = new JButton();
218 protected JLabel portLabel = new JLabel();
220 protected JLabel serverLabel = new JLabel();
222 protected JTextField proxyServerTB = new JTextField();
224 protected JTextField proxyPortTB = new JTextField();
226 protected JTextField defaultBrowser = new JTextField();
228 protected JCheckBox useProxy = new JCheckBox();
230 protected JCheckBox usagestats = new JCheckBox();
232 protected JCheckBox questionnaire = new JCheckBox();
234 protected JCheckBox versioncheck = new JCheckBox();
237 * Output tab components
239 protected JComboBox<Object> epsRendering = new JComboBox<>();
241 protected JLabel userIdWidthlabel = new JLabel();
243 protected JCheckBox autoIdWidth = new JCheckBox();
245 protected JTextField userIdWidth = new JTextField();
247 protected JCheckBox blcjv = new JCheckBox();
249 protected JCheckBox pileupjv = new JCheckBox();
251 protected JCheckBox clustaljv = new JCheckBox();
253 protected JCheckBox msfjv = new JCheckBox();
255 protected JCheckBox fastajv = new JCheckBox();
257 protected JCheckBox pfamjv = new JCheckBox();
259 protected JCheckBox pirjv = new JCheckBox();
261 protected JCheckBox modellerOutput = new JCheckBox();
263 protected JCheckBox embbedBioJSON = new JCheckBox();
266 * Editing tab components
268 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
270 protected JCheckBox padGaps = new JCheckBox();
272 protected JCheckBox sortByTree = new JCheckBox();
278 protected JPanel wsTab = new JPanel();
281 * Backups tab components
282 * a lot of these are member variables instead of local variables only so that they
283 * can be enabled/disabled easily in one go
286 protected JCheckBox enableBackupFiles = new JCheckBox();
288 protected JPanel suffixPanel = new JPanel();
290 protected JPanel keepfilesPanel = new JPanel();
292 protected JPanel exampleFilesPanel = new JPanel();
294 protected JTextField suffixTemplate = new JTextField(null, 8);
296 protected JLabel suffixTemplateLabel = new JLabel();
298 protected JLabel suffixDigitsLabel = new JLabel();
300 protected JSpinner suffixDigitsSpinner = new JSpinner();
302 protected JalviewBooleanRadioButtons suffixReverse = new JalviewBooleanRadioButtons();
304 protected JalviewBooleanRadioButtons backupfilesKeepAll = new JalviewBooleanRadioButtons();
306 protected JSpinner backupfilesRollMaxSpinner = new JSpinner();
308 protected JLabel oldBackupFilesLabel = new JLabel();
310 protected JalviewBooleanRadioButtons backupfilesConfirmDelete = new JalviewBooleanRadioButtons();
312 protected JLabel exampleLabel = new JLabel();
314 protected JTextArea backupfilesExampleLabel = new JTextArea();
317 * Creates a new GPreferences object.
319 public GPreferences()
324 } catch (Exception ex)
326 ex.printStackTrace();
331 * Construct the panel and its tabbed sub-panels.
335 private void jbInit() throws Exception
337 final JTabbedPane tabbedPane = new JTabbedPane();
338 this.setLayout(new BorderLayout());
339 JPanel okCancelPanel = initOkCancelPanel();
340 this.add(tabbedPane, BorderLayout.CENTER);
341 this.add(okCancelPanel, BorderLayout.SOUTH);
343 tabbedPane.add(initVisualTab(),
344 MessageManager.getString("label.visual"));
346 tabbedPane.add(initColoursTab(),
347 MessageManager.getString("label.colours"));
349 tabbedPane.add(initOverviewTab(),
350 MessageManager.getString("label.overview"));
352 tabbedPane.add(initStructureTab(),
353 MessageManager.getString("label.structure"));
355 tabbedPane.add(initConnectionsTab(),
356 MessageManager.getString("label.connections"));
358 tabbedPane.add(initBackupsTab(),
359 MessageManager.getString("label.backups"));
361 tabbedPane.add(initLinksTab(),
362 MessageManager.getString("label.urllinks"));
364 tabbedPane.add(initOutputTab(),
365 MessageManager.getString("label.output"));
367 tabbedPane.add(initEditingTab(),
368 MessageManager.getString("label.editing"));
371 * See WsPreferences for the real work of configuring this tab.
373 wsTab.setLayout(new BorderLayout());
374 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
377 * Handler to validate a tab before leaving it - currently only for
380 tabbedPane.addChangeListener(new ChangeListener()
382 private Component lastTab;
385 public void stateChanged(ChangeEvent e)
387 if (lastTab == structureTab
388 && tabbedPane.getSelectedComponent() != structureTab)
390 if (!validateStructure())
392 tabbedPane.setSelectedComponent(structureTab);
396 lastTab = tabbedPane.getSelectedComponent();
403 * Initialises the Editing tabbed panel.
407 private JPanel initEditingTab()
409 JPanel editingTab = new JPanel();
410 editingTab.setLayout(null);
411 autoCalculateConsCheck.setFont(LABEL_FONT);
412 autoCalculateConsCheck.setText(
413 MessageManager.getString("label.autocalculate_consensus"));
414 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
415 padGaps.setFont(LABEL_FONT);
417 MessageManager.getString("label.pad_gaps_when_editing"));
418 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
419 sortByTree.setFont(LABEL_FONT);
421 .setText(MessageManager.getString("label.sort_with_new_tree"));
422 sortByTree.setToolTipText(MessageManager.getString(
423 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
424 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
425 editingTab.add(autoCalculateConsCheck);
426 editingTab.add(padGaps);
427 editingTab.add(sortByTree);
432 * Initialises the Output tabbed panel.
436 private JPanel initOutputTab()
438 JPanel outputTab = new JPanel();
439 outputTab.setLayout(null);
440 JLabel epsLabel = new JLabel();
441 epsLabel.setFont(LABEL_FONT);
442 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
443 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
444 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
445 epsRendering.setFont(LABEL_FONT);
446 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
447 JLabel jLabel1 = new JLabel();
448 jLabel1.setFont(LABEL_FONT);
449 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
450 jLabel1.setText(MessageManager.getString("label.append_start_end"));
451 jLabel1.setFont(LABEL_FONT);
452 fastajv.setFont(LABEL_FONT);
453 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
454 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
455 blcjv.setText(MessageManager.getString("label.blc") + " ");
456 fastajv.setText(MessageManager.getString("label.fasta") + " ");
457 msfjv.setText(MessageManager.getString("label.msf") + " ");
458 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
459 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
460 msfjv.setFont(LABEL_FONT);
461 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
462 pirjv.setText(MessageManager.getString("label.pir") + " ");
463 JPanel jPanel11 = new JPanel();
464 jPanel11.setFont(LABEL_FONT);
465 TitledBorder titledBorder2 = new TitledBorder(
466 MessageManager.getString("label.file_output"));
467 jPanel11.setBorder(titledBorder2);
468 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
469 GridLayout gridLayout3 = new GridLayout();
470 jPanel11.setLayout(gridLayout3);
471 gridLayout3.setRows(8);
472 blcjv.setFont(LABEL_FONT);
473 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
474 clustaljv.setFont(LABEL_FONT);
475 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
476 pfamjv.setFont(LABEL_FONT);
477 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
478 pileupjv.setFont(LABEL_FONT);
479 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
480 pirjv.setFont(LABEL_FONT);
481 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
482 autoIdWidth.setFont(LABEL_FONT);
484 MessageManager.getString("label.automatically_set_id_width"));
485 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
486 .getString("label.adjusts_width_generated_eps_png")));
487 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
488 autoIdWidth.addActionListener(new ActionListener()
492 public void actionPerformed(ActionEvent e)
494 autoIdWidth_actionPerformed();
497 userIdWidthlabel.setFont(LABEL_FONT);
498 userIdWidthlabel.setText(
499 MessageManager.getString("label.figure_id_column_width"));
500 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
501 .getString("label.manually_specify_width_left_column")));
502 userIdWidthlabel.setToolTipText(
503 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
504 "label.manually_specify_width_left_column")));
505 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
506 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
507 userIdWidth.setText("");
508 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
509 userIdWidth.addActionListener(new ActionListener()
513 public void actionPerformed(ActionEvent e)
515 userIdWidth_actionPerformed();
518 modellerOutput.setFont(LABEL_FONT);
520 .setText(MessageManager.getString("label.use_modeller_output"));
521 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
522 embbedBioJSON.setFont(LABEL_FONT);
523 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
524 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
527 TitledBorder backupFilesBorder = new TitledBorder(
529 .getString("label.backup_files"));
532 jPanel11.add(jLabel1);
534 jPanel11.add(clustaljv);
535 jPanel11.add(fastajv);
537 jPanel11.add(pfamjv);
538 jPanel11.add(pileupjv);
540 outputTab.add(autoIdWidth);
541 outputTab.add(userIdWidth);
542 outputTab.add(userIdWidthlabel);
543 outputTab.add(modellerOutput);
544 outputTab.add(embbedBioJSON);
545 outputTab.add(epsLabel);
546 outputTab.add(epsRendering);
547 outputTab.add(jPanel11);
552 * Initialises the Connections tabbed panel.
556 private JPanel initConnectionsTab()
558 JPanel connectTab = new JPanel();
559 connectTab.setLayout(new GridBagLayout());
561 // Label for browser text box
562 JLabel browserLabel = new JLabel();
563 browserLabel.setFont(LABEL_FONT);
564 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
565 browserLabel.setText(
566 MessageManager.getString("label.default_browser_unix"));
567 defaultBrowser.setFont(LABEL_FONT);
568 defaultBrowser.setText("");
569 final String tooltip = JvSwingUtils.wrapTooltip(true,
570 MessageManager.getString("label.double_click_to_browse"));
571 defaultBrowser.setToolTipText(tooltip);
572 defaultBrowser.addMouseListener(new MouseAdapter()
575 public void mouseClicked(MouseEvent e)
577 if (e.getClickCount() > 1)
579 defaultBrowser_mouseClicked(e);
584 JPanel proxyPanel = initConnTabProxyPanel();
585 initConnTabCheckboxes();
587 // Add default Browser text box
588 connectTab.add(browserLabel,
589 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
590 GridBagConstraints.WEST, GridBagConstraints.NONE,
591 new Insets(10, 0, 5, 5), 5, 1));
592 defaultBrowser.setFont(LABEL_FONT);
593 defaultBrowser.setText("");
595 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
596 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
597 new Insets(10, 0, 5, 10), 30, 1));
599 // Add proxy server panel
600 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
601 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
602 new Insets(10, 0, 5, 12), 4, 10));
604 // Add usage stats, version check and questionnaire checkboxes
605 connectTab.add(usagestats,
606 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
607 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
608 new Insets(0, 2, 5, 5), 70, 1));
609 connectTab.add(questionnaire,
610 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
611 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
612 new Insets(0, 2, 5, 10), 70, 1));
613 connectTab.add(versioncheck,
614 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
615 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
616 new Insets(0, 2, 5, 5), 70, 1));
618 // Add padding so the panel doesn't look ridiculous
619 JPanel spacePanel = new JPanel();
620 connectTab.add(spacePanel,
621 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
622 GridBagConstraints.WEST, GridBagConstraints.BOTH,
623 new Insets(0, 0, 0, 5), 70, 1));
629 * Initialises the Links tabbed panel.
633 private JPanel initLinksTab()
635 JPanel linkTab = new JPanel();
636 linkTab.setLayout(new GridBagLayout());
638 // Set up table for Url links
639 linkUrlTable.setFillsViewportHeight(true);
640 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
641 linkUrlTable.setAutoCreateRowSorter(true);
642 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
644 // adjust row height so radio buttons actually fit
645 // don't do this in the renderer, it causes the awt thread to activate
647 JRadioButton temp = new JRadioButton();
648 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
650 // Table in scrollpane so that the table is given a scrollbar
651 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
652 linkScrollPane.setBorder(null);
654 // Panel for links functionality
655 JPanel linkPanel = new JPanel(new GridBagLayout());
656 linkPanel.setBorder(new TitledBorder(
657 MessageManager.getString("label.url_linkfrom_sequence_id")));
659 // Put the Url links panel together
661 // Buttons go at top right, resizing only resizes the blank space vertically
662 JPanel buttonPanel = initLinkTabUrlButtons();
663 GridBagConstraints linkConstraints1 = new GridBagConstraints();
664 linkConstraints1.insets = new Insets(0, 0, 5, 0);
665 linkConstraints1.gridx = 0;
666 linkConstraints1.gridy = 0;
667 linkConstraints1.weightx = 1.0;
668 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
669 linkTab.add(buttonPanel, linkConstraints1);
671 // Links table goes at top left, resizing resizes the table
672 GridBagConstraints linkConstraints2 = new GridBagConstraints();
673 linkConstraints2.insets = new Insets(0, 0, 5, 5);
674 linkConstraints2.gridx = 0;
675 linkConstraints2.gridy = 1;
676 linkConstraints2.weightx = 1.0;
677 linkConstraints2.weighty = 1.0;
678 linkConstraints2.fill = GridBagConstraints.BOTH;
679 linkTab.add(linkScrollPane, linkConstraints2);
681 // Filter box and buttons goes at bottom left, resizing resizes the text box
682 JPanel filterPanel = initLinkTabFilterPanel();
683 GridBagConstraints linkConstraints3 = new GridBagConstraints();
684 linkConstraints3.insets = new Insets(0, 0, 0, 5);
685 linkConstraints3.gridx = 0;
686 linkConstraints3.gridy = 2;
687 linkConstraints3.weightx = 1.0;
688 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
689 linkTab.add(filterPanel, linkConstraints3);
694 private JPanel initLinkTabFilterPanel()
696 // Filter textbox and reset button
697 JLabel filterLabel = new JLabel(
698 MessageManager.getString("label.filter"));
699 filterLabel.setFont(LABEL_FONT);
700 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
701 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
703 filterTB.setFont(LABEL_FONT);
704 filterTB.setText("");
706 doReset.setText(MessageManager.getString("action.showall"));
707 userOnly.setText(MessageManager.getString("action.customfilter"));
709 // Panel for filter functionality
710 JPanel filterPanel = new JPanel(new GridBagLayout());
711 filterPanel.setBorder(new TitledBorder("Filter"));
712 GridBagConstraints gbc = new GridBagConstraints();
715 gbc.fill = GridBagConstraints.NONE;
716 gbc.anchor = GridBagConstraints.WEST;
718 filterPanel.add(filterLabel, gbc);
720 GridBagConstraints gbc1 = new GridBagConstraints();
723 gbc1.fill = GridBagConstraints.HORIZONTAL;
724 gbc1.anchor = GridBagConstraints.WEST;
726 filterPanel.add(filterTB, gbc1);
728 GridBagConstraints gbc2 = new GridBagConstraints();
730 gbc2.fill = GridBagConstraints.NONE;
731 gbc2.anchor = GridBagConstraints.WEST;
732 filterPanel.add(doReset, gbc2);
734 GridBagConstraints gbc3 = new GridBagConstraints();
736 gbc3.fill = GridBagConstraints.NONE;
737 gbc3.anchor = GridBagConstraints.WEST;
738 filterPanel.add(userOnly, gbc3);
743 private JPanel initLinkTabUrlButtons()
745 // Buttons for new / edit / delete Url links
746 JButton newLink = new JButton();
747 newLink.setText(MessageManager.getString("action.new"));
749 editLink.setText(MessageManager.getString("action.edit"));
751 deleteLink.setText(MessageManager.getString("action.delete"));
753 // no current selection, so initially disable delete/edit buttons
754 editLink.setEnabled(false);
755 deleteLink.setEnabled(false);
757 newLink.addActionListener(new java.awt.event.ActionListener()
760 public void actionPerformed(ActionEvent e)
762 newLink_actionPerformed(e);
766 editLink.setText(MessageManager.getString("action.edit"));
767 editLink.addActionListener(new java.awt.event.ActionListener()
770 public void actionPerformed(ActionEvent e)
772 editLink_actionPerformed(e);
776 deleteLink.setText(MessageManager.getString("action.delete"));
777 deleteLink.addActionListener(new java.awt.event.ActionListener()
780 public void actionPerformed(ActionEvent e)
782 deleteLink_actionPerformed(e);
786 JPanel buttonPanel = new JPanel(new GridBagLayout());
787 buttonPanel.setBorder(new TitledBorder("Edit links"));
788 GridBagConstraints gbc = new GridBagConstraints();
791 gbc.fill = GridBagConstraints.NONE;
792 buttonPanel.add(newLink, gbc);
794 GridBagConstraints gbc1 = new GridBagConstraints();
797 gbc1.fill = GridBagConstraints.NONE;
798 buttonPanel.add(editLink, gbc1);
800 GridBagConstraints gbc2 = new GridBagConstraints();
803 gbc2.fill = GridBagConstraints.NONE;
804 buttonPanel.add(deleteLink, gbc2);
806 GridBagConstraints gbc3 = new GridBagConstraints();
809 gbc3.fill = GridBagConstraints.HORIZONTAL;
811 JPanel spacePanel = new JPanel();
812 spacePanel.setBorder(null);
813 buttonPanel.add(spacePanel, gbc3);
819 * Initialises the proxy server panel in the Connections tab
821 * @return the proxy server panel
823 private JPanel initConnTabProxyPanel()
825 // Label for server text box
826 serverLabel.setText(MessageManager.getString("label.address"));
827 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
828 serverLabel.setFont(LABEL_FONT);
830 // Proxy server and port text boxes
831 proxyServerTB.setFont(LABEL_FONT);
832 proxyPortTB.setFont(LABEL_FONT);
834 // Label for Port text box
835 portLabel.setFont(LABEL_FONT);
836 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
837 portLabel.setText(MessageManager.getString("label.port"));
839 // Use proxy server checkbox
840 useProxy.setFont(LABEL_FONT);
841 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
842 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
843 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
844 useProxy.addActionListener(new ActionListener()
847 public void actionPerformed(ActionEvent e)
849 useProxy_actionPerformed();
853 // Make proxy server panel
854 JPanel proxyPanel = new JPanel();
855 TitledBorder titledBorder1 = new TitledBorder(
856 MessageManager.getString("label.proxy_server"));
857 proxyPanel.setBorder(titledBorder1);
858 proxyPanel.setLayout(new GridBagLayout());
859 proxyPanel.add(serverLabel,
860 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
861 GridBagConstraints.WEST, GridBagConstraints.NONE,
862 new Insets(0, 2, 2, 0), 5, 0));
863 proxyPanel.add(portLabel,
864 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
865 GridBagConstraints.WEST, GridBagConstraints.NONE,
866 new Insets(0, 0, 2, 0), 11, 0));
867 proxyPanel.add(useProxy,
868 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
869 GridBagConstraints.WEST, GridBagConstraints.NONE,
870 new Insets(0, 2, 5, 185), 2, -4));
871 proxyPanel.add(proxyPortTB,
872 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
873 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
874 new Insets(0, 2, 2, 2), 54, 1));
875 proxyPanel.add(proxyServerTB,
876 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
877 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
878 new Insets(0, 2, 2, 0), 263, 1));
884 * Initialises the checkboxes in the Connections tab
886 private void initConnTabCheckboxes()
888 // Usage stats checkbox label
890 MessageManager.getString("label.send_usage_statistics"));
891 usagestats.setFont(LABEL_FONT);
892 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
893 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
895 // Questionnaire checkbox label
896 questionnaire.setText(
897 MessageManager.getString("label.check_for_questionnaires"));
898 questionnaire.setFont(LABEL_FONT);
899 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
900 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
902 // Check for latest version checkbox label
903 versioncheck.setText(
904 MessageManager.getString("label.check_for_latest_version"));
905 versioncheck.setFont(LABEL_FONT);
906 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
907 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
911 * Initialises the parent panel which contains the tabbed sections.
915 private JPanel initOkCancelPanel()
917 JButton ok = new JButton();
918 ok.setText(MessageManager.getString("action.ok"));
919 ok.addActionListener(new ActionListener()
922 public void actionPerformed(ActionEvent e)
924 ok_actionPerformed(e);
927 JButton cancel = new JButton();
928 cancel.setText(MessageManager.getString("action.cancel"));
929 cancel.addActionListener(new ActionListener()
932 public void actionPerformed(ActionEvent e)
934 cancel_actionPerformed(e);
937 JPanel okCancelPanel = new JPanel();
938 okCancelPanel.add(ok);
939 okCancelPanel.add(cancel);
940 return okCancelPanel;
944 * Initialises the Colours tabbed panel.
948 private JPanel initColoursTab()
950 JPanel coloursTab = new JPanel();
951 coloursTab.setBorder(new TitledBorder(
952 MessageManager.getString("action.open_new_alignment")));
953 coloursTab.setLayout(new FlowLayout());
954 JLabel mincolourLabel = new JLabel();
955 mincolourLabel.setFont(LABEL_FONT);
956 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
957 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
958 minColour.setFont(LABEL_FONT);
959 minColour.setBorder(BorderFactory.createEtchedBorder());
960 minColour.setPreferredSize(new Dimension(40, 20));
961 minColour.addMouseListener(new MouseAdapter()
964 public void mousePressed(MouseEvent e)
966 minColour_actionPerformed(minColour);
969 JLabel maxcolourLabel = new JLabel();
970 maxcolourLabel.setFont(LABEL_FONT);
971 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
972 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
973 maxColour.setFont(LABEL_FONT);
974 maxColour.setBorder(BorderFactory.createEtchedBorder());
975 maxColour.setPreferredSize(new Dimension(40, 20));
976 maxColour.addMouseListener(new MouseAdapter()
979 public void mousePressed(MouseEvent e)
981 maxColour_actionPerformed(maxColour);
985 protColour.setFont(LABEL_FONT);
986 protColour.setBounds(new Rectangle(172, 225, 155, 21));
987 JLabel protColourLabel = new JLabel();
988 protColourLabel.setFont(LABEL_FONT);
989 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
990 protColourLabel.setText(
991 MessageManager.getString("label.prot_alignment_colour") + " ");
992 JvSwingUtils.addtoLayout(coloursTab,
994 .getString("label.default_colour_scheme_for_alignment"),
995 protColourLabel, protColour);
997 nucColour.setFont(LABEL_FONT);
998 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
999 JLabel nucColourLabel = new JLabel();
1000 nucColourLabel.setFont(LABEL_FONT);
1001 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1002 nucColourLabel.setText(
1003 MessageManager.getString("label.nuc_alignment_colour") + " ");
1004 JvSwingUtils.addtoLayout(coloursTab,
1006 .getString("label.default_colour_scheme_for_alignment"),
1007 nucColourLabel, nucColour);
1009 JPanel annotationShding = new JPanel();
1010 annotationShding.setBorder(new TitledBorder(
1011 MessageManager.getString("label.annotation_shading_default")));
1012 annotationShding.setLayout(new GridLayout(1, 2));
1013 JvSwingUtils.addtoLayout(annotationShding,
1014 MessageManager.getString(
1015 "label.default_minimum_colour_annotation_shading"),
1016 mincolourLabel, minColour);
1017 JvSwingUtils.addtoLayout(annotationShding,
1018 MessageManager.getString(
1019 "label.default_maximum_colour_annotation_shading"),
1020 maxcolourLabel, maxColour);
1021 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1026 * Initialises the Overview tabbed panel.
1030 private JPanel initOverviewTab()
1032 JPanel overviewPanel = new JPanel();
1033 overviewPanel.setBorder(new TitledBorder(
1034 MessageManager.getString("label.overview_settings")));
1036 gapColour.setFont(LABEL_FONT);
1037 // fixing the border colours stops apparent colour bleed from the panel
1038 gapColour.setBorder(
1039 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1040 gapColour.setPreferredSize(new Dimension(40, 20));
1041 gapColour.addMouseListener(new MouseAdapter()
1044 public void mousePressed(MouseEvent e)
1046 gapColour_actionPerformed(gapColour);
1050 hiddenColour.setFont(LABEL_FONT);
1051 // fixing the border colours stops apparent colour bleed from the panel
1052 hiddenColour.setBorder(
1053 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1054 hiddenColour.setPreferredSize(new Dimension(40, 20));
1055 hiddenColour.addMouseListener(new MouseAdapter()
1058 public void mousePressed(MouseEvent e)
1060 hiddenColour_actionPerformed(hiddenColour);
1064 useLegacyGap = new JCheckBox(
1065 MessageManager.getString("label.ov_legacy_gap"));
1066 useLegacyGap.setFont(LABEL_FONT);
1067 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1068 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1069 gapLabel = new JLabel(
1070 MessageManager.getString("label.gap_colour"));
1071 gapLabel.setFont(LABEL_FONT);
1072 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1073 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1074 showHiddenAtStart = new JCheckBox(
1075 MessageManager.getString("label.ov_show_hide_default"));
1076 showHiddenAtStart.setFont(LABEL_FONT);
1077 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1078 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1079 JLabel hiddenLabel = new JLabel(
1080 MessageManager.getString("label.hidden_colour"));
1081 hiddenLabel.setFont(LABEL_FONT);
1082 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1083 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1085 useLegacyGap.addActionListener(new ActionListener()
1088 public void actionPerformed(ActionEvent e)
1090 useLegacyGaps_actionPerformed(e);
1094 overviewPanel.setLayout(new GridBagLayout());
1095 GridBagConstraints c1 = new GridBagConstraints();
1097 c1.fill = GridBagConstraints.HORIZONTAL;
1102 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1103 overviewPanel.add(useLegacyGap, c1);
1105 GridBagConstraints c2 = new GridBagConstraints();
1106 c2.fill = GridBagConstraints.HORIZONTAL;
1109 c2.insets = new Insets(0, 15, 0, 10);
1110 overviewPanel.add(gapLabel, c2);
1112 GridBagConstraints c3 = new GridBagConstraints();
1113 c3.fill = GridBagConstraints.HORIZONTAL;
1116 c3.insets = new Insets(0, 0, 0, 15);
1117 overviewPanel.add(gapColour, c3);
1119 GridBagConstraints c4 = new GridBagConstraints();
1120 c4.fill = GridBagConstraints.HORIZONTAL;
1124 overviewPanel.add(showHiddenAtStart, c4);
1126 GridBagConstraints c5 = new GridBagConstraints();
1127 c5.fill = GridBagConstraints.HORIZONTAL;
1130 c5.insets = new Insets(0, 15, 0, 10);
1131 overviewPanel.add(hiddenLabel, c5);
1133 GridBagConstraints c6 = new GridBagConstraints();
1134 c6.fill = GridBagConstraints.HORIZONTAL;
1137 c6.insets = new Insets(0, 0, 0, 15);
1138 overviewPanel.add(hiddenColour, c6);
1140 JButton resetButton = new JButton(
1141 MessageManager.getString("label.reset_to_defaults"));
1143 resetButton.addActionListener(new ActionListener()
1146 public void actionPerformed(ActionEvent e)
1148 resetOvDefaults_actionPerformed(e);
1152 GridBagConstraints c7 = new GridBagConstraints();
1153 c7.fill = GridBagConstraints.NONE;
1156 c7.insets = new Insets(10, 0, 0, 0);
1157 c7.anchor = GridBagConstraints.WEST;
1158 overviewPanel.add(resetButton, c7);
1160 // Add padding so the panel doesn't look ridiculous
1161 JPanel spacePanel = new JPanel();
1162 overviewPanel.add(spacePanel,
1163 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1164 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1165 new Insets(0, 0, 0, 5), 0, 0));
1167 return overviewPanel;
1171 * Initialises the Structure tabbed panel.
1175 private JPanel initStructureTab()
1177 structureTab = new JPanel();
1179 structureTab.setBorder(new TitledBorder(
1180 MessageManager.getString("label.structure_options")));
1181 structureTab.setLayout(null);
1182 final int width = 400;
1183 final int height = 22;
1184 final int lineSpacing = 25;
1187 structFromPdb.setFont(LABEL_FONT);
1189 .setText(MessageManager.getString("label.struct_from_pdb"));
1190 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1191 structFromPdb.addActionListener(new ActionListener()
1194 public void actionPerformed(ActionEvent e)
1196 boolean selected = structFromPdb.isSelected();
1197 // enable other options only when the first is checked
1198 useRnaView.setEnabled(selected);
1199 addSecondaryStructure.setEnabled(selected);
1200 addTempFactor.setEnabled(selected);
1203 structureTab.add(structFromPdb);
1205 // indent checkboxes that are conditional on the first one
1206 ypos += lineSpacing;
1207 useRnaView.setFont(LABEL_FONT);
1208 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1209 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1210 structureTab.add(useRnaView);
1212 ypos += lineSpacing;
1213 addSecondaryStructure.setFont(LABEL_FONT);
1214 addSecondaryStructure
1215 .setText(MessageManager.getString("label.autoadd_secstr"));
1216 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1217 structureTab.add(addSecondaryStructure);
1219 ypos += lineSpacing;
1220 addTempFactor.setFont(LABEL_FONT);
1221 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1222 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1223 structureTab.add(addTempFactor);
1225 ypos += lineSpacing;
1226 JLabel viewerLabel = new JLabel();
1227 viewerLabel.setFont(LABEL_FONT);
1228 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1229 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1230 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1231 structureTab.add(viewerLabel);
1233 structViewer.setFont(LABEL_FONT);
1234 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1235 structViewer.addItem(ViewerType.JMOL.name());
1236 structViewer.addItem(ViewerType.CHIMERA.name());
1237 structViewer.addActionListener(new ActionListener()
1240 public void actionPerformed(ActionEvent e)
1242 structureViewer_actionPerformed(
1243 (String) structViewer.getSelectedItem());
1246 structureTab.add(structViewer);
1248 ypos += lineSpacing;
1249 JLabel pathLabel = new JLabel();
1250 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1251 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1252 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1253 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1254 structureTab.add(pathLabel);
1256 chimeraPath.setFont(LABEL_FONT);
1257 chimeraPath.setText("");
1258 final String tooltip = JvSwingUtils.wrapTooltip(true,
1259 MessageManager.getString("label.chimera_path_tip"));
1260 chimeraPath.setToolTipText(tooltip);
1261 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1262 chimeraPath.addMouseListener(new MouseAdapter()
1265 public void mouseClicked(MouseEvent e)
1267 if (e.getClickCount() == 2)
1269 String chosen = openFileChooser();
1272 chimeraPath.setText(chosen);
1277 structureTab.add(chimeraPath);
1279 ypos += lineSpacing;
1280 nwMapping.setFont(LABEL_FONT);
1281 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1282 siftsMapping.setFont(LABEL_FONT);
1283 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1284 mappingMethod.add(nwMapping);
1285 mappingMethod.add(siftsMapping);
1286 JPanel mappingPanel = new JPanel();
1287 mappingPanel.setFont(LABEL_FONT);
1288 TitledBorder mmTitledBorder = new TitledBorder(
1289 MessageManager.getString("label.mapping_method"));
1290 mmTitledBorder.setTitleFont(LABEL_FONT);
1291 mappingPanel.setBorder(mmTitledBorder);
1292 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1293 // GridLayout mappingLayout = new GridLayout();
1294 mappingPanel.setLayout(new GridLayout());
1295 mappingPanel.add(nwMapping);
1296 mappingPanel.add(siftsMapping);
1297 structureTab.add(mappingPanel);
1299 ypos += lineSpacing;
1300 ypos += lineSpacing;
1301 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1302 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1303 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1304 structureTab.add(docFieldPref);
1306 return structureTab;
1310 * Action on choosing a structure viewer from combobox options.
1312 * @param selectedItem
1314 protected void structureViewer_actionPerformed(String selectedItem)
1319 * Show a dialog for the user to choose a file. Returns the chosen path, or
1324 protected String openFileChooser()
1326 String choice = null;
1327 JFileChooser chooser = new JFileChooser();
1329 // chooser.setFileView(new JalviewFileView());
1330 chooser.setDialogTitle(
1331 MessageManager.getString("label.open_local_file"));
1332 chooser.setToolTipText(MessageManager.getString("action.open"));
1334 int value = chooser.showOpenDialog(this);
1336 if (value == JFileChooser.APPROVE_OPTION)
1338 choice = chooser.getSelectedFile().getPath();
1344 * Validate the structure tab preferences; if invalid, set focus on this tab.
1348 protected boolean validateStructure(FocusEvent e)
1350 if (!validateStructure())
1352 e.getComponent().requestFocusInWindow();
1358 protected boolean validateStructure()
1364 * Initialises the Visual tabbed panel.
1368 private JPanel initVisualTab()
1370 JPanel visualTab = new JPanel();
1371 visualTab.setBorder(new TitledBorder(
1372 MessageManager.getString("action.open_new_alignment")));
1373 visualTab.setLayout(null);
1374 fullScreen.setFont(LABEL_FONT);
1375 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1376 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1377 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1378 quality.setEnabled(false);
1379 quality.setFont(LABEL_FONT);
1380 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1381 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1382 quality.setSelected(true);
1383 quality.setText(MessageManager.getString("label.quality"));
1384 conservation.setEnabled(false);
1385 conservation.setFont(LABEL_FONT);
1386 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1387 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1388 conservation.setSelected(true);
1389 conservation.setText(MessageManager.getString("label.conservation"));
1390 identity.setEnabled(false);
1391 identity.setFont(LABEL_FONT);
1392 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1393 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1394 identity.setSelected(true);
1395 identity.setText(MessageManager.getString("label.consensus"));
1396 showOccupancy.setFont(LABEL_FONT);
1397 showOccupancy.setEnabled(false);
1398 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1399 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1400 showOccupancy.setSelected(true);
1401 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1403 JLabel showGroupbits = new JLabel();
1404 showGroupbits.setFont(LABEL_FONT);
1405 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1406 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1408 .setText(MessageManager.getString("action.show_group") + ":");
1409 JLabel showConsensbits = new JLabel();
1410 showConsensbits.setFont(LABEL_FONT);
1411 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1412 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1414 .setText(MessageManager.getString("label.consensus") + ":");
1415 showConsensHistogram.setEnabled(false);
1416 showConsensHistogram.setFont(LABEL_FONT);
1417 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1418 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1419 showConsensHistogram.setSelected(true);
1420 showConsensHistogram
1421 .setText(MessageManager.getString("label.histogram"));
1422 showConsensLogo.setEnabled(false);
1423 showConsensLogo.setFont(LABEL_FONT);
1424 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1425 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1426 showConsensLogo.setSelected(true);
1427 showConsensLogo.setText(MessageManager.getString("label.logo"));
1428 showGroupConsensus.setEnabled(false);
1429 showGroupConsensus.setFont(LABEL_FONT);
1430 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1431 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1432 showGroupConsensus.setSelected(true);
1433 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1434 showGroupConservation.setEnabled(false);
1435 showGroupConservation.setFont(LABEL_FONT);
1436 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1437 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1438 showGroupConservation.setSelected(true);
1439 showGroupConservation
1440 .setText(MessageManager.getString("label.conservation"));
1441 showNpTooltip.setEnabled(true);
1442 showNpTooltip.setFont(LABEL_FONT);
1443 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1444 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1445 showNpTooltip.setSelected(true);
1446 showNpTooltip.setText(
1447 MessageManager.getString("label.non_positional_features"));
1448 showDbRefTooltip.setEnabled(true);
1449 showDbRefTooltip.setFont(LABEL_FONT);
1450 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1451 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1452 showDbRefTooltip.setSelected(true);
1454 .setText(MessageManager.getString("label.database_references"));
1455 annotations.setFont(LABEL_FONT);
1456 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1457 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1458 annotations.setSelected(true);
1459 annotations.setText(MessageManager.getString("label.show_annotations"));
1460 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1461 annotations.addActionListener(new ActionListener()
1464 public void actionPerformed(ActionEvent e)
1466 annotations_actionPerformed(e);
1469 identity.addActionListener(new ActionListener()
1472 public void actionPerformed(ActionEvent e)
1474 annotations_actionPerformed(e);
1477 showGroupConsensus.addActionListener(new ActionListener()
1480 public void actionPerformed(ActionEvent e)
1482 annotations_actionPerformed(e);
1485 showUnconserved.setFont(LABEL_FONT);
1486 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1487 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1488 showUnconserved.setSelected(true);
1490 .setText(MessageManager.getString("action.show_unconserved"));
1491 showUnconserved.addActionListener(new ActionListener()
1494 public void actionPerformed(ActionEvent e)
1496 showunconserved_actionPerformed(e);
1500 // TODO these are not yet added to / action from Preferences
1501 // JCheckBox shareSelections = new JCheckBox();
1502 // shareSelections.setFont(verdana11);
1503 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1504 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1505 // shareSelections.setSelected(true);
1506 // shareSelections.setText(MessageManager
1507 // .getString("label.share_selection_across_views"));
1508 // JCheckBox followHighlight = new JCheckBox();
1509 // followHighlight.setFont(verdana11);
1510 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1511 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1512 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1513 // followHighlight.setSelected(true);
1514 // followHighlight.setText(MessageManager
1515 // .getString("label.scroll_highlighted_regions"));
1517 seqLimit.setFont(LABEL_FONT);
1518 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1519 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1520 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1521 smoothFont.setFont(LABEL_FONT);
1522 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1523 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1524 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1525 scaleProteinToCdna.setFont(LABEL_FONT);
1526 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1527 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1528 scaleProteinToCdna.setText(
1529 MessageManager.getString("label.scale_protein_to_cdna"));
1530 scaleProteinToCdna.setToolTipText(
1531 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1532 JLabel gapLabel = new JLabel();
1533 gapLabel.setFont(LABEL_FONT);
1534 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1535 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1536 JLabel fontLabel = new JLabel();
1537 fontLabel.setFont(LABEL_FONT);
1538 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1539 fontLabel.setText(MessageManager.getString("label.font"));
1540 fontSizeCB.setFont(LABEL_FONT);
1541 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1542 fontStyleCB.setFont(LABEL_FONT);
1543 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1544 fontNameCB.setFont(LABEL_FONT);
1545 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1546 gapSymbolCB.setFont(LABEL_FONT);
1547 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1548 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1549 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1550 gapSymbolCB.setRenderer(dlcr);
1552 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1553 startupCheckbox.setFont(LABEL_FONT);
1554 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1555 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1556 startupCheckbox.setSelected(true);
1557 startupFileTextfield.setFont(LABEL_FONT);
1558 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1559 final String tooltip = JvSwingUtils.wrapTooltip(true,
1560 MessageManager.getString("label.double_click_to_browse"));
1561 startupFileTextfield.setToolTipText(tooltip);
1562 startupFileTextfield.addMouseListener(new MouseAdapter()
1565 public void mouseClicked(MouseEvent e)
1567 if (e.getClickCount() > 1)
1569 startupFileTextfield_mouseClicked();
1574 sortby.setFont(LABEL_FONT);
1575 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1576 JLabel sortLabel = new JLabel();
1577 sortLabel.setFont(LABEL_FONT);
1578 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1579 sortLabel.setText(MessageManager.getString("label.sort_by"));
1580 sortAnnBy.setFont(LABEL_FONT);
1581 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1582 JLabel sortAnnLabel = new JLabel();
1583 sortAnnLabel.setFont(LABEL_FONT);
1584 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1585 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1586 sortAutocalc.setFont(LABEL_FONT);
1587 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1589 JPanel annsettingsPanel = new JPanel();
1590 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1591 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1592 annsettingsPanel.setBorder(new EtchedBorder());
1593 visualTab.add(annsettingsPanel);
1594 Border jb = new EmptyBorder(1, 1, 4, 5);
1595 annotations.setBorder(jb);
1596 showOccupancy.setBorder(jb);
1597 quality.setBorder(jb);
1598 conservation.setBorder(jb);
1599 identity.setBorder(jb);
1600 showConsensbits.setBorder(jb);
1601 showGroupbits.setBorder(jb);
1602 showGroupConsensus.setBorder(jb);
1603 showGroupConservation.setBorder(jb);
1604 showConsensHistogram.setBorder(jb);
1605 showConsensLogo.setBorder(jb);
1607 JPanel autoAnnotSettings = new JPanel();
1608 annsettingsPanel.add(autoAnnotSettings);
1609 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1610 autoAnnotSettings.add(annotations);
1611 autoAnnotSettings.add(quality);
1612 // second row of autoannotation box
1613 autoAnnotSettings = new JPanel();
1614 annsettingsPanel.add(autoAnnotSettings);
1616 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1617 autoAnnotSettings.add(conservation);
1618 autoAnnotSettings.add(identity);
1619 autoAnnotSettings.add(showOccupancy);
1620 autoAnnotSettings.add(showGroupbits);
1621 autoAnnotSettings.add(showGroupConservation);
1622 autoAnnotSettings.add(showGroupConsensus);
1623 autoAnnotSettings.add(showConsensbits);
1624 autoAnnotSettings.add(showConsensHistogram);
1625 autoAnnotSettings.add(showConsensLogo);
1627 JPanel tooltipSettings = new JPanel();
1628 tooltipSettings.setBorder(new TitledBorder(
1629 MessageManager.getString("label.sequence_id_tooltip")));
1630 tooltipSettings.setBounds(173, 140, 220, 62);
1631 tooltipSettings.setLayout(new GridLayout(2, 1));
1632 tooltipSettings.add(showDbRefTooltip);
1633 tooltipSettings.add(showNpTooltip);
1634 visualTab.add(tooltipSettings);
1636 wrap.setFont(LABEL_FONT);
1637 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1638 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1639 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1640 rightAlign.setFont(LABEL_FONT);
1641 rightAlign.setForeground(Color.black);
1642 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1643 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1644 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1645 idItalics.setFont(LABEL_FONT_ITALIC);
1646 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1647 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1649 MessageManager.getString("label.sequence_name_italics"));
1650 openoverv.setFont(LABEL_FONT);
1651 openoverv.setActionCommand(
1652 MessageManager.getString("label.open_overview"));
1653 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1654 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1655 openoverv.setText(MessageManager.getString("label.open_overview"));
1656 JPanel jPanel2 = new JPanel();
1657 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1658 jPanel2.setLayout(new GridLayout(14, 1));
1659 jPanel2.add(fullScreen);
1660 jPanel2.add(openoverv);
1661 jPanel2.add(seqLimit);
1662 jPanel2.add(rightAlign);
1663 jPanel2.add(fontLabel);
1664 jPanel2.add(showUnconserved);
1665 jPanel2.add(idItalics);
1666 jPanel2.add(smoothFont);
1667 jPanel2.add(scaleProteinToCdna);
1668 jPanel2.add(gapLabel);
1670 jPanel2.add(sortLabel);
1671 jPanel2.add(sortAnnLabel);
1672 jPanel2.add(startupCheckbox);
1673 visualTab.add(jPanel2);
1674 visualTab.add(startupFileTextfield);
1675 visualTab.add(sortby);
1676 visualTab.add(sortAnnBy);
1677 visualTab.add(sortAutocalc);
1678 visualTab.add(gapSymbolCB);
1679 visualTab.add(fontNameCB);
1680 visualTab.add(fontSizeCB);
1681 visualTab.add(fontStyleCB);
1686 * Initialises the Backups tabbed panel.
1690 private JPanel initBackupsTab()
1692 JPanel backupsTab = new JPanel();
1693 // backupsTab.setBorder(new TitledBorder(MessageManager
1694 // .getString("label.backup_files")));
1695 backupsTab.setLayout(new GridBagLayout());
1697 enableBackupFiles.setFont(LABEL_FONT);
1698 enableBackupFiles.setText(
1699 MessageManager.getString("label.enable_backupfiles"));
1700 enableBackupFiles.addActionListener(new ActionListener()
1703 public void actionPerformed(ActionEvent e)
1705 boolean selected = enableBackupFiles.isSelected();
1706 // enable other options only when the first is checked
1707 backupsOptionsSetEnabled(selected);
1711 GridBagConstraints gbc = new GridBagConstraints();
1714 gbc.anchor = GridBagConstraints.NORTHWEST;
1715 gbc.fill = GridBagConstraints.NONE;
1717 // enable checkbox 1 row
1720 backupsTab.add(enableBackupFiles, gbc);
1722 initBackupsTabSuffixPanel();
1723 initBackupsTabKeepFilesPanel();
1724 initBackupsTabFilenameExamplesPanel();
1727 // set widths of the panels to the max one
1728 int maxw = suffixPanel.getWidth();
1729 if (maxw < keepfilesPanel.getWidth())
1731 maxw = keepfilesPanel.getWidth();
1733 if (maxw < exampleFilesPanel.getWidth())
1735 maxw = exampleFilesPanel.getWidth();
1737 suffixPanel.setSize(suffixPanel.getHeight(), maxw);
1738 keepfilesPanel.setSize(keepfilesPanel.getHeight(), maxw);
1739 exampleFilesPanel.setSize(exampleFilesPanel.getHeight(), maxw);
1742 // whole suffix panel next row
1744 backupsTab.add(suffixPanel, gbc);
1748 backupsTab.add(keepfilesPanel, gbc);
1750 // whole examples panel next row
1752 backupsTab.add(exampleFilesPanel, gbc);
1757 backupsTab.add(new JPanel(), gbc);
1759 backupsOptionsSetEnabled(enableBackupFiles.isSelected());
1764 public JPanel initBackupsTabSuffixPanel()
1766 suffixPanel.setBorder(new TitledBorder(
1767 MessageManager.getString("label.suffix_format")));
1768 suffixPanel.setLayout(new GridBagLayout());
1771 .setText(MessageManager.getString("label.suffix_template"));
1772 suffixTemplateLabel.setHorizontalAlignment(SwingConstants.LEFT);
1773 suffixTemplateLabel.setFont(LABEL_FONT);
1775 final String tooltip = JvSwingUtils.wrapTooltip(true, MessageManager
1776 .getString("label.suffix_template_tooltip"));
1777 suffixTemplate.setToolTipText(tooltip);
1778 suffixTemplate.addActionListener(new ActionListener()
1781 public void actionPerformed(ActionEvent e)
1783 updateBackupFilesExampleLabel();
1787 KeyListener kl = new KeyListener()
1790 public void keyReleased(KeyEvent e)
1792 updateBackupFilesExampleLabel();
1796 public void keyPressed(KeyEvent e)
1800 // disable use of ':'
1802 public void keyTyped(KeyEvent e)
1804 char c = e.getKeyChar();
1807 // don't process ':'
1813 suffixTemplate.addKeyListener(kl);
1817 .setText(MessageManager.getString("label.index_digits"));
1818 suffixDigitsLabel.setHorizontalAlignment(SwingConstants.LEFT);
1819 suffixDigitsLabel.setFont(LABEL_FONT);
1823 defaultmin = Integer.parseInt(
1824 MessageManager.getString("default.suffix_index_digits_min"));
1825 } catch (Exception e)
1829 "Exception setting suffix digits min from default.suffix_index_digits_min label, setting to "
1834 defaultmax = Integer.parseInt(
1835 MessageManager.getString("default.suffix_index_digits_max"));
1836 } catch (Exception e) {
1839 "Exception setting suffix digits max from default.suffix_index_digits_max label, setting to "
1842 ChangeListener c = new ChangeListener()
1845 public void stateChanged(ChangeEvent e)
1847 updateBackupFilesExampleLabel();
1851 setIntegerSpinner(suffixDigitsSpinner, defaultmin, defaultmax, 3, c);
1853 suffixReverse.setLabels(
1854 MessageManager.getString("label.reverse_roll"),
1855 MessageManager.getString("label.increment_index"));
1856 suffixReverse.addActionListener(new ActionListener()
1859 public void actionPerformed(ActionEvent e)
1861 updateBackupFilesExampleLabel();
1865 GridBagConstraints sgbc = new GridBagConstraints();
1867 // first row (template text box)
1868 sgbc.anchor = GridBagConstraints.WEST;
1872 sgbc.gridheight = 1;
1875 sgbc.fill = GridBagConstraints.NONE;
1876 suffixPanel.add(suffixTemplateLabel,sgbc);
1879 sgbc.fill = GridBagConstraints.HORIZONTAL;
1880 suffixPanel.add(suffixTemplate, sgbc);
1882 // second row (number of digits spinner)
1886 sgbc.fill = GridBagConstraints.NONE;
1887 suffixPanel.add(suffixDigitsLabel, sgbc);
1890 sgbc.fill = GridBagConstraints.HORIZONTAL;
1891 suffixPanel.add(suffixDigitsSpinner, sgbc);
1893 // third row (forward order radio selection)
1896 sgbc.gridwidth = GridBagConstraints.REMAINDER;
1897 sgbc.fill = GridBagConstraints.HORIZONTAL;
1898 suffixPanel.add(suffixReverse.getFalseButton(), sgbc);
1900 // fourth row (reverse order radio selection)
1902 suffixPanel.add(suffixReverse.getTrueButton(), sgbc);
1906 private JPanel initBackupsTabKeepFilesPanel()
1908 keepfilesPanel.setBorder(
1909 new TitledBorder(MessageManager.getString("label.keep_files")));
1910 keepfilesPanel.setLayout(new GridBagLayout());
1912 backupfilesKeepAll.setLabels(
1913 MessageManager.getString("label.keep_all_backup_files"),
1914 MessageManager.getString(
1915 "label.keep_only_this_number_of_backup_files"));
1916 backupfilesKeepAll.addTrueActionListener(new ActionListener()
1919 public void actionPerformed(ActionEvent e)
1921 updateBackupFilesExampleLabel();
1924 backupfilesKeepAll.addActionListener(new ActionListener()
1927 public void actionPerformed(ActionEvent e)
1929 boolean selected = backupfilesKeepAll.isSelected();
1930 keepRollMaxOptionsEnabled(!selected);
1931 updateBackupFilesExampleLabel();
1935 ChangeListener c = new ChangeListener()
1938 public void stateChanged(ChangeEvent e)
1940 updateBackupFilesExampleLabel();
1944 setIntegerSpinner(backupfilesRollMaxSpinner, 1, 999, 4, true, c);
1946 backupfilesConfirmDelete.setLabels(
1947 MessageManager.getString("label.confirm_delete"),
1948 MessageManager.getString("label.auto_delete"));
1949 // update the enabled section
1950 keepRollMaxOptionsEnabled(!backupfilesKeepAll.isSelected());
1952 GridBagConstraints kgbc = new GridBagConstraints();
1954 // first row (template text box)
1955 kgbc.anchor = GridBagConstraints.WEST;
1958 kgbc.gridwidth = GridBagConstraints.REMAINDER;
1959 kgbc.gridheight = 1;
1962 kgbc.fill = GridBagConstraints.HORIZONTAL;
1963 keepfilesPanel.add(backupfilesKeepAll.getTrueButton(), kgbc);
1969 kgbc.gridwidth = GridBagConstraints.RELATIVE;
1970 keepfilesPanel.add(backupfilesKeepAll.getFalseButton(), kgbc);
1973 kgbc.gridwidth = GridBagConstraints.REMAINDER;
1974 keepfilesPanel.add(backupfilesRollMaxSpinner, kgbc);
1976 // third row (indented)
1978 kgbc.insets = new Insets(0, 20, 0, 0);
1981 kgbc.gridwidth = GridBagConstraints.REMAINDER;
1982 kgbc.fill = GridBagConstraints.HORIZONTAL;
1985 keepfilesPanel.add(backupfilesConfirmDelete.getTrueButton(), kgbc);
1987 // fourth row (indented)
1989 keepfilesPanel.add(backupfilesConfirmDelete.getFalseButton(), kgbc);
1992 JPanel jp = new JPanel();
1993 jp.setLayout(new FlowLayout());
1995 .setText(MessageManager.getString("label.old_backup_files"));
1996 oldBackupFilesLabel.setFont(LABEL_FONT);
1997 oldBackupFilesLabel.setHorizontalAlignment(SwingConstants.LEFT);
1998 jp.add(oldBackupFilesLabel);
1999 jp.add(backupfilesConfirmDelete.getTrueButton());
2000 jp.add(backupfilesConfirmDelete.getFalseButton());
2001 keepfilesPanel.add(jp, kgbc);
2003 return keepfilesPanel;
2006 private JPanel initBackupsTabFilenameExamplesPanel()
2008 exampleFilesPanel.setBorder(new TitledBorder(
2009 MessageManager.getString("label.example_filenames")));
2010 exampleFilesPanel.setLayout(new GridBagLayout());
2013 exampleLabel.setText(
2014 MessageManager.getString("label.suffix_example_filenames"));
2015 exampleLabel.setFont(LABEL_FONT);
2016 exampleLabel.setHorizontalAlignment(SwingConstants.LEFT);
2019 backupfilesExampleLabel.setEditable(false);
2020 backupfilesExampleLabel.setPreferredSize(new Dimension(400, 85));
2021 backupfilesExampleLabel.setAlignmentX(LEFT_ALIGNMENT);
2022 backupfilesExampleLabel.setAlignmentY(TOP_ALIGNMENT);
2024 backupfilesExampleLabel.setFont(LABEL_FONT_ITALIC);
2025 backupfilesExampleLabel.setBackground(exampleLabel.getBackground());
2027 updateBackupFilesExampleLabel();
2029 GridBagConstraints gbc = new GridBagConstraints();
2030 gbc.anchor = GridBagConstraints.WEST;
2031 gbc.fill = GridBagConstraints.NONE;
2035 exampleFilesPanel.add(exampleLabel, gbc);
2038 exampleFilesPanel.add(backupfilesExampleLabel, gbc);
2039 return exampleFilesPanel;
2042 private void updateBackupFilesExampleLabel()
2044 int exampleindex = 12;
2045 String base = "filename";
2046 String extension = ".fa";
2048 String suffix = suffixTemplate.getText();
2051 suffixDigitsSpinner.commitEdit();
2052 digits = (Integer) suffixDigitsSpinner.getValue();
2053 digits = digits < 1 ? 1 : digits;
2054 } catch (Exception e)
2056 System.out.println("Failed casting (Integer) suffixTemplateSpinner.getValue()");
2058 boolean reverse = suffixReverse.isSelected();
2059 boolean keepAll = backupfilesKeepAll.isSelected();
2063 backupfilesRollMaxSpinner.commitEdit();
2064 rollMax = (Integer) backupfilesRollMaxSpinner.getValue();
2065 rollMax = rollMax < 1 ? 1 : rollMax;
2066 } catch (Exception e)
2069 "Failed casting (Integer) backupfilesRollMaxSpinner.getValue()");
2073 StringBuilder exampleSB = new StringBuilder();
2074 boolean firstLine = true;
2079 int max = keepAll ? exampleindex : rollMax;
2080 for (int index = min; index <= max; index++)
2082 if (index == min + surround && index < max)
2084 exampleSB.append("\n...");
2086 else if (index > min + surround && index < max)
2098 exampleSB.append("\n");
2100 exampleSB.append(BackupFilenameFilter.getBackupFilename(index,
2101 base, suffix, digits, extension));
2104 // no extra text needed
2106 else if (index == min)
2108 exampleSB.append(" (most recent)");
2110 else if (index == max)
2112 exampleSB.append(" (oldest)");
2120 int min = (keepAll || exampleindex - rollMax < 0) ? 1
2121 : exampleindex - rollMax + 1;
2122 int max = exampleindex;
2124 for (int index = min; index <= max; index++)
2127 if (index == min + surround && index < max)
2129 exampleSB.append("\n...");
2131 else if (index > min + surround && index < max)
2143 exampleSB.append("\n");
2145 exampleSB.append(BackupFilenameFilter.getBackupFilename(index,
2146 base, suffix, digits, extension));
2149 // no extra text needed
2151 else if (index == min)
2153 exampleSB.append(" (oldest)");
2155 else if (index == max)
2157 exampleSB.append(" (most recent)");
2164 backupfilesExampleLabel.setText(exampleSB.toString());
2167 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2168 boolean useExistingVal, ChangeListener c)
2175 i = Integer.parseInt((String) s.getValue());
2176 } catch (Exception e)
2179 "Exception casting the initial value of s.getValue()");
2183 setIntegerSpinner(s, min, max, i, c);
2186 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2189 // integer spinner for number of digits
2194 SpinnerModel sModel = new SpinnerNumberModel(def, min, max, 1);
2197 s.addChangeListener(c);
2201 public static int getSpinnerInt(JSpinner s, int def)
2207 i = (Integer) s.getValue();
2208 } catch (Exception e)
2210 System.out.println("Failed casting (Integer) JSpinner s.getValue()");
2215 private void keepRollMaxOptionsEnabled(boolean enabled)
2217 oldBackupFilesLabel.setEnabled(enabled);
2218 backupfilesRollMaxSpinner.setEnabled(enabled);
2219 backupfilesConfirmDelete.setEnabled(enabled);
2223 protected void backupsOptionsSetEnabled(boolean enabled)
2225 suffixPanel.setEnabled(enabled);
2226 keepfilesPanel.setEnabled(enabled);
2227 exampleFilesPanel.setEnabled(enabled);
2229 suffixTemplate.setEnabled(enabled);
2230 suffixTemplateLabel.setEnabled(enabled);
2231 suffixDigitsLabel.setEnabled(enabled);
2232 suffixDigitsSpinner.setEnabled(enabled);
2233 suffixReverse.setEnabled(enabled);
2234 backupfilesKeepAll.setEnabled(enabled);
2235 backupfilesRollMaxSpinner.setEnabled(enabled);
2236 oldBackupFilesLabel.setEnabled(enabled);
2237 backupfilesConfirmDelete.setEnabled(enabled);
2238 exampleLabel.setEnabled(enabled);
2239 backupfilesExampleLabel.setEnabled(enabled);
2241 keepRollMaxOptionsEnabled(enabled && !backupfilesKeepAll.isSelected());
2244 protected void autoIdWidth_actionPerformed()
2246 // TODO Auto-generated method stub
2250 protected void userIdWidth_actionPerformed()
2252 // TODO Auto-generated method stub
2256 protected void maxColour_actionPerformed(JPanel panel)
2260 protected void minColour_actionPerformed(JPanel panel)
2264 protected void gapColour_actionPerformed(JPanel panel)
2268 protected void hiddenColour_actionPerformed(JPanel panel)
2272 protected void showunconserved_actionPerformed(ActionEvent e)
2274 // TODO Auto-generated method stub
2278 protected void useLegacyGaps_actionPerformed(ActionEvent e)
2282 protected void resetOvDefaults_actionPerformed(ActionEvent e)
2292 public void ok_actionPerformed(ActionEvent e)
2302 public void cancel_actionPerformed(ActionEvent e)
2312 public void annotations_actionPerformed(ActionEvent e)
2319 public void startupFileTextfield_mouseClicked()
2323 public void newLink_actionPerformed(ActionEvent e)
2328 public void editLink_actionPerformed(ActionEvent e)
2333 public void deleteLink_actionPerformed(ActionEvent e)
2338 public void defaultBrowser_mouseClicked(MouseEvent e)
2343 public void linkURLList_keyTyped(KeyEvent e)
2348 public void useProxy_actionPerformed()
2350 boolean enabled = useProxy.isSelected();
2351 portLabel.setEnabled(enabled);
2352 serverLabel.setEnabled(enabled);
2353 proxyServerTB.setEnabled(enabled);
2354 proxyPortTB.setEnabled(enabled);
2358 * Customer renderer for JTable: supports column of radio buttons
2360 public class RadioButtonRenderer extends JRadioButton
2361 implements TableCellRenderer
2363 public RadioButtonRenderer()
2365 setHorizontalAlignment(CENTER);
2366 setToolTipText(MessageManager.getString("label.urltooltip"));
2370 public Component getTableCellRendererComponent(JTable table,
2371 Object value, boolean isSelected, boolean hasFocus, int row,
2374 setSelected((boolean) value);
2376 // set colours to match rest of table
2379 setBackground(table.getSelectionBackground());
2380 setForeground(table.getSelectionForeground());
2384 setBackground(table.getBackground());
2385 setForeground(table.getForeground());
2392 * Customer cell editor for JTable: supports column of radio buttons in
2393 * conjunction with renderer
2395 public class RadioButtonEditor extends AbstractCellEditor
2396 implements TableCellEditor
2398 private JRadioButton button = new JRadioButton();
2400 public RadioButtonEditor()
2402 button.setHorizontalAlignment(SwingConstants.CENTER);
2403 this.button.addActionListener(new ActionListener()
2406 public void actionPerformed(ActionEvent e)
2408 fireEditingStopped();
2414 public Component getTableCellEditorComponent(JTable table, Object value,
2415 boolean isSelected, int row, int column)
2417 button.setSelected((boolean) value);
2422 public Object getCellEditorValue()
2424 return button.isSelected();