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 versioncheck.setVisible(false);
791 // Add padding so the panel doesn't look ridiculous
792 JPanel spacePanel = new JPanel();
793 connectTab.add(spacePanel,
794 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
795 GridBagConstraints.WEST, GridBagConstraints.BOTH,
796 new Insets(0, 0, 0, 5), 70, 1));
802 * Initialises the Links tabbed panel.
806 private JPanel initLinksTab()
808 JPanel linkTab = new JPanel();
809 linkTab.setLayout(new GridBagLayout());
811 // Set up table for Url links
812 linkUrlTable.getTableHeader().setReorderingAllowed(false);
813 linkUrlTable.setFillsViewportHeight(true);
814 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
815 linkUrlTable.setAutoCreateRowSorter(true);
816 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
818 // adjust row height so radio buttons actually fit
819 // don't do this in the renderer, it causes the awt thread to activate
821 JRadioButton temp = new JRadioButton();
822 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
824 // Table in scrollpane so that the table is given a scrollbar
825 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
826 linkScrollPane.setBorder(null);
828 // Panel for links functionality
829 JPanel linkPanel = new JPanel(new GridBagLayout());
830 linkPanel.setBorder(new TitledBorder(
831 MessageManager.getString("label.url_linkfrom_sequence_id")));
833 // Put the Url links panel together
835 // Buttons go at top right, resizing only resizes the blank space vertically
836 JPanel buttonPanel = initLinkTabUrlButtons();
837 GridBagConstraints linkConstraints1 = new GridBagConstraints();
838 linkConstraints1.insets = new Insets(0, 0, 5, 0);
839 linkConstraints1.gridx = 0;
840 linkConstraints1.gridy = 0;
841 linkConstraints1.weightx = 1.0;
842 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
843 linkTab.add(buttonPanel, linkConstraints1);
845 // Links table goes at top left, resizing resizes the table
846 GridBagConstraints linkConstraints2 = new GridBagConstraints();
847 linkConstraints2.insets = new Insets(0, 0, 5, 5);
848 linkConstraints2.gridx = 0;
849 linkConstraints2.gridy = 1;
850 linkConstraints2.weightx = 1.0;
851 linkConstraints2.weighty = 1.0;
852 linkConstraints2.fill = GridBagConstraints.BOTH;
853 linkTab.add(linkScrollPane, linkConstraints2);
855 // Filter box and buttons goes at bottom left, resizing resizes the text box
856 JPanel filterPanel = initLinkTabFilterPanel();
857 GridBagConstraints linkConstraints3 = new GridBagConstraints();
858 linkConstraints3.insets = new Insets(0, 0, 0, 5);
859 linkConstraints3.gridx = 0;
860 linkConstraints3.gridy = 2;
861 linkConstraints3.weightx = 1.0;
862 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
863 linkTab.add(filterPanel, linkConstraints3);
868 private JPanel initLinkTabFilterPanel()
870 // Filter textbox and reset button
871 JLabel filterLabel = new JLabel(
872 MessageManager.getString("label.filter"));
873 filterLabel.setFont(LABEL_FONT);
874 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
875 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
877 filterTB.setFont(LABEL_FONT);
878 filterTB.setText("");
880 doReset.setText(MessageManager.getString("action.showall"));
881 userOnly.setText(MessageManager.getString("action.customfilter"));
883 // Panel for filter functionality
884 JPanel filterPanel = new JPanel(new GridBagLayout());
885 filterPanel.setBorder(new TitledBorder("Filter"));
886 GridBagConstraints gbc = new GridBagConstraints();
889 gbc.fill = GridBagConstraints.NONE;
890 gbc.anchor = GridBagConstraints.WEST;
892 filterPanel.add(filterLabel, gbc);
894 GridBagConstraints gbc1 = new GridBagConstraints();
897 gbc1.fill = GridBagConstraints.HORIZONTAL;
898 gbc1.anchor = GridBagConstraints.WEST;
900 filterPanel.add(filterTB, gbc1);
902 GridBagConstraints gbc2 = new GridBagConstraints();
904 gbc2.fill = GridBagConstraints.NONE;
905 gbc2.anchor = GridBagConstraints.WEST;
906 filterPanel.add(doReset, gbc2);
908 GridBagConstraints gbc3 = new GridBagConstraints();
910 gbc3.fill = GridBagConstraints.NONE;
911 gbc3.anchor = GridBagConstraints.WEST;
912 filterPanel.add(userOnly, gbc3);
917 private JPanel initLinkTabUrlButtons()
919 // Buttons for new / edit / delete Url links
920 JButton newLink = new JButton();
921 newLink.setText(MessageManager.getString("action.new"));
923 editLink.setText(MessageManager.getString("action.edit"));
925 deleteLink.setText(MessageManager.getString("action.delete"));
927 // no current selection, so initially disable delete/edit buttons
928 editLink.setEnabled(false);
929 deleteLink.setEnabled(false);
931 newLink.addActionListener(new java.awt.event.ActionListener()
934 public void actionPerformed(ActionEvent e)
936 newLink_actionPerformed(e);
940 editLink.setText(MessageManager.getString("action.edit"));
941 editLink.addActionListener(new java.awt.event.ActionListener()
944 public void actionPerformed(ActionEvent e)
946 editLink_actionPerformed(e);
950 deleteLink.setText(MessageManager.getString("action.delete"));
951 deleteLink.addActionListener(new java.awt.event.ActionListener()
954 public void actionPerformed(ActionEvent e)
956 deleteLink_actionPerformed(e);
960 JPanel buttonPanel = new JPanel(new GridBagLayout());
961 buttonPanel.setBorder(new TitledBorder("Edit links"));
962 GridBagConstraints gbc = new GridBagConstraints();
965 gbc.fill = GridBagConstraints.NONE;
966 buttonPanel.add(newLink, gbc);
968 GridBagConstraints gbc1 = new GridBagConstraints();
971 gbc1.fill = GridBagConstraints.NONE;
972 buttonPanel.add(editLink, gbc1);
974 GridBagConstraints gbc2 = new GridBagConstraints();
977 gbc2.fill = GridBagConstraints.NONE;
978 buttonPanel.add(deleteLink, gbc2);
980 GridBagConstraints gbc3 = new GridBagConstraints();
983 gbc3.fill = GridBagConstraints.HORIZONTAL;
985 JPanel spacePanel = new JPanel();
986 spacePanel.setBorder(null);
987 buttonPanel.add(spacePanel, gbc3);
993 * Initialises the proxy server panel in the Connections tab
995 * @return the proxy server panel
997 private JPanel initConnTabProxyPanel()
999 // Label for server text box
1000 serverLabel.setText(MessageManager.getString("label.address"));
1001 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1002 serverLabel.setFont(LABEL_FONT);
1004 // Proxy server and port text boxes
1005 proxyServerTB.setFont(LABEL_FONT);
1006 proxyPortTB.setFont(LABEL_FONT);
1008 // Label for Port text box
1009 portLabel.setFont(LABEL_FONT);
1010 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1011 portLabel.setText(MessageManager.getString("label.port"));
1013 // Use proxy server checkbox
1014 useProxy.setFont(LABEL_FONT);
1015 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
1016 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
1017 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
1018 useProxy.addActionListener(new ActionListener()
1021 public void actionPerformed(ActionEvent e)
1023 useProxy_actionPerformed();
1027 // Make proxy server panel
1028 JPanel proxyPanel = new JPanel();
1029 TitledBorder titledBorder1 = new TitledBorder(
1030 MessageManager.getString("label.proxy_server"));
1031 proxyPanel.setBorder(titledBorder1);
1032 proxyPanel.setLayout(new GridBagLayout());
1033 proxyPanel.add(serverLabel,
1034 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
1035 GridBagConstraints.WEST, GridBagConstraints.NONE,
1036 new Insets(0, 2, 2, 0), 5, 0));
1037 proxyPanel.add(portLabel,
1038 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
1039 GridBagConstraints.WEST, GridBagConstraints.NONE,
1040 new Insets(0, 0, 2, 0), 11, 0));
1041 proxyPanel.add(useProxy,
1042 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
1043 GridBagConstraints.WEST, GridBagConstraints.NONE,
1044 new Insets(0, 2, 5, 185), 2, -4));
1045 proxyPanel.add(proxyPortTB,
1046 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
1047 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
1048 new Insets(0, 2, 2, 2), 54, 1));
1049 proxyPanel.add(proxyServerTB,
1050 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
1051 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
1052 new Insets(0, 2, 2, 0), 263, 1));
1058 * Initialises the checkboxes in the Connections tab
1060 private void initConnTabCheckboxes()
1062 // Usage stats checkbox label
1064 MessageManager.getString("label.send_usage_statistics"));
1065 usagestats.setFont(LABEL_FONT);
1066 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
1067 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
1069 // Questionnaire checkbox label
1070 questionnaire.setText(
1071 MessageManager.getString("label.check_for_questionnaires"));
1072 questionnaire.setFont(LABEL_FONT);
1073 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
1074 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
1076 // Check for latest version checkbox label
1077 versioncheck.setText(
1078 MessageManager.getString("label.check_for_latest_version"));
1079 versioncheck.setFont(LABEL_FONT);
1080 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
1081 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
1085 * Initialises the parent panel which contains the tabbed sections.
1089 private JPanel initOkCancelPanel()
1091 JButton ok = new JButton();
1092 ok.setText(MessageManager.getString("action.ok"));
1093 ok.addActionListener(new ActionListener()
1096 public void actionPerformed(ActionEvent e)
1098 ok_actionPerformed(e);
1101 JButton cancel = new JButton();
1102 cancel.setText(MessageManager.getString("action.cancel"));
1103 cancel.addActionListener(new ActionListener()
1106 public void actionPerformed(ActionEvent e)
1108 cancel_actionPerformed(e);
1111 JPanel okCancelPanel = new JPanel();
1112 okCancelPanel.add(ok);
1113 okCancelPanel.add(cancel);
1114 return okCancelPanel;
1118 * Initialises the Colours tabbed panel.
1122 private JPanel initColoursTab()
1124 JPanel coloursTab = new JPanel();
1125 coloursTab.setBorder(new TitledBorder(
1126 MessageManager.getString("action.open_new_alignment")));
1127 coloursTab.setLayout(new FlowLayout());
1128 JLabel mincolourLabel = new JLabel();
1129 mincolourLabel.setFont(LABEL_FONT);
1130 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1131 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1132 minColour.setFont(LABEL_FONT);
1133 minColour.setBorder(BorderFactory.createEtchedBorder());
1134 minColour.setPreferredSize(new Dimension(40, 20));
1135 minColour.addMouseListener(new MouseAdapter()
1138 public void mousePressed(MouseEvent e)
1140 minColour_actionPerformed(minColour);
1143 JLabel maxcolourLabel = new JLabel();
1144 maxcolourLabel.setFont(LABEL_FONT);
1145 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1146 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1147 maxColour.setFont(LABEL_FONT);
1148 maxColour.setBorder(BorderFactory.createEtchedBorder());
1149 maxColour.setPreferredSize(new Dimension(40, 20));
1150 maxColour.addMouseListener(new MouseAdapter()
1153 public void mousePressed(MouseEvent e)
1155 maxColour_actionPerformed(maxColour);
1159 protColour.setFont(LABEL_FONT);
1160 protColour.setBounds(new Rectangle(172, 225, 155, 21));
1161 JLabel protColourLabel = new JLabel();
1162 protColourLabel.setFont(LABEL_FONT);
1163 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1164 protColourLabel.setText(
1165 MessageManager.getString("label.prot_alignment_colour") + " ");
1166 GPreferences.addtoLayout(coloursTab,
1168 .getString("label.default_colour_scheme_for_alignment"),
1169 protColourLabel, protColour);
1171 nucColour.setFont(LABEL_FONT);
1172 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1173 JLabel nucColourLabel = new JLabel();
1174 nucColourLabel.setFont(LABEL_FONT);
1175 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1176 nucColourLabel.setText(
1177 MessageManager.getString("label.nuc_alignment_colour") + " ");
1178 GPreferences.addtoLayout(coloursTab,
1180 .getString("label.default_colour_scheme_for_alignment"),
1181 nucColourLabel, nucColour);
1183 JPanel annotationShding = new JPanel();
1184 annotationShding.setBorder(new TitledBorder(
1185 MessageManager.getString("label.annotation_shading_default")));
1186 annotationShding.setLayout(new GridLayout(1, 2));
1187 GPreferences.addtoLayout(annotationShding,
1188 MessageManager.getString(
1189 "label.default_minimum_colour_annotation_shading"),
1190 mincolourLabel, minColour);
1191 GPreferences.addtoLayout(annotationShding,
1192 MessageManager.getString(
1193 "label.default_maximum_colour_annotation_shading"),
1194 maxcolourLabel, maxColour);
1195 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1200 * Initialises the Overview tabbed panel.
1204 private JPanel initOverviewTab()
1206 JPanel overviewPanel = new JPanel();
1207 overviewPanel.setBorder(new TitledBorder(
1208 MessageManager.getString("label.overview_settings")));
1210 gapColour.setFont(LABEL_FONT);
1211 // fixing the border colours stops apparent colour bleed from the panel
1212 gapColour.setBorder(
1213 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1214 gapColour.setPreferredSize(new Dimension(40, 20));
1215 gapColour.addMouseListener(new MouseAdapter()
1218 public void mousePressed(MouseEvent e)
1220 gapColour_actionPerformed(gapColour);
1224 hiddenColour.setFont(LABEL_FONT);
1225 // fixing the border colours stops apparent colour bleed from the panel
1226 hiddenColour.setBorder(
1227 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1228 hiddenColour.setPreferredSize(new Dimension(40, 20));
1229 hiddenColour.addMouseListener(new MouseAdapter()
1232 public void mousePressed(MouseEvent e)
1234 hiddenColour_actionPerformed(hiddenColour);
1238 useLegacyGap = new JCheckBox(
1239 MessageManager.getString("label.ov_legacy_gap"));
1240 useLegacyGap.setFont(LABEL_FONT);
1241 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1242 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1243 gapLabel = new JLabel(MessageManager.getString("label.gap_colour"));
1244 gapLabel.setFont(LABEL_FONT);
1245 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1246 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1247 showHiddenAtStart = new JCheckBox(
1248 MessageManager.getString("label.ov_show_hide_default"));
1249 showHiddenAtStart.setFont(LABEL_FONT);
1250 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1251 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1252 JLabel hiddenLabel = new JLabel(
1253 MessageManager.getString("label.hidden_colour"));
1254 hiddenLabel.setFont(LABEL_FONT);
1255 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1256 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1258 useLegacyGap.addActionListener(new ActionListener()
1261 public void actionPerformed(ActionEvent e)
1263 useLegacyGaps_actionPerformed(e);
1267 overviewPanel.setLayout(new GridBagLayout());
1268 GridBagConstraints c1 = new GridBagConstraints();
1270 c1.fill = GridBagConstraints.HORIZONTAL;
1275 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1276 overviewPanel.add(useLegacyGap, c1);
1278 GridBagConstraints c2 = new GridBagConstraints();
1279 c2.fill = GridBagConstraints.HORIZONTAL;
1282 c2.insets = new Insets(0, 15, 0, 10);
1283 overviewPanel.add(gapLabel, c2);
1285 GridBagConstraints c3 = new GridBagConstraints();
1286 c3.fill = GridBagConstraints.HORIZONTAL;
1289 c3.insets = new Insets(0, 0, 0, 15);
1290 overviewPanel.add(gapColour, c3);
1292 GridBagConstraints c4 = new GridBagConstraints();
1293 c4.fill = GridBagConstraints.HORIZONTAL;
1297 overviewPanel.add(showHiddenAtStart, c4);
1299 GridBagConstraints c5 = new GridBagConstraints();
1300 c5.fill = GridBagConstraints.HORIZONTAL;
1303 c5.insets = new Insets(0, 15, 0, 10);
1304 overviewPanel.add(hiddenLabel, c5);
1306 GridBagConstraints c6 = new GridBagConstraints();
1307 c6.fill = GridBagConstraints.HORIZONTAL;
1310 c6.insets = new Insets(0, 0, 0, 15);
1311 overviewPanel.add(hiddenColour, c6);
1313 JButton resetButton = new JButton(
1314 MessageManager.getString("label.reset_to_defaults"));
1316 resetButton.addActionListener(new ActionListener()
1319 public void actionPerformed(ActionEvent e)
1321 resetOvDefaults_actionPerformed(e);
1325 GridBagConstraints c7 = new GridBagConstraints();
1326 c7.fill = GridBagConstraints.NONE;
1329 c7.insets = new Insets(10, 0, 0, 0);
1330 c7.anchor = GridBagConstraints.WEST;
1331 overviewPanel.add(resetButton, c7);
1333 // Add padding so the panel doesn't look ridiculous
1334 JPanel spacePanel = new JPanel();
1335 overviewPanel.add(spacePanel,
1336 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1337 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1338 new Insets(0, 0, 0, 5), 0, 0));
1340 return overviewPanel;
1344 * Initialises the Structure tabbed panel.
1348 private JPanel initStructureTab()
1350 structureTab = new JPanel();
1352 structureTab.setBorder(new TitledBorder(
1353 MessageManager.getString("label.structure_options")));
1354 structureTab.setLayout(null);
1355 final int width = 400;
1356 final int height = 22;
1357 final int lineSpacing = 25;
1360 structFromPdb.setFont(LABEL_FONT);
1362 .setText(MessageManager.getString("label.struct_from_pdb"));
1363 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1364 structFromPdb.addActionListener(new ActionListener()
1367 public void actionPerformed(ActionEvent e)
1369 boolean selected = structFromPdb.isSelected();
1370 // enable other options only when the first is checked
1371 useRnaView.setEnabled(selected);
1372 addSecondaryStructure.setEnabled(selected);
1373 addTempFactor.setEnabled(selected);
1376 structureTab.add(structFromPdb);
1378 // indent checkboxes that are conditional on the first one
1379 ypos += lineSpacing;
1380 useRnaView.setFont(LABEL_FONT);
1381 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1382 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1383 structureTab.add(useRnaView);
1385 ypos += lineSpacing;
1386 addSecondaryStructure.setFont(LABEL_FONT);
1387 addSecondaryStructure
1388 .setText(MessageManager.getString("label.autoadd_secstr"));
1389 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1390 structureTab.add(addSecondaryStructure);
1392 ypos += lineSpacing;
1393 addTempFactor.setFont(LABEL_FONT);
1394 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1395 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1396 structureTab.add(addTempFactor);
1398 ypos += lineSpacing;
1399 JLabel viewerLabel = new JLabel();
1400 viewerLabel.setFont(LABEL_FONT);
1401 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1402 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1403 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1404 structureTab.add(viewerLabel);
1406 structViewer.setFont(LABEL_FONT);
1407 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1408 structViewer.addItem(ViewerType.JMOL.name());
1409 structViewer.addItem(ViewerType.CHIMERA.name());
1410 structViewer.addActionListener(new ActionListener()
1413 public void actionPerformed(ActionEvent e)
1415 structureViewer_actionPerformed(
1416 (String) structViewer.getSelectedItem());
1419 structureTab.add(structViewer);
1421 ypos += lineSpacing;
1422 JLabel pathLabel = new JLabel();
1423 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1424 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1425 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1426 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1427 structureTab.add(pathLabel);
1429 chimeraPath.setFont(LABEL_FONT);
1430 chimeraPath.setText("");
1431 final String tooltip = JvSwingUtils.wrapTooltip(true,
1432 MessageManager.getString("label.chimera_path_tip"));
1433 chimeraPath.setToolTipText(tooltip);
1434 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1435 chimeraPath.addMouseListener(new MouseAdapter()
1438 public void mouseClicked(MouseEvent e)
1440 if (e.getClickCount() == 2)
1442 String chosen = openFileChooser(false);
1445 chimeraPath.setText(chosen);
1450 structureTab.add(chimeraPath);
1452 ypos += lineSpacing;
1453 nwMapping.setFont(LABEL_FONT);
1454 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1455 siftsMapping.setFont(LABEL_FONT);
1456 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1457 mappingMethod.add(nwMapping);
1458 mappingMethod.add(siftsMapping);
1459 JPanel mappingPanel = new JPanel();
1460 mappingPanel.setFont(LABEL_FONT);
1461 TitledBorder mmTitledBorder = new TitledBorder(
1462 MessageManager.getString("label.mapping_method"));
1463 mmTitledBorder.setTitleFont(LABEL_FONT);
1464 mappingPanel.setBorder(mmTitledBorder);
1465 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1466 // GridLayout mappingLayout = new GridLayout();
1467 mappingPanel.setLayout(new GridLayout());
1468 mappingPanel.add(nwMapping);
1469 mappingPanel.add(siftsMapping);
1470 structureTab.add(mappingPanel);
1472 ypos += lineSpacing;
1473 ypos += lineSpacing;
1474 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1475 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1476 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1477 structureTab.add(docFieldPref);
1479 return structureTab;
1483 * Action on choosing a structure viewer from combobox options.
1485 * @param selectedItem
1487 protected void structureViewer_actionPerformed(String selectedItem)
1492 * Show a dialog for the user to choose a file. Returns the chosen path, or
1497 protected String openFileChooser(boolean forFolder)
1499 String choice = null;
1500 JFileChooser chooser = new JFileChooser();
1503 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1506 // chooser.setFileView(new JalviewFileView());
1507 chooser.setDialogTitle(
1508 MessageManager.getString("label.open_local_file"));
1509 chooser.setToolTipText(MessageManager.getString("action.open"));
1511 int value = chooser.showOpenDialog(this);
1513 if (value == JFileChooser.APPROVE_OPTION)
1515 choice = chooser.getSelectedFile().getPath();
1520 protected boolean validateStructure()
1526 * Initialises the Visual tabbed panel.
1530 private JPanel initVisualTab()
1532 JPanel visualTab = new JPanel();
1533 visualTab.setBorder(new TitledBorder(
1534 MessageManager.getString("action.open_new_alignment")));
1535 visualTab.setLayout(null);
1536 fullScreen.setFont(LABEL_FONT);
1537 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1538 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1539 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1540 quality.setEnabled(false);
1541 quality.setFont(LABEL_FONT);
1542 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1543 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1544 quality.setSelected(true);
1545 quality.setText(MessageManager.getString("label.quality"));
1546 conservation.setEnabled(false);
1547 conservation.setFont(LABEL_FONT);
1548 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1549 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1550 conservation.setSelected(true);
1551 conservation.setText(MessageManager.getString("label.conservation"));
1552 identity.setEnabled(false);
1553 identity.setFont(LABEL_FONT);
1554 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1555 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1556 identity.setSelected(true);
1557 identity.setText(MessageManager.getString("label.consensus"));
1558 showOccupancy.setFont(LABEL_FONT);
1559 showOccupancy.setEnabled(false);
1560 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1561 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1562 showOccupancy.setSelected(true);
1563 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1565 JLabel showGroupbits = new JLabel();
1566 showGroupbits.setFont(LABEL_FONT);
1567 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1568 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1570 .setText(MessageManager.getString("action.show_group") + ":");
1571 JLabel showConsensbits = new JLabel();
1572 showConsensbits.setFont(LABEL_FONT);
1573 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1574 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1576 .setText(MessageManager.getString("label.consensus") + ":");
1577 showConsensHistogram.setEnabled(false);
1578 showConsensHistogram.setFont(LABEL_FONT);
1579 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1580 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1581 showConsensHistogram.setSelected(true);
1582 showConsensHistogram
1583 .setText(MessageManager.getString("label.histogram"));
1584 showConsensLogo.setEnabled(false);
1585 showConsensLogo.setFont(LABEL_FONT);
1586 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1587 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1588 showConsensLogo.setSelected(true);
1589 showConsensLogo.setText(MessageManager.getString("label.logo"));
1590 showGroupConsensus.setEnabled(false);
1591 showGroupConsensus.setFont(LABEL_FONT);
1592 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1593 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1594 showGroupConsensus.setSelected(true);
1595 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1596 showGroupConservation.setEnabled(false);
1597 showGroupConservation.setFont(LABEL_FONT);
1598 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1599 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1600 showGroupConservation.setSelected(true);
1601 showGroupConservation
1602 .setText(MessageManager.getString("label.conservation"));
1603 showNpTooltip.setEnabled(true);
1604 showNpTooltip.setFont(LABEL_FONT);
1605 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1606 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1607 showNpTooltip.setSelected(true);
1608 showNpTooltip.setText(
1609 MessageManager.getString("label.non_positional_features"));
1610 showDbRefTooltip.setEnabled(true);
1611 showDbRefTooltip.setFont(LABEL_FONT);
1612 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1613 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1614 showDbRefTooltip.setSelected(true);
1616 .setText(MessageManager.getString("label.database_references"));
1617 annotations.setFont(LABEL_FONT);
1618 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1619 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1620 annotations.setSelected(true);
1621 annotations.setText(MessageManager.getString("label.show_annotations"));
1622 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1623 annotations.addActionListener(new ActionListener()
1626 public void actionPerformed(ActionEvent e)
1628 annotations_actionPerformed(e);
1631 identity.addActionListener(new ActionListener()
1634 public void actionPerformed(ActionEvent e)
1636 annotations_actionPerformed(e);
1639 showGroupConsensus.addActionListener(new ActionListener()
1642 public void actionPerformed(ActionEvent e)
1644 annotations_actionPerformed(e);
1647 showUnconserved.setFont(LABEL_FONT);
1648 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1649 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1650 showUnconserved.setSelected(true);
1652 .setText(MessageManager.getString("action.show_unconserved"));
1653 showUnconserved.addActionListener(new ActionListener()
1656 public void actionPerformed(ActionEvent e)
1658 showunconserved_actionPerformed(e);
1662 // TODO these are not yet added to / action from Preferences
1663 // JCheckBox shareSelections = new JCheckBox();
1664 // shareSelections.setFont(verdana11);
1665 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1666 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1667 // shareSelections.setSelected(true);
1668 // shareSelections.setText(MessageManager
1669 // .getString("label.share_selection_across_views"));
1670 // JCheckBox followHighlight = new JCheckBox();
1671 // followHighlight.setFont(verdana11);
1672 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1673 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1674 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1675 // followHighlight.setSelected(true);
1676 // followHighlight.setText(MessageManager
1677 // .getString("label.scroll_highlighted_regions"));
1679 seqLimit.setFont(LABEL_FONT);
1680 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1681 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1682 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1683 smoothFont.setFont(LABEL_FONT);
1684 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1685 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1686 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1687 scaleProteinToCdna.setFont(LABEL_FONT);
1688 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1689 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1690 scaleProteinToCdna.setText(
1691 MessageManager.getString("label.scale_protein_to_cdna"));
1692 scaleProteinToCdna.setToolTipText(
1693 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1694 JLabel gapLabel = new JLabel();
1695 gapLabel.setFont(LABEL_FONT);
1696 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1697 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1698 JLabel fontLabel = new JLabel();
1699 fontLabel.setFont(LABEL_FONT);
1700 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1701 fontLabel.setText(MessageManager.getString("label.font"));
1702 fontSizeCB.setFont(LABEL_FONT);
1703 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1704 fontStyleCB.setFont(LABEL_FONT);
1705 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1706 fontNameCB.setFont(LABEL_FONT);
1707 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1708 gapSymbolCB.setFont(LABEL_FONT);
1709 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1710 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1711 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1712 gapSymbolCB.setRenderer(dlcr);
1714 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1715 startupCheckbox.setFont(LABEL_FONT);
1716 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1717 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1718 startupCheckbox.setSelected(true);
1719 startupFileTextfield.setFont(LABEL_FONT);
1720 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1721 final String tooltip = JvSwingUtils.wrapTooltip(true,
1722 MessageManager.getString("label.double_click_to_browse"));
1723 startupFileTextfield.setToolTipText(tooltip);
1724 startupFileTextfield.addMouseListener(new MouseAdapter()
1727 public void mouseClicked(MouseEvent e)
1729 if (e.getClickCount() > 1)
1731 startupFileTextfield_mouseClicked();
1736 sortby.setFont(LABEL_FONT);
1737 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1738 JLabel sortLabel = new JLabel();
1739 sortLabel.setFont(LABEL_FONT);
1740 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1741 sortLabel.setText(MessageManager.getString("label.sort_by"));
1742 sortAnnBy.setFont(LABEL_FONT);
1743 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1744 JLabel sortAnnLabel = new JLabel();
1745 sortAnnLabel.setFont(LABEL_FONT);
1746 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1747 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1748 sortAutocalc.setFont(LABEL_FONT);
1749 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1751 JPanel annsettingsPanel = new JPanel();
1752 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1753 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1754 annsettingsPanel.setBorder(new EtchedBorder());
1755 visualTab.add(annsettingsPanel);
1756 Border jb = new EmptyBorder(1, 1, 4, 5);
1757 annotations.setBorder(jb);
1758 showOccupancy.setBorder(jb);
1759 quality.setBorder(jb);
1760 conservation.setBorder(jb);
1761 identity.setBorder(jb);
1762 showConsensbits.setBorder(jb);
1763 showGroupbits.setBorder(jb);
1764 showGroupConsensus.setBorder(jb);
1765 showGroupConservation.setBorder(jb);
1766 showConsensHistogram.setBorder(jb);
1767 showConsensLogo.setBorder(jb);
1769 JPanel autoAnnotSettings = new JPanel();
1770 annsettingsPanel.add(autoAnnotSettings);
1771 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1772 autoAnnotSettings.add(annotations);
1773 autoAnnotSettings.add(quality);
1774 // second row of autoannotation box
1775 autoAnnotSettings = new JPanel();
1776 annsettingsPanel.add(autoAnnotSettings);
1778 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1779 autoAnnotSettings.add(conservation);
1780 autoAnnotSettings.add(identity);
1781 autoAnnotSettings.add(showOccupancy);
1782 autoAnnotSettings.add(showGroupbits);
1783 autoAnnotSettings.add(showGroupConservation);
1784 autoAnnotSettings.add(showGroupConsensus);
1785 autoAnnotSettings.add(showConsensbits);
1786 autoAnnotSettings.add(showConsensHistogram);
1787 autoAnnotSettings.add(showConsensLogo);
1789 JPanel tooltipSettings = new JPanel();
1790 tooltipSettings.setBorder(new TitledBorder(
1791 MessageManager.getString("label.sequence_id_tooltip")));
1792 tooltipSettings.setBounds(173, 140, 220, 62);
1793 tooltipSettings.setLayout(new GridLayout(2, 1));
1794 tooltipSettings.add(showDbRefTooltip);
1795 tooltipSettings.add(showNpTooltip);
1796 visualTab.add(tooltipSettings);
1798 wrap.setFont(LABEL_FONT);
1799 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1800 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1801 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1802 rightAlign.setFont(LABEL_FONT);
1803 rightAlign.setForeground(Color.black);
1804 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1805 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1806 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1807 idItalics.setFont(LABEL_FONT_ITALIC);
1808 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1809 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1811 MessageManager.getString("label.sequence_name_italics"));
1812 openoverv.setFont(LABEL_FONT);
1813 openoverv.setActionCommand(
1814 MessageManager.getString("label.open_overview"));
1815 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1816 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1817 openoverv.setText(MessageManager.getString("label.open_overview"));
1818 JPanel jPanel2 = new JPanel();
1819 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1820 jPanel2.setLayout(new GridLayout(14, 1));
1821 jPanel2.add(fullScreen);
1822 jPanel2.add(openoverv);
1823 jPanel2.add(seqLimit);
1824 jPanel2.add(rightAlign);
1825 jPanel2.add(fontLabel);
1826 jPanel2.add(showUnconserved);
1827 jPanel2.add(idItalics);
1828 jPanel2.add(smoothFont);
1829 jPanel2.add(scaleProteinToCdna);
1830 jPanel2.add(gapLabel);
1832 jPanel2.add(sortLabel);
1833 jPanel2.add(sortAnnLabel);
1834 jPanel2.add(startupCheckbox);
1835 visualTab.add(jPanel2);
1836 visualTab.add(startupFileTextfield);
1837 visualTab.add(sortby);
1838 visualTab.add(sortAnnBy);
1839 visualTab.add(sortAutocalc);
1840 visualTab.add(gapSymbolCB);
1841 visualTab.add(fontNameCB);
1842 visualTab.add(fontSizeCB);
1843 visualTab.add(fontStyleCB);
1848 * Load the saved Backups options EXCEPT "Enabled" and "Scheme"
1851 protected void loadLastSavedBackupsOptions()
1853 BackupFilesPresetEntry savedPreset = BackupFilesPresetEntry
1854 .getSavedBackupEntry();
1856 .setSelected(Cache.getDefault(BackupFiles.ENABLED, true));
1858 BackupFilesPresetEntry backupfilesCustomEntry = BackupFilesPresetEntry
1859 .createBackupFilesPresetEntry(Cache
1860 .getDefault(BackupFilesPresetEntry.CUSTOMCONFIG, null));
1861 if (backupfilesCustomEntry == null)
1863 backupfilesCustomEntry = BackupFilesPresetEntry.backupfilesPresetEntriesValues
1864 .get(BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT);
1866 BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
1867 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM,
1868 backupfilesCustomEntry);
1870 setComboIntStringKey(backupfilesPresetsCombo,
1871 Cache.getDefault(BackupFiles.NS + "_PRESET",
1872 BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT));
1874 backupsSetOptions(savedPreset);
1876 backupsOptionsSetEnabled();
1877 updateBackupFilesExampleLabel();
1880 private boolean warnAboutSuffixReverseChange()
1882 BackupFilesPresetEntry bfpe = BackupFilesPresetEntry
1883 .getSavedBackupEntry();
1884 boolean savedSuffixReverse = bfpe.reverse;
1885 int savedSuffixDigits = bfpe.digits;
1886 String savedSuffixTemplate = bfpe.suffix;
1888 boolean nowSuffixReverse = suffixReverse.isSelected();
1889 int nowSuffixDigits = getSpinnerInt(suffixDigitsSpinner, 3);
1890 String nowSuffixTemplate = suffixTemplate.getText();
1891 return nowSuffixReverse != savedSuffixReverse
1892 && nowSuffixDigits == savedSuffixDigits
1893 && nowSuffixTemplate != null
1894 && nowSuffixTemplate.equals(savedSuffixTemplate);
1898 * Initialises the Backups tabbed panel.
1902 private JPanel initBackupsTab()
1904 JPanel backupsTab = new JPanel();
1905 backupsTab.setBorder(new TitledBorder(
1906 MessageManager.getString("label.backup_files")));
1907 backupsTab.setLayout(new GridBagLayout());
1909 GridBagConstraints gbc = new GridBagConstraints();
1912 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
1913 gbc.fill = GridBagConstraints.NONE;
1915 initBackupsTabPresetsPanel();
1916 initBackupsTabSuffixPanel();
1917 initBackupsTabKeepFilesPanel();
1918 initBackupsTabFilenameExamplesPanel();
1920 enableBackupFiles.setFont(LABEL_FONT_BOLD);
1922 .setText(MessageManager.getString("label.enable_backupfiles"));
1923 enableBackupFiles.addActionListener(new ActionListener()
1926 public void actionPerformed(ActionEvent e)
1928 // enable other options only when the first is checked
1929 backupsOptionsSetEnabled();
1934 // enable checkbox 1 col
1938 gbc.gridy = 0; // row 0
1939 backupsTab.add(enableBackupFiles, gbc);
1941 // summary of scheme box (over two rows)
1945 gbc.anchor = GridBagConstraints.FIRST_LINE_END;
1946 gbc.fill = GridBagConstraints.BOTH;
1947 backupsTab.add(exampleFilesPanel, gbc);
1949 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
1950 gbc.fill = GridBagConstraints.NONE;
1952 // fill empty space on right
1955 backupsTab.add(new JPanel(), gbc);
1960 gbc.gridy++; // row 1
1961 backupsTab.add(presetsPanel, gbc);
1963 // now using whole row
1968 gbc.gridy++; // row 2
1969 backupsTab.add(keepfilesPanel, gbc);
1971 // filename strategy box
1972 gbc.gridy++; // row 3
1973 backupsTab.add(suffixPanel, gbc);
1976 gbc.gridy++; // row 4
1978 backupsTab.add(new JPanel(), gbc);
1980 backupsOptionsSetEnabled();
1984 private JPanel initBackupsTabPresetsPanel()
1987 String title = MessageManager.getString("label.schemes");
1989 presetsPanel.setLayout(new GridBagLayout());
1991 GridBagConstraints gbc = new GridBagConstraints();
1994 gbc.anchor = GridBagConstraints.BASELINE_LEADING;
1995 gbc.fill = GridBagConstraints.NONE;
2003 presetsComboLabel = new JLabel(title + ":");
2004 presetsPanel.add(presetsComboLabel, gbc);
2006 List<Object> entries = Arrays
2007 .asList((Object[]) BackupFilesPresetEntry.backupfilesPresetEntries);
2008 List<String> tooltips = Arrays.asList(
2009 BackupFilesPresetEntry.backupfilesPresetEntryDescriptions);
2010 backupfilesPresetsCombo = JvSwingUtils.buildComboWithTooltips(entries,
2013 for (int i = 0; i < BackupFilesPresetEntry.backupfilesPresetEntries.length; i++)
2015 backupfilesPresetsCombo
2016 .addItem(BackupFilesPresetEntry.backupfilesPresetEntries[i]);
2020 backupfilesPresetsCombo.addActionListener(new ActionListener()
2023 public void actionPerformed(ActionEvent e)
2025 int key = getComboIntStringKey(backupfilesPresetsCombo);
2026 if (!customiseCheckbox.isSelected())
2028 backupfilesPresetsComboLastSelected = key;
2030 if (key == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM)
2032 if (customiseCheckbox.isSelected())
2034 // got here by clicking on customiseCheckbox so don't change the values
2035 backupfilesCustomOptionsSetEnabled();
2039 backupsTabUpdatePresets();
2040 backupfilesCustomOptionsSetEnabled();
2045 customiseCheckbox.setSelected(false);
2046 backupsTabUpdatePresets();
2047 backupfilesCustomOptionsSetEnabled();
2052 // dropdown list of preset schemes
2054 presetsPanel.add(backupfilesPresetsCombo, gbc);
2056 revertButton.setText(MessageManager.getString("label.cancel_changes"));
2057 revertButton.setToolTipText(
2058 MessageManager.getString("label.cancel_changes_description"));
2059 revertButton.addActionListener(new ActionListener()
2062 public void actionPerformed(ActionEvent e)
2065 BackupFilesPresetEntry.backupfilesPresetEntriesValues.get(
2066 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM));
2067 backupfilesCustomOptionsSetEnabled();
2071 revertButton.setFont(LABEL_FONT);
2073 customiseCheckbox.setFont(LABEL_FONT);
2074 customiseCheckbox.setText(MessageManager.getString("label.customise"));
2075 customiseCheckbox.addActionListener(new ActionListener()
2078 public void actionPerformed(ActionEvent e)
2080 int currently = getComboIntStringKey(backupfilesPresetsCombo);
2081 if (customiseCheckbox.isSelected())
2083 backupfilesPresetsComboLastSelected = currently;
2084 setComboIntStringKey(backupfilesPresetsCombo,
2085 BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM);
2089 setComboIntStringKey(backupfilesPresetsCombo,
2090 backupfilesPresetsComboLastSelected);
2093 backupfilesCustomOptionsSetEnabled();
2096 customiseCheckbox.setToolTipText(
2097 MessageManager.getString("label.customise_description"));
2099 // customise checkbox
2102 presetsPanel.add(customiseCheckbox, gbc);
2104 // "Cancel changes" button (aligned with combo box above)
2106 presetsPanel.add(revertButton, gbc);
2108 return presetsPanel;
2111 private JPanel initBackupsTabFilenameExamplesPanel()
2113 String title = MessageManager
2114 .getString("label.scheme_examples");
2115 TitledBorder tb = new TitledBorder(title);
2116 exampleFilesPanel.setBorder(tb);
2117 exampleFilesPanel.setLayout(new GridBagLayout());
2120 backupfilesExampleLabel.setEditable(false);
2121 backupfilesExampleLabel
2122 .setBackground(exampleFilesPanel.getBackground());
2124 updateBackupFilesExampleLabel();
2126 GridBagConstraints gbc = new GridBagConstraints();
2129 gbc.fill = GridBagConstraints.NONE;
2130 gbc.anchor = GridBagConstraints.FIRST_LINE_START;
2132 exampleFilesPanel.add(backupfilesExampleLabel, gbc);
2133 return exampleFilesPanel;
2136 private void backupsTabUpdatePresets()
2138 IntKeyStringValueEntry entry = (IntKeyStringValueEntry) backupfilesPresetsCombo
2141 String value = entry.v;
2143 if (BackupFilesPresetEntry.backupfilesPresetEntriesValues
2147 BackupFilesPresetEntry.backupfilesPresetEntriesValues
2153 "Preset '" + value + "' [key:" + key + "] not implemented");
2156 // Custom options will now be enabled when the customiseCheckbox is checked
2157 // (performed above)
2158 // backupfilesCustomOptionsSetEnabled();
2159 updateBackupFilesExampleLabel();
2162 protected int getComboIntStringKey(
2163 JComboBox<Object> backupfilesPresetsCombo2)
2165 IntKeyStringValueEntry e;
2168 e = (IntKeyStringValueEntry) backupfilesPresetsCombo2
2170 } catch (Exception ex)
2173 "Problem casting Combo entry to IntKeyStringValueEntry.");
2176 return e != null ? e.k : 0;
2179 protected void setComboIntStringKey(
2180 JComboBox<Object> backupfilesPresetsCombo2,
2183 for (int i = 0; i < backupfilesPresetsCombo2.getItemCount(); i++)
2185 IntKeyStringValueEntry e;
2188 e = (IntKeyStringValueEntry) backupfilesPresetsCombo2.getItemAt(i);
2189 } catch (Exception ex)
2192 "Problem casting Combo entry to IntKeyStringValueEntry. Skipping item. ");
2197 backupfilesPresetsCombo2.setSelectedIndex(i);
2201 // backupsTabUpdatePresets();
2204 private JPanel initBackupsTabSuffixPanel()
2206 suffixPanel.setBorder(new TitledBorder(
2207 MessageManager.getString("label.backup_filename_strategy")));
2208 suffixPanel.setLayout(new GridBagLayout());
2211 .setText(MessageManager.getString("label.append_to_filename"));
2212 suffixTemplateLabel.setHorizontalAlignment(SwingConstants.LEFT);
2213 suffixTemplateLabel.setFont(LABEL_FONT);
2215 final String tooltip = JvSwingUtils.wrapTooltip(true,
2216 MessageManager.getString("label.append_to_filename_tooltip"));
2217 suffixTemplate.setToolTipText(tooltip);
2218 suffixTemplate.addActionListener(new ActionListener()
2221 public void actionPerformed(ActionEvent e)
2223 updateBackupFilesExampleLabel();
2224 backupfilesCustomOptionsSetEnabled();
2225 backupfilesRevertButtonSetEnabled(true);
2229 suffixTemplate.addKeyListener(new KeyListener()
2232 public void keyReleased(KeyEvent e)
2234 updateBackupFilesExampleLabel();
2235 backupfilesCustomOptionsSetEnabled();
2236 backupfilesRevertButtonSetEnabled(true);
2240 public void keyPressed(KeyEvent e)
2244 // disable use of ':' or '/' or '\'
2246 public void keyTyped(KeyEvent e)
2248 char c = e.getKeyChar();
2249 if (c == ':' || c == '/' || c == '\\')
2251 // don't process ':' or '/' or '\'
2260 .setText(MessageManager.getString("label.index_digits"));
2261 suffixDigitsLabel.setHorizontalAlignment(SwingConstants.LEFT);
2262 suffixDigitsLabel.setFont(LABEL_FONT);
2263 ChangeListener c = new ChangeListener()
2266 public void stateChanged(ChangeEvent e)
2268 backupfilesRevertButtonSetEnabled(true);
2269 updateBackupFilesExampleLabel();
2273 setIntegerSpinner(suffixDigitsSpinner, BackupFilesPresetEntry.DIGITSMIN,
2274 BackupFilesPresetEntry.DIGITSMAX, 3, c);
2276 suffixReverse.setLabels(MessageManager.getString("label.reverse_roll"),
2277 MessageManager.getString("label.increment_index"));
2278 suffixReverse.addActionListener(new ActionListener()
2281 public void actionPerformed(ActionEvent e)
2283 boolean okay = true;
2284 if (warnAboutSuffixReverseChange())
2287 okay = confirmSuffixReverseChange();
2291 backupfilesRevertButtonSetEnabled(true);
2292 updateBackupFilesExampleLabel();
2296 boolean savedSuffixReverse = BackupFilesPresetEntry
2297 .getSavedBackupEntry().reverse;
2298 suffixReverse.setSelected(savedSuffixReverse);
2303 GridBagConstraints sgbc = new GridBagConstraints();
2305 // first row (template text box)
2306 sgbc.anchor = GridBagConstraints.WEST;
2310 sgbc.gridheight = 1;
2313 sgbc.fill = GridBagConstraints.NONE;
2314 suffixPanel.add(suffixTemplateLabel, sgbc);
2317 sgbc.fill = GridBagConstraints.HORIZONTAL;
2318 suffixPanel.add(suffixTemplate, sgbc);
2320 // second row (number of digits spinner)
2324 sgbc.fill = GridBagConstraints.NONE;
2325 suffixPanel.add(suffixDigitsLabel, sgbc);
2328 sgbc.fill = GridBagConstraints.HORIZONTAL;
2329 suffixPanel.add(suffixDigitsSpinner, sgbc);
2331 // third row (forward order radio selection)
2334 sgbc.gridwidth = GridBagConstraints.REMAINDER;
2335 sgbc.fill = GridBagConstraints.HORIZONTAL;
2336 suffixPanel.add(suffixReverse.getFalseButton(), sgbc);
2338 // fourth row (reverse order radio selection)
2340 suffixPanel.add(suffixReverse.getTrueButton(), sgbc);
2344 private boolean confirmSuffixReverseChange()
2346 boolean ret = false;
2347 String warningMessage = MessageManager
2348 .getString("label.warning_confirm_change_reverse");
2349 int confirm = JvOptionPane.showConfirmDialog(Desktop.desktop,
2351 MessageManager.getString("label.change_increment_decrement"),
2352 JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE);
2354 ret = (confirm == JvOptionPane.YES_OPTION);
2358 private JPanel initBackupsTabKeepFilesPanel()
2360 keepfilesPanel.setBorder(
2361 new TitledBorder(MessageManager.getString("label.keep_files")));
2362 keepfilesPanel.setLayout(new GridBagLayout());
2364 backupfilesKeepAll.setLabels(
2365 MessageManager.getString("label.keep_all_backup_files"),
2366 MessageManager.getString(
2367 "label.keep_only_this_number_of_backup_files"));
2368 backupfilesKeepAll.addTrueActionListener(new ActionListener()
2371 public void actionPerformed(ActionEvent e)
2373 backupfilesRevertButtonSetEnabled(true);
2374 updateBackupFilesExampleLabel();
2377 backupfilesKeepAll.addActionListener(new ActionListener()
2380 public void actionPerformed(ActionEvent e)
2382 backupfilesRevertButtonSetEnabled(true);
2383 keepRollMaxOptionsEnabled();
2384 updateBackupFilesExampleLabel();
2388 ChangeListener c = new ChangeListener()
2391 public void stateChanged(ChangeEvent e)
2393 backupfilesRevertButtonSetEnabled(true);
2394 updateBackupFilesExampleLabel();
2398 setIntegerSpinner(backupfilesRollMaxSpinner,
2399 BackupFilesPresetEntry.ROLLMAXMIN,
2400 BackupFilesPresetEntry.ROLLMAXMAX, 4, true, c);
2402 backupfilesConfirmDelete.setLabels(
2403 MessageManager.getString("label.always_ask"),
2404 MessageManager.getString("label.auto_delete"));
2405 backupfilesConfirmDelete.addActionListener(new ActionListener()
2408 public void actionPerformed(ActionEvent e)
2410 backupfilesRevertButtonSetEnabled(true);
2413 // update the enabled section
2414 keepRollMaxOptionsEnabled();
2416 GridBagConstraints kgbc = new GridBagConstraints();
2418 // first row (template text box)
2419 kgbc.anchor = GridBagConstraints.WEST;
2422 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2423 kgbc.gridheight = 1;
2426 kgbc.fill = GridBagConstraints.HORIZONTAL;
2427 keepfilesPanel.add(backupfilesKeepAll.getTrueButton(), kgbc);
2433 kgbc.gridwidth = GridBagConstraints.RELATIVE;
2434 keepfilesPanel.add(backupfilesKeepAll.getFalseButton(), kgbc);
2437 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2438 keepfilesPanel.add(backupfilesRollMaxSpinner, kgbc);
2440 // third row (indented)
2442 kgbc.insets = new Insets(0, 20, 0, 0);
2445 kgbc.gridwidth = GridBagConstraints.REMAINDER;
2446 kgbc.fill = GridBagConstraints.HORIZONTAL;
2449 JPanel jp = new JPanel();
2450 jp.setLayout(new FlowLayout());
2452 .setText(MessageManager
2453 .getString("label.autodelete_old_backup_files"));
2454 oldBackupFilesLabel.setFont(LABEL_FONT);
2455 oldBackupFilesLabel.setHorizontalAlignment(SwingConstants.LEFT);
2456 jp.add(oldBackupFilesLabel);
2457 jp.add(backupfilesConfirmDelete.getTrueButton());
2458 jp.add(backupfilesConfirmDelete.getFalseButton());
2459 keepfilesPanel.add(jp, kgbc);
2461 return keepfilesPanel;
2464 protected void updateBackupFilesExampleLabel()
2466 int exampleindex = 12;
2467 String base = MessageManager.getString("label.filename") + ".fa";
2468 if (base == null || base.length() == 0)
2470 base = "file_name.fa";
2473 boolean reverse = suffixReverse.isSelected();
2474 boolean keepAll = backupfilesKeepAll.isSelected();
2476 String suffix = suffixTemplate.getText();
2479 backupfilesExampleLabel.setFont(LABEL_FONT_ITALIC);
2480 if (suffix == null || suffix.length() == 0)
2482 backupfilesExampleLabel
2483 .setText(MessageManager.getString("label.no_backup_files"));
2484 backupfilesExampleLabel.setFont(LABEL_FONT_BOLD);
2488 rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 4);
2489 rollMax = rollMax < 1 ? 1 : rollMax;
2491 if (suffix.indexOf(BackupFiles.NUM_PLACEHOLDER) == -1)
2496 digits = getSpinnerInt(suffixDigitsSpinner, 3);
2497 digits = digits < 1 ? 1 : digits;
2499 int lowersurround = 2;
2500 int uppersurround = 0;
2501 StringBuilder exampleSB = new StringBuilder();
2502 boolean firstLine = true;
2508 int max = keepAll ? exampleindex : rollMax;
2509 for (int index = min; index <= max; index++)
2511 if (index == min + lowersurround && index < max - uppersurround - 1)
2513 exampleSB.append("\n...");
2516 else if (index > min + lowersurround && index < max - uppersurround)
2528 exampleSB.append("\n");
2531 exampleSB.append(BackupFilenameParts.getBackupFilename(index,
2532 base, suffix, digits));
2535 // no extra text needed
2537 else if (index == min)
2539 String newest = MessageManager.getString("label.braced_newest");
2540 if (newest != null && newest.length() > 0)
2542 exampleSB.append(" " + newest);
2545 else if (index == max)
2547 String oldest = MessageManager.getString("label.braced_oldest");
2548 if (oldest != null && oldest.length() > 0)
2550 exampleSB.append(" " + oldest);
2559 int min = (keepAll || exampleindex - rollMax < 0) ? 1
2560 : exampleindex - rollMax + 1;
2561 int max = exampleindex;
2563 for (int index = min; index <= max; index++)
2566 if (index == min + lowersurround && index < max - uppersurround - 1)
2568 exampleSB.append("\n...");
2571 else if (index > min + lowersurround && index < max - uppersurround)
2583 exampleSB.append("\n");
2586 exampleSB.append(BackupFilenameParts.getBackupFilename(index,
2587 base, suffix, digits));
2590 // no extra text needed
2592 else if (index == min)
2594 String oldest = MessageManager.getString("label.braced_oldest");
2595 if (oldest != null && oldest.length() > 0)
2597 exampleSB.append(" " + oldest);
2600 else if (index == max)
2602 String newest = MessageManager.getString("label.braced_newest");
2603 if (newest != null && newest.length() > 0)
2605 exampleSB.append(" " + newest);
2613 // add some extra empty lines to pad out the example files box. ugh, please tell
2614 // me how to do this better
2615 int remainingLines = lowersurround + uppersurround + 1 - lineNumber;
2616 if (remainingLines > 0)
2618 for (int i = 0; i < remainingLines; i++)
2620 exampleSB.append("\n ");
2625 backupfilesExampleLabel.setText(exampleSB.toString());
2628 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2629 boolean useExistingVal, ChangeListener c)
2636 i = Integer.parseInt((String) s.getValue());
2637 } catch (Exception e)
2640 "Exception casting the initial value of s.getValue()");
2644 setIntegerSpinner(s, min, max, i, c);
2647 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2650 // integer spinner for number of digits
2655 SpinnerModel sModel = new SpinnerNumberModel(def, min, max, 1);
2658 s.addChangeListener(c);
2662 protected static int getSpinnerInt(JSpinner s, int def)
2668 i = (Integer) s.getValue();
2669 } catch (Exception e)
2671 Cache.log.error("Failed casting (Integer) JSpinner s.getValue()");
2676 private void keepRollMaxOptionsEnabled()
2678 boolean enabled = backupfilesKeepAll.isEnabled()
2679 && !backupfilesKeepAll.isSelected();
2680 oldBackupFilesLabel.setEnabled(enabled);
2681 backupfilesRollMaxSpinner.setEnabled(enabled);
2682 backupfilesConfirmDelete.setEnabled(enabled);
2685 private void backupfilesKeepAllSetEnabled(boolean tryEnabled)
2687 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2688 && customiseCheckbox.isSelected()
2689 && suffixTemplate.getText()
2690 .indexOf(BackupFiles.NUM_PLACEHOLDER) > -1;
2691 keepfilesPanel.setEnabled(enabled);
2692 backupfilesKeepAll.setEnabled(enabled);
2693 oldBackupFilesLabel.setEnabled(enabled);
2694 keepRollMaxOptionsEnabled();
2697 private void backupfilesSuffixTemplateDigitsSetEnabled()
2699 boolean enabled = suffixTemplate.isEnabled() && suffixTemplate.getText()
2700 .indexOf(BackupFiles.NUM_PLACEHOLDER) > -1;
2701 suffixDigitsLabel.setEnabled(enabled);
2702 suffixDigitsSpinner.setEnabled(enabled);
2703 suffixReverse.setEnabled(enabled);
2706 private void backupfilesSuffixTemplateSetEnabled(boolean tryEnabled)
2708 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2709 && customiseCheckbox.isSelected();
2710 suffixPanel.setEnabled(enabled);
2711 suffixTemplateLabel.setEnabled(enabled);
2712 suffixTemplate.setEnabled(enabled);
2713 backupfilesSuffixTemplateDigitsSetEnabled();
2716 private void backupfilesRevertButtonSetEnabled(boolean tryEnabled)
2718 boolean enabled = tryEnabled && enableBackupFiles.isSelected()
2719 && customiseCheckbox.isSelected() && backupfilesCustomChanged();
2720 revertButton.setEnabled(enabled);
2723 private boolean backupfilesCustomChanged()
2725 BackupFilesPresetEntry custom = BackupFilesPresetEntry.backupfilesPresetEntriesValues
2726 .get(BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM);
2727 BackupFilesPresetEntry current = getBackupfilesCurrentEntry();
2728 return !custom.equals(current);
2731 protected BackupFilesPresetEntry getBackupfilesCurrentEntry()
2733 String suffix = suffixTemplate.getText();
2734 int digits = getSpinnerInt(suffixDigitsSpinner, 3);
2735 boolean reverse = suffixReverse.isSelected();
2736 boolean keepAll = backupfilesKeepAll.isSelected();
2737 int rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 3);
2738 boolean confirmDelete = backupfilesConfirmDelete.isSelected();
2740 BackupFilesPresetEntry bfpe = new BackupFilesPresetEntry(suffix, digits,
2741 reverse, keepAll, rollMax, confirmDelete);
2746 protected void backupfilesCustomOptionsSetEnabled()
2748 boolean enabled = customiseCheckbox.isSelected();
2750 backupfilesRevertButtonSetEnabled(enabled);
2751 backupfilesSuffixTemplateSetEnabled(enabled);
2752 backupfilesKeepAllSetEnabled(enabled);
2755 private void backupfilesSummarySetEnabled()
2757 boolean enabled = enableBackupFiles.isSelected();
2758 backupfilesExampleLabel.setEnabled(enabled);
2759 exampleFilesPanel.setEnabled(enabled);
2762 private void backupfilesPresetsSetEnabled()
2764 boolean enabled = enableBackupFiles.isSelected();
2765 presetsPanel.setEnabled(enabled);
2766 presetsComboLabel.setEnabled(enabled);
2767 backupfilesPresetsCombo.setEnabled(enabled);
2768 customiseCheckbox.setEnabled(enabled);
2769 revertButton.setEnabled(enabled);
2772 protected void backupsOptionsSetEnabled()
2774 backupfilesPresetsSetEnabled();
2775 backupfilesSummarySetEnabled();
2776 backupfilesCustomOptionsSetEnabled();
2779 protected void backupsSetOptions(String suffix, int digits,
2780 boolean reverse, boolean keepAll, int rollMax,
2781 boolean confirmDelete)
2783 suffixTemplate.setText(suffix);
2784 suffixDigitsSpinner.setValue(digits);
2785 suffixReverse.setSelected(reverse);
2786 backupfilesKeepAll.setSelected(keepAll);
2787 backupfilesRollMaxSpinner.setValue(rollMax);
2788 backupfilesConfirmDelete.setSelected(confirmDelete);
2791 protected void backupsSetOptions(BackupFilesPresetEntry p)
2793 backupsSetOptions(p.suffix, p.digits, p.reverse, p.keepAll, p.rollMax,
2797 protected void autoIdWidth_actionPerformed()
2799 // TODO Auto-generated method stub
2803 protected void userIdWidth_actionPerformed()
2805 // TODO Auto-generated method stub
2809 protected void maxColour_actionPerformed(JPanel panel)
2813 protected void minColour_actionPerformed(JPanel panel)
2817 protected void gapColour_actionPerformed(JPanel panel)
2821 protected void hiddenColour_actionPerformed(JPanel panel)
2825 protected void showunconserved_actionPerformed(ActionEvent e)
2827 // TODO Auto-generated method stub
2831 protected void useLegacyGaps_actionPerformed(ActionEvent e)
2835 protected void resetOvDefaults_actionPerformed(ActionEvent e)
2845 public void ok_actionPerformed(ActionEvent e)
2855 public void cancel_actionPerformed(ActionEvent e)
2865 public void annotations_actionPerformed(ActionEvent e)
2872 public void startupFileTextfield_mouseClicked()
2876 public void newLink_actionPerformed(ActionEvent e)
2881 public void editLink_actionPerformed(ActionEvent e)
2886 public void deleteLink_actionPerformed(ActionEvent e)
2891 public void defaultBrowser_mouseClicked(MouseEvent e)
2896 public void linkURLList_keyTyped(KeyEvent e)
2901 public void useProxy_actionPerformed()
2903 boolean enabled = useProxy.isSelected();
2904 portLabel.setEnabled(enabled);
2905 serverLabel.setEnabled(enabled);
2906 proxyServerTB.setEnabled(enabled);
2907 proxyPortTB.setEnabled(enabled);
2911 * Customer renderer for JTable: supports column of radio buttons
2913 public class RadioButtonRenderer extends JRadioButton
2914 implements TableCellRenderer
2916 public RadioButtonRenderer()
2918 setHorizontalAlignment(CENTER);
2919 setToolTipText(MessageManager.getString("label.urltooltip"));
2923 public Component getTableCellRendererComponent(JTable table,
2924 Object value, boolean isSelected, boolean hasFocus, int row,
2927 setSelected((boolean) value);
2929 // set colours to match rest of table
2932 setBackground(table.getSelectionBackground());
2933 setForeground(table.getSelectionForeground());
2937 setBackground(table.getBackground());
2938 setForeground(table.getForeground());
2945 * Customer cell editor for JTable: supports column of radio buttons in
2946 * conjunction with renderer
2948 public class RadioButtonEditor extends AbstractCellEditor
2949 implements TableCellEditor
2951 private JRadioButton button = new JRadioButton();
2953 public RadioButtonEditor()
2955 button.setHorizontalAlignment(SwingConstants.CENTER);
2956 this.button.addActionListener(new ActionListener()
2959 public void actionPerformed(ActionEvent e)
2961 fireEditingStopped();
2967 public Component getTableCellEditorComponent(JTable table, Object value,
2968 boolean isSelected, int row, int column)
2970 button.setSelected((boolean) value);
2975 public Object getCellEditorValue()
2977 return button.isSelected();
2982 protected void validateHmmerPath()
2986 protected void validateCygwinPath()
2991 * A helper method to add a panel containing a label and a component to a
2999 protected static void addtoLayout(JPanel panel, String tooltip,
3000 JComponent label, JComponent valBox)
3002 JPanel laypanel = new JPanel(new GridLayout(1, 2));
3003 JPanel labPanel = new JPanel(new BorderLayout());
3004 JPanel valPanel = new JPanel();
3005 labPanel.setBounds(new Rectangle(7, 7, 158, 23));
3006 valPanel.setBounds(new Rectangle(172, 7, 270, 23));
3007 labPanel.add(label, BorderLayout.WEST);
3008 valPanel.add(valBox);
3009 laypanel.add(labPanel);
3010 laypanel.add(valPanel);
3011 valPanel.setToolTipText(tooltip);
3012 labPanel.setToolTipText(tooltip);
3013 valBox.setToolTipText(tooltip);
3014 panel.add(laypanel);