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 if (!Platform.isJS())
1449 structViewer.setFont(LABEL_FONT);
1450 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1451 structViewer.addItem(ViewerType.JMOL.name());
1452 structViewer.addItem(ViewerType.CHIMERA.name());
1453 structViewer.addActionListener(new ActionListener()
1456 public void actionPerformed(ActionEvent e)
1458 structureViewer_actionPerformed(
1459 (String) structViewer.getSelectedItem());
1462 structureTab.add(structViewer);
1465 ypos += lineSpacing;
1466 JLabel pathLabel = new JLabel();
1467 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1468 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1469 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1470 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1471 structureTab.add(pathLabel);
1473 chimeraPath.setFont(LABEL_FONT);
1474 chimeraPath.setText("");
1475 final String tooltip = JvSwingUtils.wrapTooltip(true,
1476 MessageManager.getString("label.chimera_path_tip"));
1477 chimeraPath.setToolTipText(tooltip);
1478 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1479 chimeraPath.addMouseListener(new MouseAdapter()
1482 public void mouseClicked(MouseEvent e)
1484 if (e.getClickCount() == 2)
1486 String chosen = openFileChooser(false);
1489 chimeraPath.setText(chosen);
1494 structureTab.add(chimeraPath);
1496 ypos += lineSpacing;
1497 nwMapping.setFont(LABEL_FONT);
1498 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1499 siftsMapping.setFont(LABEL_FONT);
1500 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1501 mappingMethod.add(nwMapping);
1502 mappingMethod.add(siftsMapping);
1503 JPanel mappingPanel = new JPanel();
1504 mappingPanel.setFont(LABEL_FONT);
1505 TitledBorder mmTitledBorder = new TitledBorder(
1506 MessageManager.getString("label.mapping_method"));
1507 mmTitledBorder.setTitleFont(LABEL_FONT);
1508 mappingPanel.setBorder(mmTitledBorder);
1509 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1510 // GridLayout mappingLayout = new GridLayout();
1511 mappingPanel.setLayout(new GridLayout());
1512 mappingPanel.add(nwMapping);
1513 mappingPanel.add(siftsMapping);
1514 structureTab.add(mappingPanel);
1516 ypos += lineSpacing;
1517 ypos += lineSpacing;
1518 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1519 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1520 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1521 structureTab.add(docFieldPref);
1524 * hide Chimera options in JalviewJS
1526 if (Platform.isJS())
1528 pathLabel.setVisible(false);
1529 chimeraPath.setVisible(false);
1530 viewerLabel.setVisible(false);
1531 structViewer.setVisible(false);
1534 return structureTab;
1538 * Action on choosing a structure viewer from combobox options.
1540 * @param selectedItem
1542 protected void structureViewer_actionPerformed(String selectedItem)
1547 * Show a dialog for the user to choose a file. Returns the chosen path, or
1552 protected String openFileChooser(boolean forFolder)
1554 String choice = null;
1555 JFileChooser chooser = new JFileChooser();
1558 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1561 // chooser.setFileView(new JalviewFileView());
1562 chooser.setDialogTitle(
1563 MessageManager.getString("label.open_local_file"));
1564 chooser.setToolTipText(MessageManager.getString("action.open"));
1566 int value = chooser.showOpenDialog(this);
1568 if (value == JFileChooser.APPROVE_OPTION)
1570 choice = chooser.getSelectedFile().getPath();
1575 protected boolean validateStructure()
1581 * Initialises the Visual tabbed panel.
1585 private JPanel initVisualTab()
1587 JPanel visualTab = new JPanel();
1588 visualTab.setBorder(new TitledBorder(
1589 MessageManager.getString("action.open_new_alignment")));
1590 visualTab.setLayout(null);
1591 fullScreen.setFont(LABEL_FONT);
1592 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1593 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1594 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1595 quality.setEnabled(false);
1596 quality.setFont(LABEL_FONT);
1597 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1598 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1599 quality.setSelected(true);
1600 quality.setText(MessageManager.getString("label.quality"));
1601 conservation.setEnabled(false);
1602 conservation.setFont(LABEL_FONT);
1603 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1604 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1605 conservation.setSelected(true);
1606 conservation.setText(MessageManager.getString("label.conservation"));
1607 identity.setEnabled(false);
1608 identity.setFont(LABEL_FONT);
1609 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1610 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1611 identity.setSelected(true);
1612 identity.setText(MessageManager.getString("label.consensus"));
1613 showOccupancy.setFont(LABEL_FONT);
1614 showOccupancy.setEnabled(false);
1615 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1616 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1617 showOccupancy.setSelected(true);
1618 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1620 JLabel showGroupbits = new JLabel();
1621 showGroupbits.setFont(LABEL_FONT);
1622 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1623 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1625 .setText(MessageManager.getString("action.show_group") + ":");
1626 JLabel showConsensbits = new JLabel();
1627 showConsensbits.setFont(LABEL_FONT);
1628 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1629 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1631 .setText(MessageManager.getString("label.consensus") + ":");
1632 showConsensHistogram.setEnabled(false);
1633 showConsensHistogram.setFont(LABEL_FONT);
1634 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1635 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1636 showConsensHistogram.setSelected(true);
1637 showConsensHistogram
1638 .setText(MessageManager.getString("label.histogram"));
1639 showConsensLogo.setEnabled(false);
1640 showConsensLogo.setFont(LABEL_FONT);
1641 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1642 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1643 showConsensLogo.setSelected(true);
1644 showConsensLogo.setText(MessageManager.getString("label.logo"));
1645 showGroupConsensus.setEnabled(false);
1646 showGroupConsensus.setFont(LABEL_FONT);
1647 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1648 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1649 showGroupConsensus.setSelected(true);
1650 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1651 showGroupConservation.setEnabled(false);
1652 showGroupConservation.setFont(LABEL_FONT);
1653 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1654 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1655 showGroupConservation.setSelected(true);
1656 showGroupConservation
1657 .setText(MessageManager.getString("label.conservation"));
1658 showNpTooltip.setEnabled(true);
1659 showNpTooltip.setFont(LABEL_FONT);
1660 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1661 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1662 showNpTooltip.setSelected(true);
1663 showNpTooltip.setText(
1664 MessageManager.getString("label.non_positional_features"));
1665 showDbRefTooltip.setEnabled(true);
1666 showDbRefTooltip.setFont(LABEL_FONT);
1667 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1668 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1669 showDbRefTooltip.setSelected(true);
1671 .setText(MessageManager.getString("label.database_references"));
1672 annotations.setFont(LABEL_FONT);
1673 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1674 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1675 annotations.setSelected(true);
1676 annotations.setText(MessageManager.getString("label.show_annotations"));
1677 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1678 annotations.addActionListener(new ActionListener()
1681 public void actionPerformed(ActionEvent e)
1683 annotations_actionPerformed(e);
1686 identity.addActionListener(new ActionListener()
1689 public void actionPerformed(ActionEvent e)
1691 annotations_actionPerformed(e);
1694 showGroupConsensus.addActionListener(new ActionListener()
1697 public void actionPerformed(ActionEvent e)
1699 annotations_actionPerformed(e);
1702 showUnconserved.setFont(LABEL_FONT);
1703 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1704 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1705 showUnconserved.setSelected(true);
1707 .setText(MessageManager.getString("action.show_unconserved"));
1708 showUnconserved.addActionListener(new ActionListener()
1711 public void actionPerformed(ActionEvent e)
1713 showunconserved_actionPerformed(e);
1717 // TODO these are not yet added to / action from Preferences
1718 // JCheckBox shareSelections = new JCheckBox();
1719 // shareSelections.setFont(verdana11);
1720 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1721 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1722 // shareSelections.setSelected(true);
1723 // shareSelections.setText(MessageManager
1724 // .getString("label.share_selection_across_views"));
1725 // JCheckBox followHighlight = new JCheckBox();
1726 // followHighlight.setFont(verdana11);
1727 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1728 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1729 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1730 // followHighlight.setSelected(true);
1731 // followHighlight.setText(MessageManager
1732 // .getString("label.scroll_highlighted_regions"));
1734 seqLimit.setFont(LABEL_FONT);
1735 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1736 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1737 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1738 smoothFont.setFont(LABEL_FONT);
1739 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1740 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1741 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1742 scaleProteinToCdna.setFont(LABEL_FONT);
1743 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1744 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1745 scaleProteinToCdna.setText(
1746 MessageManager.getString("label.scale_protein_to_cdna"));
1747 scaleProteinToCdna.setToolTipText(
1748 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1749 JLabel gapLabel = new JLabel();
1750 gapLabel.setFont(LABEL_FONT);
1751 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1752 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1753 JLabel fontLabel = new JLabel();
1754 fontLabel.setFont(LABEL_FONT);
1755 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1756 fontLabel.setText(MessageManager.getString("label.font"));
1757 fontSizeCB.setFont(LABEL_FONT);
1758 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1759 fontStyleCB.setFont(LABEL_FONT);
1760 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1761 fontNameCB.setFont(LABEL_FONT);
1762 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1763 gapSymbolCB.setFont(LABEL_FONT);
1764 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1765 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1766 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1767 gapSymbolCB.setRenderer(dlcr);
1769 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1770 startupCheckbox.setFont(LABEL_FONT);
1771 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1772 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1773 startupCheckbox.setSelected(true);
1774 startupFileTextfield.setFont(LABEL_FONT);
1775 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1776 final String tooltip = JvSwingUtils.wrapTooltip(true,
1777 MessageManager.getString("label.double_click_to_browse"));
1778 startupFileTextfield.setToolTipText(tooltip);
1779 startupFileTextfield.addMouseListener(new MouseAdapter()
1782 public void mouseClicked(MouseEvent e)
1784 if (e.getClickCount() > 1)
1786 startupFileTextfield_mouseClicked();
1791 sortby.setFont(LABEL_FONT);
1792 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1793 JLabel sortLabel = new JLabel();
1794 sortLabel.setFont(LABEL_FONT);
1795 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1796 sortLabel.setText(MessageManager.getString("label.sort_by"));
1797 sortAnnBy.setFont(LABEL_FONT);
1798 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1799 JLabel sortAnnLabel = new JLabel();
1800 sortAnnLabel.setFont(LABEL_FONT);
1801 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1802 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1803 sortAutocalc.setFont(LABEL_FONT);
1804 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1806 JPanel annsettingsPanel = new JPanel();
1807 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1808 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1809 annsettingsPanel.setBorder(new EtchedBorder());
1810 visualTab.add(annsettingsPanel);
1811 Border jb = new EmptyBorder(1, 1, 4, 5);
1812 annotations.setBorder(jb);
1813 showOccupancy.setBorder(jb);
1814 quality.setBorder(jb);
1815 conservation.setBorder(jb);
1816 identity.setBorder(jb);
1817 showConsensbits.setBorder(jb);
1818 showGroupbits.setBorder(jb);
1819 showGroupConsensus.setBorder(jb);
1820 showGroupConservation.setBorder(jb);
1821 showConsensHistogram.setBorder(jb);
1822 showConsensLogo.setBorder(jb);
1824 JPanel autoAnnotSettings = new JPanel();
1825 annsettingsPanel.add(autoAnnotSettings);
1826 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1827 autoAnnotSettings.add(annotations);
1828 autoAnnotSettings.add(quality);
1829 // second row of autoannotation box
1830 autoAnnotSettings = new JPanel();
1831 annsettingsPanel.add(autoAnnotSettings);
1833 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1834 autoAnnotSettings.add(conservation);
1835 autoAnnotSettings.add(identity);
1836 autoAnnotSettings.add(showOccupancy);
1837 autoAnnotSettings.add(showGroupbits);
1838 autoAnnotSettings.add(showGroupConservation);
1839 autoAnnotSettings.add(showGroupConsensus);
1840 autoAnnotSettings.add(showConsensbits);
1841 autoAnnotSettings.add(showConsensHistogram);
1842 autoAnnotSettings.add(showConsensLogo);
1844 JPanel tooltipSettings = new JPanel();
1845 tooltipSettings.setBorder(new TitledBorder(
1846 MessageManager.getString("label.sequence_id_tooltip")));
1847 tooltipSettings.setBounds(173, 140, 220, 62);
1848 tooltipSettings.setLayout(new GridLayout(2, 1));
1849 tooltipSettings.add(showDbRefTooltip);
1850 tooltipSettings.add(showNpTooltip);
1851 visualTab.add(tooltipSettings);
1853 wrap.setFont(LABEL_FONT);
1854 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1855 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1856 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1857 rightAlign.setFont(LABEL_FONT);
1858 rightAlign.setForeground(Color.black);
1859 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1860 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1861 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1862 idItalics.setFont(LABEL_FONT_ITALIC);
1863 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1864 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1866 MessageManager.getString("label.sequence_name_italics"));
1867 openoverv.setFont(LABEL_FONT);
1868 openoverv.setActionCommand(
1869 MessageManager.getString("label.open_overview"));
1870 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1871 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1872 openoverv.setText(MessageManager.getString("label.open_overview"));
1873 JPanel jPanel2 = new JPanel();
1874 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1875 jPanel2.setLayout(new GridLayout(14, 1));
1876 jPanel2.add(fullScreen);
1877 jPanel2.add(openoverv);
1878 jPanel2.add(seqLimit);
1879 jPanel2.add(rightAlign);
1880 jPanel2.add(fontLabel);
1881 jPanel2.add(showUnconserved);
1882 jPanel2.add(idItalics);
1883 jPanel2.add(smoothFont);
1884 jPanel2.add(scaleProteinToCdna);
1885 jPanel2.add(gapLabel);
1887 jPanel2.add(sortLabel);
1888 jPanel2.add(sortAnnLabel);
1889 jPanel2.add(startupCheckbox);
1890 visualTab.add(jPanel2);
1891 visualTab.add(startupFileTextfield);
1892 visualTab.add(sortby);
1893 visualTab.add(sortAnnBy);
1894 visualTab.add(sortAutocalc);
1895 visualTab.add(gapSymbolCB);
1896 visualTab.add(fontNameCB);
1897 visualTab.add(fontSizeCB);
1898 visualTab.add(fontStyleCB);
1900 if (Platform.isJS())
1902 startupCheckbox.setVisible(false);
1903 startupFileTextfield.setVisible(false);
1910 * Load the saved Backups options EXCEPT "Enabled" and "Scheme"
1913 protected void loadLastSavedBackupsOptions()
1915 BackupFilesPresetEntry savedPreset = BackupFilesPresetEntry
1916 .getSavedBackupEntry();
1918 .setSelected(Cache.getDefault(BackupFiles.ENABLED, !Platform.isJS()));
1920 BackupFilesPresetEntry backupfilesCustomEntry = BackupFilesPresetEntry
1921 .createBackupFilesPresetEntry(Cache
1922 .getDefault(BackupFilesPresetEntry.CUSTOMCONFIG, null));
1923 if (backupfilesCustomEntry == null)
1925 backupfilesCustomEntry = BackupFilesPresetEntry.backupfilesPresetEntriesValues
1926 .get(BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT);
1928 BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
1929 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM,
1930 backupfilesCustomEntry);
1932 setComboIntStringKey(backupfilesPresetsCombo,
1933 Cache.getDefault(BackupFiles.NS + "_PRESET",
1934 BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT));
1936 backupsSetOptions(savedPreset);
1938 backupsOptionsSetEnabled();
1939 updateBackupFilesExampleLabel();
1942 private boolean warnAboutSuffixReverseChange()
1944 BackupFilesPresetEntry bfpe = BackupFilesPresetEntry
1945 .getSavedBackupEntry();
1946 boolean savedSuffixReverse = bfpe.reverse;
1947 int savedSuffixDigits = bfpe.digits;
1948 String savedSuffixTemplate = bfpe.suffix;
1950 boolean nowSuffixReverse = suffixReverse.isSelected();
1951 int nowSuffixDigits = getSpinnerInt(suffixDigitsSpinner, 3);
1952 String nowSuffixTemplate = suffixTemplate.getText();
1953 return nowSuffixReverse != savedSuffixReverse
1954 && nowSuffixDigits == savedSuffixDigits
1955 && nowSuffixTemplate != null
1956 && nowSuffixTemplate.equals(savedSuffixTemplate);
1960 * Initialises the Backups tabbed panel.
1964 private JPanel initBackupsTab()
1966 JPanel backupsTab = new JPanel();
1967 backupsTab.setBorder(new TitledBorder(
1968 MessageManager.getString("label.backup_files")));
1969 backupsTab.setLayout(new GridBagLayout());
1971 GridBagConstraints gbc = new GridBagConstraints();
1974 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
1975 gbc.fill = GridBagConstraints.NONE;
1977 initBackupsTabPresetsPanel();
1978 initBackupsTabSuffixPanel();
1979 initBackupsTabKeepFilesPanel();
1980 initBackupsTabFilenameExamplesPanel();
1982 enableBackupFiles.setFont(LABEL_FONT_BOLD);
1984 .setText(MessageManager.getString("label.enable_backupfiles"));
1985 enableBackupFiles.addActionListener(new ActionListener()
1988 public void actionPerformed(ActionEvent e)
1990 // enable other options only when the first is checked
1991 backupsOptionsSetEnabled();
1996 // enable checkbox 1 col
2000 gbc.gridy = 0; // row 0
2001 backupsTab.add(enableBackupFiles, gbc);
2003 // summary of scheme box (over two rows)
2007 gbc.anchor = GridBagConstraints.FIRST_LINE_END;
2008 gbc.fill = GridBagConstraints.BOTH;
2009 backupsTab.add(exampleFilesPanel, gbc);
2011 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
2012 gbc.fill = GridBagConstraints.NONE;
2014 // fill empty space on right
2017 backupsTab.add(new JPanel(), gbc);
2022 gbc.gridy++; // row 1
2023 backupsTab.add(presetsPanel, gbc);
2025 // now using whole row
2030 gbc.gridy++; // row 2
2031 backupsTab.add(keepfilesPanel, gbc);
2033 // filename strategy box
2034 gbc.gridy++; // row 3
2035 backupsTab.add(suffixPanel, gbc);
2038 gbc.gridy++; // row 4
2040 backupsTab.add(new JPanel(), gbc);
2042 backupsOptionsSetEnabled();
2046 private JPanel initBackupsTabPresetsPanel()
2049 String title = MessageManager.getString("label.schemes");
2051 presetsPanel.setLayout(new GridBagLayout());
2053 GridBagConstraints gbc = new GridBagConstraints();
2056 gbc.anchor = GridBagConstraints.BASELINE_LEADING;
2057 gbc.fill = GridBagConstraints.NONE;
2065 presetsComboLabel = new JLabel(title + ":");
2066 presetsPanel.add(presetsComboLabel, gbc);
2068 List<Object> entries = Arrays
2069 .asList((Object[]) BackupFilesPresetEntry.backupfilesPresetEntries);
2070 List<String> tooltips = Arrays.asList(
2071 BackupFilesPresetEntry.backupfilesPresetEntryDescriptions);
2072 backupfilesPresetsCombo = JvSwingUtils.buildComboWithTooltips(entries,
2075 for (int i = 0; i < BackupFilesPresetEntry.backupfilesPresetEntries.length; i++)
2077 backupfilesPresetsCombo
2078 .addItem(BackupFilesPresetEntry.backupfilesPresetEntries[i]);
2082 backupfilesPresetsCombo.addActionListener(new ActionListener()
2085 public void actionPerformed(ActionEvent e)
2087 int key = getComboIntStringKey(backupfilesPresetsCombo);
2088 if (!customiseCheckbox.isSelected())
2090 backupfilesPresetsComboLastSelected = key;
2092 if (key == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM)
2094 if (customiseCheckbox.isSelected())
2096 // got here by clicking on customiseCheckbox so don't change the values
2097 backupfilesCustomOptionsSetEnabled();
2101 backupsTabUpdatePresets();
2102 backupfilesCustomOptionsSetEnabled();
2107 customiseCheckbox.setSelected(false);
2108 backupsTabUpdatePresets();
2109 backupfilesCustomOptionsSetEnabled();
2114 // dropdown list of preset schemes
2116 presetsPanel.add(backupfilesPresetsCombo, gbc);
2118 revertButton.setText(MessageManager.getString("label.cancel_changes"));
2119 revertButton.setToolTipText(
2120 MessageManager.getString("label.cancel_changes_description"));
2121 revertButton.addActionListener(new ActionListener()
2124 public void actionPerformed(ActionEvent e)
2127 BackupFilesPresetEntry.backupfilesPresetEntriesValues.get(
2128 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM));
2129 backupfilesCustomOptionsSetEnabled();
2133 revertButton.setFont(LABEL_FONT);
2135 customiseCheckbox.setFont(LABEL_FONT);
2136 customiseCheckbox.setText(MessageManager.getString("label.customise"));
2137 customiseCheckbox.addActionListener(new ActionListener()
2140 public void actionPerformed(ActionEvent e)
2142 int currently = getComboIntStringKey(backupfilesPresetsCombo);
2143 if (customiseCheckbox.isSelected())
2145 backupfilesPresetsComboLastSelected = currently;
2146 setComboIntStringKey(backupfilesPresetsCombo,
2147 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM);
2151 setComboIntStringKey(backupfilesPresetsCombo,
2152 backupfilesPresetsComboLastSelected);
2155 backupfilesCustomOptionsSetEnabled();
2158 customiseCheckbox.setToolTipText(
2159 MessageManager.getString("label.customise_description"));
2161 // customise checkbox
2164 presetsPanel.add(customiseCheckbox, gbc);
2166 // "Cancel changes" button (aligned with combo box above)
2168 presetsPanel.add(revertButton, gbc);
2170 return presetsPanel;
2173 private JPanel initBackupsTabFilenameExamplesPanel()
2175 String title = MessageManager
2176 .getString("label.scheme_examples");
2177 TitledBorder tb = new TitledBorder(title);
2178 exampleFilesPanel.setBorder(tb);
2179 exampleFilesPanel.setLayout(new GridBagLayout());
2182 backupfilesExampleLabel.setEditable(false);
2183 backupfilesExampleLabel
2184 .setBackground(exampleFilesPanel.getBackground());
2186 updateBackupFilesExampleLabel();
2188 GridBagConstraints gbc = new GridBagConstraints();
2191 gbc.fill = GridBagConstraints.NONE;
2192 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
2194 exampleFilesPanel.add(backupfilesExampleLabel, gbc);
2195 return exampleFilesPanel;
2198 private void backupsTabUpdatePresets()
2200 IntKeyStringValueEntry entry = (IntKeyStringValueEntry) backupfilesPresetsCombo
2203 String value = entry.v;
2205 if (BackupFilesPresetEntry.backupfilesPresetEntriesValues
2209 BackupFilesPresetEntry.backupfilesPresetEntriesValues
2215 "Preset '" + value + "' [key:" + key + "] not implemented");
2218 // Custom options will now be enabled when the customiseCheckbox is checked
2219 // (performed above)
2220 // backupfilesCustomOptionsSetEnabled();
2221 updateBackupFilesExampleLabel();
2224 protected int getComboIntStringKey(
2225 JComboBox<Object> backupfilesPresetsCombo2)
2227 IntKeyStringValueEntry e;
2230 e = (IntKeyStringValueEntry) backupfilesPresetsCombo2
2232 } catch (Exception ex)
2235 "Problem casting Combo entry to IntKeyStringValueEntry.");
2238 return e != null ? e.k : 0;
2241 protected void setComboIntStringKey(
2242 JComboBox<Object> backupfilesPresetsCombo2,
2245 for (int i = 0; i < backupfilesPresetsCombo2.getItemCount(); i++)
2247 IntKeyStringValueEntry e;
2250 e = (IntKeyStringValueEntry) backupfilesPresetsCombo2.getItemAt(i);
2251 } catch (Exception ex)
2254 "Problem casting Combo entry to IntKeyStringValueEntry. Skipping item. ");
2259 backupfilesPresetsCombo2.setSelectedIndex(i);
2263 // backupsTabUpdatePresets();
2266 private JPanel initBackupsTabSuffixPanel()
2268 suffixPanel.setBorder(new TitledBorder(
2269 MessageManager.getString("label.backup_filename_strategy")));
2270 suffixPanel.setLayout(new GridBagLayout());
2273 .setText(MessageManager.getString("label.append_to_filename"));
2274 suffixTemplateLabel.setHorizontalAlignment(SwingConstants.LEFT);
2275 suffixTemplateLabel.setFont(LABEL_FONT);
2277 final String tooltip = JvSwingUtils.wrapTooltip(true,
2278 MessageManager.getString("label.append_to_filename_tooltip"));
2279 suffixTemplate.setToolTipText(tooltip);
2280 suffixTemplate.addActionListener(new ActionListener()
2283 public void actionPerformed(ActionEvent e)
2285 updateBackupFilesExampleLabel();
2286 backupfilesCustomOptionsSetEnabled();
2287 backupfilesRevertButtonSetEnabled(true);
2291 suffixTemplate.addKeyListener(new KeyListener()
2294 public void keyReleased(KeyEvent e)
2296 updateBackupFilesExampleLabel();
2297 backupfilesCustomOptionsSetEnabled();
2298 backupfilesRevertButtonSetEnabled(true);
2302 public void keyPressed(KeyEvent e)
2306 // disable use of ':' or '/' or '\'
2308 public void keyTyped(KeyEvent e)
2310 char c = e.getKeyChar();
2311 if (c == ':' || c == '/' || c == '\\')
2313 // don't process ':' or '/' or '\'
2322 .setText(MessageManager.getString("label.index_digits"));
2323 suffixDigitsLabel.setHorizontalAlignment(SwingConstants.LEFT);
2324 suffixDigitsLabel.setFont(LABEL_FONT);
2325 ChangeListener c = new ChangeListener()
2328 public void stateChanged(ChangeEvent e)
2330 backupfilesRevertButtonSetEnabled(true);
2331 updateBackupFilesExampleLabel();
2335 setIntegerSpinner(suffixDigitsSpinner, BackupFilesPresetEntry.DIGITSMIN,
2336 BackupFilesPresetEntry.DIGITSMAX, 3, c);
2338 suffixReverse.setLabels(MessageManager.getString("label.reverse_roll"),
2339 MessageManager.getString("label.increment_index"));
2340 suffixReverse.addActionListener(new ActionListener()
2343 public void actionPerformed(ActionEvent e)
2345 boolean okay = true;
2346 if (warnAboutSuffixReverseChange())
2349 okay = confirmSuffixReverseChange();
2353 backupfilesRevertButtonSetEnabled(true);
2354 updateBackupFilesExampleLabel();
2358 boolean savedSuffixReverse = BackupFilesPresetEntry
2359 .getSavedBackupEntry().reverse;
2360 suffixReverse.setSelected(savedSuffixReverse);
2365 GridBagConstraints sgbc = new GridBagConstraints();
2367 // first row (template text box)
2368 sgbc.anchor = GridBagConstraints.WEST;
2372 sgbc.gridheight = 1;
2375 sgbc.fill = GridBagConstraints.NONE;
2376 suffixPanel.add(suffixTemplateLabel, sgbc);
2379 sgbc.fill = GridBagConstraints.HORIZONTAL;
2380 suffixPanel.add(suffixTemplate, sgbc);
2382 // second row (number of digits spinner)
2386 sgbc.fill = GridBagConstraints.NONE;
2387 suffixPanel.add(suffixDigitsLabel, sgbc);
2390 sgbc.fill = GridBagConstraints.HORIZONTAL;
2391 suffixPanel.add(suffixDigitsSpinner, sgbc);
2393 // third row (forward order radio selection)
2396 sgbc.gridwidth = GridBagConstraints.REMAINDER;
2397 sgbc.fill = GridBagConstraints.HORIZONTAL;
2398 suffixPanel.add(suffixReverse.getFalseButton(), sgbc);
2400 // fourth row (reverse order radio selection)
2402 suffixPanel.add(suffixReverse.getTrueButton(), sgbc);
2406 private boolean confirmSuffixReverseChange()
2408 boolean ret = false;
2409 String warningMessage = MessageManager
2410 .getString("label.warning_confirm_change_reverse");
2411 int confirm = JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(),
2413 MessageManager.getString("label.change_increment_decrement"),
2414 JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE);
2416 ret = (confirm == JvOptionPane.YES_OPTION);
2420 private JPanel initBackupsTabKeepFilesPanel()
2422 keepfilesPanel.setBorder(
2423 new TitledBorder(MessageManager.getString("label.keep_files")));
2424 keepfilesPanel.setLayout(new GridBagLayout());
2426 backupfilesKeepAll.setLabels(
2427 MessageManager.getString("label.keep_all_backup_files"),
2428 MessageManager.getString(
2429 "label.keep_only_this_number_of_backup_files"));
2430 backupfilesKeepAll.addTrueActionListener(new ActionListener()
2433 public void actionPerformed(ActionEvent e)
2435 backupfilesRevertButtonSetEnabled(true);
2436 updateBackupFilesExampleLabel();
2439 backupfilesKeepAll.addActionListener(new ActionListener()
2442 public void actionPerformed(ActionEvent e)
2444 backupfilesRevertButtonSetEnabled(true);
2445 keepRollMaxOptionsEnabled();
2446 updateBackupFilesExampleLabel();
2450 ChangeListener c = new ChangeListener()
2453 public void stateChanged(ChangeEvent e)
2455 backupfilesRevertButtonSetEnabled(true);
2456 updateBackupFilesExampleLabel();
2460 setIntegerSpinner(backupfilesRollMaxSpinner,
2461 BackupFilesPresetEntry.ROLLMAXMIN,
2462 BackupFilesPresetEntry.ROLLMAXMAX, 4, true, c);
2464 backupfilesConfirmDelete.setLabels(
2465 MessageManager.getString("label.always_ask"),
2466 MessageManager.getString("label.auto_delete"));
2467 backupfilesConfirmDelete.addActionListener(new ActionListener()
2470 public void actionPerformed(ActionEvent e)
2472 backupfilesRevertButtonSetEnabled(true);
2475 // update the enabled section
2476 keepRollMaxOptionsEnabled();
2478 GridBagConstraints kgbc = new GridBagConstraints();
2480 // first row (template text box)
2481 kgbc.anchor = GridBagConstraints.WEST;
2484 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2485 kgbc.gridheight = 1;
2488 kgbc.fill = GridBagConstraints.HORIZONTAL;
2489 keepfilesPanel.add(backupfilesKeepAll.getTrueButton(), kgbc);
2495 kgbc.gridwidth = GridBagConstraints.RELATIVE;
2496 keepfilesPanel.add(backupfilesKeepAll.getFalseButton(), kgbc);
2499 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2500 keepfilesPanel.add(backupfilesRollMaxSpinner, kgbc);
2502 // third row (indented)
2504 kgbc.insets = new Insets(0, 20, 0, 0);
2507 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2508 kgbc.fill = GridBagConstraints.HORIZONTAL;
2511 JPanel jp = new JPanel();
2512 jp.setLayout(new FlowLayout());
2514 .setText(MessageManager
2515 .getString("label.autodelete_old_backup_files"));
2516 oldBackupFilesLabel.setFont(LABEL_FONT);
2517 oldBackupFilesLabel.setHorizontalAlignment(SwingConstants.LEFT);
2518 jp.add(oldBackupFilesLabel);
2519 jp.add(backupfilesConfirmDelete.getTrueButton());
2520 jp.add(backupfilesConfirmDelete.getFalseButton());
2521 keepfilesPanel.add(jp, kgbc);
2523 return keepfilesPanel;
2526 protected void updateBackupFilesExampleLabel()
2528 int exampleindex = 12;
2529 String base = MessageManager.getString("label.filename") + ".fa";
2530 if (base == null || base.length() == 0)
2532 base = "file_name.fa";
2535 boolean reverse = suffixReverse.isSelected();
2536 boolean keepAll = backupfilesKeepAll.isSelected();
2538 String suffix = suffixTemplate.getText();
2541 backupfilesExampleLabel.setFont(LABEL_FONT_ITALIC);
2542 if (suffix == null || suffix.length() == 0)
2544 backupfilesExampleLabel
2545 .setText(MessageManager.getString("label.no_backup_files"));
2546 backupfilesExampleLabel.setFont(LABEL_FONT_BOLD);
2550 rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 4);
2551 rollMax = rollMax < 1 ? 1 : rollMax;
2553 if (suffix.indexOf(BackupFiles.NUM_PLACEHOLDER) == -1)
2558 digits = getSpinnerInt(suffixDigitsSpinner, 3);
2559 digits = digits < 1 ? 1 : digits;
2561 int lowersurround = 2;
2562 int uppersurround = 0;
2563 StringBuilder exampleSB = new StringBuilder();
2564 boolean firstLine = true;
2570 int max = keepAll ? exampleindex : rollMax;
2571 for (int index = min; index <= max; index++)
2573 if (index == min + lowersurround && index < max - uppersurround - 1)
2575 exampleSB.append("\n...");
2578 else if (index > min + lowersurround && index < max - uppersurround)
2590 exampleSB.append("\n");
2593 exampleSB.append(BackupFilenameParts.getBackupFilename(index,
2594 base, suffix, digits));
2597 // no extra text needed
2599 else if (index == min)
2601 String newest = MessageManager.getString("label.braced_newest");
2602 if (newest != null && newest.length() > 0)
2604 exampleSB.append(" " + newest);
2607 else if (index == max)
2609 String oldest = MessageManager.getString("label.braced_oldest");
2610 if (oldest != null && oldest.length() > 0)
2612 exampleSB.append(" " + oldest);
2621 int min = (keepAll || exampleindex - rollMax < 0) ? 1
2622 : exampleindex - rollMax + 1;
2623 int max = exampleindex;
2625 for (int index = min; index <= max; index++)
2628 if (index == min + lowersurround && index < max - uppersurround - 1)
2630 exampleSB.append("\n...");
2633 else if (index > min + lowersurround && index < max - uppersurround)
2645 exampleSB.append("\n");
2648 exampleSB.append(BackupFilenameParts.getBackupFilename(index,
2649 base, suffix, digits));
2652 // no extra text needed
2654 else if (index == min)
2656 String oldest = MessageManager.getString("label.braced_oldest");
2657 if (oldest != null && oldest.length() > 0)
2659 exampleSB.append(" " + oldest);
2662 else if (index == max)
2664 String newest = MessageManager.getString("label.braced_newest");
2665 if (newest != null && newest.length() > 0)
2667 exampleSB.append(" " + newest);
2675 // add some extra empty lines to pad out the example files box. ugh, please tell
2676 // me how to do this better
2677 int remainingLines = lowersurround + uppersurround + 1 - lineNumber;
2678 if (remainingLines > 0)
2680 for (int i = 0; i < remainingLines; i++)
2682 exampleSB.append("\n ");
2687 backupfilesExampleLabel.setText(exampleSB.toString());
2690 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2691 boolean useExistingVal, ChangeListener c)
2698 i = ((Integer) s.getValue()).intValue();
2699 } catch (Exception e)
2702 "Exception casting the initial value of s.getValue()");
2706 setIntegerSpinner(s, min, max, i, c);
2709 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2712 // integer spinner for number of digits
2721 SpinnerModel sModel = new SpinnerNumberModel(def, min, max, 1);
2724 s.addChangeListener(c);
2728 protected static int getSpinnerInt(JSpinner s, int def)
2734 i = (Integer) s.getValue();
2735 } catch (Exception e)
2737 Cache.log.error("Failed casting (Integer) JSpinner s.getValue()");
2742 private void keepRollMaxOptionsEnabled()
2744 boolean enabled = backupfilesKeepAll.isEnabled()
2745 && !backupfilesKeepAll.isSelected();
2746 oldBackupFilesLabel.setEnabled(enabled);
2747 backupfilesRollMaxSpinner.setEnabled(enabled);
2748 backupfilesConfirmDelete.setEnabled(enabled);
2751 private void backupfilesKeepAllSetEnabled(boolean tryEnabled)
2753 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2754 && customiseCheckbox.isSelected()
2755 && suffixTemplate.getText()
2756 .indexOf(BackupFiles.NUM_PLACEHOLDER) > -1;
2757 keepfilesPanel.setEnabled(enabled);
2758 backupfilesKeepAll.setEnabled(enabled);
2759 oldBackupFilesLabel.setEnabled(enabled);
2760 keepRollMaxOptionsEnabled();
2763 private void backupfilesSuffixTemplateDigitsSetEnabled()
2765 boolean enabled = suffixTemplate.isEnabled() && suffixTemplate.getText()
2766 .indexOf(BackupFiles.NUM_PLACEHOLDER) > -1;
2767 suffixDigitsLabel.setEnabled(enabled);
2768 suffixDigitsSpinner.setEnabled(enabled);
2769 suffixReverse.setEnabled(enabled);
2772 private void backupfilesSuffixTemplateSetEnabled(boolean tryEnabled)
2774 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2775 && customiseCheckbox.isSelected();
2776 suffixPanel.setEnabled(enabled);
2777 suffixTemplateLabel.setEnabled(enabled);
2778 suffixTemplate.setEnabled(enabled);
2779 backupfilesSuffixTemplateDigitsSetEnabled();
2782 private void backupfilesRevertButtonSetEnabled(boolean tryEnabled)
2784 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2785 && customiseCheckbox.isSelected() && backupfilesCustomChanged();
2786 revertButton.setEnabled(enabled);
2789 private boolean backupfilesCustomChanged()
2791 BackupFilesPresetEntry custom = BackupFilesPresetEntry.backupfilesPresetEntriesValues
2792 .get(BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM);
2793 BackupFilesPresetEntry current = getBackupfilesCurrentEntry();
2794 return !custom.equals(current);
2797 protected BackupFilesPresetEntry getBackupfilesCurrentEntry()
2799 String suffix = suffixTemplate.getText();
2800 int digits = getSpinnerInt(suffixDigitsSpinner, 3);
2801 boolean reverse = suffixReverse.isSelected();
2802 boolean keepAll = backupfilesKeepAll.isSelected();
2803 int rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 3);
2804 boolean confirmDelete = backupfilesConfirmDelete.isSelected();
2806 BackupFilesPresetEntry bfpe = new BackupFilesPresetEntry(suffix, digits,
2807 reverse, keepAll, rollMax, confirmDelete);
2812 protected void backupfilesCustomOptionsSetEnabled()
2814 boolean enabled = customiseCheckbox.isSelected();
2816 backupfilesRevertButtonSetEnabled(enabled);
2817 backupfilesSuffixTemplateSetEnabled(enabled);
2818 backupfilesKeepAllSetEnabled(enabled);
2821 private void backupfilesSummarySetEnabled()
2823 boolean enabled = enableBackupFiles.isSelected();
2824 backupfilesExampleLabel.setEnabled(enabled);
2825 exampleFilesPanel.setEnabled(enabled);
2828 private void backupfilesPresetsSetEnabled()
2830 boolean enabled = enableBackupFiles.isSelected();
2831 presetsPanel.setEnabled(enabled);
2832 presetsComboLabel.setEnabled(enabled);
2833 backupfilesPresetsCombo.setEnabled(enabled);
2834 customiseCheckbox.setEnabled(enabled);
2835 revertButton.setEnabled(enabled);
2838 protected void backupsOptionsSetEnabled()
2840 backupfilesPresetsSetEnabled();
2841 backupfilesSummarySetEnabled();
2842 backupfilesCustomOptionsSetEnabled();
2845 protected void backupsSetOptions(String suffix, int digits,
2846 boolean reverse, boolean keepAll, int rollMax,
2847 boolean confirmDelete)
2849 suffixTemplate.setText(suffix);
2850 suffixDigitsSpinner.setValue(digits);
2851 suffixReverse.setSelected(reverse);
2852 backupfilesKeepAll.setSelected(keepAll);
2853 backupfilesRollMaxSpinner.setValue(rollMax);
2854 backupfilesConfirmDelete.setSelected(confirmDelete);
2857 protected void backupsSetOptions(BackupFilesPresetEntry p)
2859 backupsSetOptions(p.suffix, p.digits, p.reverse, p.keepAll, p.rollMax,
2863 protected void autoIdWidth_actionPerformed()
2865 // TODO Auto-generated method stub
2869 protected void userIdWidth_actionPerformed()
2871 // TODO Auto-generated method stub
2875 protected void maxColour_actionPerformed(JPanel panel)
2879 protected void minColour_actionPerformed(JPanel panel)
2883 protected void gapColour_actionPerformed(JPanel panel)
2887 protected void hiddenColour_actionPerformed(JPanel panel)
2891 protected void showunconserved_actionPerformed(ActionEvent e)
2893 // TODO Auto-generated method stub
2897 protected void useLegacyGaps_actionPerformed(ActionEvent e)
2901 protected void resetOvDefaults_actionPerformed(ActionEvent e)
2911 public void ok_actionPerformed(ActionEvent e)
2921 public void cancel_actionPerformed(ActionEvent e)
2931 public void annotations_actionPerformed(ActionEvent e)
2938 public void startupFileTextfield_mouseClicked()
2942 public void newLink_actionPerformed(ActionEvent e)
2947 public void editLink_actionPerformed(ActionEvent e)
2952 public void deleteLink_actionPerformed(ActionEvent e)
2957 public void defaultBrowser_mouseClicked(MouseEvent e)
2962 public void linkURLList_keyTyped(KeyEvent e)
2967 public void useProxy_actionPerformed()
2969 boolean enabled = useProxy.isSelected();
2970 portLabel.setEnabled(enabled);
2971 serverLabel.setEnabled(enabled);
2972 proxyServerTB.setEnabled(enabled);
2973 proxyPortTB.setEnabled(enabled);
2977 * Customer renderer for JTable: supports column of radio buttons
2979 public class RadioButtonRenderer extends JRadioButton
2980 implements TableCellRenderer
2982 public RadioButtonRenderer()
2984 setHorizontalAlignment(CENTER);
2985 setToolTipText(MessageManager.getString("label.urltooltip"));
2989 public Component getTableCellRendererComponent(JTable table,
2990 Object value, boolean isSelected, boolean hasFocus, int row,
2993 setSelected((boolean) value);
2995 // set colours to match rest of table
2998 setBackground(table.getSelectionBackground());
2999 setForeground(table.getSelectionForeground());
3003 setBackground(table.getBackground());
3004 setForeground(table.getForeground());
3011 * Customer cell editor for JTable: supports column of radio buttons in
3012 * conjunction with renderer
3014 public class RadioButtonEditor extends AbstractCellEditor
3015 implements TableCellEditor
3017 private JRadioButton button = new JRadioButton();
3019 public RadioButtonEditor()
3021 button.setHorizontalAlignment(SwingConstants.CENTER);
3022 this.button.addActionListener(new ActionListener()
3025 public void actionPerformed(ActionEvent e)
3027 fireEditingStopped();
3033 public Component getTableCellEditorComponent(JTable table, Object value,
3034 boolean isSelected, int row, int column)
3036 button.setSelected((boolean) value);
3041 public Object getCellEditorValue()
3043 return button.isSelected();
3048 protected void validateHmmerPath()
3052 protected void validateCygwinPath()
3057 * A helper method to add a panel containing a label and a component to a
3065 protected static void addtoLayout(JPanel panel, String tooltip,
3066 JComponent label, JComponent valBox)
3068 JPanel laypanel = new JPanel(new GridLayout(1, 2));
3069 JPanel labPanel = new JPanel(new BorderLayout());
3070 JPanel valPanel = new JPanel();
3071 labPanel.setBounds(new Rectangle(7, 7, 158, 23));
3072 valPanel.setBounds(new Rectangle(172, 7, 270, 23));
3073 labPanel.add(label, BorderLayout.WEST);
3074 valPanel.add(valBox);
3075 laypanel.add(labPanel);
3076 laypanel.add(valPanel);
3077 valPanel.setToolTipText(tooltip);
3078 labPanel.setToolTipText(tooltip);
3079 valBox.setToolTipText(tooltip);
3080 panel.add(laypanel);