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.bin.Cache;
24 import jalview.fts.core.FTSDataColumnPreferences;
25 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
26 import jalview.fts.service.pdb.PDBFTSRestClient;
27 import jalview.gui.Desktop;
28 import jalview.gui.JalviewBooleanRadioButtons;
29 import jalview.gui.JvOptionPane;
30 import jalview.gui.JvSwingUtils;
31 import jalview.gui.StructureViewer.ViewerType;
32 import jalview.io.BackupFilenameParts;
33 import jalview.io.BackupFiles;
34 import jalview.io.BackupFilesPresetEntry;
35 import jalview.io.IntKeyStringValueEntry;
36 import jalview.util.MessageManager;
37 import jalview.util.Platform;
39 import java.awt.BorderLayout;
40 import java.awt.Color;
41 import java.awt.Component;
42 import java.awt.Dimension;
43 import java.awt.FlowLayout;
45 import java.awt.GridBagConstraints;
46 import java.awt.GridBagLayout;
47 import java.awt.GridLayout;
48 import java.awt.Insets;
49 import java.awt.Rectangle;
50 import java.awt.event.ActionEvent;
51 import java.awt.event.ActionListener;
52 import java.awt.event.KeyEvent;
53 import java.awt.event.KeyListener;
54 import java.awt.event.MouseAdapter;
55 import java.awt.event.MouseEvent;
56 import java.util.Arrays;
57 import java.util.List;
59 import javax.swing.AbstractButton;
60 import javax.swing.AbstractCellEditor;
61 import javax.swing.BorderFactory;
62 import javax.swing.BoxLayout;
63 import javax.swing.ButtonGroup;
64 import javax.swing.DefaultListCellRenderer;
65 import javax.swing.JButton;
66 import javax.swing.JCheckBox;
67 import javax.swing.JComboBox;
68 import javax.swing.JComponent;
69 import javax.swing.JFileChooser;
70 import javax.swing.JLabel;
71 import javax.swing.JPanel;
72 import javax.swing.JRadioButton;
73 import javax.swing.JScrollPane;
74 import javax.swing.JSpinner;
75 import javax.swing.JTabbedPane;
76 import javax.swing.JTable;
77 import javax.swing.JTextArea;
78 import javax.swing.JTextField;
79 import javax.swing.ListSelectionModel;
80 import javax.swing.SpinnerModel;
81 import javax.swing.SpinnerNumberModel;
82 import javax.swing.SwingConstants;
83 import javax.swing.border.Border;
84 import javax.swing.border.EmptyBorder;
85 import javax.swing.border.EtchedBorder;
86 import javax.swing.border.TitledBorder;
87 import javax.swing.event.ChangeEvent;
88 import javax.swing.event.ChangeListener;
89 import javax.swing.table.TableCellEditor;
90 import javax.swing.table.TableCellRenderer;
92 import net.miginfocom.swing.MigLayout;
95 * Base class for the Preferences panel.
100 public class GPreferences extends JPanel
102 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
104 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
105 .getLabelFont(false, true);
107 private static final Font LABEL_FONT_BOLD = JvSwingUtils
108 .getLabelFont(true, false);
111 * Visual tab components
113 protected JCheckBox fullScreen = new JCheckBox();
115 protected JCheckBox openoverv = new JCheckBox();
117 protected JCheckBox seqLimit = new JCheckBox();
119 protected JCheckBox rightAlign = new JCheckBox();
121 protected JComboBox<String> fontSizeCB = new JComboBox<>();
123 protected JComboBox<String> fontStyleCB = new JComboBox<>();
125 protected JComboBox<String> fontNameCB = new JComboBox<>();
127 protected JCheckBox showOccupancy = new JCheckBox();
129 protected JCheckBox showUnconserved = new JCheckBox();
131 protected JCheckBox idItalics = new JCheckBox();
133 protected JCheckBox smoothFont = new JCheckBox();
135 protected JCheckBox scaleProteinToCdna = new JCheckBox();
137 protected JComboBox<String> gapSymbolCB = new JComboBox<>();
139 protected JCheckBox wrap = new JCheckBox();
141 protected JComboBox<String> sortby = new JComboBox<>();
143 protected JComboBox<String> sortAnnBy = new JComboBox<>();
145 protected JComboBox<String> sortAutocalc = new JComboBox<>();
147 protected JCheckBox startupCheckbox = new JCheckBox();
149 protected JTextField startupFileTextfield = new JTextField();
151 // below are in the 'second column'
152 protected JCheckBox annotations = new JCheckBox();
154 protected JCheckBox quality = new JCheckBox();
156 protected JCheckBox conservation = new JCheckBox();
158 protected JCheckBox identity = new JCheckBox();
160 protected JCheckBox showGroupConsensus = new JCheckBox();
162 protected JCheckBox showGroupConservation = new JCheckBox();
164 protected JCheckBox showConsensHistogram = new JCheckBox();
166 protected JCheckBox showConsensLogo = new JCheckBox();
168 protected JCheckBox showInformationHistogram = new JCheckBox();
170 protected JCheckBox showHMMLogo = new JCheckBox();
172 protected JCheckBox showDbRefTooltip = new JCheckBox();
174 protected JCheckBox showNpTooltip = new JCheckBox();
178 * Structure tab and components
180 protected JPanel structureTab;
182 protected JCheckBox structFromPdb = new JCheckBox();
184 protected JCheckBox useRnaView = new JCheckBox();
186 protected JCheckBox addSecondaryStructure = new JCheckBox();
188 protected JCheckBox addTempFactor = new JCheckBox();
190 protected JComboBox<String> structViewer = new JComboBox<>();
192 protected JTextField chimeraPath = new JTextField();
194 protected ButtonGroup mappingMethod = new ButtonGroup();
196 protected JRadioButton siftsMapping = new JRadioButton();
198 protected JRadioButton nwMapping = new JRadioButton();
201 * Colours tab components
203 protected JPanel minColour = new JPanel();
205 protected JPanel maxColour = new JPanel();
207 protected JComboBox<String> protColour = new JComboBox<>();
209 protected JComboBox<String> nucColour = new JComboBox<>();
212 * Overview tab components
214 protected JPanel gapColour = new JPanel();
216 protected JPanel hiddenColour = new JPanel();
218 protected JCheckBox useLegacyGap;
220 protected JCheckBox showHiddenAtStart;
222 protected JLabel gapLabel;
225 * Connections tab components
227 protected JTable linkUrlTable = new JTable();
229 protected JButton editLink = new JButton();
231 protected JButton deleteLink = new JButton();
233 protected JTextField filterTB = new JTextField();
235 protected JButton doReset = new JButton();
237 protected JButton userOnly = new JButton();
239 protected JLabel portLabel = new JLabel();
241 protected JLabel serverLabel = new JLabel();
243 protected JTextField proxyServerTB = new JTextField();
245 protected JTextField proxyPortTB = new JTextField();
247 protected JTextField defaultBrowser = new JTextField();
249 protected JCheckBox useProxy = new JCheckBox();
251 protected JCheckBox usagestats = new JCheckBox();
253 protected JCheckBox questionnaire = new JCheckBox();
255 protected JCheckBox versioncheck = new JCheckBox();
258 * Output tab components
260 protected JComboBox<Object> epsRendering = new JComboBox<>();
262 protected JComboBox<Object> htmlRendering = new JComboBox<>();
264 protected JComboBox<Object> svgRendering = new JComboBox<>();
266 protected JLabel userIdWidthlabel = new JLabel();
268 protected JCheckBox autoIdWidth = new JCheckBox();
270 protected JTextField userIdWidth = new JTextField();
272 protected JCheckBox blcjv = new JCheckBox();
274 protected JCheckBox pileupjv = new JCheckBox();
276 protected JCheckBox clustaljv = new JCheckBox();
278 protected JCheckBox msfjv = new JCheckBox();
280 protected JCheckBox fastajv = new JCheckBox();
282 protected JCheckBox pfamjv = new JCheckBox();
284 protected JCheckBox pirjv = new JCheckBox();
286 protected JCheckBox modellerOutput = new JCheckBox();
288 protected JCheckBox embbedBioJSON = new JCheckBox();
291 * Editing tab components
293 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
295 protected JCheckBox padGaps = new JCheckBox();
297 protected JCheckBox sortByTree = new JCheckBox();
300 * hmmer tab and components
302 protected JPanel hmmerTab;
304 protected JCheckBox hmmrTrimTermini;
306 protected AbstractButton hmmerBackgroundUniprot;
308 protected AbstractButton hmmerBackgroundAlignment;
310 protected JTextField hmmerSequenceCount;
312 protected JTextField hmmerPath;
314 protected JTextField cygwinPath;
319 protected JPanel wsTab = new JPanel();
321 protected JPanel slivkaTab = new JPanel();
324 * Backups tab components
325 * a lot of these are member variables instead of local variables only so that they
326 * can be enabled/disabled easily in one go
329 protected JCheckBox enableBackupFiles = new JCheckBox();
331 protected JPanel presetsPanel = new JPanel();
333 protected JLabel presetsComboLabel = new JLabel();
335 protected JCheckBox customiseCheckbox = new JCheckBox();
337 protected JButton revertButton = new JButton();
339 protected JComboBox<Object> backupfilesPresetsCombo = new JComboBox<>();
341 private int backupfilesPresetsComboLastSelected = 0;
343 protected JPanel suffixPanel = new JPanel();
345 protected JPanel keepfilesPanel = new JPanel();
347 protected JPanel exampleFilesPanel = new JPanel();
349 protected JTextField suffixTemplate = new JTextField(null, 8);
351 protected JLabel suffixTemplateLabel = new JLabel();
353 protected JLabel suffixDigitsLabel = new JLabel();
355 protected JSpinner suffixDigitsSpinner = new JSpinner();
357 protected JalviewBooleanRadioButtons suffixReverse = new JalviewBooleanRadioButtons();
359 protected JalviewBooleanRadioButtons backupfilesKeepAll = new JalviewBooleanRadioButtons();
361 public JSpinner backupfilesRollMaxSpinner = new JSpinner();
363 protected JLabel oldBackupFilesLabel = new JLabel();
365 protected JalviewBooleanRadioButtons backupfilesConfirmDelete = new JalviewBooleanRadioButtons();
367 protected JTextArea backupfilesExampleLabel = new JTextArea();
370 * Creates a new GPreferences object.
372 public GPreferences()
377 } catch (Exception ex)
379 ex.printStackTrace();
384 * Construct the panel and its tabbed sub-panels.
388 private void jbInit() throws Exception
390 final JTabbedPane tabbedPane = new JTabbedPane();
391 this.setLayout(new BorderLayout());
392 JPanel okCancelPanel = initOkCancelPanel();
393 this.add(tabbedPane, BorderLayout.CENTER);
394 this.add(okCancelPanel, BorderLayout.SOUTH);
396 tabbedPane.add(initVisualTab(),
397 MessageManager.getString("label.visual"));
399 tabbedPane.add(initColoursTab(),
400 MessageManager.getString("label.colours"));
402 tabbedPane.add(initOverviewTab(),
403 MessageManager.getString("label.overview"));
405 tabbedPane.add(initStructureTab(),
406 MessageManager.getString("label.structure"));
408 tabbedPane.add(initConnectionsTab(),
409 MessageManager.getString("label.connections"));
411 if (!Platform.isJS())
413 tabbedPane.add(initBackupsTab(),
414 MessageManager.getString("label.backups"));
417 tabbedPane.add(initLinksTab(),
418 MessageManager.getString("label.urllinks"));
420 tabbedPane.add(initOutputTab(),
421 MessageManager.getString("label.output"));
423 tabbedPane.add(initEditingTab(),
424 MessageManager.getString("label.editing"));
426 tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
429 * See WsPreferences for the real work of configuring this tab.
431 if (!Platform.isJS())
433 wsTab.setLayout(new BorderLayout());
434 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
435 slivkaTab.setLayout(new BorderLayout());
436 tabbedPane.add(slivkaTab, "Slivka Services");
440 * Handler to validate a tab before leaving it - currently only for
443 tabbedPane.addChangeListener(new ChangeListener()
445 private Component lastTab;
448 public void stateChanged(ChangeEvent e)
450 if (lastTab == structureTab
451 && tabbedPane.getSelectedComponent() != structureTab)
453 if (!validateStructure())
455 tabbedPane.setSelectedComponent(structureTab);
459 lastTab = tabbedPane.getSelectedComponent();
466 * Initialises the Editing tabbed panel.
470 private JPanel initEditingTab()
472 JPanel editingTab = new JPanel();
473 editingTab.setLayout(null);
474 autoCalculateConsCheck.setFont(LABEL_FONT);
475 autoCalculateConsCheck.setText(
476 MessageManager.getString("label.autocalculate_consensus"));
477 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
478 padGaps.setFont(LABEL_FONT);
480 MessageManager.getString("label.pad_gaps_when_editing"));
481 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
482 sortByTree.setFont(LABEL_FONT);
484 .setText(MessageManager.getString("label.sort_with_new_tree"));
485 sortByTree.setToolTipText(MessageManager.getString(
486 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
487 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
488 editingTab.add(autoCalculateConsCheck);
489 editingTab.add(padGaps);
490 editingTab.add(sortByTree);
495 * Initialises the hmmer tabbed panel
499 private JPanel initHMMERTab()
501 hmmerTab = new JPanel();
502 hmmerTab.setLayout(new BoxLayout(hmmerTab, BoxLayout.Y_AXIS));
503 hmmerTab.setLayout(new MigLayout("flowy"));
506 * path to hmmer binaries folder
508 JPanel installationPanel = new JPanel(new MigLayout("flowy"));
509 // new FlowLayout(FlowLayout.LEFT));
510 JvSwingUtils.createTitledBorder(installationPanel,
511 MessageManager.getString("label.installation"), true);
512 hmmerTab.add(installationPanel);
513 JLabel hmmerLocation = new JLabel(
514 MessageManager.getString("label.hmmer_location"));
515 hmmerLocation.setFont(LABEL_FONT);
516 final int pathFieldLength = 40;
517 hmmerPath = new JTextField(pathFieldLength);
518 hmmerPath.addMouseListener(new MouseAdapter()
521 public void mouseClicked(MouseEvent e)
523 if (e.getClickCount() == 2)
525 String chosen = openFileChooser(true);
528 hmmerPath.setText(chosen);
534 installationPanel.add(hmmerLocation);
535 installationPanel.add(hmmerPath);
538 * path to Cygwin binaries folder (for Windows)
540 if (Platform.isWindowsAndNotJS())
542 JLabel cygwinLocation = new JLabel(
543 MessageManager.getString("label.cygwin_location"));
544 cygwinLocation.setFont(LABEL_FONT);
545 cygwinPath = new JTextField(pathFieldLength);
546 cygwinPath.addMouseListener(new MouseAdapter()
549 public void mouseClicked(MouseEvent e)
551 if (e.getClickCount() == 2)
553 String chosen = openFileChooser(true);
556 cygwinPath.setText(chosen);
557 validateCygwinPath();
562 installationPanel.add(cygwinLocation);
563 installationPanel.add(cygwinPath);
567 * preferences for hmmalign
569 JPanel alignOptionsPanel = new JPanel(new MigLayout());
570 // new FlowLayout(FlowLayout.LEFT));
571 JvSwingUtils.createTitledBorder(alignOptionsPanel,
572 MessageManager.getString("label.hmmalign_options"), true);
573 hmmerTab.add(alignOptionsPanel);
574 hmmrTrimTermini = new JCheckBox();
575 hmmrTrimTermini.setFont(LABEL_FONT);
576 hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
577 alignOptionsPanel.add(hmmrTrimTermini);
580 * preferences for hmmsearch
582 JPanel searchOptions = new JPanel(new MigLayout());
583 // FlowLayout(FlowLayout.LEFT));
584 JvSwingUtils.createTitledBorder(searchOptions,
585 MessageManager.getString("label.hmmsearch_options"), true);
586 hmmerTab.add(searchOptions);
587 JLabel sequencesToKeep = new JLabel(
588 MessageManager.getString("label.no_of_sequences"));
589 sequencesToKeep.setFont(LABEL_FONT);
590 searchOptions.add(sequencesToKeep);
591 hmmerSequenceCount = new JTextField(5);
592 searchOptions.add(hmmerSequenceCount);
595 * preferences for Information Content annotation
597 // JPanel dummy = new JPanel(new FlowLayout(FlowLayout.LEFT));
598 JPanel annotationOptions = new JPanel(new MigLayout("left"));
599 JvSwingUtils.createTitledBorder(annotationOptions,
600 MessageManager.getString("label.information_annotation"), true);
601 // dummy.add(annotationOptions);
602 hmmerTab.add(annotationOptions);
603 ButtonGroup backgroundOptions = new ButtonGroup();
604 hmmerBackgroundUniprot = new JRadioButton(
605 MessageManager.getString("label.freq_uniprot"));
606 hmmerBackgroundUniprot.setFont(LABEL_FONT);
607 hmmerBackgroundAlignment = new JRadioButton(
608 MessageManager.getString("label.freq_alignment"));
609 hmmerBackgroundAlignment.setFont(LABEL_FONT);
610 backgroundOptions.add(hmmerBackgroundUniprot);
611 backgroundOptions.add(hmmerBackgroundAlignment);
612 backgroundOptions.setSelected(hmmerBackgroundUniprot.getModel(), true);
613 // disable buttons for now as annotation only uses Uniprot background
614 hmmerBackgroundAlignment.setEnabled(false);
615 hmmerBackgroundUniprot.setEnabled(false);
616 annotationOptions.add(hmmerBackgroundUniprot, "wrap");
617 annotationOptions.add(hmmerBackgroundAlignment);
623 * Initialises the Output tabbed panel.
627 private JPanel initOutputTab()
629 JPanel outputTab = new JPanel();
630 outputTab.setLayout(null);
632 JLabel epsLabel = new JLabel(
633 MessageManager.formatMessage("label.rendering_style", "EPS"));
634 epsLabel.setFont(LABEL_FONT);
635 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
636 epsLabel.setBounds(new Rectangle(9, 31, 160, 24));
637 epsRendering.setFont(LABEL_FONT);
638 epsRendering.setBounds(new Rectangle(174, 34, 187, 21));
639 JLabel htmlLabel = new JLabel(
640 MessageManager.formatMessage("label.rendering_style", "HTML"));
641 htmlLabel.setFont(LABEL_FONT);
642 htmlLabel.setHorizontalAlignment(SwingConstants.RIGHT);
643 htmlLabel.setBounds(new Rectangle(9, 55, 160, 24));
644 htmlRendering.setFont(LABEL_FONT);
645 htmlRendering.setBounds(new Rectangle(174, 58, 187, 21));
646 JLabel svgLabel = new JLabel(
647 MessageManager.formatMessage("label.rendering_style", "SVG"));
648 svgLabel.setFont(LABEL_FONT);
649 svgLabel.setHorizontalAlignment(SwingConstants.RIGHT);
650 svgLabel.setBounds(new Rectangle(9, 79, 160, 24));
651 svgRendering.setFont(LABEL_FONT);
652 svgRendering.setBounds(new Rectangle(174, 82, 187, 21));
654 JLabel jLabel1 = new JLabel();
655 jLabel1.setFont(LABEL_FONT);
656 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
657 jLabel1.setText(MessageManager.getString("label.append_start_end"));
658 jLabel1.setFont(LABEL_FONT);
660 fastajv.setFont(LABEL_FONT);
661 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
662 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
663 blcjv.setText(MessageManager.getString("label.blc") + " ");
664 fastajv.setText(MessageManager.getString("label.fasta") + " ");
665 msfjv.setText(MessageManager.getString("label.msf") + " ");
666 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
667 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
668 msfjv.setFont(LABEL_FONT);
669 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
670 pirjv.setText(MessageManager.getString("label.pir") + " ");
671 JPanel jPanel11 = new JPanel();
672 jPanel11.setFont(LABEL_FONT);
673 TitledBorder titledBorder2 = new TitledBorder(
674 MessageManager.getString("label.file_output"));
675 jPanel11.setBorder(titledBorder2);
676 jPanel11.setBounds(new Rectangle(30, 120, 196, 182));
677 GridLayout gridLayout3 = new GridLayout();
678 jPanel11.setLayout(gridLayout3);
679 gridLayout3.setRows(8);
680 blcjv.setFont(LABEL_FONT);
681 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
682 clustaljv.setFont(LABEL_FONT);
683 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
684 pfamjv.setFont(LABEL_FONT);
685 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
686 pileupjv.setFont(LABEL_FONT);
687 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
688 pirjv.setFont(LABEL_FONT);
689 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
690 autoIdWidth.setFont(LABEL_FONT);
692 MessageManager.getString("label.automatically_set_id_width"));
693 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
694 .getString("label.adjusts_width_generated_eps_png")));
695 autoIdWidth.setBounds(new Rectangle(228, 144, 320, 23));
696 autoIdWidth.addActionListener(new ActionListener()
700 public void actionPerformed(ActionEvent e)
702 autoIdWidth_actionPerformed();
705 userIdWidthlabel.setFont(LABEL_FONT);
706 userIdWidthlabel.setText(
707 MessageManager.getString("label.figure_id_column_width"));
708 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
709 .getString("label.manually_specify_width_left_column")));
710 userIdWidthlabel.setToolTipText(
711 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
712 "label.manually_specify_width_left_column")));
713 userIdWidthlabel.setBounds(new Rectangle(236, 168, 320, 23));
714 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
715 userIdWidth.setText("");
716 userIdWidth.setBounds(new Rectangle(232, 192, 84, 23));
717 userIdWidth.addActionListener(new ActionListener()
721 public void actionPerformed(ActionEvent e)
723 userIdWidth_actionPerformed();
726 modellerOutput.setFont(LABEL_FONT);
728 .setText(MessageManager.getString("label.use_modeller_output"));
729 modellerOutput.setBounds(new Rectangle(228, 274, 320, 23));
730 embbedBioJSON.setFont(LABEL_FONT);
731 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
732 embbedBioJSON.setBounds(new Rectangle(228, 248, 250, 23));
734 jPanel11.add(jLabel1);
736 jPanel11.add(clustaljv);
737 jPanel11.add(fastajv);
739 jPanel11.add(pfamjv);
740 jPanel11.add(pileupjv);
742 outputTab.add(autoIdWidth);
743 outputTab.add(userIdWidth);
744 outputTab.add(userIdWidthlabel);
745 outputTab.add(modellerOutput);
746 if (!Platform.isJS())
749 * JalviewJS doesn't support Lineart option or SVG output
751 outputTab.add(embbedBioJSON);
752 outputTab.add(epsLabel);
753 outputTab.add(epsRendering);
754 outputTab.add(htmlLabel);
755 outputTab.add(htmlRendering);
756 outputTab.add(svgLabel);
757 outputTab.add(svgRendering);
759 outputTab.add(jPanel11);
764 * Initialises the Connections tabbed panel.
768 private JPanel initConnectionsTab()
770 JPanel connectTab = new JPanel();
771 connectTab.setLayout(new GridBagLayout());
773 // Label for browser text box
774 JLabel browserLabel = new JLabel();
775 browserLabel.setFont(LABEL_FONT);
776 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
777 browserLabel.setText(
778 MessageManager.getString("label.default_browser_unix"));
779 defaultBrowser.setFont(LABEL_FONT);
780 defaultBrowser.setText("");
781 final String tooltip = JvSwingUtils.wrapTooltip(true,
782 MessageManager.getString("label.double_click_to_browse"));
783 defaultBrowser.setToolTipText(tooltip);
784 defaultBrowser.addMouseListener(new MouseAdapter()
787 public void mouseClicked(MouseEvent e)
789 if (e.getClickCount() > 1)
791 defaultBrowser_mouseClicked(e);
796 JPanel proxyPanel = initConnTabProxyPanel();
797 initConnTabCheckboxes();
799 // Add default Browser text box
800 connectTab.add(browserLabel,
801 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
802 GridBagConstraints.WEST, GridBagConstraints.NONE,
803 new Insets(10, 0, 5, 5), 5, 1));
804 defaultBrowser.setFont(LABEL_FONT);
805 defaultBrowser.setText("");
807 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
808 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
809 new Insets(10, 0, 5, 10), 30, 1));
811 // Add proxy server panel
812 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
813 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
814 new Insets(10, 0, 5, 12), 4, 10));
816 // Add usage stats, version check and questionnaire checkboxes
817 connectTab.add(usagestats,
818 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
819 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
820 new Insets(0, 2, 5, 5), 70, 1));
821 connectTab.add(questionnaire,
822 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
823 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
824 new Insets(0, 2, 5, 10), 70, 1));
825 connectTab.add(versioncheck,
826 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
827 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
828 new Insets(0, 2, 5, 5), 70, 1));
830 versioncheck.setVisible(false);
832 // Add padding so the panel doesn't look ridiculous
833 JPanel spacePanel = new JPanel();
834 connectTab.add(spacePanel,
835 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
836 GridBagConstraints.WEST, GridBagConstraints.BOTH,
837 new Insets(0, 0, 0, 5), 70, 1));
843 * Initialises the Links tabbed panel.
847 private JPanel initLinksTab()
849 JPanel linkTab = new JPanel();
850 linkTab.setLayout(new GridBagLayout());
852 // Set up table for Url links
853 linkUrlTable.getTableHeader().setReorderingAllowed(false);
854 linkUrlTable.setFillsViewportHeight(true);
855 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
856 linkUrlTable.setAutoCreateRowSorter(true);
857 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
859 // adjust row height so radio buttons actually fit
860 // don't do this in the renderer, it causes the awt thread to activate
862 JRadioButton temp = new JRadioButton();
863 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
865 // Table in scrollpane so that the table is given a scrollbar
866 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
867 linkScrollPane.setBorder(null);
869 // Panel for links functionality
870 JPanel linkPanel = new JPanel(new GridBagLayout());
871 linkPanel.setBorder(new TitledBorder(
872 MessageManager.getString("label.url_linkfrom_sequence_id")));
874 // Put the Url links panel together
876 // Buttons go at top right, resizing only resizes the blank space vertically
877 JPanel buttonPanel = initLinkTabUrlButtons();
878 GridBagConstraints linkConstraints1 = new GridBagConstraints();
879 linkConstraints1.insets = new Insets(0, 0, 5, 0);
880 linkConstraints1.gridx = 0;
881 linkConstraints1.gridy = 0;
882 linkConstraints1.weightx = 1.0;
883 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
884 linkTab.add(buttonPanel, linkConstraints1);
886 // Links table goes at top left, resizing resizes the table
887 GridBagConstraints linkConstraints2 = new GridBagConstraints();
888 linkConstraints2.insets = new Insets(0, 0, 5, 5);
889 linkConstraints2.gridx = 0;
890 linkConstraints2.gridy = 1;
891 linkConstraints2.weightx = 1.0;
892 linkConstraints2.weighty = 1.0;
893 linkConstraints2.fill = GridBagConstraints.BOTH;
894 linkTab.add(linkScrollPane, linkConstraints2);
896 // Filter box and buttons goes at bottom left, resizing resizes the text box
897 JPanel filterPanel = initLinkTabFilterPanel();
898 GridBagConstraints linkConstraints3 = new GridBagConstraints();
899 linkConstraints3.insets = new Insets(0, 0, 0, 5);
900 linkConstraints3.gridx = 0;
901 linkConstraints3.gridy = 2;
902 linkConstraints3.weightx = 1.0;
903 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
904 linkTab.add(filterPanel, linkConstraints3);
909 private JPanel initLinkTabFilterPanel()
911 // Filter textbox and reset button
912 JLabel filterLabel = new JLabel(
913 MessageManager.getString("label.filter"));
914 filterLabel.setFont(LABEL_FONT);
915 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
916 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
918 filterTB.setFont(LABEL_FONT);
919 filterTB.setText("");
921 doReset.setText(MessageManager.getString("action.showall"));
922 userOnly.setText(MessageManager.getString("action.customfilter"));
924 // Panel for filter functionality
925 JPanel filterPanel = new JPanel(new GridBagLayout());
926 filterPanel.setBorder(new TitledBorder("Filter"));
927 GridBagConstraints gbc = new GridBagConstraints();
930 gbc.fill = GridBagConstraints.NONE;
931 gbc.anchor = GridBagConstraints.WEST;
933 filterPanel.add(filterLabel, gbc);
935 GridBagConstraints gbc1 = new GridBagConstraints();
938 gbc1.fill = GridBagConstraints.HORIZONTAL;
939 gbc1.anchor = GridBagConstraints.WEST;
941 filterPanel.add(filterTB, gbc1);
943 GridBagConstraints gbc2 = new GridBagConstraints();
945 gbc2.fill = GridBagConstraints.NONE;
946 gbc2.anchor = GridBagConstraints.WEST;
947 filterPanel.add(doReset, gbc2);
949 GridBagConstraints gbc3 = new GridBagConstraints();
951 gbc3.fill = GridBagConstraints.NONE;
952 gbc3.anchor = GridBagConstraints.WEST;
953 filterPanel.add(userOnly, gbc3);
958 private JPanel initLinkTabUrlButtons()
960 // Buttons for new / edit / delete Url links
961 JButton newLink = new JButton();
962 newLink.setText(MessageManager.getString("action.new"));
964 editLink.setText(MessageManager.getString("action.edit"));
966 deleteLink.setText(MessageManager.getString("action.delete"));
968 // no current selection, so initially disable delete/edit buttons
969 editLink.setEnabled(false);
970 deleteLink.setEnabled(false);
972 newLink.addActionListener(new java.awt.event.ActionListener()
975 public void actionPerformed(ActionEvent e)
977 newLink_actionPerformed(e);
981 editLink.setText(MessageManager.getString("action.edit"));
982 editLink.addActionListener(new java.awt.event.ActionListener()
985 public void actionPerformed(ActionEvent e)
987 editLink_actionPerformed(e);
991 deleteLink.setText(MessageManager.getString("action.delete"));
992 deleteLink.addActionListener(new java.awt.event.ActionListener()
995 public void actionPerformed(ActionEvent e)
997 deleteLink_actionPerformed(e);
1001 JPanel buttonPanel = new JPanel(new GridBagLayout());
1002 buttonPanel.setBorder(new TitledBorder("Edit links"));
1003 GridBagConstraints gbc = new GridBagConstraints();
1006 gbc.fill = GridBagConstraints.NONE;
1007 buttonPanel.add(newLink, gbc);
1009 GridBagConstraints gbc1 = new GridBagConstraints();
1012 gbc1.fill = GridBagConstraints.NONE;
1013 buttonPanel.add(editLink, gbc1);
1015 GridBagConstraints gbc2 = new GridBagConstraints();
1018 gbc2.fill = GridBagConstraints.NONE;
1019 buttonPanel.add(deleteLink, gbc2);
1021 GridBagConstraints gbc3 = new GridBagConstraints();
1024 gbc3.fill = GridBagConstraints.HORIZONTAL;
1026 JPanel spacePanel = new JPanel();
1027 spacePanel.setBorder(null);
1028 buttonPanel.add(spacePanel, gbc3);
1034 * Initialises the proxy server panel in the Connections tab
1036 * @return the proxy server panel
1038 private JPanel initConnTabProxyPanel()
1040 // Label for server text box
1041 serverLabel.setText(MessageManager.getString("label.address"));
1042 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1043 serverLabel.setFont(LABEL_FONT);
1045 // Proxy server and port text boxes
1046 proxyServerTB.setFont(LABEL_FONT);
1047 proxyPortTB.setFont(LABEL_FONT);
1049 // Label for Port text box
1050 portLabel.setFont(LABEL_FONT);
1051 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1052 portLabel.setText(MessageManager.getString("label.port"));
1054 // Use proxy server checkbox
1055 useProxy.setFont(LABEL_FONT);
1056 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
1057 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
1058 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
1059 useProxy.addActionListener(new ActionListener()
1062 public void actionPerformed(ActionEvent e)
1064 useProxy_actionPerformed();
1068 // Make proxy server panel
1069 JPanel proxyPanel = new JPanel();
1070 TitledBorder titledBorder1 = new TitledBorder(
1071 MessageManager.getString("label.proxy_server"));
1072 proxyPanel.setBorder(titledBorder1);
1073 proxyPanel.setLayout(new GridBagLayout());
1074 proxyPanel.add(serverLabel,
1075 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
1076 GridBagConstraints.WEST, GridBagConstraints.NONE,
1077 new Insets(0, 2, 2, 0), 5, 0));
1078 proxyPanel.add(portLabel,
1079 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
1080 GridBagConstraints.WEST, GridBagConstraints.NONE,
1081 new Insets(0, 0, 2, 0), 11, 0));
1082 proxyPanel.add(useProxy,
1083 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
1084 GridBagConstraints.WEST, GridBagConstraints.NONE,
1085 new Insets(0, 2, 5, 185), 2, -4));
1086 proxyPanel.add(proxyPortTB,
1087 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
1088 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
1089 new Insets(0, 2, 2, 2), 54, 1));
1090 proxyPanel.add(proxyServerTB,
1091 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
1092 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
1093 new Insets(0, 2, 2, 0), 263, 1));
1099 * Initialises the checkboxes in the Connections tab
1101 private void initConnTabCheckboxes()
1103 // Usage stats checkbox label
1105 MessageManager.getString("label.send_usage_statistics"));
1106 usagestats.setFont(LABEL_FONT);
1107 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
1108 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
1110 // Questionnaire checkbox label
1111 questionnaire.setText(
1112 MessageManager.getString("label.check_for_questionnaires"));
1113 questionnaire.setFont(LABEL_FONT);
1114 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
1115 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
1117 // Check for latest version checkbox label
1118 versioncheck.setText(
1119 MessageManager.getString("label.check_for_latest_version"));
1120 versioncheck.setFont(LABEL_FONT);
1121 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
1122 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
1126 * Initialises the parent panel which contains the tabbed sections.
1130 private JPanel initOkCancelPanel()
1132 JButton ok = new JButton();
1133 ok.setText(MessageManager.getString("action.ok"));
1134 ok.addActionListener(new ActionListener()
1137 public void actionPerformed(ActionEvent e)
1139 ok_actionPerformed(e);
1142 JButton cancel = new JButton();
1143 cancel.setText(MessageManager.getString("action.cancel"));
1144 cancel.addActionListener(new ActionListener()
1147 public void actionPerformed(ActionEvent e)
1149 cancel_actionPerformed(e);
1152 JPanel okCancelPanel = new JPanel();
1153 okCancelPanel.add(ok);
1154 okCancelPanel.add(cancel);
1155 return okCancelPanel;
1159 * Initialises the Colours tabbed panel.
1163 private JPanel initColoursTab()
1165 JPanel coloursTab = new JPanel();
1166 coloursTab.setBorder(new TitledBorder(
1167 MessageManager.getString("action.open_new_alignment")));
1168 coloursTab.setLayout(new FlowLayout());
1169 JLabel mincolourLabel = new JLabel();
1170 mincolourLabel.setFont(LABEL_FONT);
1171 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1172 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1173 minColour.setFont(LABEL_FONT);
1174 minColour.setBorder(BorderFactory.createEtchedBorder());
1175 minColour.setPreferredSize(new Dimension(40, 20));
1176 minColour.addMouseListener(new MouseAdapter()
1179 public void mousePressed(MouseEvent e)
1181 minColour_actionPerformed(minColour);
1184 JLabel maxcolourLabel = new JLabel();
1185 maxcolourLabel.setFont(LABEL_FONT);
1186 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1187 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1188 maxColour.setFont(LABEL_FONT);
1189 maxColour.setBorder(BorderFactory.createEtchedBorder());
1190 maxColour.setPreferredSize(new Dimension(40, 20));
1191 maxColour.addMouseListener(new MouseAdapter()
1194 public void mousePressed(MouseEvent e)
1196 maxColour_actionPerformed(maxColour);
1200 protColour.setFont(LABEL_FONT);
1201 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1202 JLabel protColourLabel = new JLabel();
1203 protColourLabel.setFont(LABEL_FONT);
1204 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1205 protColourLabel.setText(
1206 MessageManager.getString("label.prot_alignment_colour") + " ");
1207 GPreferences.addtoLayout(coloursTab,
1209 .getString("label.default_colour_scheme_for_alignment"),
1210 protColourLabel, protColour);
1212 nucColour.setFont(LABEL_FONT);
1213 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1214 JLabel nucColourLabel = new JLabel();
1215 nucColourLabel.setFont(LABEL_FONT);
1216 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1217 nucColourLabel.setText(
1218 MessageManager.getString("label.nuc_alignment_colour") + " ");
1219 GPreferences.addtoLayout(coloursTab,
1221 .getString("label.default_colour_scheme_for_alignment"),
1222 nucColourLabel, nucColour);
1224 JPanel annotationShding = new JPanel();
1225 annotationShding.setBorder(new TitledBorder(
1226 MessageManager.getString("label.annotation_shading_default")));
1227 annotationShding.setLayout(new GridLayout(1, 2));
1228 GPreferences.addtoLayout(annotationShding,
1229 MessageManager.getString(
1230 "label.default_minimum_colour_annotation_shading"),
1231 mincolourLabel, minColour);
1232 GPreferences.addtoLayout(annotationShding,
1233 MessageManager.getString(
1234 "label.default_maximum_colour_annotation_shading"),
1235 maxcolourLabel, maxColour);
1236 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1241 * Initialises the Overview tabbed panel.
1245 private JPanel initOverviewTab()
1247 JPanel overviewPanel = new JPanel();
1248 overviewPanel.setBorder(new TitledBorder(
1249 MessageManager.getString("label.overview_settings")));
1251 gapColour.setFont(LABEL_FONT);
1252 // fixing the border colours stops apparent colour bleed from the panel
1253 gapColour.setBorder(
1254 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1255 gapColour.setPreferredSize(new Dimension(40, 20));
1256 gapColour.addMouseListener(new MouseAdapter()
1259 public void mousePressed(MouseEvent e)
1261 gapColour_actionPerformed(gapColour);
1265 hiddenColour.setFont(LABEL_FONT);
1266 // fixing the border colours stops apparent colour bleed from the panel
1267 hiddenColour.setBorder(
1268 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1269 hiddenColour.setPreferredSize(new Dimension(40, 20));
1270 hiddenColour.addMouseListener(new MouseAdapter()
1273 public void mousePressed(MouseEvent e)
1275 hiddenColour_actionPerformed(hiddenColour);
1279 useLegacyGap = new JCheckBox(
1280 MessageManager.getString("label.ov_legacy_gap"));
1281 useLegacyGap.setFont(LABEL_FONT);
1282 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1283 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1284 gapLabel = new JLabel(MessageManager.getString("label.gap_colour"));
1285 gapLabel.setFont(LABEL_FONT);
1286 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1287 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1288 showHiddenAtStart = new JCheckBox(
1289 MessageManager.getString("label.ov_show_hide_default"));
1290 showHiddenAtStart.setFont(LABEL_FONT);
1291 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1292 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1293 JLabel hiddenLabel = new JLabel(
1294 MessageManager.getString("label.hidden_colour"));
1295 hiddenLabel.setFont(LABEL_FONT);
1296 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1297 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1299 useLegacyGap.addActionListener(new ActionListener()
1302 public void actionPerformed(ActionEvent e)
1304 useLegacyGaps_actionPerformed(e);
1308 overviewPanel.setLayout(new GridBagLayout());
1309 GridBagConstraints c1 = new GridBagConstraints();
1311 c1.fill = GridBagConstraints.HORIZONTAL;
1316 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1317 overviewPanel.add(useLegacyGap, c1);
1319 GridBagConstraints c2 = new GridBagConstraints();
1320 c2.fill = GridBagConstraints.HORIZONTAL;
1323 c2.insets = new Insets(0, 15, 0, 10);
1324 overviewPanel.add(gapLabel, c2);
1326 GridBagConstraints c3 = new GridBagConstraints();
1327 c3.fill = GridBagConstraints.HORIZONTAL;
1330 c3.insets = new Insets(0, 0, 0, 15);
1331 overviewPanel.add(gapColour, c3);
1333 GridBagConstraints c4 = new GridBagConstraints();
1334 c4.fill = GridBagConstraints.HORIZONTAL;
1338 overviewPanel.add(showHiddenAtStart, c4);
1340 GridBagConstraints c5 = new GridBagConstraints();
1341 c5.fill = GridBagConstraints.HORIZONTAL;
1344 c5.insets = new Insets(0, 15, 0, 10);
1345 overviewPanel.add(hiddenLabel, c5);
1347 GridBagConstraints c6 = new GridBagConstraints();
1348 c6.fill = GridBagConstraints.HORIZONTAL;
1351 c6.insets = new Insets(0, 0, 0, 15);
1352 overviewPanel.add(hiddenColour, c6);
1354 JButton resetButton = new JButton(
1355 MessageManager.getString("label.reset_to_defaults"));
1357 resetButton.addActionListener(new ActionListener()
1360 public void actionPerformed(ActionEvent e)
1362 resetOvDefaults_actionPerformed(e);
1366 GridBagConstraints c7 = new GridBagConstraints();
1367 c7.fill = GridBagConstraints.NONE;
1370 c7.insets = new Insets(10, 0, 0, 0);
1371 c7.anchor = GridBagConstraints.WEST;
1372 overviewPanel.add(resetButton, c7);
1374 // Add padding so the panel doesn't look ridiculous
1375 JPanel spacePanel = new JPanel();
1376 overviewPanel.add(spacePanel,
1377 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1378 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1379 new Insets(0, 0, 0, 5), 0, 0));
1381 return overviewPanel;
1385 * Initialises the Structure tabbed panel.
1389 private JPanel initStructureTab()
1391 structureTab = new JPanel();
1393 structureTab.setBorder(new TitledBorder(
1394 MessageManager.getString("label.structure_options")));
1395 structureTab.setLayout(null);
1396 final int width = 400;
1397 final int height = 22;
1398 final int lineSpacing = 25;
1401 structFromPdb.setFont(LABEL_FONT);
1403 .setText(MessageManager.getString("label.struct_from_pdb"));
1404 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1405 structFromPdb.addActionListener(new ActionListener()
1408 public void actionPerformed(ActionEvent e)
1410 boolean selected = structFromPdb.isSelected();
1411 // enable other options only when the first is checked
1412 useRnaView.setEnabled(selected);
1413 addSecondaryStructure.setEnabled(selected);
1414 addTempFactor.setEnabled(selected);
1417 structureTab.add(structFromPdb);
1419 // indent checkboxes that are conditional on the first one
1420 ypos += lineSpacing;
1421 useRnaView.setFont(LABEL_FONT);
1422 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1423 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1424 structureTab.add(useRnaView);
1426 ypos += lineSpacing;
1427 addSecondaryStructure.setFont(LABEL_FONT);
1428 addSecondaryStructure
1429 .setText(MessageManager.getString("label.autoadd_secstr"));
1430 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1431 structureTab.add(addSecondaryStructure);
1433 ypos += lineSpacing;
1434 addTempFactor.setFont(LABEL_FONT);
1435 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1436 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1437 structureTab.add(addTempFactor);
1439 ypos += lineSpacing;
1440 JLabel viewerLabel = new JLabel();
1441 viewerLabel.setFont(LABEL_FONT);
1442 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1443 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1444 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1445 structureTab.add(viewerLabel);
1447 structViewer.setFont(LABEL_FONT);
1448 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1449 structViewer.addItem(ViewerType.JMOL.name());
1450 structViewer.addItem(ViewerType.CHIMERA.name());
1451 structViewer.addActionListener(new ActionListener()
1454 public void actionPerformed(ActionEvent e)
1456 structureViewer_actionPerformed(
1457 (String) structViewer.getSelectedItem());
1460 structureTab.add(structViewer);
1462 ypos += lineSpacing;
1463 JLabel pathLabel = new JLabel();
1464 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1465 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1466 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1467 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1468 structureTab.add(pathLabel);
1470 chimeraPath.setFont(LABEL_FONT);
1471 chimeraPath.setText("");
1472 final String tooltip = JvSwingUtils.wrapTooltip(true,
1473 MessageManager.getString("label.chimera_path_tip"));
1474 chimeraPath.setToolTipText(tooltip);
1475 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1476 chimeraPath.addMouseListener(new MouseAdapter()
1479 public void mouseClicked(MouseEvent e)
1481 if (e.getClickCount() == 2)
1483 String chosen = openFileChooser(false);
1486 chimeraPath.setText(chosen);
1491 structureTab.add(chimeraPath);
1493 ypos += lineSpacing;
1494 nwMapping.setFont(LABEL_FONT);
1495 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1496 siftsMapping.setFont(LABEL_FONT);
1497 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1498 mappingMethod.add(nwMapping);
1499 mappingMethod.add(siftsMapping);
1500 JPanel mappingPanel = new JPanel();
1501 mappingPanel.setFont(LABEL_FONT);
1502 TitledBorder mmTitledBorder = new TitledBorder(
1503 MessageManager.getString("label.mapping_method"));
1504 mmTitledBorder.setTitleFont(LABEL_FONT);
1505 mappingPanel.setBorder(mmTitledBorder);
1506 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1507 // GridLayout mappingLayout = new GridLayout();
1508 mappingPanel.setLayout(new GridLayout());
1509 mappingPanel.add(nwMapping);
1510 mappingPanel.add(siftsMapping);
1511 structureTab.add(mappingPanel);
1513 ypos += lineSpacing;
1514 ypos += lineSpacing;
1515 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1516 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1517 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1518 structureTab.add(docFieldPref);
1521 * hide Chimera options in JalviewJS
1523 if (Platform.isJS())
1525 pathLabel.setVisible(false);
1526 chimeraPath.setVisible(false);
1527 viewerLabel.setVisible(false);
1528 structViewer.setVisible(false);
1531 return structureTab;
1535 * Action on choosing a structure viewer from combobox options.
1537 * @param selectedItem
1539 protected void structureViewer_actionPerformed(String selectedItem)
1544 * Show a dialog for the user to choose a file. Returns the chosen path, or
1549 protected String openFileChooser(boolean forFolder)
1551 String choice = null;
1552 JFileChooser chooser = new JFileChooser();
1555 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1558 // chooser.setFileView(new JalviewFileView());
1559 chooser.setDialogTitle(
1560 MessageManager.getString("label.open_local_file"));
1561 chooser.setToolTipText(MessageManager.getString("action.open"));
1563 int value = chooser.showOpenDialog(this);
1565 if (value == JFileChooser.APPROVE_OPTION)
1567 choice = chooser.getSelectedFile().getPath();
1572 protected boolean validateStructure()
1578 * Initialises the Visual tabbed panel.
1582 private JPanel initVisualTab()
1584 JPanel visualTab = new JPanel();
1585 visualTab.setBorder(new TitledBorder(
1586 MessageManager.getString("action.open_new_alignment")));
1587 visualTab.setLayout(null);
1588 fullScreen.setFont(LABEL_FONT);
1589 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1590 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1591 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1592 quality.setEnabled(false);
1593 quality.setFont(LABEL_FONT);
1594 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1595 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1596 quality.setSelected(true);
1597 quality.setText(MessageManager.getString("label.quality"));
1598 conservation.setEnabled(false);
1599 conservation.setFont(LABEL_FONT);
1600 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1601 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1602 conservation.setSelected(true);
1603 conservation.setText(MessageManager.getString("label.conservation"));
1604 identity.setEnabled(false);
1605 identity.setFont(LABEL_FONT);
1606 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1607 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1608 identity.setSelected(true);
1609 identity.setText(MessageManager.getString("label.consensus"));
1610 showOccupancy.setFont(LABEL_FONT);
1611 showOccupancy.setEnabled(false);
1612 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1613 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1614 showOccupancy.setSelected(true);
1615 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1617 JLabel showGroupbits = new JLabel();
1618 showGroupbits.setFont(LABEL_FONT);
1619 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1620 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1622 .setText(MessageManager.getString("action.show_group") + ":");
1623 JLabel showConsensbits = new JLabel();
1624 showConsensbits.setFont(LABEL_FONT);
1625 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1626 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1628 .setText(MessageManager.getString("label.consensus") + ":");
1629 showConsensHistogram.setEnabled(false);
1630 showConsensHistogram.setFont(LABEL_FONT);
1631 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1632 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1633 showConsensHistogram.setSelected(true);
1634 showConsensHistogram
1635 .setText(MessageManager.getString("label.histogram"));
1636 showConsensLogo.setEnabled(false);
1637 showConsensLogo.setFont(LABEL_FONT);
1638 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1639 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1640 showConsensLogo.setSelected(true);
1641 showConsensLogo.setText(MessageManager.getString("label.logo"));
1642 showGroupConsensus.setEnabled(false);
1643 showGroupConsensus.setFont(LABEL_FONT);
1644 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1645 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1646 showGroupConsensus.setSelected(true);
1647 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1648 showGroupConservation.setEnabled(false);
1649 showGroupConservation.setFont(LABEL_FONT);
1650 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1651 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1652 showGroupConservation.setSelected(true);
1653 showGroupConservation
1654 .setText(MessageManager.getString("label.conservation"));
1655 showNpTooltip.setEnabled(true);
1656 showNpTooltip.setFont(LABEL_FONT);
1657 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1658 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1659 showNpTooltip.setSelected(true);
1660 showNpTooltip.setText(
1661 MessageManager.getString("label.non_positional_features"));
1662 showDbRefTooltip.setEnabled(true);
1663 showDbRefTooltip.setFont(LABEL_FONT);
1664 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1665 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1666 showDbRefTooltip.setSelected(true);
1668 .setText(MessageManager.getString("label.database_references"));
1669 annotations.setFont(LABEL_FONT);
1670 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1671 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1672 annotations.setSelected(true);
1673 annotations.setText(MessageManager.getString("label.show_annotations"));
1674 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1675 annotations.addActionListener(new ActionListener()
1678 public void actionPerformed(ActionEvent e)
1680 annotations_actionPerformed(e);
1683 identity.addActionListener(new ActionListener()
1686 public void actionPerformed(ActionEvent e)
1688 annotations_actionPerformed(e);
1691 showGroupConsensus.addActionListener(new ActionListener()
1694 public void actionPerformed(ActionEvent e)
1696 annotations_actionPerformed(e);
1699 showUnconserved.setFont(LABEL_FONT);
1700 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1701 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1702 showUnconserved.setSelected(true);
1704 .setText(MessageManager.getString("action.show_unconserved"));
1705 showUnconserved.addActionListener(new ActionListener()
1708 public void actionPerformed(ActionEvent e)
1710 showunconserved_actionPerformed(e);
1714 // TODO these are not yet added to / action from Preferences
1715 // JCheckBox shareSelections = new JCheckBox();
1716 // shareSelections.setFont(verdana11);
1717 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1718 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1719 // shareSelections.setSelected(true);
1720 // shareSelections.setText(MessageManager
1721 // .getString("label.share_selection_across_views"));
1722 // JCheckBox followHighlight = new JCheckBox();
1723 // followHighlight.setFont(verdana11);
1724 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1725 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1726 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1727 // followHighlight.setSelected(true);
1728 // followHighlight.setText(MessageManager
1729 // .getString("label.scroll_highlighted_regions"));
1731 seqLimit.setFont(LABEL_FONT);
1732 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1733 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1734 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1735 smoothFont.setFont(LABEL_FONT);
1736 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1737 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1738 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1739 scaleProteinToCdna.setFont(LABEL_FONT);
1740 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1741 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1742 scaleProteinToCdna.setText(
1743 MessageManager.getString("label.scale_protein_to_cdna"));
1744 scaleProteinToCdna.setToolTipText(
1745 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1746 JLabel gapLabel = new JLabel();
1747 gapLabel.setFont(LABEL_FONT);
1748 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1749 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1750 JLabel fontLabel = new JLabel();
1751 fontLabel.setFont(LABEL_FONT);
1752 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1753 fontLabel.setText(MessageManager.getString("label.font"));
1754 fontSizeCB.setFont(LABEL_FONT);
1755 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1756 fontStyleCB.setFont(LABEL_FONT);
1757 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1758 fontNameCB.setFont(LABEL_FONT);
1759 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1760 gapSymbolCB.setFont(LABEL_FONT);
1761 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1762 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1763 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1764 gapSymbolCB.setRenderer(dlcr);
1766 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1767 startupCheckbox.setFont(LABEL_FONT);
1768 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1769 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1770 startupCheckbox.setSelected(true);
1771 startupFileTextfield.setFont(LABEL_FONT);
1772 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1773 final String tooltip = JvSwingUtils.wrapTooltip(true,
1774 MessageManager.getString("label.double_click_to_browse"));
1775 startupFileTextfield.setToolTipText(tooltip);
1776 startupFileTextfield.addMouseListener(new MouseAdapter()
1779 public void mouseClicked(MouseEvent e)
1781 if (e.getClickCount() > 1)
1783 startupFileTextfield_mouseClicked();
1788 sortby.setFont(LABEL_FONT);
1789 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1790 JLabel sortLabel = new JLabel();
1791 sortLabel.setFont(LABEL_FONT);
1792 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1793 sortLabel.setText(MessageManager.getString("label.sort_by"));
1794 sortAnnBy.setFont(LABEL_FONT);
1795 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1796 JLabel sortAnnLabel = new JLabel();
1797 sortAnnLabel.setFont(LABEL_FONT);
1798 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1799 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1800 sortAutocalc.setFont(LABEL_FONT);
1801 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1803 JPanel annsettingsPanel = new JPanel();
1804 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1805 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1806 annsettingsPanel.setBorder(new EtchedBorder());
1807 visualTab.add(annsettingsPanel);
1808 Border jb = new EmptyBorder(1, 1, 4, 5);
1809 annotations.setBorder(jb);
1810 showOccupancy.setBorder(jb);
1811 quality.setBorder(jb);
1812 conservation.setBorder(jb);
1813 identity.setBorder(jb);
1814 showConsensbits.setBorder(jb);
1815 showGroupbits.setBorder(jb);
1816 showGroupConsensus.setBorder(jb);
1817 showGroupConservation.setBorder(jb);
1818 showConsensHistogram.setBorder(jb);
1819 showConsensLogo.setBorder(jb);
1821 JPanel autoAnnotSettings = new JPanel();
1822 annsettingsPanel.add(autoAnnotSettings);
1823 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1824 autoAnnotSettings.add(annotations);
1825 autoAnnotSettings.add(quality);
1826 // second row of autoannotation box
1827 autoAnnotSettings = new JPanel();
1828 annsettingsPanel.add(autoAnnotSettings);
1830 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1831 autoAnnotSettings.add(conservation);
1832 autoAnnotSettings.add(identity);
1833 autoAnnotSettings.add(showOccupancy);
1834 autoAnnotSettings.add(showGroupbits);
1835 autoAnnotSettings.add(showGroupConservation);
1836 autoAnnotSettings.add(showGroupConsensus);
1837 autoAnnotSettings.add(showConsensbits);
1838 autoAnnotSettings.add(showConsensHistogram);
1839 autoAnnotSettings.add(showConsensLogo);
1841 JPanel tooltipSettings = new JPanel();
1842 tooltipSettings.setBorder(new TitledBorder(
1843 MessageManager.getString("label.sequence_id_tooltip")));
1844 tooltipSettings.setBounds(173, 140, 220, 62);
1845 tooltipSettings.setLayout(new GridLayout(2, 1));
1846 tooltipSettings.add(showDbRefTooltip);
1847 tooltipSettings.add(showNpTooltip);
1848 visualTab.add(tooltipSettings);
1850 wrap.setFont(LABEL_FONT);
1851 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1852 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1853 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1854 rightAlign.setFont(LABEL_FONT);
1855 rightAlign.setForeground(Color.black);
1856 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1857 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1858 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1859 idItalics.setFont(LABEL_FONT_ITALIC);
1860 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1861 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1863 MessageManager.getString("label.sequence_name_italics"));
1864 openoverv.setFont(LABEL_FONT);
1865 openoverv.setActionCommand(
1866 MessageManager.getString("label.open_overview"));
1867 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1868 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1869 openoverv.setText(MessageManager.getString("label.open_overview"));
1870 JPanel jPanel2 = new JPanel();
1871 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1872 jPanel2.setLayout(new GridLayout(14, 1));
1873 jPanel2.add(fullScreen);
1874 jPanel2.add(openoverv);
1875 jPanel2.add(seqLimit);
1876 jPanel2.add(rightAlign);
1877 jPanel2.add(fontLabel);
1878 jPanel2.add(showUnconserved);
1879 jPanel2.add(idItalics);
1880 jPanel2.add(smoothFont);
1881 jPanel2.add(scaleProteinToCdna);
1882 jPanel2.add(gapLabel);
1884 jPanel2.add(sortLabel);
1885 jPanel2.add(sortAnnLabel);
1886 jPanel2.add(startupCheckbox);
1887 visualTab.add(jPanel2);
1888 visualTab.add(startupFileTextfield);
1889 visualTab.add(sortby);
1890 visualTab.add(sortAnnBy);
1891 visualTab.add(sortAutocalc);
1892 visualTab.add(gapSymbolCB);
1893 visualTab.add(fontNameCB);
1894 visualTab.add(fontSizeCB);
1895 visualTab.add(fontStyleCB);
1897 if (Platform.isJS())
1899 startupCheckbox.setVisible(false);
1900 startupFileTextfield.setVisible(false);
1907 * Load the saved Backups options EXCEPT "Enabled" and "Scheme"
1910 protected void loadLastSavedBackupsOptions()
1912 BackupFilesPresetEntry savedPreset = BackupFilesPresetEntry
1913 .getSavedBackupEntry();
1915 .setSelected(Cache.getDefault(BackupFiles.ENABLED, !Platform.isJS()));
1917 BackupFilesPresetEntry backupfilesCustomEntry = BackupFilesPresetEntry
1918 .createBackupFilesPresetEntry(Cache
1919 .getDefault(BackupFilesPresetEntry.CUSTOMCONFIG, null));
1920 if (backupfilesCustomEntry == null)
1922 backupfilesCustomEntry = BackupFilesPresetEntry.backupfilesPresetEntriesValues
1923 .get(BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT);
1925 BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
1926 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM,
1927 backupfilesCustomEntry);
1929 setComboIntStringKey(backupfilesPresetsCombo,
1930 Cache.getDefault(BackupFiles.NS + "_PRESET",
1931 BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT));
1933 backupsSetOptions(savedPreset);
1935 backupsOptionsSetEnabled();
1936 updateBackupFilesExampleLabel();
1939 private boolean warnAboutSuffixReverseChange()
1941 BackupFilesPresetEntry bfpe = BackupFilesPresetEntry
1942 .getSavedBackupEntry();
1943 boolean savedSuffixReverse = bfpe.reverse;
1944 int savedSuffixDigits = bfpe.digits;
1945 String savedSuffixTemplate = bfpe.suffix;
1947 boolean nowSuffixReverse = suffixReverse.isSelected();
1948 int nowSuffixDigits = getSpinnerInt(suffixDigitsSpinner, 3);
1949 String nowSuffixTemplate = suffixTemplate.getText();
1950 return nowSuffixReverse != savedSuffixReverse
1951 && nowSuffixDigits == savedSuffixDigits
1952 && nowSuffixTemplate != null
1953 && nowSuffixTemplate.equals(savedSuffixTemplate);
1957 * Initialises the Backups tabbed panel.
1961 private JPanel initBackupsTab()
1963 JPanel backupsTab = new JPanel();
1964 backupsTab.setBorder(new TitledBorder(
1965 MessageManager.getString("label.backup_files")));
1966 backupsTab.setLayout(new GridBagLayout());
1968 GridBagConstraints gbc = new GridBagConstraints();
1971 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
1972 gbc.fill = GridBagConstraints.NONE;
1974 initBackupsTabPresetsPanel();
1975 initBackupsTabSuffixPanel();
1976 initBackupsTabKeepFilesPanel();
1977 initBackupsTabFilenameExamplesPanel();
1979 enableBackupFiles.setFont(LABEL_FONT_BOLD);
1981 .setText(MessageManager.getString("label.enable_backupfiles"));
1982 enableBackupFiles.addActionListener(new ActionListener()
1985 public void actionPerformed(ActionEvent e)
1987 // enable other options only when the first is checked
1988 backupsOptionsSetEnabled();
1993 // enable checkbox 1 col
1997 gbc.gridy = 0; // row 0
1998 backupsTab.add(enableBackupFiles, gbc);
2000 // summary of scheme box (over two rows)
2004 gbc.anchor = GridBagConstraints.FIRST_LINE_END;
2005 gbc.fill = GridBagConstraints.BOTH;
2006 backupsTab.add(exampleFilesPanel, gbc);
2008 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
2009 gbc.fill = GridBagConstraints.NONE;
2011 // fill empty space on right
2014 backupsTab.add(new JPanel(), gbc);
2019 gbc.gridy++; // row 1
2020 backupsTab.add(presetsPanel, gbc);
2022 // now using whole row
2027 gbc.gridy++; // row 2
2028 backupsTab.add(keepfilesPanel, gbc);
2030 // filename strategy box
2031 gbc.gridy++; // row 3
2032 backupsTab.add(suffixPanel, gbc);
2035 gbc.gridy++; // row 4
2037 backupsTab.add(new JPanel(), gbc);
2039 backupsOptionsSetEnabled();
2043 private JPanel initBackupsTabPresetsPanel()
2046 String title = MessageManager.getString("label.schemes");
2048 presetsPanel.setLayout(new GridBagLayout());
2050 GridBagConstraints gbc = new GridBagConstraints();
2053 gbc.anchor = GridBagConstraints.BASELINE_LEADING;
2054 gbc.fill = GridBagConstraints.NONE;
2062 presetsComboLabel = new JLabel(title + ":");
2063 presetsPanel.add(presetsComboLabel, gbc);
2065 List<Object> entries = Arrays
2066 .asList((Object[]) BackupFilesPresetEntry.backupfilesPresetEntries);
2067 List<String> tooltips = Arrays.asList(
2068 BackupFilesPresetEntry.backupfilesPresetEntryDescriptions);
2069 backupfilesPresetsCombo = JvSwingUtils.buildComboWithTooltips(entries,
2072 for (int i = 0; i < BackupFilesPresetEntry.backupfilesPresetEntries.length; i++)
2074 backupfilesPresetsCombo
2075 .addItem(BackupFilesPresetEntry.backupfilesPresetEntries[i]);
2079 backupfilesPresetsCombo.addActionListener(new ActionListener()
2082 public void actionPerformed(ActionEvent e)
2084 int key = getComboIntStringKey(backupfilesPresetsCombo);
2085 if (!customiseCheckbox.isSelected())
2087 backupfilesPresetsComboLastSelected = key;
2089 if (key == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM)
2091 if (customiseCheckbox.isSelected())
2093 // got here by clicking on customiseCheckbox so don't change the values
2094 backupfilesCustomOptionsSetEnabled();
2098 backupsTabUpdatePresets();
2099 backupfilesCustomOptionsSetEnabled();
2104 customiseCheckbox.setSelected(false);
2105 backupsTabUpdatePresets();
2106 backupfilesCustomOptionsSetEnabled();
2111 // dropdown list of preset schemes
2113 presetsPanel.add(backupfilesPresetsCombo, gbc);
2115 revertButton.setText(MessageManager.getString("label.cancel_changes"));
2116 revertButton.setToolTipText(
2117 MessageManager.getString("label.cancel_changes_description"));
2118 revertButton.addActionListener(new ActionListener()
2121 public void actionPerformed(ActionEvent e)
2124 BackupFilesPresetEntry.backupfilesPresetEntriesValues.get(
2125 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM));
2126 backupfilesCustomOptionsSetEnabled();
2130 revertButton.setFont(LABEL_FONT);
2132 customiseCheckbox.setFont(LABEL_FONT);
2133 customiseCheckbox.setText(MessageManager.getString("label.customise"));
2134 customiseCheckbox.addActionListener(new ActionListener()
2137 public void actionPerformed(ActionEvent e)
2139 int currently = getComboIntStringKey(backupfilesPresetsCombo);
2140 if (customiseCheckbox.isSelected())
2142 backupfilesPresetsComboLastSelected = currently;
2143 setComboIntStringKey(backupfilesPresetsCombo,
2144 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM);
2148 setComboIntStringKey(backupfilesPresetsCombo,
2149 backupfilesPresetsComboLastSelected);
2152 backupfilesCustomOptionsSetEnabled();
2155 customiseCheckbox.setToolTipText(
2156 MessageManager.getString("label.customise_description"));
2158 // customise checkbox
2161 presetsPanel.add(customiseCheckbox, gbc);
2163 // "Cancel changes" button (aligned with combo box above)
2165 presetsPanel.add(revertButton, gbc);
2167 return presetsPanel;
2170 private JPanel initBackupsTabFilenameExamplesPanel()
2172 String title = MessageManager
2173 .getString("label.scheme_examples");
2174 TitledBorder tb = new TitledBorder(title);
2175 exampleFilesPanel.setBorder(tb);
2176 exampleFilesPanel.setLayout(new GridBagLayout());
2179 backupfilesExampleLabel.setEditable(false);
2180 backupfilesExampleLabel
2181 .setBackground(exampleFilesPanel.getBackground());
2183 updateBackupFilesExampleLabel();
2185 GridBagConstraints gbc = new GridBagConstraints();
2188 gbc.fill = GridBagConstraints.NONE;
2189 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
2191 exampleFilesPanel.add(backupfilesExampleLabel, gbc);
2192 return exampleFilesPanel;
2195 private void backupsTabUpdatePresets()
2197 IntKeyStringValueEntry entry = (IntKeyStringValueEntry) backupfilesPresetsCombo
2200 String value = entry.v;
2202 if (BackupFilesPresetEntry.backupfilesPresetEntriesValues
2206 BackupFilesPresetEntry.backupfilesPresetEntriesValues
2212 "Preset '" + value + "' [key:" + key + "] not implemented");
2215 // Custom options will now be enabled when the customiseCheckbox is checked
2216 // (performed above)
2217 // backupfilesCustomOptionsSetEnabled();
2218 updateBackupFilesExampleLabel();
2221 protected int getComboIntStringKey(
2222 JComboBox<Object> backupfilesPresetsCombo2)
2224 IntKeyStringValueEntry e;
2227 e = (IntKeyStringValueEntry) backupfilesPresetsCombo2
2229 } catch (Exception ex)
2232 "Problem casting Combo entry to IntKeyStringValueEntry.");
2235 return e != null ? e.k : 0;
2238 protected void setComboIntStringKey(
2239 JComboBox<Object> backupfilesPresetsCombo2,
2242 for (int i = 0; i < backupfilesPresetsCombo2.getItemCount(); i++)
2244 IntKeyStringValueEntry e;
2247 e = (IntKeyStringValueEntry) backupfilesPresetsCombo2.getItemAt(i);
2248 } catch (Exception ex)
2251 "Problem casting Combo entry to IntKeyStringValueEntry. Skipping item. ");
2256 backupfilesPresetsCombo2.setSelectedIndex(i);
2260 // backupsTabUpdatePresets();
2263 private JPanel initBackupsTabSuffixPanel()
2265 suffixPanel.setBorder(new TitledBorder(
2266 MessageManager.getString("label.backup_filename_strategy")));
2267 suffixPanel.setLayout(new GridBagLayout());
2270 .setText(MessageManager.getString("label.append_to_filename"));
2271 suffixTemplateLabel.setHorizontalAlignment(SwingConstants.LEFT);
2272 suffixTemplateLabel.setFont(LABEL_FONT);
2274 final String tooltip = JvSwingUtils.wrapTooltip(true,
2275 MessageManager.getString("label.append_to_filename_tooltip"));
2276 suffixTemplate.setToolTipText(tooltip);
2277 suffixTemplate.addActionListener(new ActionListener()
2280 public void actionPerformed(ActionEvent e)
2282 updateBackupFilesExampleLabel();
2283 backupfilesCustomOptionsSetEnabled();
2284 backupfilesRevertButtonSetEnabled(true);
2288 suffixTemplate.addKeyListener(new KeyListener()
2291 public void keyReleased(KeyEvent e)
2293 updateBackupFilesExampleLabel();
2294 backupfilesCustomOptionsSetEnabled();
2295 backupfilesRevertButtonSetEnabled(true);
2299 public void keyPressed(KeyEvent e)
2303 // disable use of ':' or '/' or '\'
2305 public void keyTyped(KeyEvent e)
2307 char c = e.getKeyChar();
2308 if (c == ':' || c == '/' || c == '\\')
2310 // don't process ':' or '/' or '\'
2319 .setText(MessageManager.getString("label.index_digits"));
2320 suffixDigitsLabel.setHorizontalAlignment(SwingConstants.LEFT);
2321 suffixDigitsLabel.setFont(LABEL_FONT);
2322 ChangeListener c = new ChangeListener()
2325 public void stateChanged(ChangeEvent e)
2327 backupfilesRevertButtonSetEnabled(true);
2328 updateBackupFilesExampleLabel();
2332 setIntegerSpinner(suffixDigitsSpinner, BackupFilesPresetEntry.DIGITSMIN,
2333 BackupFilesPresetEntry.DIGITSMAX, 3, c);
2335 suffixReverse.setLabels(MessageManager.getString("label.reverse_roll"),
2336 MessageManager.getString("label.increment_index"));
2337 suffixReverse.addActionListener(new ActionListener()
2340 public void actionPerformed(ActionEvent e)
2342 boolean okay = true;
2343 if (warnAboutSuffixReverseChange())
2346 okay = confirmSuffixReverseChange();
2350 backupfilesRevertButtonSetEnabled(true);
2351 updateBackupFilesExampleLabel();
2355 boolean savedSuffixReverse = BackupFilesPresetEntry
2356 .getSavedBackupEntry().reverse;
2357 suffixReverse.setSelected(savedSuffixReverse);
2362 GridBagConstraints sgbc = new GridBagConstraints();
2364 // first row (template text box)
2365 sgbc.anchor = GridBagConstraints.WEST;
2369 sgbc.gridheight = 1;
2372 sgbc.fill = GridBagConstraints.NONE;
2373 suffixPanel.add(suffixTemplateLabel, sgbc);
2376 sgbc.fill = GridBagConstraints.HORIZONTAL;
2377 suffixPanel.add(suffixTemplate, sgbc);
2379 // second row (number of digits spinner)
2383 sgbc.fill = GridBagConstraints.NONE;
2384 suffixPanel.add(suffixDigitsLabel, sgbc);
2387 sgbc.fill = GridBagConstraints.HORIZONTAL;
2388 suffixPanel.add(suffixDigitsSpinner, sgbc);
2390 // third row (forward order radio selection)
2393 sgbc.gridwidth = GridBagConstraints.REMAINDER;
2394 sgbc.fill = GridBagConstraints.HORIZONTAL;
2395 suffixPanel.add(suffixReverse.getFalseButton(), sgbc);
2397 // fourth row (reverse order radio selection)
2399 suffixPanel.add(suffixReverse.getTrueButton(), sgbc);
2403 private boolean confirmSuffixReverseChange()
2405 boolean ret = false;
2406 String warningMessage = MessageManager
2407 .getString("label.warning_confirm_change_reverse");
2408 int confirm = JvOptionPane.showConfirmDialog(Desktop.desktop,
2410 MessageManager.getString("label.change_increment_decrement"),
2411 JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE);
2413 ret = (confirm == JvOptionPane.YES_OPTION);
2417 private JPanel initBackupsTabKeepFilesPanel()
2419 keepfilesPanel.setBorder(
2420 new TitledBorder(MessageManager.getString("label.keep_files")));
2421 keepfilesPanel.setLayout(new GridBagLayout());
2423 backupfilesKeepAll.setLabels(
2424 MessageManager.getString("label.keep_all_backup_files"),
2425 MessageManager.getString(
2426 "label.keep_only_this_number_of_backup_files"));
2427 backupfilesKeepAll.addTrueActionListener(new ActionListener()
2430 public void actionPerformed(ActionEvent e)
2432 backupfilesRevertButtonSetEnabled(true);
2433 updateBackupFilesExampleLabel();
2436 backupfilesKeepAll.addActionListener(new ActionListener()
2439 public void actionPerformed(ActionEvent e)
2441 backupfilesRevertButtonSetEnabled(true);
2442 keepRollMaxOptionsEnabled();
2443 updateBackupFilesExampleLabel();
2447 ChangeListener c = new ChangeListener()
2450 public void stateChanged(ChangeEvent e)
2452 backupfilesRevertButtonSetEnabled(true);
2453 updateBackupFilesExampleLabel();
2457 setIntegerSpinner(backupfilesRollMaxSpinner,
2458 BackupFilesPresetEntry.ROLLMAXMIN,
2459 BackupFilesPresetEntry.ROLLMAXMAX, 4, true, c);
2461 backupfilesConfirmDelete.setLabels(
2462 MessageManager.getString("label.always_ask"),
2463 MessageManager.getString("label.auto_delete"));
2464 backupfilesConfirmDelete.addActionListener(new ActionListener()
2467 public void actionPerformed(ActionEvent e)
2469 backupfilesRevertButtonSetEnabled(true);
2472 // update the enabled section
2473 keepRollMaxOptionsEnabled();
2475 GridBagConstraints kgbc = new GridBagConstraints();
2477 // first row (template text box)
2478 kgbc.anchor = GridBagConstraints.WEST;
2481 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2482 kgbc.gridheight = 1;
2485 kgbc.fill = GridBagConstraints.HORIZONTAL;
2486 keepfilesPanel.add(backupfilesKeepAll.getTrueButton(), kgbc);
2492 kgbc.gridwidth = GridBagConstraints.RELATIVE;
2493 keepfilesPanel.add(backupfilesKeepAll.getFalseButton(), kgbc);
2496 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2497 keepfilesPanel.add(backupfilesRollMaxSpinner, kgbc);
2499 // third row (indented)
2501 kgbc.insets = new Insets(0, 20, 0, 0);
2504 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2505 kgbc.fill = GridBagConstraints.HORIZONTAL;
2508 JPanel jp = new JPanel();
2509 jp.setLayout(new FlowLayout());
2511 .setText(MessageManager
2512 .getString("label.autodelete_old_backup_files"));
2513 oldBackupFilesLabel.setFont(LABEL_FONT);
2514 oldBackupFilesLabel.setHorizontalAlignment(SwingConstants.LEFT);
2515 jp.add(oldBackupFilesLabel);
2516 jp.add(backupfilesConfirmDelete.getTrueButton());
2517 jp.add(backupfilesConfirmDelete.getFalseButton());
2518 keepfilesPanel.add(jp, kgbc);
2520 return keepfilesPanel;
2523 protected void updateBackupFilesExampleLabel()
2525 int exampleindex = 12;
2526 String base = MessageManager.getString("label.filename") + ".fa";
2527 if (base == null || base.length() == 0)
2529 base = "file_name.fa";
2532 boolean reverse = suffixReverse.isSelected();
2533 boolean keepAll = backupfilesKeepAll.isSelected();
2535 String suffix = suffixTemplate.getText();
2538 backupfilesExampleLabel.setFont(LABEL_FONT_ITALIC);
2539 if (suffix == null || suffix.length() == 0)
2541 backupfilesExampleLabel
2542 .setText(MessageManager.getString("label.no_backup_files"));
2543 backupfilesExampleLabel.setFont(LABEL_FONT_BOLD);
2547 rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 4);
2548 rollMax = rollMax < 1 ? 1 : rollMax;
2550 if (suffix.indexOf(BackupFiles.NUM_PLACEHOLDER) == -1)
2555 digits = getSpinnerInt(suffixDigitsSpinner, 3);
2556 digits = digits < 1 ? 1 : digits;
2558 int lowersurround = 2;
2559 int uppersurround = 0;
2560 StringBuilder exampleSB = new StringBuilder();
2561 boolean firstLine = true;
2567 int max = keepAll ? exampleindex : rollMax;
2568 for (int index = min; index <= max; index++)
2570 if (index == min + lowersurround && index < max - uppersurround - 1)
2572 exampleSB.append("\n...");
2575 else if (index > min + lowersurround && index < max - uppersurround)
2587 exampleSB.append("\n");
2590 exampleSB.append(BackupFilenameParts.getBackupFilename(index,
2591 base, suffix, digits));
2594 // no extra text needed
2596 else if (index == min)
2598 String newest = MessageManager.getString("label.braced_newest");
2599 if (newest != null && newest.length() > 0)
2601 exampleSB.append(" " + newest);
2604 else if (index == max)
2606 String oldest = MessageManager.getString("label.braced_oldest");
2607 if (oldest != null && oldest.length() > 0)
2609 exampleSB.append(" " + oldest);
2618 int min = (keepAll || exampleindex - rollMax < 0) ? 1
2619 : exampleindex - rollMax + 1;
2620 int max = exampleindex;
2622 for (int index = min; index <= max; index++)
2625 if (index == min + lowersurround && index < max - uppersurround - 1)
2627 exampleSB.append("\n...");
2630 else if (index > min + lowersurround && index < max - uppersurround)
2642 exampleSB.append("\n");
2645 exampleSB.append(BackupFilenameParts.getBackupFilename(index,
2646 base, suffix, digits));
2649 // no extra text needed
2651 else if (index == min)
2653 String oldest = MessageManager.getString("label.braced_oldest");
2654 if (oldest != null && oldest.length() > 0)
2656 exampleSB.append(" " + oldest);
2659 else if (index == max)
2661 String newest = MessageManager.getString("label.braced_newest");
2662 if (newest != null && newest.length() > 0)
2664 exampleSB.append(" " + newest);
2672 // add some extra empty lines to pad out the example files box. ugh, please tell
2673 // me how to do this better
2674 int remainingLines = lowersurround + uppersurround + 1 - lineNumber;
2675 if (remainingLines > 0)
2677 for (int i = 0; i < remainingLines; i++)
2679 exampleSB.append("\n ");
2684 backupfilesExampleLabel.setText(exampleSB.toString());
2687 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2688 boolean useExistingVal, ChangeListener c)
2695 i = ((Integer) s.getValue()).intValue();
2696 } catch (Exception e)
2699 "Exception casting the initial value of s.getValue()");
2703 setIntegerSpinner(s, min, max, i, c);
2706 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2709 // integer spinner for number of digits
2718 SpinnerModel sModel = new SpinnerNumberModel(def, min, max, 1);
2721 s.addChangeListener(c);
2725 protected static int getSpinnerInt(JSpinner s, int def)
2731 i = (Integer) s.getValue();
2732 } catch (Exception e)
2734 Cache.log.error("Failed casting (Integer) JSpinner s.getValue()");
2739 private void keepRollMaxOptionsEnabled()
2741 boolean enabled = backupfilesKeepAll.isEnabled()
2742 && !backupfilesKeepAll.isSelected();
2743 oldBackupFilesLabel.setEnabled(enabled);
2744 backupfilesRollMaxSpinner.setEnabled(enabled);
2745 backupfilesConfirmDelete.setEnabled(enabled);
2748 private void backupfilesKeepAllSetEnabled(boolean tryEnabled)
2750 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2751 && customiseCheckbox.isSelected()
2752 && suffixTemplate.getText()
2753 .indexOf(BackupFiles.NUM_PLACEHOLDER) > -1;
2754 keepfilesPanel.setEnabled(enabled);
2755 backupfilesKeepAll.setEnabled(enabled);
2756 oldBackupFilesLabel.setEnabled(enabled);
2757 keepRollMaxOptionsEnabled();
2760 private void backupfilesSuffixTemplateDigitsSetEnabled()
2762 boolean enabled = suffixTemplate.isEnabled() && suffixTemplate.getText()
2763 .indexOf(BackupFiles.NUM_PLACEHOLDER) > -1;
2764 suffixDigitsLabel.setEnabled(enabled);
2765 suffixDigitsSpinner.setEnabled(enabled);
2766 suffixReverse.setEnabled(enabled);
2769 private void backupfilesSuffixTemplateSetEnabled(boolean tryEnabled)
2771 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2772 && customiseCheckbox.isSelected();
2773 suffixPanel.setEnabled(enabled);
2774 suffixTemplateLabel.setEnabled(enabled);
2775 suffixTemplate.setEnabled(enabled);
2776 backupfilesSuffixTemplateDigitsSetEnabled();
2779 private void backupfilesRevertButtonSetEnabled(boolean tryEnabled)
2781 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2782 && customiseCheckbox.isSelected() && backupfilesCustomChanged();
2783 revertButton.setEnabled(enabled);
2786 private boolean backupfilesCustomChanged()
2788 BackupFilesPresetEntry custom = BackupFilesPresetEntry.backupfilesPresetEntriesValues
2789 .get(BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM);
2790 BackupFilesPresetEntry current = getBackupfilesCurrentEntry();
2791 return !custom.equals(current);
2794 protected BackupFilesPresetEntry getBackupfilesCurrentEntry()
2796 String suffix = suffixTemplate.getText();
2797 int digits = getSpinnerInt(suffixDigitsSpinner, 3);
2798 boolean reverse = suffixReverse.isSelected();
2799 boolean keepAll = backupfilesKeepAll.isSelected();
2800 int rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 3);
2801 boolean confirmDelete = backupfilesConfirmDelete.isSelected();
2803 BackupFilesPresetEntry bfpe = new BackupFilesPresetEntry(suffix, digits,
2804 reverse, keepAll, rollMax, confirmDelete);
2809 protected void backupfilesCustomOptionsSetEnabled()
2811 boolean enabled = customiseCheckbox.isSelected();
2813 backupfilesRevertButtonSetEnabled(enabled);
2814 backupfilesSuffixTemplateSetEnabled(enabled);
2815 backupfilesKeepAllSetEnabled(enabled);
2818 private void backupfilesSummarySetEnabled()
2820 boolean enabled = enableBackupFiles.isSelected();
2821 backupfilesExampleLabel.setEnabled(enabled);
2822 exampleFilesPanel.setEnabled(enabled);
2825 private void backupfilesPresetsSetEnabled()
2827 boolean enabled = enableBackupFiles.isSelected();
2828 presetsPanel.setEnabled(enabled);
2829 presetsComboLabel.setEnabled(enabled);
2830 backupfilesPresetsCombo.setEnabled(enabled);
2831 customiseCheckbox.setEnabled(enabled);
2832 revertButton.setEnabled(enabled);
2835 protected void backupsOptionsSetEnabled()
2837 backupfilesPresetsSetEnabled();
2838 backupfilesSummarySetEnabled();
2839 backupfilesCustomOptionsSetEnabled();
2842 protected void backupsSetOptions(String suffix, int digits,
2843 boolean reverse, boolean keepAll, int rollMax,
2844 boolean confirmDelete)
2846 suffixTemplate.setText(suffix);
2847 suffixDigitsSpinner.setValue(digits);
2848 suffixReverse.setSelected(reverse);
2849 backupfilesKeepAll.setSelected(keepAll);
2850 backupfilesRollMaxSpinner.setValue(rollMax);
2851 backupfilesConfirmDelete.setSelected(confirmDelete);
2854 protected void backupsSetOptions(BackupFilesPresetEntry p)
2856 backupsSetOptions(p.suffix, p.digits, p.reverse, p.keepAll, p.rollMax,
2860 protected void autoIdWidth_actionPerformed()
2862 // TODO Auto-generated method stub
2866 protected void userIdWidth_actionPerformed()
2868 // TODO Auto-generated method stub
2872 protected void maxColour_actionPerformed(JPanel panel)
2876 protected void minColour_actionPerformed(JPanel panel)
2880 protected void gapColour_actionPerformed(JPanel panel)
2884 protected void hiddenColour_actionPerformed(JPanel panel)
2888 protected void showunconserved_actionPerformed(ActionEvent e)
2890 // TODO Auto-generated method stub
2894 protected void useLegacyGaps_actionPerformed(ActionEvent e)
2898 protected void resetOvDefaults_actionPerformed(ActionEvent e)
2908 public void ok_actionPerformed(ActionEvent e)
2918 public void cancel_actionPerformed(ActionEvent e)
2928 public void annotations_actionPerformed(ActionEvent e)
2935 public void startupFileTextfield_mouseClicked()
2939 public void newLink_actionPerformed(ActionEvent e)
2944 public void editLink_actionPerformed(ActionEvent e)
2949 public void deleteLink_actionPerformed(ActionEvent e)
2954 public void defaultBrowser_mouseClicked(MouseEvent e)
2959 public void linkURLList_keyTyped(KeyEvent e)
2964 public void useProxy_actionPerformed()
2966 boolean enabled = useProxy.isSelected();
2967 portLabel.setEnabled(enabled);
2968 serverLabel.setEnabled(enabled);
2969 proxyServerTB.setEnabled(enabled);
2970 proxyPortTB.setEnabled(enabled);
2974 * Customer renderer for JTable: supports column of radio buttons
2976 public class RadioButtonRenderer extends JRadioButton
2977 implements TableCellRenderer
2979 public RadioButtonRenderer()
2981 setHorizontalAlignment(CENTER);
2982 setToolTipText(MessageManager.getString("label.urltooltip"));
2986 public Component getTableCellRendererComponent(JTable table,
2987 Object value, boolean isSelected, boolean hasFocus, int row,
2990 setSelected((boolean) value);
2992 // set colours to match rest of table
2995 setBackground(table.getSelectionBackground());
2996 setForeground(table.getSelectionForeground());
3000 setBackground(table.getBackground());
3001 setForeground(table.getForeground());
3008 * Customer cell editor for JTable: supports column of radio buttons in
3009 * conjunction with renderer
3011 public class RadioButtonEditor extends AbstractCellEditor
3012 implements TableCellEditor
3014 private JRadioButton button = new JRadioButton();
3016 public RadioButtonEditor()
3018 button.setHorizontalAlignment(SwingConstants.CENTER);
3019 this.button.addActionListener(new ActionListener()
3022 public void actionPerformed(ActionEvent e)
3024 fireEditingStopped();
3030 public Component getTableCellEditorComponent(JTable table, Object value,
3031 boolean isSelected, int row, int column)
3033 button.setSelected((boolean) value);
3038 public Object getCellEditorValue()
3040 return button.isSelected();
3045 protected void validateHmmerPath()
3049 protected void validateCygwinPath()
3054 * A helper method to add a panel containing a label and a component to a
3062 protected static void addtoLayout(JPanel panel, String tooltip,
3063 JComponent label, JComponent valBox)
3065 JPanel laypanel = new JPanel(new GridLayout(1, 2));
3066 JPanel labPanel = new JPanel(new BorderLayout());
3067 JPanel valPanel = new JPanel();
3068 labPanel.setBounds(new Rectangle(7, 7, 158, 23));
3069 valPanel.setBounds(new Rectangle(172, 7, 270, 23));
3070 labPanel.add(label, BorderLayout.WEST);
3071 valPanel.add(valBox);
3072 laypanel.add(labPanel);
3073 laypanel.add(valPanel);
3074 valPanel.setToolTipText(tooltip);
3075 labPanel.setToolTipText(tooltip);
3076 valBox.setToolTipText(tooltip);
3077 panel.add(laypanel);