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"));
437 slivkaTab.setLayout(new BorderLayout());
438 tabbedPane.add(slivkaTab, "Slivka Services");
441 * Handler to validate a tab before leaving it - currently only for
444 tabbedPane.addChangeListener(new ChangeListener()
446 private Component lastTab;
449 public void stateChanged(ChangeEvent e)
451 if (lastTab == structureTab
452 && tabbedPane.getSelectedComponent() != structureTab)
454 if (!validateStructure())
456 tabbedPane.setSelectedComponent(structureTab);
460 lastTab = tabbedPane.getSelectedComponent();
467 * Initialises the Editing tabbed panel.
471 private JPanel initEditingTab()
473 JPanel editingTab = new JPanel();
474 editingTab.setLayout(null);
475 autoCalculateConsCheck.setFont(LABEL_FONT);
476 autoCalculateConsCheck.setText(
477 MessageManager.getString("label.autocalculate_consensus"));
478 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
479 padGaps.setFont(LABEL_FONT);
481 MessageManager.getString("label.pad_gaps_when_editing"));
482 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
483 sortByTree.setFont(LABEL_FONT);
485 .setText(MessageManager.getString("label.sort_with_new_tree"));
486 sortByTree.setToolTipText(MessageManager.getString(
487 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
488 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
489 editingTab.add(autoCalculateConsCheck);
490 editingTab.add(padGaps);
491 editingTab.add(sortByTree);
496 * Initialises the hmmer tabbed panel
500 private JPanel initHMMERTab()
502 hmmerTab = new JPanel();
503 hmmerTab.setLayout(new BoxLayout(hmmerTab, BoxLayout.Y_AXIS));
504 hmmerTab.setLayout(new MigLayout("flowy"));
507 * path to hmmer binaries folder
509 JPanel installationPanel = new JPanel(new MigLayout("flowy"));
510 // new FlowLayout(FlowLayout.LEFT));
511 JvSwingUtils.createTitledBorder(installationPanel,
512 MessageManager.getString("label.installation"), true);
513 hmmerTab.add(installationPanel);
514 JLabel hmmerLocation = new JLabel(
515 MessageManager.getString("label.hmmer_location"));
516 hmmerLocation.setFont(LABEL_FONT);
517 final int pathFieldLength = 40;
518 hmmerPath = new JTextField(pathFieldLength);
519 hmmerPath.addMouseListener(new MouseAdapter()
522 public void mouseClicked(MouseEvent e)
524 if (e.getClickCount() == 2)
526 String chosen = openFileChooser(true);
529 hmmerPath.setText(chosen);
535 installationPanel.add(hmmerLocation);
536 installationPanel.add(hmmerPath);
539 * path to Cygwin binaries folder (for Windows)
541 if (Platform.isWindowsAndNotJS())
543 JLabel cygwinLocation = new JLabel(
544 MessageManager.getString("label.cygwin_location"));
545 cygwinLocation.setFont(LABEL_FONT);
546 cygwinPath = new JTextField(pathFieldLength);
547 cygwinPath.addMouseListener(new MouseAdapter()
550 public void mouseClicked(MouseEvent e)
552 if (e.getClickCount() == 2)
554 String chosen = openFileChooser(true);
557 cygwinPath.setText(chosen);
558 validateCygwinPath();
563 installationPanel.add(cygwinLocation);
564 installationPanel.add(cygwinPath);
568 * preferences for hmmalign
570 JPanel alignOptionsPanel = new JPanel(new MigLayout());
571 // new FlowLayout(FlowLayout.LEFT));
572 JvSwingUtils.createTitledBorder(alignOptionsPanel,
573 MessageManager.getString("label.hmmalign_options"), true);
574 hmmerTab.add(alignOptionsPanel);
575 hmmrTrimTermini = new JCheckBox();
576 hmmrTrimTermini.setFont(LABEL_FONT);
577 hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
578 alignOptionsPanel.add(hmmrTrimTermini);
581 * preferences for hmmsearch
583 JPanel searchOptions = new JPanel(new MigLayout());
584 // FlowLayout(FlowLayout.LEFT));
585 JvSwingUtils.createTitledBorder(searchOptions,
586 MessageManager.getString("label.hmmsearch_options"), true);
587 hmmerTab.add(searchOptions);
588 JLabel sequencesToKeep = new JLabel(
589 MessageManager.getString("label.no_of_sequences"));
590 sequencesToKeep.setFont(LABEL_FONT);
591 searchOptions.add(sequencesToKeep);
592 hmmerSequenceCount = new JTextField(5);
593 searchOptions.add(hmmerSequenceCount);
596 * preferences for Information Content annotation
598 // JPanel dummy = new JPanel(new FlowLayout(FlowLayout.LEFT));
599 JPanel annotationOptions = new JPanel(new MigLayout("left"));
600 JvSwingUtils.createTitledBorder(annotationOptions,
601 MessageManager.getString("label.information_annotation"), true);
602 // dummy.add(annotationOptions);
603 hmmerTab.add(annotationOptions);
604 ButtonGroup backgroundOptions = new ButtonGroup();
605 hmmerBackgroundUniprot = new JRadioButton(
606 MessageManager.getString("label.freq_uniprot"));
607 hmmerBackgroundUniprot.setFont(LABEL_FONT);
608 hmmerBackgroundAlignment = new JRadioButton(
609 MessageManager.getString("label.freq_alignment"));
610 hmmerBackgroundAlignment.setFont(LABEL_FONT);
611 backgroundOptions.add(hmmerBackgroundUniprot);
612 backgroundOptions.add(hmmerBackgroundAlignment);
613 backgroundOptions.setSelected(hmmerBackgroundUniprot.getModel(), true);
614 // disable buttons for now as annotation only uses Uniprot background
615 hmmerBackgroundAlignment.setEnabled(false);
616 hmmerBackgroundUniprot.setEnabled(false);
617 annotationOptions.add(hmmerBackgroundUniprot, "wrap");
618 annotationOptions.add(hmmerBackgroundAlignment);
624 * Initialises the Output tabbed panel.
628 private JPanel initOutputTab()
630 JPanel outputTab = new JPanel();
631 outputTab.setLayout(null);
633 JLabel epsLabel = new JLabel(
634 MessageManager.formatMessage("label.rendering_style", "EPS"));
635 epsLabel.setFont(LABEL_FONT);
636 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
637 epsLabel.setBounds(new Rectangle(9, 31, 160, 24));
638 epsRendering.setFont(LABEL_FONT);
639 epsRendering.setBounds(new Rectangle(174, 34, 187, 21));
640 JLabel htmlLabel = new JLabel(
641 MessageManager.formatMessage("label.rendering_style", "HTML"));
642 htmlLabel.setFont(LABEL_FONT);
643 htmlLabel.setHorizontalAlignment(SwingConstants.RIGHT);
644 htmlLabel.setBounds(new Rectangle(9, 55, 160, 24));
645 htmlRendering.setFont(LABEL_FONT);
646 htmlRendering.setBounds(new Rectangle(174, 58, 187, 21));
647 JLabel svgLabel = new JLabel(
648 MessageManager.formatMessage("label.rendering_style", "SVG"));
649 svgLabel.setFont(LABEL_FONT);
650 svgLabel.setHorizontalAlignment(SwingConstants.RIGHT);
651 svgLabel.setBounds(new Rectangle(9, 79, 160, 24));
652 svgRendering.setFont(LABEL_FONT);
653 svgRendering.setBounds(new Rectangle(174, 82, 187, 21));
655 JLabel jLabel1 = new JLabel();
656 jLabel1.setFont(LABEL_FONT);
657 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
658 jLabel1.setText(MessageManager.getString("label.append_start_end"));
659 jLabel1.setFont(LABEL_FONT);
661 fastajv.setFont(LABEL_FONT);
662 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
663 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
664 blcjv.setText(MessageManager.getString("label.blc") + " ");
665 fastajv.setText(MessageManager.getString("label.fasta") + " ");
666 msfjv.setText(MessageManager.getString("label.msf") + " ");
667 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
668 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
669 msfjv.setFont(LABEL_FONT);
670 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
671 pirjv.setText(MessageManager.getString("label.pir") + " ");
672 JPanel jPanel11 = new JPanel();
673 jPanel11.setFont(LABEL_FONT);
674 TitledBorder titledBorder2 = new TitledBorder(
675 MessageManager.getString("label.file_output"));
676 jPanel11.setBorder(titledBorder2);
677 jPanel11.setBounds(new Rectangle(30, 120, 196, 182));
678 GridLayout gridLayout3 = new GridLayout();
679 jPanel11.setLayout(gridLayout3);
680 gridLayout3.setRows(8);
681 blcjv.setFont(LABEL_FONT);
682 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
683 clustaljv.setFont(LABEL_FONT);
684 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
685 pfamjv.setFont(LABEL_FONT);
686 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
687 pileupjv.setFont(LABEL_FONT);
688 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
689 pirjv.setFont(LABEL_FONT);
690 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
691 autoIdWidth.setFont(LABEL_FONT);
693 MessageManager.getString("label.automatically_set_id_width"));
694 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
695 .getString("label.adjusts_width_generated_eps_png")));
696 autoIdWidth.setBounds(new Rectangle(228, 144, 320, 23));
697 autoIdWidth.addActionListener(new ActionListener()
701 public void actionPerformed(ActionEvent e)
703 autoIdWidth_actionPerformed();
706 userIdWidthlabel.setFont(LABEL_FONT);
707 userIdWidthlabel.setText(
708 MessageManager.getString("label.figure_id_column_width"));
709 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
710 .getString("label.manually_specify_width_left_column")));
711 userIdWidthlabel.setToolTipText(
712 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
713 "label.manually_specify_width_left_column")));
714 userIdWidthlabel.setBounds(new Rectangle(236, 168, 320, 23));
715 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
716 userIdWidth.setText("");
717 userIdWidth.setBounds(new Rectangle(232, 192, 84, 23));
718 userIdWidth.addActionListener(new ActionListener()
722 public void actionPerformed(ActionEvent e)
724 userIdWidth_actionPerformed();
727 modellerOutput.setFont(LABEL_FONT);
729 .setText(MessageManager.getString("label.use_modeller_output"));
730 modellerOutput.setBounds(new Rectangle(228, 274, 320, 23));
731 embbedBioJSON.setFont(LABEL_FONT);
732 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
733 embbedBioJSON.setBounds(new Rectangle(228, 248, 250, 23));
735 jPanel11.add(jLabel1);
737 jPanel11.add(clustaljv);
738 jPanel11.add(fastajv);
740 jPanel11.add(pfamjv);
741 jPanel11.add(pileupjv);
743 outputTab.add(autoIdWidth);
744 outputTab.add(userIdWidth);
745 outputTab.add(userIdWidthlabel);
746 outputTab.add(modellerOutput);
747 if (!Platform.isJS())
750 * JalviewJS doesn't support Lineart option or SVG output
752 outputTab.add(embbedBioJSON);
753 outputTab.add(epsLabel);
754 outputTab.add(epsRendering);
755 outputTab.add(htmlLabel);
756 outputTab.add(htmlRendering);
757 outputTab.add(svgLabel);
758 outputTab.add(svgRendering);
760 outputTab.add(jPanel11);
765 * Initialises the Connections tabbed panel.
769 private JPanel initConnectionsTab()
771 JPanel connectTab = new JPanel();
772 connectTab.setLayout(new GridBagLayout());
774 // Label for browser text box
775 JLabel browserLabel = new JLabel();
776 browserLabel.setFont(LABEL_FONT);
777 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
778 browserLabel.setText(
779 MessageManager.getString("label.default_browser_unix"));
780 defaultBrowser.setFont(LABEL_FONT);
781 defaultBrowser.setText("");
782 final String tooltip = JvSwingUtils.wrapTooltip(true,
783 MessageManager.getString("label.double_click_to_browse"));
784 defaultBrowser.setToolTipText(tooltip);
785 defaultBrowser.addMouseListener(new MouseAdapter()
788 public void mouseClicked(MouseEvent e)
790 if (e.getClickCount() > 1)
792 defaultBrowser_mouseClicked(e);
797 JPanel proxyPanel = initConnTabProxyPanel();
798 initConnTabCheckboxes();
800 // Add default Browser text box
801 connectTab.add(browserLabel,
802 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
803 GridBagConstraints.WEST, GridBagConstraints.NONE,
804 new Insets(10, 0, 5, 5), 5, 1));
805 defaultBrowser.setFont(LABEL_FONT);
806 defaultBrowser.setText("");
808 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
809 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
810 new Insets(10, 0, 5, 10), 30, 1));
812 // Add proxy server panel
813 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
814 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
815 new Insets(10, 0, 5, 12), 4, 10));
817 // Add usage stats, version check and questionnaire checkboxes
818 connectTab.add(usagestats,
819 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
820 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
821 new Insets(0, 2, 5, 5), 70, 1));
822 connectTab.add(questionnaire,
823 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
824 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
825 new Insets(0, 2, 5, 10), 70, 1));
826 connectTab.add(versioncheck,
827 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
828 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
829 new Insets(0, 2, 5, 5), 70, 1));
831 versioncheck.setVisible(false);
833 // Add padding so the panel doesn't look ridiculous
834 JPanel spacePanel = new JPanel();
835 connectTab.add(spacePanel,
836 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
837 GridBagConstraints.WEST, GridBagConstraints.BOTH,
838 new Insets(0, 0, 0, 5), 70, 1));
844 * Initialises the Links tabbed panel.
848 private JPanel initLinksTab()
850 JPanel linkTab = new JPanel();
851 linkTab.setLayout(new GridBagLayout());
853 // Set up table for Url links
854 linkUrlTable.getTableHeader().setReorderingAllowed(false);
855 linkUrlTable.setFillsViewportHeight(true);
856 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
857 linkUrlTable.setAutoCreateRowSorter(true);
858 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
860 // adjust row height so radio buttons actually fit
861 // don't do this in the renderer, it causes the awt thread to activate
863 JRadioButton temp = new JRadioButton();
864 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
866 // Table in scrollpane so that the table is given a scrollbar
867 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
868 linkScrollPane.setBorder(null);
870 // Panel for links functionality
871 JPanel linkPanel = new JPanel(new GridBagLayout());
872 linkPanel.setBorder(new TitledBorder(
873 MessageManager.getString("label.url_linkfrom_sequence_id")));
875 // Put the Url links panel together
877 // Buttons go at top right, resizing only resizes the blank space vertically
878 JPanel buttonPanel = initLinkTabUrlButtons();
879 GridBagConstraints linkConstraints1 = new GridBagConstraints();
880 linkConstraints1.insets = new Insets(0, 0, 5, 0);
881 linkConstraints1.gridx = 0;
882 linkConstraints1.gridy = 0;
883 linkConstraints1.weightx = 1.0;
884 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
885 linkTab.add(buttonPanel, linkConstraints1);
887 // Links table goes at top left, resizing resizes the table
888 GridBagConstraints linkConstraints2 = new GridBagConstraints();
889 linkConstraints2.insets = new Insets(0, 0, 5, 5);
890 linkConstraints2.gridx = 0;
891 linkConstraints2.gridy = 1;
892 linkConstraints2.weightx = 1.0;
893 linkConstraints2.weighty = 1.0;
894 linkConstraints2.fill = GridBagConstraints.BOTH;
895 linkTab.add(linkScrollPane, linkConstraints2);
897 // Filter box and buttons goes at bottom left, resizing resizes the text box
898 JPanel filterPanel = initLinkTabFilterPanel();
899 GridBagConstraints linkConstraints3 = new GridBagConstraints();
900 linkConstraints3.insets = new Insets(0, 0, 0, 5);
901 linkConstraints3.gridx = 0;
902 linkConstraints3.gridy = 2;
903 linkConstraints3.weightx = 1.0;
904 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
905 linkTab.add(filterPanel, linkConstraints3);
910 private JPanel initLinkTabFilterPanel()
912 // Filter textbox and reset button
913 JLabel filterLabel = new JLabel(
914 MessageManager.getString("label.filter"));
915 filterLabel.setFont(LABEL_FONT);
916 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
917 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
919 filterTB.setFont(LABEL_FONT);
920 filterTB.setText("");
922 doReset.setText(MessageManager.getString("action.showall"));
923 userOnly.setText(MessageManager.getString("action.customfilter"));
925 // Panel for filter functionality
926 JPanel filterPanel = new JPanel(new GridBagLayout());
927 filterPanel.setBorder(new TitledBorder("Filter"));
928 GridBagConstraints gbc = new GridBagConstraints();
931 gbc.fill = GridBagConstraints.NONE;
932 gbc.anchor = GridBagConstraints.WEST;
934 filterPanel.add(filterLabel, gbc);
936 GridBagConstraints gbc1 = new GridBagConstraints();
939 gbc1.fill = GridBagConstraints.HORIZONTAL;
940 gbc1.anchor = GridBagConstraints.WEST;
942 filterPanel.add(filterTB, gbc1);
944 GridBagConstraints gbc2 = new GridBagConstraints();
946 gbc2.fill = GridBagConstraints.NONE;
947 gbc2.anchor = GridBagConstraints.WEST;
948 filterPanel.add(doReset, gbc2);
950 GridBagConstraints gbc3 = new GridBagConstraints();
952 gbc3.fill = GridBagConstraints.NONE;
953 gbc3.anchor = GridBagConstraints.WEST;
954 filterPanel.add(userOnly, gbc3);
959 private JPanel initLinkTabUrlButtons()
961 // Buttons for new / edit / delete Url links
962 JButton newLink = new JButton();
963 newLink.setText(MessageManager.getString("action.new"));
965 editLink.setText(MessageManager.getString("action.edit"));
967 deleteLink.setText(MessageManager.getString("action.delete"));
969 // no current selection, so initially disable delete/edit buttons
970 editLink.setEnabled(false);
971 deleteLink.setEnabled(false);
973 newLink.addActionListener(new java.awt.event.ActionListener()
976 public void actionPerformed(ActionEvent e)
978 newLink_actionPerformed(e);
982 editLink.setText(MessageManager.getString("action.edit"));
983 editLink.addActionListener(new java.awt.event.ActionListener()
986 public void actionPerformed(ActionEvent e)
988 editLink_actionPerformed(e);
992 deleteLink.setText(MessageManager.getString("action.delete"));
993 deleteLink.addActionListener(new java.awt.event.ActionListener()
996 public void actionPerformed(ActionEvent e)
998 deleteLink_actionPerformed(e);
1002 JPanel buttonPanel = new JPanel(new GridBagLayout());
1003 buttonPanel.setBorder(new TitledBorder("Edit links"));
1004 GridBagConstraints gbc = new GridBagConstraints();
1007 gbc.fill = GridBagConstraints.NONE;
1008 buttonPanel.add(newLink, gbc);
1010 GridBagConstraints gbc1 = new GridBagConstraints();
1013 gbc1.fill = GridBagConstraints.NONE;
1014 buttonPanel.add(editLink, gbc1);
1016 GridBagConstraints gbc2 = new GridBagConstraints();
1019 gbc2.fill = GridBagConstraints.NONE;
1020 buttonPanel.add(deleteLink, gbc2);
1022 GridBagConstraints gbc3 = new GridBagConstraints();
1025 gbc3.fill = GridBagConstraints.HORIZONTAL;
1027 JPanel spacePanel = new JPanel();
1028 spacePanel.setBorder(null);
1029 buttonPanel.add(spacePanel, gbc3);
1035 * Initialises the proxy server panel in the Connections tab
1037 * @return the proxy server panel
1039 private JPanel initConnTabProxyPanel()
1041 // Label for server text box
1042 serverLabel.setText(MessageManager.getString("label.address"));
1043 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1044 serverLabel.setFont(LABEL_FONT);
1046 // Proxy server and port text boxes
1047 proxyServerTB.setFont(LABEL_FONT);
1048 proxyPortTB.setFont(LABEL_FONT);
1050 // Label for Port text box
1051 portLabel.setFont(LABEL_FONT);
1052 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1053 portLabel.setText(MessageManager.getString("label.port"));
1055 // Use proxy server checkbox
1056 useProxy.setFont(LABEL_FONT);
1057 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
1058 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
1059 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
1060 useProxy.addActionListener(new ActionListener()
1063 public void actionPerformed(ActionEvent e)
1065 useProxy_actionPerformed();
1069 // Make proxy server panel
1070 JPanel proxyPanel = new JPanel();
1071 TitledBorder titledBorder1 = new TitledBorder(
1072 MessageManager.getString("label.proxy_server"));
1073 proxyPanel.setBorder(titledBorder1);
1074 proxyPanel.setLayout(new GridBagLayout());
1075 proxyPanel.add(serverLabel,
1076 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
1077 GridBagConstraints.WEST, GridBagConstraints.NONE,
1078 new Insets(0, 2, 2, 0), 5, 0));
1079 proxyPanel.add(portLabel,
1080 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
1081 GridBagConstraints.WEST, GridBagConstraints.NONE,
1082 new Insets(0, 0, 2, 0), 11, 0));
1083 proxyPanel.add(useProxy,
1084 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
1085 GridBagConstraints.WEST, GridBagConstraints.NONE,
1086 new Insets(0, 2, 5, 185), 2, -4));
1087 proxyPanel.add(proxyPortTB,
1088 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
1089 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
1090 new Insets(0, 2, 2, 2), 54, 1));
1091 proxyPanel.add(proxyServerTB,
1092 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
1093 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
1094 new Insets(0, 2, 2, 0), 263, 1));
1100 * Initialises the checkboxes in the Connections tab
1102 private void initConnTabCheckboxes()
1104 // Usage stats checkbox label
1106 MessageManager.getString("label.send_usage_statistics"));
1107 usagestats.setFont(LABEL_FONT);
1108 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
1109 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
1111 // Questionnaire checkbox label
1112 questionnaire.setText(
1113 MessageManager.getString("label.check_for_questionnaires"));
1114 questionnaire.setFont(LABEL_FONT);
1115 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
1116 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
1118 // Check for latest version checkbox label
1119 versioncheck.setText(
1120 MessageManager.getString("label.check_for_latest_version"));
1121 versioncheck.setFont(LABEL_FONT);
1122 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
1123 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
1127 * Initialises the parent panel which contains the tabbed sections.
1131 private JPanel initOkCancelPanel()
1133 JButton ok = new JButton();
1134 ok.setText(MessageManager.getString("action.ok"));
1135 ok.addActionListener(new ActionListener()
1138 public void actionPerformed(ActionEvent e)
1140 ok_actionPerformed(e);
1143 JButton cancel = new JButton();
1144 cancel.setText(MessageManager.getString("action.cancel"));
1145 cancel.addActionListener(new ActionListener()
1148 public void actionPerformed(ActionEvent e)
1150 cancel_actionPerformed(e);
1153 JPanel okCancelPanel = new JPanel();
1154 okCancelPanel.add(ok);
1155 okCancelPanel.add(cancel);
1156 return okCancelPanel;
1160 * Initialises the Colours tabbed panel.
1164 private JPanel initColoursTab()
1166 JPanel coloursTab = new JPanel();
1167 coloursTab.setBorder(new TitledBorder(
1168 MessageManager.getString("action.open_new_alignment")));
1169 coloursTab.setLayout(new FlowLayout());
1170 JLabel mincolourLabel = new JLabel();
1171 mincolourLabel.setFont(LABEL_FONT);
1172 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1173 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1174 minColour.setFont(LABEL_FONT);
1175 minColour.setBorder(BorderFactory.createEtchedBorder());
1176 minColour.setPreferredSize(new Dimension(40, 20));
1177 minColour.addMouseListener(new MouseAdapter()
1180 public void mousePressed(MouseEvent e)
1182 minColour_actionPerformed(minColour);
1185 JLabel maxcolourLabel = new JLabel();
1186 maxcolourLabel.setFont(LABEL_FONT);
1187 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1188 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1189 maxColour.setFont(LABEL_FONT);
1190 maxColour.setBorder(BorderFactory.createEtchedBorder());
1191 maxColour.setPreferredSize(new Dimension(40, 20));
1192 maxColour.addMouseListener(new MouseAdapter()
1195 public void mousePressed(MouseEvent e)
1197 maxColour_actionPerformed(maxColour);
1201 protColour.setFont(LABEL_FONT);
1202 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1203 JLabel protColourLabel = new JLabel();
1204 protColourLabel.setFont(LABEL_FONT);
1205 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1206 protColourLabel.setText(
1207 MessageManager.getString("label.prot_alignment_colour") + " ");
1208 GPreferences.addtoLayout(coloursTab,
1210 .getString("label.default_colour_scheme_for_alignment"),
1211 protColourLabel, protColour);
1213 nucColour.setFont(LABEL_FONT);
1214 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1215 JLabel nucColourLabel = new JLabel();
1216 nucColourLabel.setFont(LABEL_FONT);
1217 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1218 nucColourLabel.setText(
1219 MessageManager.getString("label.nuc_alignment_colour") + " ");
1220 GPreferences.addtoLayout(coloursTab,
1222 .getString("label.default_colour_scheme_for_alignment"),
1223 nucColourLabel, nucColour);
1225 JPanel annotationShding = new JPanel();
1226 annotationShding.setBorder(new TitledBorder(
1227 MessageManager.getString("label.annotation_shading_default")));
1228 annotationShding.setLayout(new GridLayout(1, 2));
1229 GPreferences.addtoLayout(annotationShding,
1230 MessageManager.getString(
1231 "label.default_minimum_colour_annotation_shading"),
1232 mincolourLabel, minColour);
1233 GPreferences.addtoLayout(annotationShding,
1234 MessageManager.getString(
1235 "label.default_maximum_colour_annotation_shading"),
1236 maxcolourLabel, maxColour);
1237 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1242 * Initialises the Overview tabbed panel.
1246 private JPanel initOverviewTab()
1248 JPanel overviewPanel = new JPanel();
1249 overviewPanel.setBorder(new TitledBorder(
1250 MessageManager.getString("label.overview_settings")));
1252 gapColour.setFont(LABEL_FONT);
1253 // fixing the border colours stops apparent colour bleed from the panel
1254 gapColour.setBorder(
1255 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1256 gapColour.setPreferredSize(new Dimension(40, 20));
1257 gapColour.addMouseListener(new MouseAdapter()
1260 public void mousePressed(MouseEvent e)
1262 gapColour_actionPerformed(gapColour);
1266 hiddenColour.setFont(LABEL_FONT);
1267 // fixing the border colours stops apparent colour bleed from the panel
1268 hiddenColour.setBorder(
1269 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1270 hiddenColour.setPreferredSize(new Dimension(40, 20));
1271 hiddenColour.addMouseListener(new MouseAdapter()
1274 public void mousePressed(MouseEvent e)
1276 hiddenColour_actionPerformed(hiddenColour);
1280 useLegacyGap = new JCheckBox(
1281 MessageManager.getString("label.ov_legacy_gap"));
1282 useLegacyGap.setFont(LABEL_FONT);
1283 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1284 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1285 gapLabel = new JLabel(MessageManager.getString("label.gap_colour"));
1286 gapLabel.setFont(LABEL_FONT);
1287 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1288 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1289 showHiddenAtStart = new JCheckBox(
1290 MessageManager.getString("label.ov_show_hide_default"));
1291 showHiddenAtStart.setFont(LABEL_FONT);
1292 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1293 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1294 JLabel hiddenLabel = new JLabel(
1295 MessageManager.getString("label.hidden_colour"));
1296 hiddenLabel.setFont(LABEL_FONT);
1297 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1298 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1300 useLegacyGap.addActionListener(new ActionListener()
1303 public void actionPerformed(ActionEvent e)
1305 useLegacyGaps_actionPerformed(e);
1309 overviewPanel.setLayout(new GridBagLayout());
1310 GridBagConstraints c1 = new GridBagConstraints();
1312 c1.fill = GridBagConstraints.HORIZONTAL;
1317 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1318 overviewPanel.add(useLegacyGap, c1);
1320 GridBagConstraints c2 = new GridBagConstraints();
1321 c2.fill = GridBagConstraints.HORIZONTAL;
1324 c2.insets = new Insets(0, 15, 0, 10);
1325 overviewPanel.add(gapLabel, c2);
1327 GridBagConstraints c3 = new GridBagConstraints();
1328 c3.fill = GridBagConstraints.HORIZONTAL;
1331 c3.insets = new Insets(0, 0, 0, 15);
1332 overviewPanel.add(gapColour, c3);
1334 GridBagConstraints c4 = new GridBagConstraints();
1335 c4.fill = GridBagConstraints.HORIZONTAL;
1339 overviewPanel.add(showHiddenAtStart, c4);
1341 GridBagConstraints c5 = new GridBagConstraints();
1342 c5.fill = GridBagConstraints.HORIZONTAL;
1345 c5.insets = new Insets(0, 15, 0, 10);
1346 overviewPanel.add(hiddenLabel, c5);
1348 GridBagConstraints c6 = new GridBagConstraints();
1349 c6.fill = GridBagConstraints.HORIZONTAL;
1352 c6.insets = new Insets(0, 0, 0, 15);
1353 overviewPanel.add(hiddenColour, c6);
1355 JButton resetButton = new JButton(
1356 MessageManager.getString("label.reset_to_defaults"));
1358 resetButton.addActionListener(new ActionListener()
1361 public void actionPerformed(ActionEvent e)
1363 resetOvDefaults_actionPerformed(e);
1367 GridBagConstraints c7 = new GridBagConstraints();
1368 c7.fill = GridBagConstraints.NONE;
1371 c7.insets = new Insets(10, 0, 0, 0);
1372 c7.anchor = GridBagConstraints.WEST;
1373 overviewPanel.add(resetButton, c7);
1375 // Add padding so the panel doesn't look ridiculous
1376 JPanel spacePanel = new JPanel();
1377 overviewPanel.add(spacePanel,
1378 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1379 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1380 new Insets(0, 0, 0, 5), 0, 0));
1382 return overviewPanel;
1386 * Initialises the Structure tabbed panel.
1390 private JPanel initStructureTab()
1392 structureTab = new JPanel();
1394 structureTab.setBorder(new TitledBorder(
1395 MessageManager.getString("label.structure_options")));
1396 structureTab.setLayout(null);
1397 final int width = 400;
1398 final int height = 22;
1399 final int lineSpacing = 25;
1402 structFromPdb.setFont(LABEL_FONT);
1404 .setText(MessageManager.getString("label.struct_from_pdb"));
1405 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1406 structFromPdb.addActionListener(new ActionListener()
1409 public void actionPerformed(ActionEvent e)
1411 boolean selected = structFromPdb.isSelected();
1412 // enable other options only when the first is checked
1413 useRnaView.setEnabled(selected);
1414 addSecondaryStructure.setEnabled(selected);
1415 addTempFactor.setEnabled(selected);
1418 structureTab.add(structFromPdb);
1420 // indent checkboxes that are conditional on the first one
1421 ypos += lineSpacing;
1422 useRnaView.setFont(LABEL_FONT);
1423 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1424 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1425 structureTab.add(useRnaView);
1427 ypos += lineSpacing;
1428 addSecondaryStructure.setFont(LABEL_FONT);
1429 addSecondaryStructure
1430 .setText(MessageManager.getString("label.autoadd_secstr"));
1431 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1432 structureTab.add(addSecondaryStructure);
1434 ypos += lineSpacing;
1435 addTempFactor.setFont(LABEL_FONT);
1436 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1437 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1438 structureTab.add(addTempFactor);
1440 ypos += lineSpacing;
1441 JLabel viewerLabel = new JLabel();
1442 viewerLabel.setFont(LABEL_FONT);
1443 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1444 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1445 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1446 structureTab.add(viewerLabel);
1448 if (!Platform.isJS())
1450 structViewer.setFont(LABEL_FONT);
1451 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1452 structViewer.addItem(ViewerType.JMOL.name());
1453 structViewer.addItem(ViewerType.CHIMERA.name());
1454 structViewer.addActionListener(new ActionListener()
1457 public void actionPerformed(ActionEvent e)
1459 structureViewer_actionPerformed(
1460 (String) structViewer.getSelectedItem());
1463 structureTab.add(structViewer);
1466 ypos += lineSpacing;
1467 JLabel pathLabel = new JLabel();
1468 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1469 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1470 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1471 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1472 structureTab.add(pathLabel);
1474 chimeraPath.setFont(LABEL_FONT);
1475 chimeraPath.setText("");
1476 final String tooltip = JvSwingUtils.wrapTooltip(true,
1477 MessageManager.getString("label.chimera_path_tip"));
1478 chimeraPath.setToolTipText(tooltip);
1479 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1480 chimeraPath.addMouseListener(new MouseAdapter()
1483 public void mouseClicked(MouseEvent e)
1485 if (e.getClickCount() == 2)
1487 String chosen = openFileChooser(false);
1490 chimeraPath.setText(chosen);
1495 structureTab.add(chimeraPath);
1497 ypos += lineSpacing;
1498 nwMapping.setFont(LABEL_FONT);
1499 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1500 siftsMapping.setFont(LABEL_FONT);
1501 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1502 mappingMethod.add(nwMapping);
1503 mappingMethod.add(siftsMapping);
1504 JPanel mappingPanel = new JPanel();
1505 mappingPanel.setFont(LABEL_FONT);
1506 TitledBorder mmTitledBorder = new TitledBorder(
1507 MessageManager.getString("label.mapping_method"));
1508 mmTitledBorder.setTitleFont(LABEL_FONT);
1509 mappingPanel.setBorder(mmTitledBorder);
1510 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1511 // GridLayout mappingLayout = new GridLayout();
1512 mappingPanel.setLayout(new GridLayout());
1513 mappingPanel.add(nwMapping);
1514 mappingPanel.add(siftsMapping);
1515 structureTab.add(mappingPanel);
1517 ypos += lineSpacing;
1518 ypos += lineSpacing;
1519 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1520 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1521 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1522 structureTab.add(docFieldPref);
1525 * hide Chimera options in JalviewJS
1527 if (Platform.isJS())
1529 pathLabel.setVisible(false);
1530 chimeraPath.setVisible(false);
1531 viewerLabel.setVisible(false);
1532 structViewer.setVisible(false);
1535 return structureTab;
1539 * Action on choosing a structure viewer from combobox options.
1541 * @param selectedItem
1543 protected void structureViewer_actionPerformed(String selectedItem)
1548 * Show a dialog for the user to choose a file. Returns the chosen path, or
1553 protected String openFileChooser(boolean forFolder)
1555 String choice = null;
1556 JFileChooser chooser = new JFileChooser();
1559 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1562 // chooser.setFileView(new JalviewFileView());
1563 chooser.setDialogTitle(
1564 MessageManager.getString("label.open_local_file"));
1565 chooser.setToolTipText(MessageManager.getString("action.open"));
1567 int value = chooser.showOpenDialog(this);
1569 if (value == JFileChooser.APPROVE_OPTION)
1571 choice = chooser.getSelectedFile().getPath();
1576 protected boolean validateStructure()
1582 * Initialises the Visual tabbed panel.
1586 private JPanel initVisualTab()
1588 JPanel visualTab = new JPanel();
1589 visualTab.setBorder(new TitledBorder(
1590 MessageManager.getString("action.open_new_alignment")));
1591 visualTab.setLayout(null);
1592 fullScreen.setFont(LABEL_FONT);
1593 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1594 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1595 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1596 quality.setEnabled(false);
1597 quality.setFont(LABEL_FONT);
1598 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1599 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1600 quality.setSelected(true);
1601 quality.setText(MessageManager.getString("label.quality"));
1602 conservation.setEnabled(false);
1603 conservation.setFont(LABEL_FONT);
1604 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1605 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1606 conservation.setSelected(true);
1607 conservation.setText(MessageManager.getString("label.conservation"));
1608 identity.setEnabled(false);
1609 identity.setFont(LABEL_FONT);
1610 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1611 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1612 identity.setSelected(true);
1613 identity.setText(MessageManager.getString("label.consensus"));
1614 showOccupancy.setFont(LABEL_FONT);
1615 showOccupancy.setEnabled(false);
1616 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1617 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1618 showOccupancy.setSelected(true);
1619 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1621 JLabel showGroupbits = new JLabel();
1622 showGroupbits.setFont(LABEL_FONT);
1623 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1624 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1626 .setText(MessageManager.getString("action.show_group") + ":");
1627 JLabel showConsensbits = new JLabel();
1628 showConsensbits.setFont(LABEL_FONT);
1629 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1630 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1632 .setText(MessageManager.getString("label.consensus") + ":");
1633 showConsensHistogram.setEnabled(false);
1634 showConsensHistogram.setFont(LABEL_FONT);
1635 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1636 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1637 showConsensHistogram.setSelected(true);
1638 showConsensHistogram
1639 .setText(MessageManager.getString("label.histogram"));
1640 showConsensLogo.setEnabled(false);
1641 showConsensLogo.setFont(LABEL_FONT);
1642 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1643 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1644 showConsensLogo.setSelected(true);
1645 showConsensLogo.setText(MessageManager.getString("label.logo"));
1646 showGroupConsensus.setEnabled(false);
1647 showGroupConsensus.setFont(LABEL_FONT);
1648 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1649 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1650 showGroupConsensus.setSelected(true);
1651 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1652 showGroupConservation.setEnabled(false);
1653 showGroupConservation.setFont(LABEL_FONT);
1654 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1655 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1656 showGroupConservation.setSelected(true);
1657 showGroupConservation
1658 .setText(MessageManager.getString("label.conservation"));
1659 showNpTooltip.setEnabled(true);
1660 showNpTooltip.setFont(LABEL_FONT);
1661 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1662 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1663 showNpTooltip.setSelected(true);
1664 showNpTooltip.setText(
1665 MessageManager.getString("label.non_positional_features"));
1666 showDbRefTooltip.setEnabled(true);
1667 showDbRefTooltip.setFont(LABEL_FONT);
1668 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1669 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1670 showDbRefTooltip.setSelected(true);
1672 .setText(MessageManager.getString("label.database_references"));
1673 annotations.setFont(LABEL_FONT);
1674 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1675 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1676 annotations.setSelected(true);
1677 annotations.setText(MessageManager.getString("label.show_annotations"));
1678 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1679 annotations.addActionListener(new ActionListener()
1682 public void actionPerformed(ActionEvent e)
1684 annotations_actionPerformed(e);
1687 identity.addActionListener(new ActionListener()
1690 public void actionPerformed(ActionEvent e)
1692 annotations_actionPerformed(e);
1695 showGroupConsensus.addActionListener(new ActionListener()
1698 public void actionPerformed(ActionEvent e)
1700 annotations_actionPerformed(e);
1703 showUnconserved.setFont(LABEL_FONT);
1704 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1705 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1706 showUnconserved.setSelected(true);
1708 .setText(MessageManager.getString("action.show_unconserved"));
1709 showUnconserved.addActionListener(new ActionListener()
1712 public void actionPerformed(ActionEvent e)
1714 showunconserved_actionPerformed(e);
1718 // TODO these are not yet added to / action from Preferences
1719 // JCheckBox shareSelections = new JCheckBox();
1720 // shareSelections.setFont(verdana11);
1721 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1722 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1723 // shareSelections.setSelected(true);
1724 // shareSelections.setText(MessageManager
1725 // .getString("label.share_selection_across_views"));
1726 // JCheckBox followHighlight = new JCheckBox();
1727 // followHighlight.setFont(verdana11);
1728 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1729 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1730 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1731 // followHighlight.setSelected(true);
1732 // followHighlight.setText(MessageManager
1733 // .getString("label.scroll_highlighted_regions"));
1735 seqLimit.setFont(LABEL_FONT);
1736 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1737 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1738 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1739 smoothFont.setFont(LABEL_FONT);
1740 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1741 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1742 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1743 scaleProteinToCdna.setFont(LABEL_FONT);
1744 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1745 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1746 scaleProteinToCdna.setText(
1747 MessageManager.getString("label.scale_protein_to_cdna"));
1748 scaleProteinToCdna.setToolTipText(
1749 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1750 JLabel gapLabel = new JLabel();
1751 gapLabel.setFont(LABEL_FONT);
1752 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1753 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1754 JLabel fontLabel = new JLabel();
1755 fontLabel.setFont(LABEL_FONT);
1756 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1757 fontLabel.setText(MessageManager.getString("label.font"));
1758 fontSizeCB.setFont(LABEL_FONT);
1759 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1760 fontStyleCB.setFont(LABEL_FONT);
1761 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1762 fontNameCB.setFont(LABEL_FONT);
1763 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1764 gapSymbolCB.setFont(LABEL_FONT);
1765 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1766 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1767 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1768 gapSymbolCB.setRenderer(dlcr);
1770 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1771 startupCheckbox.setFont(LABEL_FONT);
1772 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1773 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1774 startupCheckbox.setSelected(true);
1775 startupFileTextfield.setFont(LABEL_FONT);
1776 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1777 final String tooltip = JvSwingUtils.wrapTooltip(true,
1778 MessageManager.getString("label.double_click_to_browse"));
1779 startupFileTextfield.setToolTipText(tooltip);
1780 startupFileTextfield.addMouseListener(new MouseAdapter()
1783 public void mouseClicked(MouseEvent e)
1785 if (e.getClickCount() > 1)
1787 startupFileTextfield_mouseClicked();
1792 sortby.setFont(LABEL_FONT);
1793 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1794 JLabel sortLabel = new JLabel();
1795 sortLabel.setFont(LABEL_FONT);
1796 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1797 sortLabel.setText(MessageManager.getString("label.sort_by"));
1798 sortAnnBy.setFont(LABEL_FONT);
1799 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1800 JLabel sortAnnLabel = new JLabel();
1801 sortAnnLabel.setFont(LABEL_FONT);
1802 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1803 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1804 sortAutocalc.setFont(LABEL_FONT);
1805 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1807 JPanel annsettingsPanel = new JPanel();
1808 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1809 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1810 annsettingsPanel.setBorder(new EtchedBorder());
1811 visualTab.add(annsettingsPanel);
1812 Border jb = new EmptyBorder(1, 1, 4, 5);
1813 annotations.setBorder(jb);
1814 showOccupancy.setBorder(jb);
1815 quality.setBorder(jb);
1816 conservation.setBorder(jb);
1817 identity.setBorder(jb);
1818 showConsensbits.setBorder(jb);
1819 showGroupbits.setBorder(jb);
1820 showGroupConsensus.setBorder(jb);
1821 showGroupConservation.setBorder(jb);
1822 showConsensHistogram.setBorder(jb);
1823 showConsensLogo.setBorder(jb);
1825 JPanel autoAnnotSettings = new JPanel();
1826 annsettingsPanel.add(autoAnnotSettings);
1827 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1828 autoAnnotSettings.add(annotations);
1829 autoAnnotSettings.add(quality);
1830 // second row of autoannotation box
1831 autoAnnotSettings = new JPanel();
1832 annsettingsPanel.add(autoAnnotSettings);
1834 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1835 autoAnnotSettings.add(conservation);
1836 autoAnnotSettings.add(identity);
1837 autoAnnotSettings.add(showOccupancy);
1838 autoAnnotSettings.add(showGroupbits);
1839 autoAnnotSettings.add(showGroupConservation);
1840 autoAnnotSettings.add(showGroupConsensus);
1841 autoAnnotSettings.add(showConsensbits);
1842 autoAnnotSettings.add(showConsensHistogram);
1843 autoAnnotSettings.add(showConsensLogo);
1845 JPanel tooltipSettings = new JPanel();
1846 tooltipSettings.setBorder(new TitledBorder(
1847 MessageManager.getString("label.sequence_id_tooltip")));
1848 tooltipSettings.setBounds(173, 140, 220, 62);
1849 tooltipSettings.setLayout(new GridLayout(2, 1));
1850 tooltipSettings.add(showDbRefTooltip);
1851 tooltipSettings.add(showNpTooltip);
1852 visualTab.add(tooltipSettings);
1854 wrap.setFont(LABEL_FONT);
1855 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1856 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1857 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1858 rightAlign.setFont(LABEL_FONT);
1859 rightAlign.setForeground(Color.black);
1860 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1861 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1862 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1863 idItalics.setFont(LABEL_FONT_ITALIC);
1864 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1865 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1867 MessageManager.getString("label.sequence_name_italics"));
1868 openoverv.setFont(LABEL_FONT);
1869 openoverv.setActionCommand(
1870 MessageManager.getString("label.open_overview"));
1871 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1872 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1873 openoverv.setText(MessageManager.getString("label.open_overview"));
1874 JPanel jPanel2 = new JPanel();
1875 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1876 jPanel2.setLayout(new GridLayout(14, 1));
1877 jPanel2.add(fullScreen);
1878 jPanel2.add(openoverv);
1879 jPanel2.add(seqLimit);
1880 jPanel2.add(rightAlign);
1881 jPanel2.add(fontLabel);
1882 jPanel2.add(showUnconserved);
1883 jPanel2.add(idItalics);
1884 jPanel2.add(smoothFont);
1885 jPanel2.add(scaleProteinToCdna);
1886 jPanel2.add(gapLabel);
1888 jPanel2.add(sortLabel);
1889 jPanel2.add(sortAnnLabel);
1890 jPanel2.add(startupCheckbox);
1891 visualTab.add(jPanel2);
1892 visualTab.add(startupFileTextfield);
1893 visualTab.add(sortby);
1894 visualTab.add(sortAnnBy);
1895 visualTab.add(sortAutocalc);
1896 visualTab.add(gapSymbolCB);
1897 visualTab.add(fontNameCB);
1898 visualTab.add(fontSizeCB);
1899 visualTab.add(fontStyleCB);
1901 if (Platform.isJS())
1903 startupCheckbox.setVisible(false);
1904 startupFileTextfield.setVisible(false);
1911 * Load the saved Backups options EXCEPT "Enabled" and "Scheme"
1914 protected void loadLastSavedBackupsOptions()
1916 BackupFilesPresetEntry savedPreset = BackupFilesPresetEntry
1917 .getSavedBackupEntry();
1919 .setSelected(Cache.getDefault(BackupFiles.ENABLED, !Platform.isJS()));
1921 BackupFilesPresetEntry backupfilesCustomEntry = BackupFilesPresetEntry
1922 .createBackupFilesPresetEntry(Cache
1923 .getDefault(BackupFilesPresetEntry.CUSTOMCONFIG, null));
1924 if (backupfilesCustomEntry == null)
1926 backupfilesCustomEntry = BackupFilesPresetEntry.backupfilesPresetEntriesValues
1927 .get(BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT);
1929 BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
1930 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM,
1931 backupfilesCustomEntry);
1933 setComboIntStringKey(backupfilesPresetsCombo,
1934 Cache.getDefault(BackupFiles.NS + "_PRESET",
1935 BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT));
1937 backupsSetOptions(savedPreset);
1939 backupsOptionsSetEnabled();
1940 updateBackupFilesExampleLabel();
1943 private boolean warnAboutSuffixReverseChange()
1945 BackupFilesPresetEntry bfpe = BackupFilesPresetEntry
1946 .getSavedBackupEntry();
1947 boolean savedSuffixReverse = bfpe.reverse;
1948 int savedSuffixDigits = bfpe.digits;
1949 String savedSuffixTemplate = bfpe.suffix;
1951 boolean nowSuffixReverse = suffixReverse.isSelected();
1952 int nowSuffixDigits = getSpinnerInt(suffixDigitsSpinner, 3);
1953 String nowSuffixTemplate = suffixTemplate.getText();
1954 return nowSuffixReverse != savedSuffixReverse
1955 && nowSuffixDigits == savedSuffixDigits
1956 && nowSuffixTemplate != null
1957 && nowSuffixTemplate.equals(savedSuffixTemplate);
1961 * Initialises the Backups tabbed panel.
1965 private JPanel initBackupsTab()
1967 JPanel backupsTab = new JPanel();
1968 backupsTab.setBorder(new TitledBorder(
1969 MessageManager.getString("label.backup_files")));
1970 backupsTab.setLayout(new GridBagLayout());
1972 GridBagConstraints gbc = new GridBagConstraints();
1975 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
1976 gbc.fill = GridBagConstraints.NONE;
1978 initBackupsTabPresetsPanel();
1979 initBackupsTabSuffixPanel();
1980 initBackupsTabKeepFilesPanel();
1981 initBackupsTabFilenameExamplesPanel();
1983 enableBackupFiles.setFont(LABEL_FONT_BOLD);
1985 .setText(MessageManager.getString("label.enable_backupfiles"));
1986 enableBackupFiles.addActionListener(new ActionListener()
1989 public void actionPerformed(ActionEvent e)
1991 // enable other options only when the first is checked
1992 backupsOptionsSetEnabled();
1997 // enable checkbox 1 col
2001 gbc.gridy = 0; // row 0
2002 backupsTab.add(enableBackupFiles, gbc);
2004 // summary of scheme box (over two rows)
2008 gbc.anchor = GridBagConstraints.FIRST_LINE_END;
2009 gbc.fill = GridBagConstraints.BOTH;
2010 backupsTab.add(exampleFilesPanel, gbc);
2012 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
2013 gbc.fill = GridBagConstraints.NONE;
2015 // fill empty space on right
2018 backupsTab.add(new JPanel(), gbc);
2023 gbc.gridy++; // row 1
2024 backupsTab.add(presetsPanel, gbc);
2026 // now using whole row
2031 gbc.gridy++; // row 2
2032 backupsTab.add(keepfilesPanel, gbc);
2034 // filename strategy box
2035 gbc.gridy++; // row 3
2036 backupsTab.add(suffixPanel, gbc);
2039 gbc.gridy++; // row 4
2041 backupsTab.add(new JPanel(), gbc);
2043 backupsOptionsSetEnabled();
2047 private JPanel initBackupsTabPresetsPanel()
2050 String title = MessageManager.getString("label.schemes");
2052 presetsPanel.setLayout(new GridBagLayout());
2054 GridBagConstraints gbc = new GridBagConstraints();
2057 gbc.anchor = GridBagConstraints.BASELINE_LEADING;
2058 gbc.fill = GridBagConstraints.NONE;
2066 presetsComboLabel = new JLabel(title + ":");
2067 presetsPanel.add(presetsComboLabel, gbc);
2069 List<Object> entries = Arrays
2070 .asList((Object[]) BackupFilesPresetEntry.backupfilesPresetEntries);
2071 List<String> tooltips = Arrays.asList(
2072 BackupFilesPresetEntry.backupfilesPresetEntryDescriptions);
2073 backupfilesPresetsCombo = JvSwingUtils.buildComboWithTooltips(entries,
2076 for (int i = 0; i < BackupFilesPresetEntry.backupfilesPresetEntries.length; i++)
2078 backupfilesPresetsCombo
2079 .addItem(BackupFilesPresetEntry.backupfilesPresetEntries[i]);
2083 backupfilesPresetsCombo.addActionListener(new ActionListener()
2086 public void actionPerformed(ActionEvent e)
2088 int key = getComboIntStringKey(backupfilesPresetsCombo);
2089 if (!customiseCheckbox.isSelected())
2091 backupfilesPresetsComboLastSelected = key;
2093 if (key == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM)
2095 if (customiseCheckbox.isSelected())
2097 // got here by clicking on customiseCheckbox so don't change the values
2098 backupfilesCustomOptionsSetEnabled();
2102 backupsTabUpdatePresets();
2103 backupfilesCustomOptionsSetEnabled();
2108 customiseCheckbox.setSelected(false);
2109 backupsTabUpdatePresets();
2110 backupfilesCustomOptionsSetEnabled();
2115 // dropdown list of preset schemes
2117 presetsPanel.add(backupfilesPresetsCombo, gbc);
2119 revertButton.setText(MessageManager.getString("label.cancel_changes"));
2120 revertButton.setToolTipText(
2121 MessageManager.getString("label.cancel_changes_description"));
2122 revertButton.addActionListener(new ActionListener()
2125 public void actionPerformed(ActionEvent e)
2128 BackupFilesPresetEntry.backupfilesPresetEntriesValues.get(
2129 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM));
2130 backupfilesCustomOptionsSetEnabled();
2134 revertButton.setFont(LABEL_FONT);
2136 customiseCheckbox.setFont(LABEL_FONT);
2137 customiseCheckbox.setText(MessageManager.getString("label.customise"));
2138 customiseCheckbox.addActionListener(new ActionListener()
2141 public void actionPerformed(ActionEvent e)
2143 int currently = getComboIntStringKey(backupfilesPresetsCombo);
2144 if (customiseCheckbox.isSelected())
2146 backupfilesPresetsComboLastSelected = currently;
2147 setComboIntStringKey(backupfilesPresetsCombo,
2148 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM);
2152 setComboIntStringKey(backupfilesPresetsCombo,
2153 backupfilesPresetsComboLastSelected);
2156 backupfilesCustomOptionsSetEnabled();
2159 customiseCheckbox.setToolTipText(
2160 MessageManager.getString("label.customise_description"));
2162 // customise checkbox
2165 presetsPanel.add(customiseCheckbox, gbc);
2167 // "Cancel changes" button (aligned with combo box above)
2169 presetsPanel.add(revertButton, gbc);
2171 return presetsPanel;
2174 private JPanel initBackupsTabFilenameExamplesPanel()
2176 String title = MessageManager
2177 .getString("label.scheme_examples");
2178 TitledBorder tb = new TitledBorder(title);
2179 exampleFilesPanel.setBorder(tb);
2180 exampleFilesPanel.setLayout(new GridBagLayout());
2183 backupfilesExampleLabel.setEditable(false);
2184 backupfilesExampleLabel
2185 .setBackground(exampleFilesPanel.getBackground());
2187 updateBackupFilesExampleLabel();
2189 GridBagConstraints gbc = new GridBagConstraints();
2192 gbc.fill = GridBagConstraints.NONE;
2193 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
2195 exampleFilesPanel.add(backupfilesExampleLabel, gbc);
2196 return exampleFilesPanel;
2199 private void backupsTabUpdatePresets()
2201 IntKeyStringValueEntry entry = (IntKeyStringValueEntry) backupfilesPresetsCombo
2204 String value = entry.v;
2206 if (BackupFilesPresetEntry.backupfilesPresetEntriesValues
2210 BackupFilesPresetEntry.backupfilesPresetEntriesValues
2216 "Preset '" + value + "' [key:" + key + "] not implemented");
2219 // Custom options will now be enabled when the customiseCheckbox is checked
2220 // (performed above)
2221 // backupfilesCustomOptionsSetEnabled();
2222 updateBackupFilesExampleLabel();
2225 protected int getComboIntStringKey(
2226 JComboBox<Object> backupfilesPresetsCombo2)
2228 IntKeyStringValueEntry e;
2231 e = (IntKeyStringValueEntry) backupfilesPresetsCombo2
2233 } catch (Exception ex)
2236 "Problem casting Combo entry to IntKeyStringValueEntry.");
2239 return e != null ? e.k : 0;
2242 protected void setComboIntStringKey(
2243 JComboBox<Object> backupfilesPresetsCombo2,
2246 for (int i = 0; i < backupfilesPresetsCombo2.getItemCount(); i++)
2248 IntKeyStringValueEntry e;
2251 e = (IntKeyStringValueEntry) backupfilesPresetsCombo2.getItemAt(i);
2252 } catch (Exception ex)
2255 "Problem casting Combo entry to IntKeyStringValueEntry. Skipping item. ");
2260 backupfilesPresetsCombo2.setSelectedIndex(i);
2264 // backupsTabUpdatePresets();
2267 private JPanel initBackupsTabSuffixPanel()
2269 suffixPanel.setBorder(new TitledBorder(
2270 MessageManager.getString("label.backup_filename_strategy")));
2271 suffixPanel.setLayout(new GridBagLayout());
2274 .setText(MessageManager.getString("label.append_to_filename"));
2275 suffixTemplateLabel.setHorizontalAlignment(SwingConstants.LEFT);
2276 suffixTemplateLabel.setFont(LABEL_FONT);
2278 final String tooltip = JvSwingUtils.wrapTooltip(true,
2279 MessageManager.getString("label.append_to_filename_tooltip"));
2280 suffixTemplate.setToolTipText(tooltip);
2281 suffixTemplate.addActionListener(new ActionListener()
2284 public void actionPerformed(ActionEvent e)
2286 updateBackupFilesExampleLabel();
2287 backupfilesCustomOptionsSetEnabled();
2288 backupfilesRevertButtonSetEnabled(true);
2292 suffixTemplate.addKeyListener(new KeyListener()
2295 public void keyReleased(KeyEvent e)
2297 updateBackupFilesExampleLabel();
2298 backupfilesCustomOptionsSetEnabled();
2299 backupfilesRevertButtonSetEnabled(true);
2303 public void keyPressed(KeyEvent e)
2307 // disable use of ':' or '/' or '\'
2309 public void keyTyped(KeyEvent e)
2311 char c = e.getKeyChar();
2312 if (c == ':' || c == '/' || c == '\\')
2314 // don't process ':' or '/' or '\'
2323 .setText(MessageManager.getString("label.index_digits"));
2324 suffixDigitsLabel.setHorizontalAlignment(SwingConstants.LEFT);
2325 suffixDigitsLabel.setFont(LABEL_FONT);
2326 ChangeListener c = new ChangeListener()
2329 public void stateChanged(ChangeEvent e)
2331 backupfilesRevertButtonSetEnabled(true);
2332 updateBackupFilesExampleLabel();
2336 setIntegerSpinner(suffixDigitsSpinner, BackupFilesPresetEntry.DIGITSMIN,
2337 BackupFilesPresetEntry.DIGITSMAX, 3, c);
2339 suffixReverse.setLabels(MessageManager.getString("label.reverse_roll"),
2340 MessageManager.getString("label.increment_index"));
2341 suffixReverse.addActionListener(new ActionListener()
2344 public void actionPerformed(ActionEvent e)
2346 boolean okay = true;
2347 if (warnAboutSuffixReverseChange())
2350 okay = confirmSuffixReverseChange();
2354 backupfilesRevertButtonSetEnabled(true);
2355 updateBackupFilesExampleLabel();
2359 boolean savedSuffixReverse = BackupFilesPresetEntry
2360 .getSavedBackupEntry().reverse;
2361 suffixReverse.setSelected(savedSuffixReverse);
2366 GridBagConstraints sgbc = new GridBagConstraints();
2368 // first row (template text box)
2369 sgbc.anchor = GridBagConstraints.WEST;
2373 sgbc.gridheight = 1;
2376 sgbc.fill = GridBagConstraints.NONE;
2377 suffixPanel.add(suffixTemplateLabel, sgbc);
2380 sgbc.fill = GridBagConstraints.HORIZONTAL;
2381 suffixPanel.add(suffixTemplate, sgbc);
2383 // second row (number of digits spinner)
2387 sgbc.fill = GridBagConstraints.NONE;
2388 suffixPanel.add(suffixDigitsLabel, sgbc);
2391 sgbc.fill = GridBagConstraints.HORIZONTAL;
2392 suffixPanel.add(suffixDigitsSpinner, sgbc);
2394 // third row (forward order radio selection)
2397 sgbc.gridwidth = GridBagConstraints.REMAINDER;
2398 sgbc.fill = GridBagConstraints.HORIZONTAL;
2399 suffixPanel.add(suffixReverse.getFalseButton(), sgbc);
2401 // fourth row (reverse order radio selection)
2403 suffixPanel.add(suffixReverse.getTrueButton(), sgbc);
2407 private boolean confirmSuffixReverseChange()
2409 boolean ret = false;
2410 String warningMessage = MessageManager
2411 .getString("label.warning_confirm_change_reverse");
2412 int confirm = JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(),
2414 MessageManager.getString("label.change_increment_decrement"),
2415 JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE);
2417 ret = (confirm == JvOptionPane.YES_OPTION);
2421 private JPanel initBackupsTabKeepFilesPanel()
2423 keepfilesPanel.setBorder(
2424 new TitledBorder(MessageManager.getString("label.keep_files")));
2425 keepfilesPanel.setLayout(new GridBagLayout());
2427 backupfilesKeepAll.setLabels(
2428 MessageManager.getString("label.keep_all_backup_files"),
2429 MessageManager.getString(
2430 "label.keep_only_this_number_of_backup_files"));
2431 backupfilesKeepAll.addTrueActionListener(new ActionListener()
2434 public void actionPerformed(ActionEvent e)
2436 backupfilesRevertButtonSetEnabled(true);
2437 updateBackupFilesExampleLabel();
2440 backupfilesKeepAll.addActionListener(new ActionListener()
2443 public void actionPerformed(ActionEvent e)
2445 backupfilesRevertButtonSetEnabled(true);
2446 keepRollMaxOptionsEnabled();
2447 updateBackupFilesExampleLabel();
2451 ChangeListener c = new ChangeListener()
2454 public void stateChanged(ChangeEvent e)
2456 backupfilesRevertButtonSetEnabled(true);
2457 updateBackupFilesExampleLabel();
2461 setIntegerSpinner(backupfilesRollMaxSpinner,
2462 BackupFilesPresetEntry.ROLLMAXMIN,
2463 BackupFilesPresetEntry.ROLLMAXMAX, 4, true, c);
2465 backupfilesConfirmDelete.setLabels(
2466 MessageManager.getString("label.always_ask"),
2467 MessageManager.getString("label.auto_delete"));
2468 backupfilesConfirmDelete.addActionListener(new ActionListener()
2471 public void actionPerformed(ActionEvent e)
2473 backupfilesRevertButtonSetEnabled(true);
2476 // update the enabled section
2477 keepRollMaxOptionsEnabled();
2479 GridBagConstraints kgbc = new GridBagConstraints();
2481 // first row (template text box)
2482 kgbc.anchor = GridBagConstraints.WEST;
2485 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2486 kgbc.gridheight = 1;
2489 kgbc.fill = GridBagConstraints.HORIZONTAL;
2490 keepfilesPanel.add(backupfilesKeepAll.getTrueButton(), kgbc);
2496 kgbc.gridwidth = GridBagConstraints.RELATIVE;
2497 keepfilesPanel.add(backupfilesKeepAll.getFalseButton(), kgbc);
2500 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2501 keepfilesPanel.add(backupfilesRollMaxSpinner, kgbc);
2503 // third row (indented)
2505 kgbc.insets = new Insets(0, 20, 0, 0);
2508 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2509 kgbc.fill = GridBagConstraints.HORIZONTAL;
2512 JPanel jp = new JPanel();
2513 jp.setLayout(new FlowLayout());
2515 .setText(MessageManager
2516 .getString("label.autodelete_old_backup_files"));
2517 oldBackupFilesLabel.setFont(LABEL_FONT);
2518 oldBackupFilesLabel.setHorizontalAlignment(SwingConstants.LEFT);
2519 jp.add(oldBackupFilesLabel);
2520 jp.add(backupfilesConfirmDelete.getTrueButton());
2521 jp.add(backupfilesConfirmDelete.getFalseButton());
2522 keepfilesPanel.add(jp, kgbc);
2524 return keepfilesPanel;
2527 protected void updateBackupFilesExampleLabel()
2529 int exampleindex = 12;
2530 String base = MessageManager.getString("label.filename") + ".fa";
2531 if (base == null || base.length() == 0)
2533 base = "file_name.fa";
2536 boolean reverse = suffixReverse.isSelected();
2537 boolean keepAll = backupfilesKeepAll.isSelected();
2539 String suffix = suffixTemplate.getText();
2542 backupfilesExampleLabel.setFont(LABEL_FONT_ITALIC);
2543 if (suffix == null || suffix.length() == 0)
2545 backupfilesExampleLabel
2546 .setText(MessageManager.getString("label.no_backup_files"));
2547 backupfilesExampleLabel.setFont(LABEL_FONT_BOLD);
2551 rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 4);
2552 rollMax = rollMax < 1 ? 1 : rollMax;
2554 if (suffix.indexOf(BackupFiles.NUM_PLACEHOLDER) == -1)
2559 digits = getSpinnerInt(suffixDigitsSpinner, 3);
2560 digits = digits < 1 ? 1 : digits;
2562 int lowersurround = 2;
2563 int uppersurround = 0;
2564 StringBuilder exampleSB = new StringBuilder();
2565 boolean firstLine = true;
2571 int max = keepAll ? exampleindex : rollMax;
2572 for (int index = min; index <= max; index++)
2574 if (index == min + lowersurround && index < max - uppersurround - 1)
2576 exampleSB.append("\n...");
2579 else if (index > min + lowersurround && index < max - uppersurround)
2591 exampleSB.append("\n");
2594 exampleSB.append(BackupFilenameParts.getBackupFilename(index,
2595 base, suffix, digits));
2598 // no extra text needed
2600 else if (index == min)
2602 String newest = MessageManager.getString("label.braced_newest");
2603 if (newest != null && newest.length() > 0)
2605 exampleSB.append(" " + newest);
2608 else if (index == max)
2610 String oldest = MessageManager.getString("label.braced_oldest");
2611 if (oldest != null && oldest.length() > 0)
2613 exampleSB.append(" " + oldest);
2622 int min = (keepAll || exampleindex - rollMax < 0) ? 1
2623 : exampleindex - rollMax + 1;
2624 int max = exampleindex;
2626 for (int index = min; index <= max; index++)
2629 if (index == min + lowersurround && index < max - uppersurround - 1)
2631 exampleSB.append("\n...");
2634 else if (index > min + lowersurround && index < max - uppersurround)
2646 exampleSB.append("\n");
2649 exampleSB.append(BackupFilenameParts.getBackupFilename(index,
2650 base, suffix, digits));
2653 // no extra text needed
2655 else if (index == min)
2657 String oldest = MessageManager.getString("label.braced_oldest");
2658 if (oldest != null && oldest.length() > 0)
2660 exampleSB.append(" " + oldest);
2663 else if (index == max)
2665 String newest = MessageManager.getString("label.braced_newest");
2666 if (newest != null && newest.length() > 0)
2668 exampleSB.append(" " + newest);
2676 // add some extra empty lines to pad out the example files box. ugh, please tell
2677 // me how to do this better
2678 int remainingLines = lowersurround + uppersurround + 1 - lineNumber;
2679 if (remainingLines > 0)
2681 for (int i = 0; i < remainingLines; i++)
2683 exampleSB.append("\n ");
2688 backupfilesExampleLabel.setText(exampleSB.toString());
2691 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2692 boolean useExistingVal, ChangeListener c)
2699 i = ((Integer) s.getValue()).intValue();
2700 } catch (Exception e)
2703 "Exception casting the initial value of s.getValue()");
2707 setIntegerSpinner(s, min, max, i, c);
2710 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2713 // integer spinner for number of digits
2722 SpinnerModel sModel = new SpinnerNumberModel(def, min, max, 1);
2725 s.addChangeListener(c);
2729 protected static int getSpinnerInt(JSpinner s, int def)
2735 i = (Integer) s.getValue();
2736 } catch (Exception e)
2738 Cache.log.error("Failed casting (Integer) JSpinner s.getValue()");
2743 private void keepRollMaxOptionsEnabled()
2745 boolean enabled = backupfilesKeepAll.isEnabled()
2746 && !backupfilesKeepAll.isSelected();
2747 oldBackupFilesLabel.setEnabled(enabled);
2748 backupfilesRollMaxSpinner.setEnabled(enabled);
2749 backupfilesConfirmDelete.setEnabled(enabled);
2752 private void backupfilesKeepAllSetEnabled(boolean tryEnabled)
2754 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2755 && customiseCheckbox.isSelected()
2756 && suffixTemplate.getText()
2757 .indexOf(BackupFiles.NUM_PLACEHOLDER) > -1;
2758 keepfilesPanel.setEnabled(enabled);
2759 backupfilesKeepAll.setEnabled(enabled);
2760 oldBackupFilesLabel.setEnabled(enabled);
2761 keepRollMaxOptionsEnabled();
2764 private void backupfilesSuffixTemplateDigitsSetEnabled()
2766 boolean enabled = suffixTemplate.isEnabled() && suffixTemplate.getText()
2767 .indexOf(BackupFiles.NUM_PLACEHOLDER) > -1;
2768 suffixDigitsLabel.setEnabled(enabled);
2769 suffixDigitsSpinner.setEnabled(enabled);
2770 suffixReverse.setEnabled(enabled);
2773 private void backupfilesSuffixTemplateSetEnabled(boolean tryEnabled)
2775 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2776 && customiseCheckbox.isSelected();
2777 suffixPanel.setEnabled(enabled);
2778 suffixTemplateLabel.setEnabled(enabled);
2779 suffixTemplate.setEnabled(enabled);
2780 backupfilesSuffixTemplateDigitsSetEnabled();
2783 private void backupfilesRevertButtonSetEnabled(boolean tryEnabled)
2785 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2786 && customiseCheckbox.isSelected() && backupfilesCustomChanged();
2787 revertButton.setEnabled(enabled);
2790 private boolean backupfilesCustomChanged()
2792 BackupFilesPresetEntry custom = BackupFilesPresetEntry.backupfilesPresetEntriesValues
2793 .get(BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM);
2794 BackupFilesPresetEntry current = getBackupfilesCurrentEntry();
2795 return !custom.equals(current);
2798 protected BackupFilesPresetEntry getBackupfilesCurrentEntry()
2800 String suffix = suffixTemplate.getText();
2801 int digits = getSpinnerInt(suffixDigitsSpinner, 3);
2802 boolean reverse = suffixReverse.isSelected();
2803 boolean keepAll = backupfilesKeepAll.isSelected();
2804 int rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 3);
2805 boolean confirmDelete = backupfilesConfirmDelete.isSelected();
2807 BackupFilesPresetEntry bfpe = new BackupFilesPresetEntry(suffix, digits,
2808 reverse, keepAll, rollMax, confirmDelete);
2813 protected void backupfilesCustomOptionsSetEnabled()
2815 boolean enabled = customiseCheckbox.isSelected();
2817 backupfilesRevertButtonSetEnabled(enabled);
2818 backupfilesSuffixTemplateSetEnabled(enabled);
2819 backupfilesKeepAllSetEnabled(enabled);
2822 private void backupfilesSummarySetEnabled()
2824 boolean enabled = enableBackupFiles.isSelected();
2825 backupfilesExampleLabel.setEnabled(enabled);
2826 exampleFilesPanel.setEnabled(enabled);
2829 private void backupfilesPresetsSetEnabled()
2831 boolean enabled = enableBackupFiles.isSelected();
2832 presetsPanel.setEnabled(enabled);
2833 presetsComboLabel.setEnabled(enabled);
2834 backupfilesPresetsCombo.setEnabled(enabled);
2835 customiseCheckbox.setEnabled(enabled);
2836 revertButton.setEnabled(enabled);
2839 protected void backupsOptionsSetEnabled()
2841 backupfilesPresetsSetEnabled();
2842 backupfilesSummarySetEnabled();
2843 backupfilesCustomOptionsSetEnabled();
2846 protected void backupsSetOptions(String suffix, int digits,
2847 boolean reverse, boolean keepAll, int rollMax,
2848 boolean confirmDelete)
2850 suffixTemplate.setText(suffix);
2851 suffixDigitsSpinner.setValue(digits);
2852 suffixReverse.setSelected(reverse);
2853 backupfilesKeepAll.setSelected(keepAll);
2854 backupfilesRollMaxSpinner.setValue(rollMax);
2855 backupfilesConfirmDelete.setSelected(confirmDelete);
2858 protected void backupsSetOptions(BackupFilesPresetEntry p)
2860 backupsSetOptions(p.suffix, p.digits, p.reverse, p.keepAll, p.rollMax,
2864 protected void autoIdWidth_actionPerformed()
2866 // TODO Auto-generated method stub
2870 protected void userIdWidth_actionPerformed()
2872 // TODO Auto-generated method stub
2876 protected void maxColour_actionPerformed(JPanel panel)
2880 protected void minColour_actionPerformed(JPanel panel)
2884 protected void gapColour_actionPerformed(JPanel panel)
2888 protected void hiddenColour_actionPerformed(JPanel panel)
2892 protected void showunconserved_actionPerformed(ActionEvent e)
2894 // TODO Auto-generated method stub
2898 protected void useLegacyGaps_actionPerformed(ActionEvent e)
2902 protected void resetOvDefaults_actionPerformed(ActionEvent e)
2912 public void ok_actionPerformed(ActionEvent e)
2922 public void cancel_actionPerformed(ActionEvent e)
2932 public void annotations_actionPerformed(ActionEvent e)
2939 public void startupFileTextfield_mouseClicked()
2943 public void newLink_actionPerformed(ActionEvent e)
2948 public void editLink_actionPerformed(ActionEvent e)
2953 public void deleteLink_actionPerformed(ActionEvent e)
2958 public void defaultBrowser_mouseClicked(MouseEvent e)
2963 public void linkURLList_keyTyped(KeyEvent e)
2968 public void useProxy_actionPerformed()
2970 boolean enabled = useProxy.isSelected();
2971 portLabel.setEnabled(enabled);
2972 serverLabel.setEnabled(enabled);
2973 proxyServerTB.setEnabled(enabled);
2974 proxyPortTB.setEnabled(enabled);
2978 * Customer renderer for JTable: supports column of radio buttons
2980 public class RadioButtonRenderer extends JRadioButton
2981 implements TableCellRenderer
2983 public RadioButtonRenderer()
2985 setHorizontalAlignment(CENTER);
2986 setToolTipText(MessageManager.getString("label.urltooltip"));
2990 public Component getTableCellRendererComponent(JTable table,
2991 Object value, boolean isSelected, boolean hasFocus, int row,
2994 setSelected((boolean) value);
2996 // set colours to match rest of table
2999 setBackground(table.getSelectionBackground());
3000 setForeground(table.getSelectionForeground());
3004 setBackground(table.getBackground());
3005 setForeground(table.getForeground());
3012 * Customer cell editor for JTable: supports column of radio buttons in
3013 * conjunction with renderer
3015 public class RadioButtonEditor extends AbstractCellEditor
3016 implements TableCellEditor
3018 private JRadioButton button = new JRadioButton();
3020 public RadioButtonEditor()
3022 button.setHorizontalAlignment(SwingConstants.CENTER);
3023 this.button.addActionListener(new ActionListener()
3026 public void actionPerformed(ActionEvent e)
3028 fireEditingStopped();
3034 public Component getTableCellEditorComponent(JTable table, Object value,
3035 boolean isSelected, int row, int column)
3037 button.setSelected((boolean) value);
3042 public Object getCellEditorValue()
3044 return button.isSelected();
3049 protected void validateHmmerPath()
3053 protected void validateCygwinPath()
3058 * A helper method to add a panel containing a label and a component to a
3066 protected static void addtoLayout(JPanel panel, String tooltip,
3067 JComponent label, JComponent valBox)
3069 JPanel laypanel = new JPanel(new GridLayout(1, 2));
3070 JPanel labPanel = new JPanel(new BorderLayout());
3071 JPanel valPanel = new JPanel();
3072 labPanel.setBounds(new Rectangle(7, 7, 158, 23));
3073 valPanel.setBounds(new Rectangle(172, 7, 270, 23));
3074 labPanel.add(label, BorderLayout.WEST);
3075 valPanel.add(valBox);
3076 laypanel.add(labPanel);
3077 laypanel.add(valPanel);
3078 valPanel.setToolTipText(tooltip);
3079 labPanel.setToolTipText(tooltip);
3080 valBox.setToolTipText(tooltip);
3081 panel.add(laypanel);