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 JLabel userIdWidthlabel = new JLabel();
264 protected JCheckBox autoIdWidth = new JCheckBox();
266 protected JTextField userIdWidth = new JTextField();
268 protected JCheckBox blcjv = new JCheckBox();
270 protected JCheckBox pileupjv = new JCheckBox();
272 protected JCheckBox clustaljv = new JCheckBox();
274 protected JCheckBox msfjv = new JCheckBox();
276 protected JCheckBox fastajv = new JCheckBox();
278 protected JCheckBox pfamjv = new JCheckBox();
280 protected JCheckBox pirjv = new JCheckBox();
282 protected JCheckBox modellerOutput = new JCheckBox();
284 protected JCheckBox embbedBioJSON = new JCheckBox();
287 * Editing tab components
289 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
291 protected JCheckBox padGaps = new JCheckBox();
293 protected JCheckBox sortByTree = new JCheckBox();
296 * hmmer tab and components
298 protected JPanel hmmerTab;
300 protected JCheckBox hmmrTrimTermini;
302 protected AbstractButton hmmerBackgroundUniprot;
304 protected AbstractButton hmmerBackgroundAlignment;
306 protected JTextField hmmerSequenceCount;
308 protected JTextField hmmerPath;
310 protected JTextField cygwinPath;
315 protected JPanel wsTab = new JPanel();
318 * Backups tab components
319 * a lot of these are member variables instead of local variables only so that they
320 * can be enabled/disabled easily in one go
323 protected JCheckBox enableBackupFiles = new JCheckBox();
325 protected JPanel presetsPanel = new JPanel();
327 protected JLabel presetsComboLabel = new JLabel();
329 protected JCheckBox customiseCheckbox = new JCheckBox();
331 protected JButton revertButton = new JButton();
333 protected JComboBox<Object> backupfilesPresetsCombo = new JComboBox<>();
335 private int backupfilesPresetsComboLastSelected = 0;
337 protected JPanel suffixPanel = new JPanel();
339 protected JPanel keepfilesPanel = new JPanel();
341 protected JPanel exampleFilesPanel = new JPanel();
343 protected JTextField suffixTemplate = new JTextField(null, 8);
345 protected JLabel suffixTemplateLabel = new JLabel();
347 protected JLabel suffixDigitsLabel = new JLabel();
349 protected JSpinner suffixDigitsSpinner = new JSpinner();
351 protected JalviewBooleanRadioButtons suffixReverse = new JalviewBooleanRadioButtons();
353 protected JalviewBooleanRadioButtons backupfilesKeepAll = new JalviewBooleanRadioButtons();
355 public JSpinner backupfilesRollMaxSpinner = new JSpinner();
357 protected JLabel oldBackupFilesLabel = new JLabel();
359 protected JalviewBooleanRadioButtons backupfilesConfirmDelete = new JalviewBooleanRadioButtons();
361 protected JTextArea backupfilesExampleLabel = new JTextArea();
364 * Creates a new GPreferences object.
366 public GPreferences()
371 } catch (Exception ex)
373 ex.printStackTrace();
378 * Construct the panel and its tabbed sub-panels.
382 private void jbInit() throws Exception
384 final JTabbedPane tabbedPane = new JTabbedPane();
385 this.setLayout(new BorderLayout());
386 JPanel okCancelPanel = initOkCancelPanel();
387 this.add(tabbedPane, BorderLayout.CENTER);
388 this.add(okCancelPanel, BorderLayout.SOUTH);
390 tabbedPane.add(initVisualTab(),
391 MessageManager.getString("label.visual"));
393 tabbedPane.add(initColoursTab(),
394 MessageManager.getString("label.colours"));
396 tabbedPane.add(initOverviewTab(),
397 MessageManager.getString("label.overview"));
399 tabbedPane.add(initStructureTab(),
400 MessageManager.getString("label.structure"));
402 tabbedPane.add(initConnectionsTab(),
403 MessageManager.getString("label.connections"));
405 tabbedPane.add(initBackupsTab(),
406 MessageManager.getString("label.backups"));
408 tabbedPane.add(initLinksTab(),
409 MessageManager.getString("label.urllinks"));
411 tabbedPane.add(initOutputTab(),
412 MessageManager.getString("label.output"));
414 tabbedPane.add(initEditingTab(),
415 MessageManager.getString("label.editing"));
417 tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
420 * See WsPreferences for the real work of configuring this tab.
422 wsTab.setLayout(new BorderLayout());
423 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
426 * Handler to validate a tab before leaving it - currently only for
429 tabbedPane.addChangeListener(new ChangeListener()
431 private Component lastTab;
434 public void stateChanged(ChangeEvent e)
436 if (lastTab == structureTab
437 && tabbedPane.getSelectedComponent() != structureTab)
439 if (!validateStructure())
441 tabbedPane.setSelectedComponent(structureTab);
445 lastTab = tabbedPane.getSelectedComponent();
452 * Initialises the Editing tabbed panel.
456 private JPanel initEditingTab()
458 JPanel editingTab = new JPanel();
459 editingTab.setLayout(null);
460 autoCalculateConsCheck.setFont(LABEL_FONT);
461 autoCalculateConsCheck.setText(
462 MessageManager.getString("label.autocalculate_consensus"));
463 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
464 padGaps.setFont(LABEL_FONT);
466 MessageManager.getString("label.pad_gaps_when_editing"));
467 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
468 sortByTree.setFont(LABEL_FONT);
470 .setText(MessageManager.getString("label.sort_with_new_tree"));
471 sortByTree.setToolTipText(MessageManager.getString(
472 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
473 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
474 editingTab.add(autoCalculateConsCheck);
475 editingTab.add(padGaps);
476 editingTab.add(sortByTree);
481 * Initialises the hmmer tabbed panel
485 private JPanel initHMMERTab()
487 hmmerTab = new JPanel();
488 hmmerTab.setLayout(new BoxLayout(hmmerTab, BoxLayout.Y_AXIS));
489 hmmerTab.setLayout(new MigLayout("flowy"));
492 * path to hmmer binaries folder
494 JPanel installationPanel = new JPanel(new MigLayout("flowy"));
495 // new FlowLayout(FlowLayout.LEFT));
496 JvSwingUtils.createTitledBorder(installationPanel,
497 MessageManager.getString("label.installation"), true);
498 hmmerTab.add(installationPanel);
499 JLabel hmmerLocation = new JLabel(
500 MessageManager.getString("label.hmmer_location"));
501 hmmerLocation.setFont(LABEL_FONT);
502 final int pathFieldLength = 40;
503 hmmerPath = new JTextField(pathFieldLength);
504 hmmerPath.addMouseListener(new MouseAdapter()
507 public void mouseClicked(MouseEvent e)
509 if (e.getClickCount() == 2)
511 String chosen = openFileChooser(true);
514 hmmerPath.setText(chosen);
520 installationPanel.add(hmmerLocation);
521 installationPanel.add(hmmerPath);
524 * path to Cygwin binaries folder (for Windows)
526 if (Platform.isWindows())
528 JLabel cygwinLocation = new JLabel(
529 MessageManager.getString("label.cygwin_location"));
530 cygwinLocation.setFont(LABEL_FONT);
531 cygwinPath = new JTextField(pathFieldLength);
532 cygwinPath.addMouseListener(new MouseAdapter()
535 public void mouseClicked(MouseEvent e)
537 if (e.getClickCount() == 2)
539 String chosen = openFileChooser(true);
542 cygwinPath.setText(chosen);
543 validateCygwinPath();
548 installationPanel.add(cygwinLocation);
549 installationPanel.add(cygwinPath);
553 * preferences for hmmalign
555 JPanel alignOptionsPanel = new JPanel(new MigLayout());
556 // new FlowLayout(FlowLayout.LEFT));
557 JvSwingUtils.createTitledBorder(alignOptionsPanel,
558 MessageManager.getString("label.hmmalign_options"), true);
559 hmmerTab.add(alignOptionsPanel);
560 hmmrTrimTermini = new JCheckBox();
561 hmmrTrimTermini.setFont(LABEL_FONT);
562 hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
563 alignOptionsPanel.add(hmmrTrimTermini);
566 * preferences for hmmsearch
568 JPanel searchOptions = new JPanel(new MigLayout());
569 // FlowLayout(FlowLayout.LEFT));
570 JvSwingUtils.createTitledBorder(searchOptions,
571 MessageManager.getString("label.hmmsearch_options"), true);
572 hmmerTab.add(searchOptions);
573 JLabel sequencesToKeep = new JLabel(
574 MessageManager.getString("label.no_of_sequences"));
575 sequencesToKeep.setFont(LABEL_FONT);
576 searchOptions.add(sequencesToKeep);
577 hmmerSequenceCount = new JTextField(5);
578 searchOptions.add(hmmerSequenceCount);
581 * preferences for Information Content annotation
583 // JPanel dummy = new JPanel(new FlowLayout(FlowLayout.LEFT));
584 JPanel annotationOptions = new JPanel(new MigLayout("left"));
585 JvSwingUtils.createTitledBorder(annotationOptions,
586 MessageManager.getString("label.information_annotation"), true);
587 // dummy.add(annotationOptions);
588 hmmerTab.add(annotationOptions);
589 ButtonGroup backgroundOptions = new ButtonGroup();
590 hmmerBackgroundUniprot = new JRadioButton(
591 MessageManager.getString("label.freq_uniprot"));
592 hmmerBackgroundUniprot.setFont(LABEL_FONT);
593 hmmerBackgroundAlignment = new JRadioButton(
594 MessageManager.getString("label.freq_alignment"));
595 hmmerBackgroundAlignment.setFont(LABEL_FONT);
596 backgroundOptions.add(hmmerBackgroundUniprot);
597 backgroundOptions.add(hmmerBackgroundAlignment);
598 backgroundOptions.setSelected(hmmerBackgroundUniprot.getModel(), true);
599 // disable buttons for now as annotation only uses Uniprot background
600 hmmerBackgroundAlignment.setEnabled(false);
601 hmmerBackgroundUniprot.setEnabled(false);
602 annotationOptions.add(hmmerBackgroundUniprot, "wrap");
603 annotationOptions.add(hmmerBackgroundAlignment);
609 * Initialises the Output tabbed panel.
613 private JPanel initOutputTab()
615 JPanel outputTab = new JPanel();
616 outputTab.setLayout(null);
617 JLabel epsLabel = new JLabel();
618 epsLabel.setFont(LABEL_FONT);
619 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
620 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
621 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
622 epsRendering.setFont(LABEL_FONT);
623 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
624 JLabel jLabel1 = new JLabel();
625 jLabel1.setFont(LABEL_FONT);
626 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
627 jLabel1.setText(MessageManager.getString("label.append_start_end"));
628 jLabel1.setFont(LABEL_FONT);
629 fastajv.setFont(LABEL_FONT);
630 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
631 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
632 blcjv.setText(MessageManager.getString("label.blc") + " ");
633 fastajv.setText(MessageManager.getString("label.fasta") + " ");
634 msfjv.setText(MessageManager.getString("label.msf") + " ");
635 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
636 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
637 msfjv.setFont(LABEL_FONT);
638 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
639 pirjv.setText(MessageManager.getString("label.pir") + " ");
640 JPanel jPanel11 = new JPanel();
641 jPanel11.setFont(LABEL_FONT);
642 TitledBorder titledBorder2 = new TitledBorder(
643 MessageManager.getString("label.file_output"));
644 jPanel11.setBorder(titledBorder2);
645 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
646 GridLayout gridLayout3 = new GridLayout();
647 jPanel11.setLayout(gridLayout3);
648 gridLayout3.setRows(8);
649 blcjv.setFont(LABEL_FONT);
650 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
651 clustaljv.setFont(LABEL_FONT);
652 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
653 pfamjv.setFont(LABEL_FONT);
654 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
655 pileupjv.setFont(LABEL_FONT);
656 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
657 pirjv.setFont(LABEL_FONT);
658 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
659 autoIdWidth.setFont(LABEL_FONT);
661 MessageManager.getString("label.automatically_set_id_width"));
662 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
663 .getString("label.adjusts_width_generated_eps_png")));
664 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
665 autoIdWidth.addActionListener(new ActionListener()
669 public void actionPerformed(ActionEvent e)
671 autoIdWidth_actionPerformed();
674 userIdWidthlabel.setFont(LABEL_FONT);
675 userIdWidthlabel.setText(
676 MessageManager.getString("label.figure_id_column_width"));
677 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
678 .getString("label.manually_specify_width_left_column")));
679 userIdWidthlabel.setToolTipText(
680 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
681 "label.manually_specify_width_left_column")));
682 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
683 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
684 userIdWidth.setText("");
685 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
686 userIdWidth.addActionListener(new ActionListener()
690 public void actionPerformed(ActionEvent e)
692 userIdWidth_actionPerformed();
695 modellerOutput.setFont(LABEL_FONT);
697 .setText(MessageManager.getString("label.use_modeller_output"));
698 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
699 embbedBioJSON.setFont(LABEL_FONT);
700 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
701 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
703 jPanel11.add(jLabel1);
705 jPanel11.add(clustaljv);
706 jPanel11.add(fastajv);
708 jPanel11.add(pfamjv);
709 jPanel11.add(pileupjv);
711 outputTab.add(autoIdWidth);
712 outputTab.add(userIdWidth);
713 outputTab.add(userIdWidthlabel);
714 outputTab.add(modellerOutput);
715 outputTab.add(embbedBioJSON);
716 outputTab.add(epsLabel);
717 outputTab.add(epsRendering);
718 outputTab.add(jPanel11);
723 * Initialises the Connections tabbed panel.
727 private JPanel initConnectionsTab()
729 JPanel connectTab = new JPanel();
730 connectTab.setLayout(new GridBagLayout());
732 // Label for browser text box
733 JLabel browserLabel = new JLabel();
734 browserLabel.setFont(LABEL_FONT);
735 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
736 browserLabel.setText(
737 MessageManager.getString("label.default_browser_unix"));
738 defaultBrowser.setFont(LABEL_FONT);
739 defaultBrowser.setText("");
740 final String tooltip = JvSwingUtils.wrapTooltip(true,
741 MessageManager.getString("label.double_click_to_browse"));
742 defaultBrowser.setToolTipText(tooltip);
743 defaultBrowser.addMouseListener(new MouseAdapter()
746 public void mouseClicked(MouseEvent e)
748 if (e.getClickCount() > 1)
750 defaultBrowser_mouseClicked(e);
755 JPanel proxyPanel = initConnTabProxyPanel();
756 initConnTabCheckboxes();
758 // Add default Browser text box
759 connectTab.add(browserLabel,
760 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
761 GridBagConstraints.WEST, GridBagConstraints.NONE,
762 new Insets(10, 0, 5, 5), 5, 1));
763 defaultBrowser.setFont(LABEL_FONT);
764 defaultBrowser.setText("");
766 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
767 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
768 new Insets(10, 0, 5, 10), 30, 1));
770 // Add proxy server panel
771 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
772 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
773 new Insets(10, 0, 5, 12), 4, 10));
775 // Add usage stats, version check and questionnaire checkboxes
776 connectTab.add(usagestats,
777 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
778 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
779 new Insets(0, 2, 5, 5), 70, 1));
780 connectTab.add(questionnaire,
781 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
782 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
783 new Insets(0, 2, 5, 10), 70, 1));
784 connectTab.add(versioncheck,
785 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
786 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
787 new Insets(0, 2, 5, 5), 70, 1));
789 // Add padding so the panel doesn't look ridiculous
790 JPanel spacePanel = new JPanel();
791 connectTab.add(spacePanel,
792 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
793 GridBagConstraints.WEST, GridBagConstraints.BOTH,
794 new Insets(0, 0, 0, 5), 70, 1));
800 * Initialises the Links tabbed panel.
804 private JPanel initLinksTab()
806 JPanel linkTab = new JPanel();
807 linkTab.setLayout(new GridBagLayout());
809 // Set up table for Url links
810 linkUrlTable.getTableHeader().setReorderingAllowed(false);
811 linkUrlTable.setFillsViewportHeight(true);
812 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
813 linkUrlTable.setAutoCreateRowSorter(true);
814 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
816 // adjust row height so radio buttons actually fit
817 // don't do this in the renderer, it causes the awt thread to activate
819 JRadioButton temp = new JRadioButton();
820 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
822 // Table in scrollpane so that the table is given a scrollbar
823 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
824 linkScrollPane.setBorder(null);
826 // Panel for links functionality
827 JPanel linkPanel = new JPanel(new GridBagLayout());
828 linkPanel.setBorder(new TitledBorder(
829 MessageManager.getString("label.url_linkfrom_sequence_id")));
831 // Put the Url links panel together
833 // Buttons go at top right, resizing only resizes the blank space vertically
834 JPanel buttonPanel = initLinkTabUrlButtons();
835 GridBagConstraints linkConstraints1 = new GridBagConstraints();
836 linkConstraints1.insets = new Insets(0, 0, 5, 0);
837 linkConstraints1.gridx = 0;
838 linkConstraints1.gridy = 0;
839 linkConstraints1.weightx = 1.0;
840 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
841 linkTab.add(buttonPanel, linkConstraints1);
843 // Links table goes at top left, resizing resizes the table
844 GridBagConstraints linkConstraints2 = new GridBagConstraints();
845 linkConstraints2.insets = new Insets(0, 0, 5, 5);
846 linkConstraints2.gridx = 0;
847 linkConstraints2.gridy = 1;
848 linkConstraints2.weightx = 1.0;
849 linkConstraints2.weighty = 1.0;
850 linkConstraints2.fill = GridBagConstraints.BOTH;
851 linkTab.add(linkScrollPane, linkConstraints2);
853 // Filter box and buttons goes at bottom left, resizing resizes the text box
854 JPanel filterPanel = initLinkTabFilterPanel();
855 GridBagConstraints linkConstraints3 = new GridBagConstraints();
856 linkConstraints3.insets = new Insets(0, 0, 0, 5);
857 linkConstraints3.gridx = 0;
858 linkConstraints3.gridy = 2;
859 linkConstraints3.weightx = 1.0;
860 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
861 linkTab.add(filterPanel, linkConstraints3);
866 private JPanel initLinkTabFilterPanel()
868 // Filter textbox and reset button
869 JLabel filterLabel = new JLabel(
870 MessageManager.getString("label.filter"));
871 filterLabel.setFont(LABEL_FONT);
872 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
873 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
875 filterTB.setFont(LABEL_FONT);
876 filterTB.setText("");
878 doReset.setText(MessageManager.getString("action.showall"));
879 userOnly.setText(MessageManager.getString("action.customfilter"));
881 // Panel for filter functionality
882 JPanel filterPanel = new JPanel(new GridBagLayout());
883 filterPanel.setBorder(new TitledBorder("Filter"));
884 GridBagConstraints gbc = new GridBagConstraints();
887 gbc.fill = GridBagConstraints.NONE;
888 gbc.anchor = GridBagConstraints.WEST;
890 filterPanel.add(filterLabel, gbc);
892 GridBagConstraints gbc1 = new GridBagConstraints();
895 gbc1.fill = GridBagConstraints.HORIZONTAL;
896 gbc1.anchor = GridBagConstraints.WEST;
898 filterPanel.add(filterTB, gbc1);
900 GridBagConstraints gbc2 = new GridBagConstraints();
902 gbc2.fill = GridBagConstraints.NONE;
903 gbc2.anchor = GridBagConstraints.WEST;
904 filterPanel.add(doReset, gbc2);
906 GridBagConstraints gbc3 = new GridBagConstraints();
908 gbc3.fill = GridBagConstraints.NONE;
909 gbc3.anchor = GridBagConstraints.WEST;
910 filterPanel.add(userOnly, gbc3);
915 private JPanel initLinkTabUrlButtons()
917 // Buttons for new / edit / delete Url links
918 JButton newLink = new JButton();
919 newLink.setText(MessageManager.getString("action.new"));
921 editLink.setText(MessageManager.getString("action.edit"));
923 deleteLink.setText(MessageManager.getString("action.delete"));
925 // no current selection, so initially disable delete/edit buttons
926 editLink.setEnabled(false);
927 deleteLink.setEnabled(false);
929 newLink.addActionListener(new java.awt.event.ActionListener()
932 public void actionPerformed(ActionEvent e)
934 newLink_actionPerformed(e);
938 editLink.setText(MessageManager.getString("action.edit"));
939 editLink.addActionListener(new java.awt.event.ActionListener()
942 public void actionPerformed(ActionEvent e)
944 editLink_actionPerformed(e);
948 deleteLink.setText(MessageManager.getString("action.delete"));
949 deleteLink.addActionListener(new java.awt.event.ActionListener()
952 public void actionPerformed(ActionEvent e)
954 deleteLink_actionPerformed(e);
958 JPanel buttonPanel = new JPanel(new GridBagLayout());
959 buttonPanel.setBorder(new TitledBorder("Edit links"));
960 GridBagConstraints gbc = new GridBagConstraints();
963 gbc.fill = GridBagConstraints.NONE;
964 buttonPanel.add(newLink, gbc);
966 GridBagConstraints gbc1 = new GridBagConstraints();
969 gbc1.fill = GridBagConstraints.NONE;
970 buttonPanel.add(editLink, gbc1);
972 GridBagConstraints gbc2 = new GridBagConstraints();
975 gbc2.fill = GridBagConstraints.NONE;
976 buttonPanel.add(deleteLink, gbc2);
978 GridBagConstraints gbc3 = new GridBagConstraints();
981 gbc3.fill = GridBagConstraints.HORIZONTAL;
983 JPanel spacePanel = new JPanel();
984 spacePanel.setBorder(null);
985 buttonPanel.add(spacePanel, gbc3);
991 * Initialises the proxy server panel in the Connections tab
993 * @return the proxy server panel
995 private JPanel initConnTabProxyPanel()
997 // Label for server text box
998 serverLabel.setText(MessageManager.getString("label.address"));
999 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1000 serverLabel.setFont(LABEL_FONT);
1002 // Proxy server and port text boxes
1003 proxyServerTB.setFont(LABEL_FONT);
1004 proxyPortTB.setFont(LABEL_FONT);
1006 // Label for Port text box
1007 portLabel.setFont(LABEL_FONT);
1008 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1009 portLabel.setText(MessageManager.getString("label.port"));
1011 // Use proxy server checkbox
1012 useProxy.setFont(LABEL_FONT);
1013 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
1014 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
1015 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
1016 useProxy.addActionListener(new ActionListener()
1019 public void actionPerformed(ActionEvent e)
1021 useProxy_actionPerformed();
1025 // Make proxy server panel
1026 JPanel proxyPanel = new JPanel();
1027 TitledBorder titledBorder1 = new TitledBorder(
1028 MessageManager.getString("label.proxy_server"));
1029 proxyPanel.setBorder(titledBorder1);
1030 proxyPanel.setLayout(new GridBagLayout());
1031 proxyPanel.add(serverLabel,
1032 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
1033 GridBagConstraints.WEST, GridBagConstraints.NONE,
1034 new Insets(0, 2, 2, 0), 5, 0));
1035 proxyPanel.add(portLabel,
1036 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
1037 GridBagConstraints.WEST, GridBagConstraints.NONE,
1038 new Insets(0, 0, 2, 0), 11, 0));
1039 proxyPanel.add(useProxy,
1040 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
1041 GridBagConstraints.WEST, GridBagConstraints.NONE,
1042 new Insets(0, 2, 5, 185), 2, -4));
1043 proxyPanel.add(proxyPortTB,
1044 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
1045 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
1046 new Insets(0, 2, 2, 2), 54, 1));
1047 proxyPanel.add(proxyServerTB,
1048 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
1049 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
1050 new Insets(0, 2, 2, 0), 263, 1));
1056 * Initialises the checkboxes in the Connections tab
1058 private void initConnTabCheckboxes()
1060 // Usage stats checkbox label
1062 MessageManager.getString("label.send_usage_statistics"));
1063 usagestats.setFont(LABEL_FONT);
1064 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
1065 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
1067 // Questionnaire checkbox label
1068 questionnaire.setText(
1069 MessageManager.getString("label.check_for_questionnaires"));
1070 questionnaire.setFont(LABEL_FONT);
1071 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
1072 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
1074 // Check for latest version checkbox label
1075 versioncheck.setText(
1076 MessageManager.getString("label.check_for_latest_version"));
1077 versioncheck.setFont(LABEL_FONT);
1078 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
1079 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
1083 * Initialises the parent panel which contains the tabbed sections.
1087 private JPanel initOkCancelPanel()
1089 JButton ok = new JButton();
1090 ok.setText(MessageManager.getString("action.ok"));
1091 ok.addActionListener(new ActionListener()
1094 public void actionPerformed(ActionEvent e)
1096 ok_actionPerformed(e);
1099 JButton cancel = new JButton();
1100 cancel.setText(MessageManager.getString("action.cancel"));
1101 cancel.addActionListener(new ActionListener()
1104 public void actionPerformed(ActionEvent e)
1106 cancel_actionPerformed(e);
1109 JPanel okCancelPanel = new JPanel();
1110 okCancelPanel.add(ok);
1111 okCancelPanel.add(cancel);
1112 return okCancelPanel;
1116 * Initialises the Colours tabbed panel.
1120 private JPanel initColoursTab()
1122 JPanel coloursTab = new JPanel();
1123 coloursTab.setBorder(new TitledBorder(
1124 MessageManager.getString("action.open_new_alignment")));
1125 coloursTab.setLayout(new FlowLayout());
1126 JLabel mincolourLabel = new JLabel();
1127 mincolourLabel.setFont(LABEL_FONT);
1128 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1129 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1130 minColour.setFont(LABEL_FONT);
1131 minColour.setBorder(BorderFactory.createEtchedBorder());
1132 minColour.setPreferredSize(new Dimension(40, 20));
1133 minColour.addMouseListener(new MouseAdapter()
1136 public void mousePressed(MouseEvent e)
1138 minColour_actionPerformed(minColour);
1141 JLabel maxcolourLabel = new JLabel();
1142 maxcolourLabel.setFont(LABEL_FONT);
1143 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1144 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1145 maxColour.setFont(LABEL_FONT);
1146 maxColour.setBorder(BorderFactory.createEtchedBorder());
1147 maxColour.setPreferredSize(new Dimension(40, 20));
1148 maxColour.addMouseListener(new MouseAdapter()
1151 public void mousePressed(MouseEvent e)
1153 maxColour_actionPerformed(maxColour);
1157 protColour.setFont(LABEL_FONT);
1158 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1159 JLabel protColourLabel = new JLabel();
1160 protColourLabel.setFont(LABEL_FONT);
1161 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1162 protColourLabel.setText(
1163 MessageManager.getString("label.prot_alignment_colour") + " ");
1164 GPreferences.addtoLayout(coloursTab,
1166 .getString("label.default_colour_scheme_for_alignment"),
1167 protColourLabel, protColour);
1169 nucColour.setFont(LABEL_FONT);
1170 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1171 JLabel nucColourLabel = new JLabel();
1172 nucColourLabel.setFont(LABEL_FONT);
1173 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1174 nucColourLabel.setText(
1175 MessageManager.getString("label.nuc_alignment_colour") + " ");
1176 GPreferences.addtoLayout(coloursTab,
1178 .getString("label.default_colour_scheme_for_alignment"),
1179 nucColourLabel, nucColour);
1181 JPanel annotationShding = new JPanel();
1182 annotationShding.setBorder(new TitledBorder(
1183 MessageManager.getString("label.annotation_shading_default")));
1184 annotationShding.setLayout(new GridLayout(1, 2));
1185 GPreferences.addtoLayout(annotationShding,
1186 MessageManager.getString(
1187 "label.default_minimum_colour_annotation_shading"),
1188 mincolourLabel, minColour);
1189 GPreferences.addtoLayout(annotationShding,
1190 MessageManager.getString(
1191 "label.default_maximum_colour_annotation_shading"),
1192 maxcolourLabel, maxColour);
1193 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1198 * Initialises the Overview tabbed panel.
1202 private JPanel initOverviewTab()
1204 JPanel overviewPanel = new JPanel();
1205 overviewPanel.setBorder(new TitledBorder(
1206 MessageManager.getString("label.overview_settings")));
1208 gapColour.setFont(LABEL_FONT);
1209 // fixing the border colours stops apparent colour bleed from the panel
1210 gapColour.setBorder(
1211 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1212 gapColour.setPreferredSize(new Dimension(40, 20));
1213 gapColour.addMouseListener(new MouseAdapter()
1216 public void mousePressed(MouseEvent e)
1218 gapColour_actionPerformed(gapColour);
1222 hiddenColour.setFont(LABEL_FONT);
1223 // fixing the border colours stops apparent colour bleed from the panel
1224 hiddenColour.setBorder(
1225 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1226 hiddenColour.setPreferredSize(new Dimension(40, 20));
1227 hiddenColour.addMouseListener(new MouseAdapter()
1230 public void mousePressed(MouseEvent e)
1232 hiddenColour_actionPerformed(hiddenColour);
1236 useLegacyGap = new JCheckBox(
1237 MessageManager.getString("label.ov_legacy_gap"));
1238 useLegacyGap.setFont(LABEL_FONT);
1239 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1240 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1241 gapLabel = new JLabel(MessageManager.getString("label.gap_colour"));
1242 gapLabel.setFont(LABEL_FONT);
1243 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1244 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1245 showHiddenAtStart = new JCheckBox(
1246 MessageManager.getString("label.ov_show_hide_default"));
1247 showHiddenAtStart.setFont(LABEL_FONT);
1248 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1249 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1250 JLabel hiddenLabel = new JLabel(
1251 MessageManager.getString("label.hidden_colour"));
1252 hiddenLabel.setFont(LABEL_FONT);
1253 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1254 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1256 useLegacyGap.addActionListener(new ActionListener()
1259 public void actionPerformed(ActionEvent e)
1261 useLegacyGaps_actionPerformed(e);
1265 overviewPanel.setLayout(new GridBagLayout());
1266 GridBagConstraints c1 = new GridBagConstraints();
1268 c1.fill = GridBagConstraints.HORIZONTAL;
1273 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1274 overviewPanel.add(useLegacyGap, c1);
1276 GridBagConstraints c2 = new GridBagConstraints();
1277 c2.fill = GridBagConstraints.HORIZONTAL;
1280 c2.insets = new Insets(0, 15, 0, 10);
1281 overviewPanel.add(gapLabel, c2);
1283 GridBagConstraints c3 = new GridBagConstraints();
1284 c3.fill = GridBagConstraints.HORIZONTAL;
1287 c3.insets = new Insets(0, 0, 0, 15);
1288 overviewPanel.add(gapColour, c3);
1290 GridBagConstraints c4 = new GridBagConstraints();
1291 c4.fill = GridBagConstraints.HORIZONTAL;
1295 overviewPanel.add(showHiddenAtStart, c4);
1297 GridBagConstraints c5 = new GridBagConstraints();
1298 c5.fill = GridBagConstraints.HORIZONTAL;
1301 c5.insets = new Insets(0, 15, 0, 10);
1302 overviewPanel.add(hiddenLabel, c5);
1304 GridBagConstraints c6 = new GridBagConstraints();
1305 c6.fill = GridBagConstraints.HORIZONTAL;
1308 c6.insets = new Insets(0, 0, 0, 15);
1309 overviewPanel.add(hiddenColour, c6);
1311 JButton resetButton = new JButton(
1312 MessageManager.getString("label.reset_to_defaults"));
1314 resetButton.addActionListener(new ActionListener()
1317 public void actionPerformed(ActionEvent e)
1319 resetOvDefaults_actionPerformed(e);
1323 GridBagConstraints c7 = new GridBagConstraints();
1324 c7.fill = GridBagConstraints.NONE;
1327 c7.insets = new Insets(10, 0, 0, 0);
1328 c7.anchor = GridBagConstraints.WEST;
1329 overviewPanel.add(resetButton, c7);
1331 // Add padding so the panel doesn't look ridiculous
1332 JPanel spacePanel = new JPanel();
1333 overviewPanel.add(spacePanel,
1334 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1335 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1336 new Insets(0, 0, 0, 5), 0, 0));
1338 return overviewPanel;
1342 * Initialises the Structure tabbed panel.
1346 private JPanel initStructureTab()
1348 structureTab = new JPanel();
1350 structureTab.setBorder(new TitledBorder(
1351 MessageManager.getString("label.structure_options")));
1352 structureTab.setLayout(null);
1353 final int width = 400;
1354 final int height = 22;
1355 final int lineSpacing = 25;
1358 structFromPdb.setFont(LABEL_FONT);
1360 .setText(MessageManager.getString("label.struct_from_pdb"));
1361 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1362 structFromPdb.addActionListener(new ActionListener()
1365 public void actionPerformed(ActionEvent e)
1367 boolean selected = structFromPdb.isSelected();
1368 // enable other options only when the first is checked
1369 useRnaView.setEnabled(selected);
1370 addSecondaryStructure.setEnabled(selected);
1371 addTempFactor.setEnabled(selected);
1374 structureTab.add(structFromPdb);
1376 // indent checkboxes that are conditional on the first one
1377 ypos += lineSpacing;
1378 useRnaView.setFont(LABEL_FONT);
1379 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1380 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1381 structureTab.add(useRnaView);
1383 ypos += lineSpacing;
1384 addSecondaryStructure.setFont(LABEL_FONT);
1385 addSecondaryStructure
1386 .setText(MessageManager.getString("label.autoadd_secstr"));
1387 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1388 structureTab.add(addSecondaryStructure);
1390 ypos += lineSpacing;
1391 addTempFactor.setFont(LABEL_FONT);
1392 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1393 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1394 structureTab.add(addTempFactor);
1396 ypos += lineSpacing;
1397 JLabel viewerLabel = new JLabel();
1398 viewerLabel.setFont(LABEL_FONT);
1399 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1400 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1401 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1402 structureTab.add(viewerLabel);
1404 structViewer.setFont(LABEL_FONT);
1405 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1406 structViewer.addItem(ViewerType.JMOL.name());
1407 structViewer.addItem(ViewerType.CHIMERA.name());
1408 structViewer.addActionListener(new ActionListener()
1411 public void actionPerformed(ActionEvent e)
1413 structureViewer_actionPerformed(
1414 (String) structViewer.getSelectedItem());
1417 structureTab.add(structViewer);
1419 ypos += lineSpacing;
1420 JLabel pathLabel = new JLabel();
1421 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1422 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1423 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1424 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1425 structureTab.add(pathLabel);
1427 chimeraPath.setFont(LABEL_FONT);
1428 chimeraPath.setText("");
1429 final String tooltip = JvSwingUtils.wrapTooltip(true,
1430 MessageManager.getString("label.chimera_path_tip"));
1431 chimeraPath.setToolTipText(tooltip);
1432 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1433 chimeraPath.addMouseListener(new MouseAdapter()
1436 public void mouseClicked(MouseEvent e)
1438 if (e.getClickCount() == 2)
1440 String chosen = openFileChooser(false);
1443 chimeraPath.setText(chosen);
1448 structureTab.add(chimeraPath);
1450 ypos += lineSpacing;
1451 nwMapping.setFont(LABEL_FONT);
1452 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1453 siftsMapping.setFont(LABEL_FONT);
1454 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1455 mappingMethod.add(nwMapping);
1456 mappingMethod.add(siftsMapping);
1457 JPanel mappingPanel = new JPanel();
1458 mappingPanel.setFont(LABEL_FONT);
1459 TitledBorder mmTitledBorder = new TitledBorder(
1460 MessageManager.getString("label.mapping_method"));
1461 mmTitledBorder.setTitleFont(LABEL_FONT);
1462 mappingPanel.setBorder(mmTitledBorder);
1463 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1464 // GridLayout mappingLayout = new GridLayout();
1465 mappingPanel.setLayout(new GridLayout());
1466 mappingPanel.add(nwMapping);
1467 mappingPanel.add(siftsMapping);
1468 structureTab.add(mappingPanel);
1470 ypos += lineSpacing;
1471 ypos += lineSpacing;
1472 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1473 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1474 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1475 structureTab.add(docFieldPref);
1477 return structureTab;
1481 * Action on choosing a structure viewer from combobox options.
1483 * @param selectedItem
1485 protected void structureViewer_actionPerformed(String selectedItem)
1490 * Show a dialog for the user to choose a file. Returns the chosen path, or
1495 protected String openFileChooser(boolean forFolder)
1497 String choice = null;
1498 JFileChooser chooser = new JFileChooser();
1501 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1504 // chooser.setFileView(new JalviewFileView());
1505 chooser.setDialogTitle(
1506 MessageManager.getString("label.open_local_file"));
1507 chooser.setToolTipText(MessageManager.getString("action.open"));
1509 int value = chooser.showOpenDialog(this);
1511 if (value == JFileChooser.APPROVE_OPTION)
1513 choice = chooser.getSelectedFile().getPath();
1518 protected boolean validateStructure()
1524 * Initialises the Visual tabbed panel.
1528 private JPanel initVisualTab()
1530 JPanel visualTab = new JPanel();
1531 visualTab.setBorder(new TitledBorder(
1532 MessageManager.getString("action.open_new_alignment")));
1533 visualTab.setLayout(null);
1534 fullScreen.setFont(LABEL_FONT);
1535 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1536 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1537 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1538 quality.setEnabled(false);
1539 quality.setFont(LABEL_FONT);
1540 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1541 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1542 quality.setSelected(true);
1543 quality.setText(MessageManager.getString("label.quality"));
1544 conservation.setEnabled(false);
1545 conservation.setFont(LABEL_FONT);
1546 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1547 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1548 conservation.setSelected(true);
1549 conservation.setText(MessageManager.getString("label.conservation"));
1550 identity.setEnabled(false);
1551 identity.setFont(LABEL_FONT);
1552 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1553 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1554 identity.setSelected(true);
1555 identity.setText(MessageManager.getString("label.consensus"));
1556 showOccupancy.setFont(LABEL_FONT);
1557 showOccupancy.setEnabled(false);
1558 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1559 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1560 showOccupancy.setSelected(true);
1561 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1563 JLabel showGroupbits = new JLabel();
1564 showGroupbits.setFont(LABEL_FONT);
1565 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1566 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1568 .setText(MessageManager.getString("action.show_group") + ":");
1569 JLabel showConsensbits = new JLabel();
1570 showConsensbits.setFont(LABEL_FONT);
1571 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1572 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1574 .setText(MessageManager.getString("label.consensus") + ":");
1575 showConsensHistogram.setEnabled(false);
1576 showConsensHistogram.setFont(LABEL_FONT);
1577 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1578 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1579 showConsensHistogram.setSelected(true);
1580 showConsensHistogram
1581 .setText(MessageManager.getString("label.histogram"));
1582 showConsensLogo.setEnabled(false);
1583 showConsensLogo.setFont(LABEL_FONT);
1584 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1585 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1586 showConsensLogo.setSelected(true);
1587 showConsensLogo.setText(MessageManager.getString("label.logo"));
1588 showGroupConsensus.setEnabled(false);
1589 showGroupConsensus.setFont(LABEL_FONT);
1590 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1591 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1592 showGroupConsensus.setSelected(true);
1593 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1594 showGroupConservation.setEnabled(false);
1595 showGroupConservation.setFont(LABEL_FONT);
1596 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1597 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1598 showGroupConservation.setSelected(true);
1599 showGroupConservation
1600 .setText(MessageManager.getString("label.conservation"));
1601 showNpTooltip.setEnabled(true);
1602 showNpTooltip.setFont(LABEL_FONT);
1603 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1604 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1605 showNpTooltip.setSelected(true);
1606 showNpTooltip.setText(
1607 MessageManager.getString("label.non_positional_features"));
1608 showDbRefTooltip.setEnabled(true);
1609 showDbRefTooltip.setFont(LABEL_FONT);
1610 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1611 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1612 showDbRefTooltip.setSelected(true);
1614 .setText(MessageManager.getString("label.database_references"));
1615 annotations.setFont(LABEL_FONT);
1616 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1617 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1618 annotations.setSelected(true);
1619 annotations.setText(MessageManager.getString("label.show_annotations"));
1620 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1621 annotations.addActionListener(new ActionListener()
1624 public void actionPerformed(ActionEvent e)
1626 annotations_actionPerformed(e);
1629 identity.addActionListener(new ActionListener()
1632 public void actionPerformed(ActionEvent e)
1634 annotations_actionPerformed(e);
1637 showGroupConsensus.addActionListener(new ActionListener()
1640 public void actionPerformed(ActionEvent e)
1642 annotations_actionPerformed(e);
1645 showUnconserved.setFont(LABEL_FONT);
1646 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1647 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1648 showUnconserved.setSelected(true);
1650 .setText(MessageManager.getString("action.show_unconserved"));
1651 showUnconserved.addActionListener(new ActionListener()
1654 public void actionPerformed(ActionEvent e)
1656 showunconserved_actionPerformed(e);
1660 // TODO these are not yet added to / action from Preferences
1661 // JCheckBox shareSelections = new JCheckBox();
1662 // shareSelections.setFont(verdana11);
1663 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1664 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1665 // shareSelections.setSelected(true);
1666 // shareSelections.setText(MessageManager
1667 // .getString("label.share_selection_across_views"));
1668 // JCheckBox followHighlight = new JCheckBox();
1669 // followHighlight.setFont(verdana11);
1670 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1671 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1672 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1673 // followHighlight.setSelected(true);
1674 // followHighlight.setText(MessageManager
1675 // .getString("label.scroll_highlighted_regions"));
1677 seqLimit.setFont(LABEL_FONT);
1678 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1679 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1680 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1681 smoothFont.setFont(LABEL_FONT);
1682 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1683 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1684 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1685 scaleProteinToCdna.setFont(LABEL_FONT);
1686 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1687 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1688 scaleProteinToCdna.setText(
1689 MessageManager.getString("label.scale_protein_to_cdna"));
1690 scaleProteinToCdna.setToolTipText(
1691 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1692 JLabel gapLabel = new JLabel();
1693 gapLabel.setFont(LABEL_FONT);
1694 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1695 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1696 JLabel fontLabel = new JLabel();
1697 fontLabel.setFont(LABEL_FONT);
1698 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1699 fontLabel.setText(MessageManager.getString("label.font"));
1700 fontSizeCB.setFont(LABEL_FONT);
1701 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1702 fontStyleCB.setFont(LABEL_FONT);
1703 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1704 fontNameCB.setFont(LABEL_FONT);
1705 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1706 gapSymbolCB.setFont(LABEL_FONT);
1707 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1708 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1709 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1710 gapSymbolCB.setRenderer(dlcr);
1712 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1713 startupCheckbox.setFont(LABEL_FONT);
1714 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1715 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1716 startupCheckbox.setSelected(true);
1717 startupFileTextfield.setFont(LABEL_FONT);
1718 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1719 final String tooltip = JvSwingUtils.wrapTooltip(true,
1720 MessageManager.getString("label.double_click_to_browse"));
1721 startupFileTextfield.setToolTipText(tooltip);
1722 startupFileTextfield.addMouseListener(new MouseAdapter()
1725 public void mouseClicked(MouseEvent e)
1727 if (e.getClickCount() > 1)
1729 startupFileTextfield_mouseClicked();
1734 sortby.setFont(LABEL_FONT);
1735 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1736 JLabel sortLabel = new JLabel();
1737 sortLabel.setFont(LABEL_FONT);
1738 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1739 sortLabel.setText(MessageManager.getString("label.sort_by"));
1740 sortAnnBy.setFont(LABEL_FONT);
1741 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1742 JLabel sortAnnLabel = new JLabel();
1743 sortAnnLabel.setFont(LABEL_FONT);
1744 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1745 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1746 sortAutocalc.setFont(LABEL_FONT);
1747 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1749 JPanel annsettingsPanel = new JPanel();
1750 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1751 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1752 annsettingsPanel.setBorder(new EtchedBorder());
1753 visualTab.add(annsettingsPanel);
1754 Border jb = new EmptyBorder(1, 1, 4, 5);
1755 annotations.setBorder(jb);
1756 showOccupancy.setBorder(jb);
1757 quality.setBorder(jb);
1758 conservation.setBorder(jb);
1759 identity.setBorder(jb);
1760 showConsensbits.setBorder(jb);
1761 showGroupbits.setBorder(jb);
1762 showGroupConsensus.setBorder(jb);
1763 showGroupConservation.setBorder(jb);
1764 showConsensHistogram.setBorder(jb);
1765 showConsensLogo.setBorder(jb);
1767 JPanel autoAnnotSettings = new JPanel();
1768 annsettingsPanel.add(autoAnnotSettings);
1769 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1770 autoAnnotSettings.add(annotations);
1771 autoAnnotSettings.add(quality);
1772 // second row of autoannotation box
1773 autoAnnotSettings = new JPanel();
1774 annsettingsPanel.add(autoAnnotSettings);
1776 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1777 autoAnnotSettings.add(conservation);
1778 autoAnnotSettings.add(identity);
1779 autoAnnotSettings.add(showOccupancy);
1780 autoAnnotSettings.add(showGroupbits);
1781 autoAnnotSettings.add(showGroupConservation);
1782 autoAnnotSettings.add(showGroupConsensus);
1783 autoAnnotSettings.add(showConsensbits);
1784 autoAnnotSettings.add(showConsensHistogram);
1785 autoAnnotSettings.add(showConsensLogo);
1787 JPanel tooltipSettings = new JPanel();
1788 tooltipSettings.setBorder(new TitledBorder(
1789 MessageManager.getString("label.sequence_id_tooltip")));
1790 tooltipSettings.setBounds(173, 140, 220, 62);
1791 tooltipSettings.setLayout(new GridLayout(2, 1));
1792 tooltipSettings.add(showDbRefTooltip);
1793 tooltipSettings.add(showNpTooltip);
1794 visualTab.add(tooltipSettings);
1796 wrap.setFont(LABEL_FONT);
1797 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1798 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1799 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1800 rightAlign.setFont(LABEL_FONT);
1801 rightAlign.setForeground(Color.black);
1802 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1803 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1804 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1805 idItalics.setFont(LABEL_FONT_ITALIC);
1806 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1807 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1809 MessageManager.getString("label.sequence_name_italics"));
1810 openoverv.setFont(LABEL_FONT);
1811 openoverv.setActionCommand(
1812 MessageManager.getString("label.open_overview"));
1813 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1814 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1815 openoverv.setText(MessageManager.getString("label.open_overview"));
1816 JPanel jPanel2 = new JPanel();
1817 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1818 jPanel2.setLayout(new GridLayout(14, 1));
1819 jPanel2.add(fullScreen);
1820 jPanel2.add(openoverv);
1821 jPanel2.add(seqLimit);
1822 jPanel2.add(rightAlign);
1823 jPanel2.add(fontLabel);
1824 jPanel2.add(showUnconserved);
1825 jPanel2.add(idItalics);
1826 jPanel2.add(smoothFont);
1827 jPanel2.add(scaleProteinToCdna);
1828 jPanel2.add(gapLabel);
1830 jPanel2.add(sortLabel);
1831 jPanel2.add(sortAnnLabel);
1832 jPanel2.add(startupCheckbox);
1833 visualTab.add(jPanel2);
1834 visualTab.add(startupFileTextfield);
1835 visualTab.add(sortby);
1836 visualTab.add(sortAnnBy);
1837 visualTab.add(sortAutocalc);
1838 visualTab.add(gapSymbolCB);
1839 visualTab.add(fontNameCB);
1840 visualTab.add(fontSizeCB);
1841 visualTab.add(fontStyleCB);
1846 * Load the saved Backups options EXCEPT "Enabled" and "Scheme"
1849 protected void loadLastSavedBackupsOptions()
1851 BackupFilesPresetEntry savedPreset = BackupFilesPresetEntry
1852 .getSavedBackupEntry();
1854 .setSelected(Cache.getDefault(BackupFiles.ENABLED, true));
1856 BackupFilesPresetEntry backupfilesCustomEntry = BackupFilesPresetEntry
1857 .createBackupFilesPresetEntry(Cache
1858 .getDefault(BackupFilesPresetEntry.CUSTOMCONFIG, null));
1859 if (backupfilesCustomEntry == null)
1861 backupfilesCustomEntry = BackupFilesPresetEntry.backupfilesPresetEntriesValues
1862 .get(BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT);
1864 BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
1865 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM,
1866 backupfilesCustomEntry);
1868 setComboIntStringKey(backupfilesPresetsCombo,
1869 Cache.getDefault(BackupFiles.NS + "_PRESET",
1870 BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT));
1872 backupsSetOptions(savedPreset);
1874 backupsOptionsSetEnabled();
1875 updateBackupFilesExampleLabel();
1878 private boolean warnAboutSuffixReverseChange()
1880 BackupFilesPresetEntry bfpe = BackupFilesPresetEntry
1881 .getSavedBackupEntry();
1882 boolean savedSuffixReverse = bfpe.reverse;
1883 int savedSuffixDigits = bfpe.digits;
1884 String savedSuffixTemplate = bfpe.suffix;
1886 boolean nowSuffixReverse = suffixReverse.isSelected();
1887 int nowSuffixDigits = getSpinnerInt(suffixDigitsSpinner, 3);
1888 String nowSuffixTemplate = suffixTemplate.getText();
1889 return nowSuffixReverse != savedSuffixReverse
1890 && nowSuffixDigits == savedSuffixDigits
1891 && nowSuffixTemplate != null
1892 && nowSuffixTemplate.equals(savedSuffixTemplate);
1896 * Initialises the Backups tabbed panel.
1900 private JPanel initBackupsTab()
1902 JPanel backupsTab = new JPanel();
1903 backupsTab.setBorder(new TitledBorder(
1904 MessageManager.getString("label.backup_files")));
1905 backupsTab.setLayout(new GridBagLayout());
1907 GridBagConstraints gbc = new GridBagConstraints();
1910 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
1911 gbc.fill = GridBagConstraints.NONE;
1913 initBackupsTabPresetsPanel();
1914 initBackupsTabSuffixPanel();
1915 initBackupsTabKeepFilesPanel();
1916 initBackupsTabFilenameExamplesPanel();
1918 enableBackupFiles.setFont(LABEL_FONT_BOLD);
1920 .setText(MessageManager.getString("label.enable_backupfiles"));
1921 enableBackupFiles.addActionListener(new ActionListener()
1924 public void actionPerformed(ActionEvent e)
1926 // enable other options only when the first is checked
1927 backupsOptionsSetEnabled();
1932 // enable checkbox 1 col
1936 gbc.gridy = 0; // row 0
1937 backupsTab.add(enableBackupFiles, gbc);
1939 // summary of scheme box (over two rows)
1943 gbc.anchor = GridBagConstraints.FIRST_LINE_END;
1944 gbc.fill = GridBagConstraints.BOTH;
1945 backupsTab.add(exampleFilesPanel, gbc);
1947 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
1948 gbc.fill = GridBagConstraints.NONE;
1950 // fill empty space on right
1953 backupsTab.add(new JPanel(), gbc);
1958 gbc.gridy++; // row 1
1959 backupsTab.add(presetsPanel, gbc);
1961 // now using whole row
1966 gbc.gridy++; // row 2
1967 backupsTab.add(keepfilesPanel, gbc);
1969 // filename strategy box
1970 gbc.gridy++; // row 3
1971 backupsTab.add(suffixPanel, gbc);
1974 gbc.gridy++; // row 4
1976 backupsTab.add(new JPanel(), gbc);
1978 backupsOptionsSetEnabled();
1982 private JPanel initBackupsTabPresetsPanel()
1985 String title = MessageManager.getString("label.schemes");
1987 presetsPanel.setLayout(new GridBagLayout());
1989 GridBagConstraints gbc = new GridBagConstraints();
1992 gbc.anchor = GridBagConstraints.BASELINE_LEADING;
1993 gbc.fill = GridBagConstraints.NONE;
2001 presetsComboLabel = new JLabel(title + ":");
2002 presetsPanel.add(presetsComboLabel, gbc);
2004 List<Object> entries = Arrays
2005 .asList((Object[]) BackupFilesPresetEntry.backupfilesPresetEntries);
2006 List<String> tooltips = Arrays.asList(
2007 BackupFilesPresetEntry.backupfilesPresetEntryDescriptions);
2008 backupfilesPresetsCombo = JvSwingUtils.buildComboWithTooltips(entries,
2011 for (int i = 0; i < BackupFilesPresetEntry.backupfilesPresetEntries.length; i++)
2013 backupfilesPresetsCombo
2014 .addItem(BackupFilesPresetEntry.backupfilesPresetEntries[i]);
2018 backupfilesPresetsCombo.addActionListener(new ActionListener()
2021 public void actionPerformed(ActionEvent e)
2023 int key = getComboIntStringKey(backupfilesPresetsCombo);
2024 if (!customiseCheckbox.isSelected())
2026 backupfilesPresetsComboLastSelected = key;
2028 if (key == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM)
2030 if (customiseCheckbox.isSelected())
2032 // got here by clicking on customiseCheckbox so don't change the values
2033 backupfilesCustomOptionsSetEnabled();
2037 backupsTabUpdatePresets();
2038 backupfilesCustomOptionsSetEnabled();
2043 customiseCheckbox.setSelected(false);
2044 backupsTabUpdatePresets();
2045 backupfilesCustomOptionsSetEnabled();
2050 // dropdown list of preset schemes
2052 presetsPanel.add(backupfilesPresetsCombo, gbc);
2054 revertButton.setText(MessageManager.getString("label.cancel_changes"));
2055 revertButton.setToolTipText(
2056 MessageManager.getString("label.cancel_changes_description"));
2057 revertButton.addActionListener(new ActionListener()
2060 public void actionPerformed(ActionEvent e)
2063 BackupFilesPresetEntry.backupfilesPresetEntriesValues.get(
2064 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM));
2065 backupfilesCustomOptionsSetEnabled();
2069 revertButton.setFont(LABEL_FONT);
2071 customiseCheckbox.setFont(LABEL_FONT);
2072 customiseCheckbox.setText(MessageManager.getString("label.customise"));
2073 customiseCheckbox.addActionListener(new ActionListener()
2076 public void actionPerformed(ActionEvent e)
2078 int currently = getComboIntStringKey(backupfilesPresetsCombo);
2079 if (customiseCheckbox.isSelected())
2081 backupfilesPresetsComboLastSelected = currently;
2082 setComboIntStringKey(backupfilesPresetsCombo,
2083 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM);
2087 setComboIntStringKey(backupfilesPresetsCombo,
2088 backupfilesPresetsComboLastSelected);
2091 backupfilesCustomOptionsSetEnabled();
2094 customiseCheckbox.setToolTipText(
2095 MessageManager.getString("label.customise_description"));
2097 // customise checkbox
2100 presetsPanel.add(customiseCheckbox, gbc);
2102 // "Cancel changes" button (aligned with combo box above)
2104 presetsPanel.add(revertButton, gbc);
2106 return presetsPanel;
2109 private JPanel initBackupsTabFilenameExamplesPanel()
2111 String title = MessageManager
2112 .getString("label.scheme_examples");
2113 TitledBorder tb = new TitledBorder(title);
2114 exampleFilesPanel.setBorder(tb);
2115 exampleFilesPanel.setLayout(new GridBagLayout());
2118 backupfilesExampleLabel.setEditable(false);
2119 backupfilesExampleLabel
2120 .setBackground(exampleFilesPanel.getBackground());
2122 updateBackupFilesExampleLabel();
2124 GridBagConstraints gbc = new GridBagConstraints();
2127 gbc.fill = GridBagConstraints.NONE;
2128 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
2130 exampleFilesPanel.add(backupfilesExampleLabel, gbc);
2131 return exampleFilesPanel;
2134 private void backupsTabUpdatePresets()
2136 IntKeyStringValueEntry entry = (IntKeyStringValueEntry) backupfilesPresetsCombo
2139 String value = entry.v;
2141 if (BackupFilesPresetEntry.backupfilesPresetEntriesValues
2145 BackupFilesPresetEntry.backupfilesPresetEntriesValues
2151 "Preset '" + value + "' [key:" + key + "] not implemented");
2154 // Custom options will now be enabled when the customiseCheckbox is checked
2155 // (performed above)
2156 // backupfilesCustomOptionsSetEnabled();
2157 updateBackupFilesExampleLabel();
2160 protected int getComboIntStringKey(
2161 JComboBox<Object> backupfilesPresetsCombo2)
2163 IntKeyStringValueEntry e;
2166 e = (IntKeyStringValueEntry) backupfilesPresetsCombo2
2168 } catch (Exception ex)
2171 "Problem casting Combo entry to IntKeyStringValueEntry.");
2174 return e != null ? e.k : 0;
2177 protected void setComboIntStringKey(
2178 JComboBox<Object> backupfilesPresetsCombo2,
2181 for (int i = 0; i < backupfilesPresetsCombo2.getItemCount(); i++)
2183 IntKeyStringValueEntry e;
2186 e = (IntKeyStringValueEntry) backupfilesPresetsCombo2.getItemAt(i);
2187 } catch (Exception ex)
2190 "Problem casting Combo entry to IntKeyStringValueEntry. Skipping item. ");
2195 backupfilesPresetsCombo2.setSelectedIndex(i);
2199 // backupsTabUpdatePresets();
2202 private JPanel initBackupsTabSuffixPanel()
2204 suffixPanel.setBorder(new TitledBorder(
2205 MessageManager.getString("label.backup_filename_strategy")));
2206 suffixPanel.setLayout(new GridBagLayout());
2209 .setText(MessageManager.getString("label.append_to_filename"));
2210 suffixTemplateLabel.setHorizontalAlignment(SwingConstants.LEFT);
2211 suffixTemplateLabel.setFont(LABEL_FONT);
2213 final String tooltip = JvSwingUtils.wrapTooltip(true,
2214 MessageManager.getString("label.append_to_filename_tooltip"));
2215 suffixTemplate.setToolTipText(tooltip);
2216 suffixTemplate.addActionListener(new ActionListener()
2219 public void actionPerformed(ActionEvent e)
2221 updateBackupFilesExampleLabel();
2222 backupfilesCustomOptionsSetEnabled();
2223 backupfilesRevertButtonSetEnabled(true);
2227 suffixTemplate.addKeyListener(new KeyListener()
2230 public void keyReleased(KeyEvent e)
2232 updateBackupFilesExampleLabel();
2233 backupfilesCustomOptionsSetEnabled();
2234 backupfilesRevertButtonSetEnabled(true);
2238 public void keyPressed(KeyEvent e)
2242 // disable use of ':' or '/' or '\'
2244 public void keyTyped(KeyEvent e)
2246 char c = e.getKeyChar();
2247 if (c == ':' || c == '/' || c == '\\')
2249 // don't process ':' or '/' or '\'
2258 .setText(MessageManager.getString("label.index_digits"));
2259 suffixDigitsLabel.setHorizontalAlignment(SwingConstants.LEFT);
2260 suffixDigitsLabel.setFont(LABEL_FONT);
2261 ChangeListener c = new ChangeListener()
2264 public void stateChanged(ChangeEvent e)
2266 backupfilesRevertButtonSetEnabled(true);
2267 updateBackupFilesExampleLabel();
2271 setIntegerSpinner(suffixDigitsSpinner, BackupFilesPresetEntry.DIGITSMIN,
2272 BackupFilesPresetEntry.DIGITSMAX, 3, c);
2274 suffixReverse.setLabels(MessageManager.getString("label.reverse_roll"),
2275 MessageManager.getString("label.increment_index"));
2276 suffixReverse.addActionListener(new ActionListener()
2279 public void actionPerformed(ActionEvent e)
2281 boolean okay = true;
2282 if (warnAboutSuffixReverseChange())
2285 okay = confirmSuffixReverseChange();
2289 backupfilesRevertButtonSetEnabled(true);
2290 updateBackupFilesExampleLabel();
2294 boolean savedSuffixReverse = BackupFilesPresetEntry
2295 .getSavedBackupEntry().reverse;
2296 suffixReverse.setSelected(savedSuffixReverse);
2301 GridBagConstraints sgbc = new GridBagConstraints();
2303 // first row (template text box)
2304 sgbc.anchor = GridBagConstraints.WEST;
2308 sgbc.gridheight = 1;
2311 sgbc.fill = GridBagConstraints.NONE;
2312 suffixPanel.add(suffixTemplateLabel, sgbc);
2315 sgbc.fill = GridBagConstraints.HORIZONTAL;
2316 suffixPanel.add(suffixTemplate, sgbc);
2318 // second row (number of digits spinner)
2322 sgbc.fill = GridBagConstraints.NONE;
2323 suffixPanel.add(suffixDigitsLabel, sgbc);
2326 sgbc.fill = GridBagConstraints.HORIZONTAL;
2327 suffixPanel.add(suffixDigitsSpinner, sgbc);
2329 // third row (forward order radio selection)
2332 sgbc.gridwidth = GridBagConstraints.REMAINDER;
2333 sgbc.fill = GridBagConstraints.HORIZONTAL;
2334 suffixPanel.add(suffixReverse.getFalseButton(), sgbc);
2336 // fourth row (reverse order radio selection)
2338 suffixPanel.add(suffixReverse.getTrueButton(), sgbc);
2342 private boolean confirmSuffixReverseChange()
2344 boolean ret = false;
2345 String warningMessage = MessageManager
2346 .getString("label.warning_confirm_change_reverse");
2347 int confirm = JvOptionPane.showConfirmDialog(Desktop.desktop,
2349 MessageManager.getString("label.change_increment_decrement"),
2350 JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE);
2352 ret = (confirm == JvOptionPane.YES_OPTION);
2356 private JPanel initBackupsTabKeepFilesPanel()
2358 keepfilesPanel.setBorder(
2359 new TitledBorder(MessageManager.getString("label.keep_files")));
2360 keepfilesPanel.setLayout(new GridBagLayout());
2362 backupfilesKeepAll.setLabels(
2363 MessageManager.getString("label.keep_all_backup_files"),
2364 MessageManager.getString(
2365 "label.keep_only_this_number_of_backup_files"));
2366 backupfilesKeepAll.addTrueActionListener(new ActionListener()
2369 public void actionPerformed(ActionEvent e)
2371 backupfilesRevertButtonSetEnabled(true);
2372 updateBackupFilesExampleLabel();
2375 backupfilesKeepAll.addActionListener(new ActionListener()
2378 public void actionPerformed(ActionEvent e)
2380 backupfilesRevertButtonSetEnabled(true);
2381 keepRollMaxOptionsEnabled();
2382 updateBackupFilesExampleLabel();
2386 ChangeListener c = new ChangeListener()
2389 public void stateChanged(ChangeEvent e)
2391 backupfilesRevertButtonSetEnabled(true);
2392 updateBackupFilesExampleLabel();
2396 setIntegerSpinner(backupfilesRollMaxSpinner,
2397 BackupFilesPresetEntry.ROLLMAXMIN,
2398 BackupFilesPresetEntry.ROLLMAXMAX, 4, true, c);
2400 backupfilesConfirmDelete.setLabels(
2401 MessageManager.getString("label.always_ask"),
2402 MessageManager.getString("label.auto_delete"));
2403 backupfilesConfirmDelete.addActionListener(new ActionListener()
2406 public void actionPerformed(ActionEvent e)
2408 backupfilesRevertButtonSetEnabled(true);
2411 // update the enabled section
2412 keepRollMaxOptionsEnabled();
2414 GridBagConstraints kgbc = new GridBagConstraints();
2416 // first row (template text box)
2417 kgbc.anchor = GridBagConstraints.WEST;
2420 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2421 kgbc.gridheight = 1;
2424 kgbc.fill = GridBagConstraints.HORIZONTAL;
2425 keepfilesPanel.add(backupfilesKeepAll.getTrueButton(), kgbc);
2431 kgbc.gridwidth = GridBagConstraints.RELATIVE;
2432 keepfilesPanel.add(backupfilesKeepAll.getFalseButton(), kgbc);
2435 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2436 keepfilesPanel.add(backupfilesRollMaxSpinner, kgbc);
2438 // third row (indented)
2440 kgbc.insets = new Insets(0, 20, 0, 0);
2443 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2444 kgbc.fill = GridBagConstraints.HORIZONTAL;
2447 JPanel jp = new JPanel();
2448 jp.setLayout(new FlowLayout());
2450 .setText(MessageManager
2451 .getString("label.autodelete_old_backup_files"));
2452 oldBackupFilesLabel.setFont(LABEL_FONT);
2453 oldBackupFilesLabel.setHorizontalAlignment(SwingConstants.LEFT);
2454 jp.add(oldBackupFilesLabel);
2455 jp.add(backupfilesConfirmDelete.getTrueButton());
2456 jp.add(backupfilesConfirmDelete.getFalseButton());
2457 keepfilesPanel.add(jp, kgbc);
2459 return keepfilesPanel;
2462 protected void updateBackupFilesExampleLabel()
2464 int exampleindex = 12;
2465 String base = MessageManager.getString("label.filename") + ".fa";
2466 if (base == null || base.length() == 0)
2468 base = "file_name.fa";
2471 boolean reverse = suffixReverse.isSelected();
2472 boolean keepAll = backupfilesKeepAll.isSelected();
2474 String suffix = suffixTemplate.getText();
2477 backupfilesExampleLabel.setFont(LABEL_FONT_ITALIC);
2478 if (suffix == null || suffix.length() == 0)
2480 backupfilesExampleLabel
2481 .setText(MessageManager.getString("label.no_backup_files"));
2482 backupfilesExampleLabel.setFont(LABEL_FONT_BOLD);
2486 rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 4);
2487 rollMax = rollMax < 1 ? 1 : rollMax;
2489 if (suffix.indexOf(BackupFiles.NUM_PLACEHOLDER) == -1)
2494 digits = getSpinnerInt(suffixDigitsSpinner, 3);
2495 digits = digits < 1 ? 1 : digits;
2497 int lowersurround = 2;
2498 int uppersurround = 0;
2499 StringBuilder exampleSB = new StringBuilder();
2500 boolean firstLine = true;
2506 int max = keepAll ? exampleindex : rollMax;
2507 for (int index = min; index <= max; index++)
2509 if (index == min + lowersurround && index < max - uppersurround - 1)
2511 exampleSB.append("\n...");
2514 else if (index > min + lowersurround && index < max - uppersurround)
2526 exampleSB.append("\n");
2529 exampleSB.append(BackupFilenameParts.getBackupFilename(index,
2530 base, suffix, digits));
2533 // no extra text needed
2535 else if (index == min)
2537 String newest = MessageManager.getString("label.braced_newest");
2538 if (newest != null && newest.length() > 0)
2540 exampleSB.append(" " + newest);
2543 else if (index == max)
2545 String oldest = MessageManager.getString("label.braced_oldest");
2546 if (oldest != null && oldest.length() > 0)
2548 exampleSB.append(" " + oldest);
2557 int min = (keepAll || exampleindex - rollMax < 0) ? 1
2558 : exampleindex - rollMax + 1;
2559 int max = exampleindex;
2561 for (int index = min; index <= max; index++)
2564 if (index == min + lowersurround && index < max - uppersurround - 1)
2566 exampleSB.append("\n...");
2569 else if (index > min + lowersurround && index < max - uppersurround)
2581 exampleSB.append("\n");
2584 exampleSB.append(BackupFilenameParts.getBackupFilename(index,
2585 base, suffix, digits));
2588 // no extra text needed
2590 else if (index == min)
2592 String oldest = MessageManager.getString("label.braced_oldest");
2593 if (oldest != null && oldest.length() > 0)
2595 exampleSB.append(" " + oldest);
2598 else if (index == max)
2600 String newest = MessageManager.getString("label.braced_newest");
2601 if (newest != null && newest.length() > 0)
2603 exampleSB.append(" " + newest);
2611 // add some extra empty lines to pad out the example files box. ugh, please tell
2612 // me how to do this better
2613 int remainingLines = lowersurround + uppersurround + 1 - lineNumber;
2614 if (remainingLines > 0)
2616 for (int i = 0; i < remainingLines; i++)
2618 exampleSB.append("\n ");
2623 backupfilesExampleLabel.setText(exampleSB.toString());
2626 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2627 boolean useExistingVal, ChangeListener c)
2634 i = Integer.parseInt((String) s.getValue());
2635 } catch (Exception e)
2638 "Exception casting the initial value of s.getValue()");
2642 setIntegerSpinner(s, min, max, i, c);
2645 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2648 // integer spinner for number of digits
2653 SpinnerModel sModel = new SpinnerNumberModel(def, min, max, 1);
2656 s.addChangeListener(c);
2660 protected static int getSpinnerInt(JSpinner s, int def)
2666 i = (Integer) s.getValue();
2667 } catch (Exception e)
2669 Cache.log.error("Failed casting (Integer) JSpinner s.getValue()");
2674 private void keepRollMaxOptionsEnabled()
2676 boolean enabled = backupfilesKeepAll.isEnabled()
2677 && !backupfilesKeepAll.isSelected();
2678 oldBackupFilesLabel.setEnabled(enabled);
2679 backupfilesRollMaxSpinner.setEnabled(enabled);
2680 backupfilesConfirmDelete.setEnabled(enabled);
2683 private void backupfilesKeepAllSetEnabled(boolean tryEnabled)
2685 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2686 && customiseCheckbox.isSelected()
2687 && suffixTemplate.getText()
2688 .indexOf(BackupFiles.NUM_PLACEHOLDER) > -1;
2689 keepfilesPanel.setEnabled(enabled);
2690 backupfilesKeepAll.setEnabled(enabled);
2691 oldBackupFilesLabel.setEnabled(enabled);
2692 keepRollMaxOptionsEnabled();
2695 private void backupfilesSuffixTemplateDigitsSetEnabled()
2697 boolean enabled = suffixTemplate.isEnabled() && suffixTemplate.getText()
2698 .indexOf(BackupFiles.NUM_PLACEHOLDER) > -1;
2699 suffixDigitsLabel.setEnabled(enabled);
2700 suffixDigitsSpinner.setEnabled(enabled);
2701 suffixReverse.setEnabled(enabled);
2704 private void backupfilesSuffixTemplateSetEnabled(boolean tryEnabled)
2706 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2707 && customiseCheckbox.isSelected();
2708 suffixPanel.setEnabled(enabled);
2709 suffixTemplateLabel.setEnabled(enabled);
2710 suffixTemplate.setEnabled(enabled);
2711 backupfilesSuffixTemplateDigitsSetEnabled();
2714 private void backupfilesRevertButtonSetEnabled(boolean tryEnabled)
2716 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2717 && customiseCheckbox.isSelected() && backupfilesCustomChanged();
2718 revertButton.setEnabled(enabled);
2721 private boolean backupfilesCustomChanged()
2723 BackupFilesPresetEntry custom = BackupFilesPresetEntry.backupfilesPresetEntriesValues
2724 .get(BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM);
2725 BackupFilesPresetEntry current = getBackupfilesCurrentEntry();
2726 return !custom.equals(current);
2729 protected BackupFilesPresetEntry getBackupfilesCurrentEntry()
2731 String suffix = suffixTemplate.getText();
2732 int digits = getSpinnerInt(suffixDigitsSpinner, 3);
2733 boolean reverse = suffixReverse.isSelected();
2734 boolean keepAll = backupfilesKeepAll.isSelected();
2735 int rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 3);
2736 boolean confirmDelete = backupfilesConfirmDelete.isSelected();
2738 BackupFilesPresetEntry bfpe = new BackupFilesPresetEntry(suffix, digits,
2739 reverse, keepAll, rollMax, confirmDelete);
2744 protected void backupfilesCustomOptionsSetEnabled()
2746 boolean enabled = customiseCheckbox.isSelected();
2748 backupfilesRevertButtonSetEnabled(enabled);
2749 backupfilesSuffixTemplateSetEnabled(enabled);
2750 backupfilesKeepAllSetEnabled(enabled);
2753 private void backupfilesSummarySetEnabled()
2755 boolean enabled = enableBackupFiles.isSelected();
2756 backupfilesExampleLabel.setEnabled(enabled);
2757 exampleFilesPanel.setEnabled(enabled);
2760 private void backupfilesPresetsSetEnabled()
2762 boolean enabled = enableBackupFiles.isSelected();
2763 presetsPanel.setEnabled(enabled);
2764 presetsComboLabel.setEnabled(enabled);
2765 backupfilesPresetsCombo.setEnabled(enabled);
2766 customiseCheckbox.setEnabled(enabled);
2767 revertButton.setEnabled(enabled);
2770 protected void backupsOptionsSetEnabled()
2772 backupfilesPresetsSetEnabled();
2773 backupfilesSummarySetEnabled();
2774 backupfilesCustomOptionsSetEnabled();
2777 protected void backupsSetOptions(String suffix, int digits,
2778 boolean reverse, boolean keepAll, int rollMax,
2779 boolean confirmDelete)
2781 suffixTemplate.setText(suffix);
2782 suffixDigitsSpinner.setValue(digits);
2783 suffixReverse.setSelected(reverse);
2784 backupfilesKeepAll.setSelected(keepAll);
2785 backupfilesRollMaxSpinner.setValue(rollMax);
2786 backupfilesConfirmDelete.setSelected(confirmDelete);
2789 protected void backupsSetOptions(BackupFilesPresetEntry p)
2791 backupsSetOptions(p.suffix, p.digits, p.reverse, p.keepAll, p.rollMax,
2795 protected void autoIdWidth_actionPerformed()
2797 // TODO Auto-generated method stub
2801 protected void userIdWidth_actionPerformed()
2803 // TODO Auto-generated method stub
2807 protected void maxColour_actionPerformed(JPanel panel)
2811 protected void minColour_actionPerformed(JPanel panel)
2815 protected void gapColour_actionPerformed(JPanel panel)
2819 protected void hiddenColour_actionPerformed(JPanel panel)
2823 protected void showunconserved_actionPerformed(ActionEvent e)
2825 // TODO Auto-generated method stub
2829 protected void useLegacyGaps_actionPerformed(ActionEvent e)
2833 protected void resetOvDefaults_actionPerformed(ActionEvent e)
2843 public void ok_actionPerformed(ActionEvent e)
2853 public void cancel_actionPerformed(ActionEvent e)
2863 public void annotations_actionPerformed(ActionEvent e)
2870 public void startupFileTextfield_mouseClicked()
2874 public void newLink_actionPerformed(ActionEvent e)
2879 public void editLink_actionPerformed(ActionEvent e)
2884 public void deleteLink_actionPerformed(ActionEvent e)
2889 public void defaultBrowser_mouseClicked(MouseEvent e)
2894 public void linkURLList_keyTyped(KeyEvent e)
2899 public void useProxy_actionPerformed()
2901 boolean enabled = useProxy.isSelected();
2902 portLabel.setEnabled(enabled);
2903 serverLabel.setEnabled(enabled);
2904 proxyServerTB.setEnabled(enabled);
2905 proxyPortTB.setEnabled(enabled);
2909 * Customer renderer for JTable: supports column of radio buttons
2911 public class RadioButtonRenderer extends JRadioButton
2912 implements TableCellRenderer
2914 public RadioButtonRenderer()
2916 setHorizontalAlignment(CENTER);
2917 setToolTipText(MessageManager.getString("label.urltooltip"));
2921 public Component getTableCellRendererComponent(JTable table,
2922 Object value, boolean isSelected, boolean hasFocus, int row,
2925 setSelected((boolean) value);
2927 // set colours to match rest of table
2930 setBackground(table.getSelectionBackground());
2931 setForeground(table.getSelectionForeground());
2935 setBackground(table.getBackground());
2936 setForeground(table.getForeground());
2943 * Customer cell editor for JTable: supports column of radio buttons in
2944 * conjunction with renderer
2946 public class RadioButtonEditor extends AbstractCellEditor
2947 implements TableCellEditor
2949 private JRadioButton button = new JRadioButton();
2951 public RadioButtonEditor()
2953 button.setHorizontalAlignment(SwingConstants.CENTER);
2954 this.button.addActionListener(new ActionListener()
2957 public void actionPerformed(ActionEvent e)
2959 fireEditingStopped();
2965 public Component getTableCellEditorComponent(JTable table, Object value,
2966 boolean isSelected, int row, int column)
2968 button.setSelected((boolean) value);
2973 public Object getCellEditorValue()
2975 return button.isSelected();
2980 protected void validateHmmerPath()
2984 protected void validateCygwinPath()
2989 * A helper method to add a panel containing a label and a component to a
2997 protected static void addtoLayout(JPanel panel, String tooltip,
2998 JComponent label, JComponent valBox)
3000 JPanel laypanel = new JPanel(new GridLayout(1, 2));
3001 JPanel labPanel = new JPanel(new BorderLayout());
3002 JPanel valPanel = new JPanel();
3003 labPanel.setBounds(new Rectangle(7, 7, 158, 23));
3004 valPanel.setBounds(new Rectangle(172, 7, 270, 23));
3005 labPanel.add(label, BorderLayout.WEST);
3006 valPanel.add(valBox);
3007 laypanel.add(labPanel);
3008 laypanel.add(valPanel);
3009 valPanel.setToolTipText(tooltip);
3010 labPanel.setToolTipText(tooltip);
3011 valBox.setToolTipText(tooltip);
3012 panel.add(laypanel);