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.fts.core.FTSDataColumnPreferences;
24 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
25 import jalview.fts.service.pdb.PDBFTSRestClient;
26 import jalview.gui.JalviewBooleanRadioButtons;
27 import jalview.gui.JvSwingUtils;
28 import jalview.gui.StructureViewer.ViewerType;
29 import jalview.io.BackupFilenameFilter;
30 import jalview.util.MessageManager;
32 import java.awt.BorderLayout;
33 import java.awt.Color;
34 import java.awt.Component;
35 import java.awt.Dimension;
36 import java.awt.FlowLayout;
38 import java.awt.GridBagConstraints;
39 import java.awt.GridBagLayout;
40 import java.awt.GridLayout;
41 import java.awt.Insets;
42 import java.awt.Rectangle;
43 import java.awt.event.ActionEvent;
44 import java.awt.event.ActionListener;
45 import java.awt.event.FocusEvent;
46 import java.awt.event.KeyEvent;
47 import java.awt.event.KeyListener;
48 import java.awt.event.MouseAdapter;
49 import java.awt.event.MouseEvent;
51 import javax.swing.AbstractCellEditor;
52 import javax.swing.BorderFactory;
53 import javax.swing.ButtonGroup;
54 import javax.swing.DefaultListCellRenderer;
55 import javax.swing.JButton;
56 import javax.swing.JCheckBox;
57 import javax.swing.JComboBox;
58 import javax.swing.JFileChooser;
59 import javax.swing.JLabel;
60 import javax.swing.JPanel;
61 import javax.swing.JRadioButton;
62 import javax.swing.JScrollPane;
63 import javax.swing.JSpinner;
64 import javax.swing.JTabbedPane;
65 import javax.swing.JTable;
66 import javax.swing.JTextArea;
67 import javax.swing.JTextField;
68 import javax.swing.ListSelectionModel;
69 import javax.swing.SpinnerModel;
70 import javax.swing.SpinnerNumberModel;
71 import javax.swing.SwingConstants;
72 import javax.swing.border.Border;
73 import javax.swing.border.EmptyBorder;
74 import javax.swing.border.EtchedBorder;
75 import javax.swing.border.TitledBorder;
76 import javax.swing.event.ChangeEvent;
77 import javax.swing.event.ChangeListener;
78 import javax.swing.table.TableCellEditor;
79 import javax.swing.table.TableCellRenderer;
82 * Base class for the Preferences panel.
87 public class GPreferences extends JPanel
89 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
91 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
92 .getLabelFont(false, true);
95 * Visual tab components
97 protected JCheckBox fullScreen = new JCheckBox();
99 protected JCheckBox openoverv = new JCheckBox();
101 protected JCheckBox seqLimit = new JCheckBox();
103 protected JCheckBox rightAlign = new JCheckBox();
105 protected JComboBox<String> fontSizeCB = new JComboBox<>();
107 protected JComboBox<String> fontStyleCB = new JComboBox<>();
109 protected JComboBox<String> fontNameCB = new JComboBox<>();
111 protected JCheckBox showOccupancy = new JCheckBox();
113 protected JCheckBox showUnconserved = new JCheckBox();
115 protected JCheckBox idItalics = new JCheckBox();
117 protected JCheckBox smoothFont = new JCheckBox();
119 protected JCheckBox scaleProteinToCdna = new JCheckBox();
121 protected JComboBox<String> gapSymbolCB = new JComboBox<>();
123 protected JCheckBox wrap = new JCheckBox();
125 protected JComboBox<String> sortby = new JComboBox<>();
127 protected JComboBox<String> sortAnnBy = new JComboBox<>();
129 protected JComboBox<String> sortAutocalc = new JComboBox<>();
131 protected JCheckBox startupCheckbox = new JCheckBox();
133 protected JTextField startupFileTextfield = new JTextField();
135 // below are in the 'second column'
136 protected JCheckBox annotations = new JCheckBox();
138 protected JCheckBox quality = new JCheckBox();
140 protected JCheckBox conservation = new JCheckBox();
142 protected JCheckBox identity = new JCheckBox();
144 protected JCheckBox showGroupConsensus = new JCheckBox();
146 protected JCheckBox showGroupConservation = new JCheckBox();
148 protected JCheckBox showConsensHistogram = new JCheckBox();
150 protected JCheckBox showConsensLogo = new JCheckBox();
152 protected JCheckBox showDbRefTooltip = new JCheckBox();
154 protected JCheckBox showNpTooltip = new JCheckBox();
157 * Structure tab and components
159 protected JPanel structureTab;
161 protected JCheckBox structFromPdb = new JCheckBox();
163 protected JCheckBox useRnaView = new JCheckBox();
165 protected JCheckBox addSecondaryStructure = new JCheckBox();
167 protected JCheckBox addTempFactor = new JCheckBox();
169 protected JComboBox<String> structViewer = new JComboBox<>();
171 protected JTextField chimeraPath = new JTextField();
173 protected ButtonGroup mappingMethod = new ButtonGroup();
175 protected JRadioButton siftsMapping = new JRadioButton();
177 protected JRadioButton nwMapping = new JRadioButton();
180 * Colours tab components
182 protected JPanel minColour = new JPanel();
184 protected JPanel maxColour = new JPanel();
186 protected JComboBox<String> protColour = new JComboBox<>();
188 protected JComboBox<String> nucColour = new JComboBox<>();
191 * Overview tab components
193 protected JPanel gapColour = new JPanel();
195 protected JPanel hiddenColour = new JPanel();
197 protected JCheckBox useLegacyGap;
199 protected JCheckBox showHiddenAtStart;
201 protected JLabel gapLabel;
204 * Connections tab components
206 protected JTable linkUrlTable = new JTable();
208 protected JButton editLink = new JButton();
210 protected JButton deleteLink = new JButton();
212 protected JTextField filterTB = new JTextField();
214 protected JButton doReset = new JButton();
216 protected JButton userOnly = new JButton();
218 protected JLabel portLabel = new JLabel();
220 protected JLabel serverLabel = new JLabel();
222 protected JTextField proxyServerTB = new JTextField();
224 protected JTextField proxyPortTB = new JTextField();
226 protected JTextField defaultBrowser = new JTextField();
228 protected JCheckBox useProxy = new JCheckBox();
230 protected JCheckBox usagestats = new JCheckBox();
232 protected JCheckBox questionnaire = new JCheckBox();
234 protected JCheckBox versioncheck = new JCheckBox();
237 * Output tab components
239 protected JComboBox<Object> epsRendering = new JComboBox<>();
241 protected JLabel userIdWidthlabel = new JLabel();
243 protected JCheckBox autoIdWidth = new JCheckBox();
245 protected JTextField userIdWidth = new JTextField();
247 protected JCheckBox blcjv = new JCheckBox();
249 protected JCheckBox pileupjv = new JCheckBox();
251 protected JCheckBox clustaljv = new JCheckBox();
253 protected JCheckBox msfjv = new JCheckBox();
255 protected JCheckBox fastajv = new JCheckBox();
257 protected JCheckBox pfamjv = new JCheckBox();
259 protected JCheckBox pirjv = new JCheckBox();
261 protected JCheckBox modellerOutput = new JCheckBox();
263 protected JCheckBox embbedBioJSON = new JCheckBox();
266 * Editing tab components
268 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
270 protected JCheckBox padGaps = new JCheckBox();
272 protected JCheckBox sortByTree = new JCheckBox();
278 protected JPanel wsTab = new JPanel();
281 * Backups tab components
282 * a lot of these are member variables instead of local variables only so that they
283 * can be enabled/disabled easily in one go
286 protected JCheckBox enableBackupFiles = new JCheckBox();
288 protected JPanel suffixPanel = new JPanel();
290 protected JPanel keepfilesPanel = new JPanel();
292 protected JPanel exampleFilesPanel = new JPanel();
294 protected JTextField suffixTemplate = new JTextField(null, 8);
296 protected JLabel suffixTemplateLabel = new JLabel();
298 protected JLabel suffixDigitsLabel = new JLabel();
300 protected JSpinner suffixDigitsSpinner = new JSpinner();
302 protected JalviewBooleanRadioButtons suffixReverse = new JalviewBooleanRadioButtons();
304 protected JalviewBooleanRadioButtons backupfilesKeepAll = new JalviewBooleanRadioButtons();
306 protected JSpinner backupfilesRollMaxSpinner = new JSpinner();
308 protected JLabel oldBackupFilesLabel = new JLabel();
310 protected JalviewBooleanRadioButtons backupfilesConfirmDelete = new JalviewBooleanRadioButtons();
312 protected JTextArea backupfilesExampleLabel = new JTextArea();
315 * Creates a new GPreferences object.
317 public GPreferences()
322 } catch (Exception ex)
324 ex.printStackTrace();
329 * Construct the panel and its tabbed sub-panels.
333 private void jbInit() throws Exception
335 final JTabbedPane tabbedPane = new JTabbedPane();
336 this.setLayout(new BorderLayout());
337 JPanel okCancelPanel = initOkCancelPanel();
338 this.add(tabbedPane, BorderLayout.CENTER);
339 this.add(okCancelPanel, BorderLayout.SOUTH);
341 tabbedPane.add(initVisualTab(),
342 MessageManager.getString("label.visual"));
344 tabbedPane.add(initColoursTab(),
345 MessageManager.getString("label.colours"));
347 tabbedPane.add(initOverviewTab(),
348 MessageManager.getString("label.overview"));
350 tabbedPane.add(initStructureTab(),
351 MessageManager.getString("label.structure"));
353 tabbedPane.add(initConnectionsTab(),
354 MessageManager.getString("label.connections"));
356 tabbedPane.add(initBackupsTab(),
357 MessageManager.getString("label.backups"));
359 tabbedPane.add(initLinksTab(),
360 MessageManager.getString("label.urllinks"));
362 tabbedPane.add(initOutputTab(),
363 MessageManager.getString("label.output"));
365 tabbedPane.add(initEditingTab(),
366 MessageManager.getString("label.editing"));
369 * See WsPreferences for the real work of configuring this tab.
371 wsTab.setLayout(new BorderLayout());
372 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
375 * Handler to validate a tab before leaving it - currently only for
378 tabbedPane.addChangeListener(new ChangeListener()
380 private Component lastTab;
383 public void stateChanged(ChangeEvent e)
385 if (lastTab == structureTab
386 && tabbedPane.getSelectedComponent() != structureTab)
388 if (!validateStructure())
390 tabbedPane.setSelectedComponent(structureTab);
394 lastTab = tabbedPane.getSelectedComponent();
401 * Initialises the Editing tabbed panel.
405 private JPanel initEditingTab()
407 JPanel editingTab = new JPanel();
408 editingTab.setLayout(null);
409 autoCalculateConsCheck.setFont(LABEL_FONT);
410 autoCalculateConsCheck.setText(
411 MessageManager.getString("label.autocalculate_consensus"));
412 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
413 padGaps.setFont(LABEL_FONT);
415 MessageManager.getString("label.pad_gaps_when_editing"));
416 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
417 sortByTree.setFont(LABEL_FONT);
419 .setText(MessageManager.getString("label.sort_with_new_tree"));
420 sortByTree.setToolTipText(MessageManager.getString(
421 "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
422 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
423 editingTab.add(autoCalculateConsCheck);
424 editingTab.add(padGaps);
425 editingTab.add(sortByTree);
430 * Initialises the Output tabbed panel.
434 private JPanel initOutputTab()
436 JPanel outputTab = new JPanel();
437 outputTab.setLayout(null);
438 JLabel epsLabel = new JLabel();
439 epsLabel.setFont(LABEL_FONT);
440 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
441 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
442 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
443 epsRendering.setFont(LABEL_FONT);
444 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
445 JLabel jLabel1 = new JLabel();
446 jLabel1.setFont(LABEL_FONT);
447 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
448 jLabel1.setText(MessageManager.getString("label.append_start_end"));
449 jLabel1.setFont(LABEL_FONT);
450 fastajv.setFont(LABEL_FONT);
451 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
452 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
453 blcjv.setText(MessageManager.getString("label.blc") + " ");
454 fastajv.setText(MessageManager.getString("label.fasta") + " ");
455 msfjv.setText(MessageManager.getString("label.msf") + " ");
456 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
457 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
458 msfjv.setFont(LABEL_FONT);
459 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
460 pirjv.setText(MessageManager.getString("label.pir") + " ");
461 JPanel jPanel11 = new JPanel();
462 jPanel11.setFont(LABEL_FONT);
463 TitledBorder titledBorder2 = new TitledBorder(
464 MessageManager.getString("label.file_output"));
465 jPanel11.setBorder(titledBorder2);
466 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
467 GridLayout gridLayout3 = new GridLayout();
468 jPanel11.setLayout(gridLayout3);
469 gridLayout3.setRows(8);
470 blcjv.setFont(LABEL_FONT);
471 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
472 clustaljv.setFont(LABEL_FONT);
473 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
474 pfamjv.setFont(LABEL_FONT);
475 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
476 pileupjv.setFont(LABEL_FONT);
477 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
478 pirjv.setFont(LABEL_FONT);
479 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
480 autoIdWidth.setFont(LABEL_FONT);
482 MessageManager.getString("label.automatically_set_id_width"));
483 autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
484 .getString("label.adjusts_width_generated_eps_png")));
485 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
486 autoIdWidth.addActionListener(new ActionListener()
490 public void actionPerformed(ActionEvent e)
492 autoIdWidth_actionPerformed();
495 userIdWidthlabel.setFont(LABEL_FONT);
496 userIdWidthlabel.setText(
497 MessageManager.getString("label.figure_id_column_width"));
498 userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
499 .getString("label.manually_specify_width_left_column")));
500 userIdWidthlabel.setToolTipText(
501 JvSwingUtils.wrapTooltip(true, MessageManager.getString(
502 "label.manually_specify_width_left_column")));
503 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
504 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
505 userIdWidth.setText("");
506 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
507 userIdWidth.addActionListener(new ActionListener()
511 public void actionPerformed(ActionEvent e)
513 userIdWidth_actionPerformed();
516 modellerOutput.setFont(LABEL_FONT);
518 .setText(MessageManager.getString("label.use_modeller_output"));
519 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
520 embbedBioJSON.setFont(LABEL_FONT);
521 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
522 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
525 TitledBorder backupFilesBorder = new TitledBorder(
527 .getString("label.backup_files"));
530 jPanel11.add(jLabel1);
532 jPanel11.add(clustaljv);
533 jPanel11.add(fastajv);
535 jPanel11.add(pfamjv);
536 jPanel11.add(pileupjv);
538 outputTab.add(autoIdWidth);
539 outputTab.add(userIdWidth);
540 outputTab.add(userIdWidthlabel);
541 outputTab.add(modellerOutput);
542 outputTab.add(embbedBioJSON);
543 outputTab.add(epsLabel);
544 outputTab.add(epsRendering);
545 outputTab.add(jPanel11);
550 * Initialises the Connections tabbed panel.
554 private JPanel initConnectionsTab()
556 JPanel connectTab = new JPanel();
557 connectTab.setLayout(new GridBagLayout());
559 // Label for browser text box
560 JLabel browserLabel = new JLabel();
561 browserLabel.setFont(LABEL_FONT);
562 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
563 browserLabel.setText(
564 MessageManager.getString("label.default_browser_unix"));
565 defaultBrowser.setFont(LABEL_FONT);
566 defaultBrowser.setText("");
567 final String tooltip = JvSwingUtils.wrapTooltip(true,
568 MessageManager.getString("label.double_click_to_browse"));
569 defaultBrowser.setToolTipText(tooltip);
570 defaultBrowser.addMouseListener(new MouseAdapter()
573 public void mouseClicked(MouseEvent e)
575 if (e.getClickCount() > 1)
577 defaultBrowser_mouseClicked(e);
582 JPanel proxyPanel = initConnTabProxyPanel();
583 initConnTabCheckboxes();
585 // Add default Browser text box
586 connectTab.add(browserLabel,
587 new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
588 GridBagConstraints.WEST, GridBagConstraints.NONE,
589 new Insets(10, 0, 5, 5), 5, 1));
590 defaultBrowser.setFont(LABEL_FONT);
591 defaultBrowser.setText("");
593 connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
594 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
595 new Insets(10, 0, 5, 10), 30, 1));
597 // Add proxy server panel
598 connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
599 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
600 new Insets(10, 0, 5, 12), 4, 10));
602 // Add usage stats, version check and questionnaire checkboxes
603 connectTab.add(usagestats,
604 new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
605 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
606 new Insets(0, 2, 5, 5), 70, 1));
607 connectTab.add(questionnaire,
608 new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
609 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
610 new Insets(0, 2, 5, 10), 70, 1));
611 connectTab.add(versioncheck,
612 new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
613 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
614 new Insets(0, 2, 5, 5), 70, 1));
616 // Add padding so the panel doesn't look ridiculous
617 JPanel spacePanel = new JPanel();
618 connectTab.add(spacePanel,
619 new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
620 GridBagConstraints.WEST, GridBagConstraints.BOTH,
621 new Insets(0, 0, 0, 5), 70, 1));
627 * Initialises the Links tabbed panel.
631 private JPanel initLinksTab()
633 JPanel linkTab = new JPanel();
634 linkTab.setLayout(new GridBagLayout());
636 // Set up table for Url links
637 linkUrlTable.setFillsViewportHeight(true);
638 linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
639 linkUrlTable.setAutoCreateRowSorter(true);
640 linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
642 // adjust row height so radio buttons actually fit
643 // don't do this in the renderer, it causes the awt thread to activate
645 JRadioButton temp = new JRadioButton();
646 linkUrlTable.setRowHeight(temp.getMinimumSize().height);
648 // Table in scrollpane so that the table is given a scrollbar
649 JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
650 linkScrollPane.setBorder(null);
652 // Panel for links functionality
653 JPanel linkPanel = new JPanel(new GridBagLayout());
654 linkPanel.setBorder(new TitledBorder(
655 MessageManager.getString("label.url_linkfrom_sequence_id")));
657 // Put the Url links panel together
659 // Buttons go at top right, resizing only resizes the blank space vertically
660 JPanel buttonPanel = initLinkTabUrlButtons();
661 GridBagConstraints linkConstraints1 = new GridBagConstraints();
662 linkConstraints1.insets = new Insets(0, 0, 5, 0);
663 linkConstraints1.gridx = 0;
664 linkConstraints1.gridy = 0;
665 linkConstraints1.weightx = 1.0;
666 linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
667 linkTab.add(buttonPanel, linkConstraints1);
669 // Links table goes at top left, resizing resizes the table
670 GridBagConstraints linkConstraints2 = new GridBagConstraints();
671 linkConstraints2.insets = new Insets(0, 0, 5, 5);
672 linkConstraints2.gridx = 0;
673 linkConstraints2.gridy = 1;
674 linkConstraints2.weightx = 1.0;
675 linkConstraints2.weighty = 1.0;
676 linkConstraints2.fill = GridBagConstraints.BOTH;
677 linkTab.add(linkScrollPane, linkConstraints2);
679 // Filter box and buttons goes at bottom left, resizing resizes the text box
680 JPanel filterPanel = initLinkTabFilterPanel();
681 GridBagConstraints linkConstraints3 = new GridBagConstraints();
682 linkConstraints3.insets = new Insets(0, 0, 0, 5);
683 linkConstraints3.gridx = 0;
684 linkConstraints3.gridy = 2;
685 linkConstraints3.weightx = 1.0;
686 linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
687 linkTab.add(filterPanel, linkConstraints3);
692 private JPanel initLinkTabFilterPanel()
694 // Filter textbox and reset button
695 JLabel filterLabel = new JLabel(
696 MessageManager.getString("label.filter"));
697 filterLabel.setFont(LABEL_FONT);
698 filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
699 filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
701 filterTB.setFont(LABEL_FONT);
702 filterTB.setText("");
704 doReset.setText(MessageManager.getString("action.showall"));
705 userOnly.setText(MessageManager.getString("action.customfilter"));
707 // Panel for filter functionality
708 JPanel filterPanel = new JPanel(new GridBagLayout());
709 filterPanel.setBorder(new TitledBorder("Filter"));
710 GridBagConstraints gbc = new GridBagConstraints();
713 gbc.fill = GridBagConstraints.NONE;
714 gbc.anchor = GridBagConstraints.WEST;
716 filterPanel.add(filterLabel, gbc);
718 GridBagConstraints gbc1 = new GridBagConstraints();
721 gbc1.fill = GridBagConstraints.HORIZONTAL;
722 gbc1.anchor = GridBagConstraints.WEST;
724 filterPanel.add(filterTB, gbc1);
726 GridBagConstraints gbc2 = new GridBagConstraints();
728 gbc2.fill = GridBagConstraints.NONE;
729 gbc2.anchor = GridBagConstraints.WEST;
730 filterPanel.add(doReset, gbc2);
732 GridBagConstraints gbc3 = new GridBagConstraints();
734 gbc3.fill = GridBagConstraints.NONE;
735 gbc3.anchor = GridBagConstraints.WEST;
736 filterPanel.add(userOnly, gbc3);
741 private JPanel initLinkTabUrlButtons()
743 // Buttons for new / edit / delete Url links
744 JButton newLink = new JButton();
745 newLink.setText(MessageManager.getString("action.new"));
747 editLink.setText(MessageManager.getString("action.edit"));
749 deleteLink.setText(MessageManager.getString("action.delete"));
751 // no current selection, so initially disable delete/edit buttons
752 editLink.setEnabled(false);
753 deleteLink.setEnabled(false);
755 newLink.addActionListener(new java.awt.event.ActionListener()
758 public void actionPerformed(ActionEvent e)
760 newLink_actionPerformed(e);
764 editLink.setText(MessageManager.getString("action.edit"));
765 editLink.addActionListener(new java.awt.event.ActionListener()
768 public void actionPerformed(ActionEvent e)
770 editLink_actionPerformed(e);
774 deleteLink.setText(MessageManager.getString("action.delete"));
775 deleteLink.addActionListener(new java.awt.event.ActionListener()
778 public void actionPerformed(ActionEvent e)
780 deleteLink_actionPerformed(e);
784 JPanel buttonPanel = new JPanel(new GridBagLayout());
785 buttonPanel.setBorder(new TitledBorder("Edit links"));
786 GridBagConstraints gbc = new GridBagConstraints();
789 gbc.fill = GridBagConstraints.NONE;
790 buttonPanel.add(newLink, gbc);
792 GridBagConstraints gbc1 = new GridBagConstraints();
795 gbc1.fill = GridBagConstraints.NONE;
796 buttonPanel.add(editLink, gbc1);
798 GridBagConstraints gbc2 = new GridBagConstraints();
801 gbc2.fill = GridBagConstraints.NONE;
802 buttonPanel.add(deleteLink, gbc2);
804 GridBagConstraints gbc3 = new GridBagConstraints();
807 gbc3.fill = GridBagConstraints.HORIZONTAL;
809 JPanel spacePanel = new JPanel();
810 spacePanel.setBorder(null);
811 buttonPanel.add(spacePanel, gbc3);
817 * Initialises the proxy server panel in the Connections tab
819 * @return the proxy server panel
821 private JPanel initConnTabProxyPanel()
823 // Label for server text box
824 serverLabel.setText(MessageManager.getString("label.address"));
825 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
826 serverLabel.setFont(LABEL_FONT);
828 // Proxy server and port text boxes
829 proxyServerTB.setFont(LABEL_FONT);
830 proxyPortTB.setFont(LABEL_FONT);
832 // Label for Port text box
833 portLabel.setFont(LABEL_FONT);
834 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
835 portLabel.setText(MessageManager.getString("label.port"));
837 // Use proxy server checkbox
838 useProxy.setFont(LABEL_FONT);
839 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
840 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
841 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
842 useProxy.addActionListener(new ActionListener()
845 public void actionPerformed(ActionEvent e)
847 useProxy_actionPerformed();
851 // Make proxy server panel
852 JPanel proxyPanel = new JPanel();
853 TitledBorder titledBorder1 = new TitledBorder(
854 MessageManager.getString("label.proxy_server"));
855 proxyPanel.setBorder(titledBorder1);
856 proxyPanel.setLayout(new GridBagLayout());
857 proxyPanel.add(serverLabel,
858 new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
859 GridBagConstraints.WEST, GridBagConstraints.NONE,
860 new Insets(0, 2, 2, 0), 5, 0));
861 proxyPanel.add(portLabel,
862 new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
863 GridBagConstraints.WEST, GridBagConstraints.NONE,
864 new Insets(0, 0, 2, 0), 11, 0));
865 proxyPanel.add(useProxy,
866 new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
867 GridBagConstraints.WEST, GridBagConstraints.NONE,
868 new Insets(0, 2, 5, 185), 2, -4));
869 proxyPanel.add(proxyPortTB,
870 new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
871 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
872 new Insets(0, 2, 2, 2), 54, 1));
873 proxyPanel.add(proxyServerTB,
874 new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
875 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
876 new Insets(0, 2, 2, 0), 263, 1));
882 * Initialises the checkboxes in the Connections tab
884 private void initConnTabCheckboxes()
886 // Usage stats checkbox label
888 MessageManager.getString("label.send_usage_statistics"));
889 usagestats.setFont(LABEL_FONT);
890 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
891 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
893 // Questionnaire checkbox label
894 questionnaire.setText(
895 MessageManager.getString("label.check_for_questionnaires"));
896 questionnaire.setFont(LABEL_FONT);
897 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
898 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
900 // Check for latest version checkbox label
901 versioncheck.setText(
902 MessageManager.getString("label.check_for_latest_version"));
903 versioncheck.setFont(LABEL_FONT);
904 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
905 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
909 * Initialises the parent panel which contains the tabbed sections.
913 private JPanel initOkCancelPanel()
915 JButton ok = new JButton();
916 ok.setText(MessageManager.getString("action.ok"));
917 ok.addActionListener(new ActionListener()
920 public void actionPerformed(ActionEvent e)
922 ok_actionPerformed(e);
925 JButton cancel = new JButton();
926 cancel.setText(MessageManager.getString("action.cancel"));
927 cancel.addActionListener(new ActionListener()
930 public void actionPerformed(ActionEvent e)
932 cancel_actionPerformed(e);
935 JPanel okCancelPanel = new JPanel();
936 okCancelPanel.add(ok);
937 okCancelPanel.add(cancel);
938 return okCancelPanel;
942 * Initialises the Colours tabbed panel.
946 private JPanel initColoursTab()
948 JPanel coloursTab = new JPanel();
949 coloursTab.setBorder(new TitledBorder(
950 MessageManager.getString("action.open_new_alignment")));
951 coloursTab.setLayout(new FlowLayout());
952 JLabel mincolourLabel = new JLabel();
953 mincolourLabel.setFont(LABEL_FONT);
954 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
955 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
956 minColour.setFont(LABEL_FONT);
957 minColour.setBorder(BorderFactory.createEtchedBorder());
958 minColour.setPreferredSize(new Dimension(40, 20));
959 minColour.addMouseListener(new MouseAdapter()
962 public void mousePressed(MouseEvent e)
964 minColour_actionPerformed(minColour);
967 JLabel maxcolourLabel = new JLabel();
968 maxcolourLabel.setFont(LABEL_FONT);
969 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
970 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
971 maxColour.setFont(LABEL_FONT);
972 maxColour.setBorder(BorderFactory.createEtchedBorder());
973 maxColour.setPreferredSize(new Dimension(40, 20));
974 maxColour.addMouseListener(new MouseAdapter()
977 public void mousePressed(MouseEvent e)
979 maxColour_actionPerformed(maxColour);
983 protColour.setFont(LABEL_FONT);
984 protColour.setBounds(new Rectangle(172, 225, 155, 21));
985 JLabel protColourLabel = new JLabel();
986 protColourLabel.setFont(LABEL_FONT);
987 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
988 protColourLabel.setText(
989 MessageManager.getString("label.prot_alignment_colour") + " ");
990 JvSwingUtils.addtoLayout(coloursTab,
992 .getString("label.default_colour_scheme_for_alignment"),
993 protColourLabel, protColour);
995 nucColour.setFont(LABEL_FONT);
996 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
997 JLabel nucColourLabel = new JLabel();
998 nucColourLabel.setFont(LABEL_FONT);
999 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1000 nucColourLabel.setText(
1001 MessageManager.getString("label.nuc_alignment_colour") + " ");
1002 JvSwingUtils.addtoLayout(coloursTab,
1004 .getString("label.default_colour_scheme_for_alignment"),
1005 nucColourLabel, nucColour);
1007 JPanel annotationShding = new JPanel();
1008 annotationShding.setBorder(new TitledBorder(
1009 MessageManager.getString("label.annotation_shading_default")));
1010 annotationShding.setLayout(new GridLayout(1, 2));
1011 JvSwingUtils.addtoLayout(annotationShding,
1012 MessageManager.getString(
1013 "label.default_minimum_colour_annotation_shading"),
1014 mincolourLabel, minColour);
1015 JvSwingUtils.addtoLayout(annotationShding,
1016 MessageManager.getString(
1017 "label.default_maximum_colour_annotation_shading"),
1018 maxcolourLabel, maxColour);
1019 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1024 * Initialises the Overview tabbed panel.
1028 private JPanel initOverviewTab()
1030 JPanel overviewPanel = new JPanel();
1031 overviewPanel.setBorder(new TitledBorder(
1032 MessageManager.getString("label.overview_settings")));
1034 gapColour.setFont(LABEL_FONT);
1035 // fixing the border colours stops apparent colour bleed from the panel
1036 gapColour.setBorder(
1037 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1038 gapColour.setPreferredSize(new Dimension(40, 20));
1039 gapColour.addMouseListener(new MouseAdapter()
1042 public void mousePressed(MouseEvent e)
1044 gapColour_actionPerformed(gapColour);
1048 hiddenColour.setFont(LABEL_FONT);
1049 // fixing the border colours stops apparent colour bleed from the panel
1050 hiddenColour.setBorder(
1051 BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1052 hiddenColour.setPreferredSize(new Dimension(40, 20));
1053 hiddenColour.addMouseListener(new MouseAdapter()
1056 public void mousePressed(MouseEvent e)
1058 hiddenColour_actionPerformed(hiddenColour);
1062 useLegacyGap = new JCheckBox(
1063 MessageManager.getString("label.ov_legacy_gap"));
1064 useLegacyGap.setFont(LABEL_FONT);
1065 useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1066 useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1067 gapLabel = new JLabel(
1068 MessageManager.getString("label.gap_colour"));
1069 gapLabel.setFont(LABEL_FONT);
1070 gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1071 gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1072 showHiddenAtStart = new JCheckBox(
1073 MessageManager.getString("label.ov_show_hide_default"));
1074 showHiddenAtStart.setFont(LABEL_FONT);
1075 showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1076 showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1077 JLabel hiddenLabel = new JLabel(
1078 MessageManager.getString("label.hidden_colour"));
1079 hiddenLabel.setFont(LABEL_FONT);
1080 hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1081 hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1083 useLegacyGap.addActionListener(new ActionListener()
1086 public void actionPerformed(ActionEvent e)
1088 useLegacyGaps_actionPerformed(e);
1092 overviewPanel.setLayout(new GridBagLayout());
1093 GridBagConstraints c1 = new GridBagConstraints();
1095 c1.fill = GridBagConstraints.HORIZONTAL;
1100 c1.anchor = GridBagConstraints.FIRST_LINE_START;
1101 overviewPanel.add(useLegacyGap, c1);
1103 GridBagConstraints c2 = new GridBagConstraints();
1104 c2.fill = GridBagConstraints.HORIZONTAL;
1107 c2.insets = new Insets(0, 15, 0, 10);
1108 overviewPanel.add(gapLabel, c2);
1110 GridBagConstraints c3 = new GridBagConstraints();
1111 c3.fill = GridBagConstraints.HORIZONTAL;
1114 c3.insets = new Insets(0, 0, 0, 15);
1115 overviewPanel.add(gapColour, c3);
1117 GridBagConstraints c4 = new GridBagConstraints();
1118 c4.fill = GridBagConstraints.HORIZONTAL;
1122 overviewPanel.add(showHiddenAtStart, c4);
1124 GridBagConstraints c5 = new GridBagConstraints();
1125 c5.fill = GridBagConstraints.HORIZONTAL;
1128 c5.insets = new Insets(0, 15, 0, 10);
1129 overviewPanel.add(hiddenLabel, c5);
1131 GridBagConstraints c6 = new GridBagConstraints();
1132 c6.fill = GridBagConstraints.HORIZONTAL;
1135 c6.insets = new Insets(0, 0, 0, 15);
1136 overviewPanel.add(hiddenColour, c6);
1138 JButton resetButton = new JButton(
1139 MessageManager.getString("label.reset_to_defaults"));
1141 resetButton.addActionListener(new ActionListener()
1144 public void actionPerformed(ActionEvent e)
1146 resetOvDefaults_actionPerformed(e);
1150 GridBagConstraints c7 = new GridBagConstraints();
1151 c7.fill = GridBagConstraints.NONE;
1154 c7.insets = new Insets(10, 0, 0, 0);
1155 c7.anchor = GridBagConstraints.WEST;
1156 overviewPanel.add(resetButton, c7);
1158 // Add padding so the panel doesn't look ridiculous
1159 JPanel spacePanel = new JPanel();
1160 overviewPanel.add(spacePanel,
1161 new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1162 GridBagConstraints.WEST, GridBagConstraints.BOTH,
1163 new Insets(0, 0, 0, 5), 0, 0));
1165 return overviewPanel;
1169 * Initialises the Structure tabbed panel.
1173 private JPanel initStructureTab()
1175 structureTab = new JPanel();
1177 structureTab.setBorder(new TitledBorder(
1178 MessageManager.getString("label.structure_options")));
1179 structureTab.setLayout(null);
1180 final int width = 400;
1181 final int height = 22;
1182 final int lineSpacing = 25;
1185 structFromPdb.setFont(LABEL_FONT);
1187 .setText(MessageManager.getString("label.struct_from_pdb"));
1188 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1189 structFromPdb.addActionListener(new ActionListener()
1192 public void actionPerformed(ActionEvent e)
1194 boolean selected = structFromPdb.isSelected();
1195 // enable other options only when the first is checked
1196 useRnaView.setEnabled(selected);
1197 addSecondaryStructure.setEnabled(selected);
1198 addTempFactor.setEnabled(selected);
1201 structureTab.add(structFromPdb);
1203 // indent checkboxes that are conditional on the first one
1204 ypos += lineSpacing;
1205 useRnaView.setFont(LABEL_FONT);
1206 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1207 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1208 structureTab.add(useRnaView);
1210 ypos += lineSpacing;
1211 addSecondaryStructure.setFont(LABEL_FONT);
1212 addSecondaryStructure
1213 .setText(MessageManager.getString("label.autoadd_secstr"));
1214 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1215 structureTab.add(addSecondaryStructure);
1217 ypos += lineSpacing;
1218 addTempFactor.setFont(LABEL_FONT);
1219 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1220 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1221 structureTab.add(addTempFactor);
1223 ypos += lineSpacing;
1224 JLabel viewerLabel = new JLabel();
1225 viewerLabel.setFont(LABEL_FONT);
1226 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1227 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1228 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1229 structureTab.add(viewerLabel);
1231 structViewer.setFont(LABEL_FONT);
1232 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1233 structViewer.addItem(ViewerType.JMOL.name());
1234 structViewer.addItem(ViewerType.CHIMERA.name());
1235 structViewer.addActionListener(new ActionListener()
1238 public void actionPerformed(ActionEvent e)
1240 structureViewer_actionPerformed(
1241 (String) structViewer.getSelectedItem());
1244 structureTab.add(structViewer);
1246 ypos += lineSpacing;
1247 JLabel pathLabel = new JLabel();
1248 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1249 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1250 pathLabel.setText(MessageManager.getString("label.chimera_path"));
1251 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1252 structureTab.add(pathLabel);
1254 chimeraPath.setFont(LABEL_FONT);
1255 chimeraPath.setText("");
1256 final String tooltip = JvSwingUtils.wrapTooltip(true,
1257 MessageManager.getString("label.chimera_path_tip"));
1258 chimeraPath.setToolTipText(tooltip);
1259 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1260 chimeraPath.addMouseListener(new MouseAdapter()
1263 public void mouseClicked(MouseEvent e)
1265 if (e.getClickCount() == 2)
1267 String chosen = openFileChooser();
1270 chimeraPath.setText(chosen);
1275 structureTab.add(chimeraPath);
1277 ypos += lineSpacing;
1278 nwMapping.setFont(LABEL_FONT);
1279 nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1280 siftsMapping.setFont(LABEL_FONT);
1281 siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1282 mappingMethod.add(nwMapping);
1283 mappingMethod.add(siftsMapping);
1284 JPanel mappingPanel = new JPanel();
1285 mappingPanel.setFont(LABEL_FONT);
1286 TitledBorder mmTitledBorder = new TitledBorder(
1287 MessageManager.getString("label.mapping_method"));
1288 mmTitledBorder.setTitleFont(LABEL_FONT);
1289 mappingPanel.setBorder(mmTitledBorder);
1290 mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1291 // GridLayout mappingLayout = new GridLayout();
1292 mappingPanel.setLayout(new GridLayout());
1293 mappingPanel.add(nwMapping);
1294 mappingPanel.add(siftsMapping);
1295 structureTab.add(mappingPanel);
1297 ypos += lineSpacing;
1298 ypos += lineSpacing;
1299 FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1300 PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1301 docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1302 structureTab.add(docFieldPref);
1304 return structureTab;
1308 * Action on choosing a structure viewer from combobox options.
1310 * @param selectedItem
1312 protected void structureViewer_actionPerformed(String selectedItem)
1317 * Show a dialog for the user to choose a file. Returns the chosen path, or
1322 protected String openFileChooser()
1324 String choice = null;
1325 JFileChooser chooser = new JFileChooser();
1327 // chooser.setFileView(new JalviewFileView());
1328 chooser.setDialogTitle(
1329 MessageManager.getString("label.open_local_file"));
1330 chooser.setToolTipText(MessageManager.getString("action.open"));
1332 int value = chooser.showOpenDialog(this);
1334 if (value == JFileChooser.APPROVE_OPTION)
1336 choice = chooser.getSelectedFile().getPath();
1342 * Validate the structure tab preferences; if invalid, set focus on this tab.
1346 protected boolean validateStructure(FocusEvent e)
1348 if (!validateStructure())
1350 e.getComponent().requestFocusInWindow();
1356 protected boolean validateStructure()
1362 * Initialises the Visual tabbed panel.
1366 private JPanel initVisualTab()
1368 JPanel visualTab = new JPanel();
1369 visualTab.setBorder(new TitledBorder(
1370 MessageManager.getString("action.open_new_alignment")));
1371 visualTab.setLayout(null);
1372 fullScreen.setFont(LABEL_FONT);
1373 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1374 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1375 fullScreen.setText(MessageManager.getString("label.maximize_window"));
1376 quality.setEnabled(false);
1377 quality.setFont(LABEL_FONT);
1378 quality.setHorizontalAlignment(SwingConstants.RIGHT);
1379 quality.setHorizontalTextPosition(SwingConstants.LEFT);
1380 quality.setSelected(true);
1381 quality.setText(MessageManager.getString("label.quality"));
1382 conservation.setEnabled(false);
1383 conservation.setFont(LABEL_FONT);
1384 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1385 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1386 conservation.setSelected(true);
1387 conservation.setText(MessageManager.getString("label.conservation"));
1388 identity.setEnabled(false);
1389 identity.setFont(LABEL_FONT);
1390 identity.setHorizontalAlignment(SwingConstants.RIGHT);
1391 identity.setHorizontalTextPosition(SwingConstants.LEFT);
1392 identity.setSelected(true);
1393 identity.setText(MessageManager.getString("label.consensus"));
1394 showOccupancy.setFont(LABEL_FONT);
1395 showOccupancy.setEnabled(false);
1396 showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1397 showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1398 showOccupancy.setSelected(true);
1399 showOccupancy.setText(MessageManager.getString("label.occupancy"));
1401 JLabel showGroupbits = new JLabel();
1402 showGroupbits.setFont(LABEL_FONT);
1403 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1404 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1406 .setText(MessageManager.getString("action.show_group") + ":");
1407 JLabel showConsensbits = new JLabel();
1408 showConsensbits.setFont(LABEL_FONT);
1409 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1410 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1412 .setText(MessageManager.getString("label.consensus") + ":");
1413 showConsensHistogram.setEnabled(false);
1414 showConsensHistogram.setFont(LABEL_FONT);
1415 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1416 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1417 showConsensHistogram.setSelected(true);
1418 showConsensHistogram
1419 .setText(MessageManager.getString("label.histogram"));
1420 showConsensLogo.setEnabled(false);
1421 showConsensLogo.setFont(LABEL_FONT);
1422 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1423 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1424 showConsensLogo.setSelected(true);
1425 showConsensLogo.setText(MessageManager.getString("label.logo"));
1426 showGroupConsensus.setEnabled(false);
1427 showGroupConsensus.setFont(LABEL_FONT);
1428 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1429 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1430 showGroupConsensus.setSelected(true);
1431 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1432 showGroupConservation.setEnabled(false);
1433 showGroupConservation.setFont(LABEL_FONT);
1434 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1435 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1436 showGroupConservation.setSelected(true);
1437 showGroupConservation
1438 .setText(MessageManager.getString("label.conservation"));
1439 showNpTooltip.setEnabled(true);
1440 showNpTooltip.setFont(LABEL_FONT);
1441 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1442 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1443 showNpTooltip.setSelected(true);
1444 showNpTooltip.setText(
1445 MessageManager.getString("label.non_positional_features"));
1446 showDbRefTooltip.setEnabled(true);
1447 showDbRefTooltip.setFont(LABEL_FONT);
1448 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1449 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1450 showDbRefTooltip.setSelected(true);
1452 .setText(MessageManager.getString("label.database_references"));
1453 annotations.setFont(LABEL_FONT);
1454 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1455 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1456 annotations.setSelected(true);
1457 annotations.setText(MessageManager.getString("label.show_annotations"));
1458 // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1459 annotations.addActionListener(new ActionListener()
1462 public void actionPerformed(ActionEvent e)
1464 annotations_actionPerformed(e);
1467 identity.addActionListener(new ActionListener()
1470 public void actionPerformed(ActionEvent e)
1472 annotations_actionPerformed(e);
1475 showGroupConsensus.addActionListener(new ActionListener()
1478 public void actionPerformed(ActionEvent e)
1480 annotations_actionPerformed(e);
1483 showUnconserved.setFont(LABEL_FONT);
1484 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1485 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1486 showUnconserved.setSelected(true);
1488 .setText(MessageManager.getString("action.show_unconserved"));
1489 showUnconserved.addActionListener(new ActionListener()
1492 public void actionPerformed(ActionEvent e)
1494 showunconserved_actionPerformed(e);
1498 // TODO these are not yet added to / action from Preferences
1499 // JCheckBox shareSelections = new JCheckBox();
1500 // shareSelections.setFont(verdana11);
1501 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1502 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1503 // shareSelections.setSelected(true);
1504 // shareSelections.setText(MessageManager
1505 // .getString("label.share_selection_across_views"));
1506 // JCheckBox followHighlight = new JCheckBox();
1507 // followHighlight.setFont(verdana11);
1508 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1509 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1510 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1511 // followHighlight.setSelected(true);
1512 // followHighlight.setText(MessageManager
1513 // .getString("label.scroll_highlighted_regions"));
1515 seqLimit.setFont(LABEL_FONT);
1516 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1517 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1518 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1519 smoothFont.setFont(LABEL_FONT);
1520 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1521 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1522 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1523 scaleProteinToCdna.setFont(LABEL_FONT);
1524 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1525 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1526 scaleProteinToCdna.setText(
1527 MessageManager.getString("label.scale_protein_to_cdna"));
1528 scaleProteinToCdna.setToolTipText(
1529 MessageManager.getString("label.scale_protein_to_cdna_tip"));
1530 JLabel gapLabel = new JLabel();
1531 gapLabel.setFont(LABEL_FONT);
1532 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1533 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1534 JLabel fontLabel = new JLabel();
1535 fontLabel.setFont(LABEL_FONT);
1536 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1537 fontLabel.setText(MessageManager.getString("label.font"));
1538 fontSizeCB.setFont(LABEL_FONT);
1539 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1540 fontStyleCB.setFont(LABEL_FONT);
1541 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1542 fontNameCB.setFont(LABEL_FONT);
1543 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1544 gapSymbolCB.setFont(LABEL_FONT);
1545 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1546 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1547 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1548 gapSymbolCB.setRenderer(dlcr);
1550 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1551 startupCheckbox.setFont(LABEL_FONT);
1552 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1553 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1554 startupCheckbox.setSelected(true);
1555 startupFileTextfield.setFont(LABEL_FONT);
1556 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1557 final String tooltip = JvSwingUtils.wrapTooltip(true,
1558 MessageManager.getString("label.double_click_to_browse"));
1559 startupFileTextfield.setToolTipText(tooltip);
1560 startupFileTextfield.addMouseListener(new MouseAdapter()
1563 public void mouseClicked(MouseEvent e)
1565 if (e.getClickCount() > 1)
1567 startupFileTextfield_mouseClicked();
1572 sortby.setFont(LABEL_FONT);
1573 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1574 JLabel sortLabel = new JLabel();
1575 sortLabel.setFont(LABEL_FONT);
1576 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1577 sortLabel.setText(MessageManager.getString("label.sort_by"));
1578 sortAnnBy.setFont(LABEL_FONT);
1579 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1580 JLabel sortAnnLabel = new JLabel();
1581 sortAnnLabel.setFont(LABEL_FONT);
1582 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1583 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1584 sortAutocalc.setFont(LABEL_FONT);
1585 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1587 JPanel annsettingsPanel = new JPanel();
1588 annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1589 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1590 annsettingsPanel.setBorder(new EtchedBorder());
1591 visualTab.add(annsettingsPanel);
1592 Border jb = new EmptyBorder(1, 1, 4, 5);
1593 annotations.setBorder(jb);
1594 showOccupancy.setBorder(jb);
1595 quality.setBorder(jb);
1596 conservation.setBorder(jb);
1597 identity.setBorder(jb);
1598 showConsensbits.setBorder(jb);
1599 showGroupbits.setBorder(jb);
1600 showGroupConsensus.setBorder(jb);
1601 showGroupConservation.setBorder(jb);
1602 showConsensHistogram.setBorder(jb);
1603 showConsensLogo.setBorder(jb);
1605 JPanel autoAnnotSettings = new JPanel();
1606 annsettingsPanel.add(autoAnnotSettings);
1607 autoAnnotSettings.setLayout(new GridLayout(0, 2));
1608 autoAnnotSettings.add(annotations);
1609 autoAnnotSettings.add(quality);
1610 // second row of autoannotation box
1611 autoAnnotSettings = new JPanel();
1612 annsettingsPanel.add(autoAnnotSettings);
1614 autoAnnotSettings.setLayout(new GridLayout(0, 3));
1615 autoAnnotSettings.add(conservation);
1616 autoAnnotSettings.add(identity);
1617 autoAnnotSettings.add(showOccupancy);
1618 autoAnnotSettings.add(showGroupbits);
1619 autoAnnotSettings.add(showGroupConservation);
1620 autoAnnotSettings.add(showGroupConsensus);
1621 autoAnnotSettings.add(showConsensbits);
1622 autoAnnotSettings.add(showConsensHistogram);
1623 autoAnnotSettings.add(showConsensLogo);
1625 JPanel tooltipSettings = new JPanel();
1626 tooltipSettings.setBorder(new TitledBorder(
1627 MessageManager.getString("label.sequence_id_tooltip")));
1628 tooltipSettings.setBounds(173, 140, 220, 62);
1629 tooltipSettings.setLayout(new GridLayout(2, 1));
1630 tooltipSettings.add(showDbRefTooltip);
1631 tooltipSettings.add(showNpTooltip);
1632 visualTab.add(tooltipSettings);
1634 wrap.setFont(LABEL_FONT);
1635 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1636 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1637 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1638 rightAlign.setFont(LABEL_FONT);
1639 rightAlign.setForeground(Color.black);
1640 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1641 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1642 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1643 idItalics.setFont(LABEL_FONT_ITALIC);
1644 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1645 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1647 MessageManager.getString("label.sequence_name_italics"));
1648 openoverv.setFont(LABEL_FONT);
1649 openoverv.setActionCommand(
1650 MessageManager.getString("label.open_overview"));
1651 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1652 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1653 openoverv.setText(MessageManager.getString("label.open_overview"));
1654 JPanel jPanel2 = new JPanel();
1655 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1656 jPanel2.setLayout(new GridLayout(14, 1));
1657 jPanel2.add(fullScreen);
1658 jPanel2.add(openoverv);
1659 jPanel2.add(seqLimit);
1660 jPanel2.add(rightAlign);
1661 jPanel2.add(fontLabel);
1662 jPanel2.add(showUnconserved);
1663 jPanel2.add(idItalics);
1664 jPanel2.add(smoothFont);
1665 jPanel2.add(scaleProteinToCdna);
1666 jPanel2.add(gapLabel);
1668 jPanel2.add(sortLabel);
1669 jPanel2.add(sortAnnLabel);
1670 jPanel2.add(startupCheckbox);
1671 visualTab.add(jPanel2);
1672 visualTab.add(startupFileTextfield);
1673 visualTab.add(sortby);
1674 visualTab.add(sortAnnBy);
1675 visualTab.add(sortAutocalc);
1676 visualTab.add(gapSymbolCB);
1677 visualTab.add(fontNameCB);
1678 visualTab.add(fontSizeCB);
1679 visualTab.add(fontStyleCB);
1684 * Initialises the Backups tabbed panel.
1688 private JPanel initBackupsTab()
1690 JPanel backupsTab = new JPanel();
1691 // backupsTab.setBorder(new TitledBorder(MessageManager
1692 // .getString("label.backup_files")));
1693 backupsTab.setLayout(new GridBagLayout());
1695 enableBackupFiles.setFont(LABEL_FONT);
1696 enableBackupFiles.setText(
1697 MessageManager.getString("label.enable_backupfiles"));
1698 enableBackupFiles.addActionListener(new ActionListener()
1701 public void actionPerformed(ActionEvent e)
1703 boolean selected = enableBackupFiles.isSelected();
1704 // enable other options only when the first is checked
1705 backupsOptionsSetEnabled(selected);
1709 GridBagConstraints gbc = new GridBagConstraints();
1712 gbc.anchor = GridBagConstraints.NORTHWEST;
1713 gbc.fill = GridBagConstraints.NONE;
1715 // enable checkbox 1 row
1718 backupsTab.add(enableBackupFiles, gbc);
1720 initBackupsTabSuffixPanel();
1721 initBackupsTabKeepFilesPanel();
1722 initBackupsTabFilenameExamplesPanel();
1725 // set widths of the panels to the max one
1726 int maxw = suffixPanel.getWidth();
1727 if (maxw < keepfilesPanel.getWidth())
1729 maxw = keepfilesPanel.getWidth();
1731 if (maxw < exampleFilesPanel.getWidth())
1733 maxw = exampleFilesPanel.getWidth();
1735 suffixPanel.setSize(suffixPanel.getHeight(), maxw);
1736 keepfilesPanel.setSize(keepfilesPanel.getHeight(), maxw);
1737 exampleFilesPanel.setSize(exampleFilesPanel.getHeight(), maxw);
1740 // whole suffix panel next row
1742 backupsTab.add(suffixPanel, gbc);
1746 backupsTab.add(keepfilesPanel, gbc);
1748 // whole examples panel next row
1750 backupsTab.add(exampleFilesPanel, gbc);
1755 backupsTab.add(new JPanel(), gbc);
1757 backupsOptionsSetEnabled(enableBackupFiles.isSelected());
1762 public JPanel initBackupsTabSuffixPanel()
1764 suffixPanel.setBorder(new TitledBorder(
1765 MessageManager.getString("label.suffix_format")));
1766 suffixPanel.setLayout(new GridBagLayout());
1769 .setText(MessageManager.getString("label.suffix_template"));
1770 suffixTemplateLabel.setHorizontalAlignment(SwingConstants.LEFT);
1771 suffixTemplateLabel.setFont(LABEL_FONT);
1773 final String tooltip = JvSwingUtils.wrapTooltip(true, MessageManager
1774 .getString("label.suffix_template_tooltip"));
1775 suffixTemplate.setToolTipText(tooltip);
1776 suffixTemplate.addActionListener(new ActionListener()
1779 public void actionPerformed(ActionEvent e)
1781 updateBackupFilesExampleLabel();
1785 KeyListener kl = new KeyListener()
1788 public void keyReleased(KeyEvent e)
1790 updateBackupFilesExampleLabel();
1794 public void keyPressed(KeyEvent e)
1798 // disable use of ':'
1800 public void keyTyped(KeyEvent e)
1802 char c = e.getKeyChar();
1805 // don't process ':'
1811 suffixTemplate.addKeyListener(kl);
1815 .setText(MessageManager.getString("label.index_digits"));
1816 suffixDigitsLabel.setHorizontalAlignment(SwingConstants.LEFT);
1817 suffixDigitsLabel.setFont(LABEL_FONT);
1820 ChangeListener c = new ChangeListener()
1823 public void stateChanged(ChangeEvent e)
1825 updateBackupFilesExampleLabel();
1829 setIntegerSpinner(suffixDigitsSpinner, defaultmin, defaultmax, 3, c);
1831 suffixReverse.setLabels(
1832 MessageManager.getString("label.reverse_roll"),
1833 MessageManager.getString("label.increment_index"));
1834 suffixReverse.addActionListener(new ActionListener()
1837 public void actionPerformed(ActionEvent e)
1839 updateBackupFilesExampleLabel();
1843 GridBagConstraints sgbc = new GridBagConstraints();
1845 // first row (template text box)
1846 sgbc.anchor = GridBagConstraints.WEST;
1850 sgbc.gridheight = 1;
1853 sgbc.fill = GridBagConstraints.NONE;
1854 suffixPanel.add(suffixTemplateLabel,sgbc);
1857 sgbc.fill = GridBagConstraints.HORIZONTAL;
1858 suffixPanel.add(suffixTemplate, sgbc);
1860 // second row (number of digits spinner)
1864 sgbc.fill = GridBagConstraints.NONE;
1865 suffixPanel.add(suffixDigitsLabel, sgbc);
1868 sgbc.fill = GridBagConstraints.HORIZONTAL;
1869 suffixPanel.add(suffixDigitsSpinner, sgbc);
1871 // third row (forward order radio selection)
1874 sgbc.gridwidth = GridBagConstraints.REMAINDER;
1875 sgbc.fill = GridBagConstraints.HORIZONTAL;
1876 suffixPanel.add(suffixReverse.getFalseButton(), sgbc);
1878 // fourth row (reverse order radio selection)
1880 suffixPanel.add(suffixReverse.getTrueButton(), sgbc);
1884 private JPanel initBackupsTabKeepFilesPanel()
1886 keepfilesPanel.setBorder(
1887 new TitledBorder(MessageManager.getString("label.keep_files")));
1888 keepfilesPanel.setLayout(new GridBagLayout());
1890 backupfilesKeepAll.setLabels(
1891 MessageManager.getString("label.keep_all_backup_files"),
1892 MessageManager.getString(
1893 "label.keep_only_this_number_of_backup_files"));
1894 backupfilesKeepAll.addTrueActionListener(new ActionListener()
1897 public void actionPerformed(ActionEvent e)
1899 updateBackupFilesExampleLabel();
1902 backupfilesKeepAll.addActionListener(new ActionListener()
1905 public void actionPerformed(ActionEvent e)
1907 boolean selected = backupfilesKeepAll.isSelected();
1908 keepRollMaxOptionsEnabled(!selected);
1909 updateBackupFilesExampleLabel();
1913 ChangeListener c = new ChangeListener()
1916 public void stateChanged(ChangeEvent e)
1918 updateBackupFilesExampleLabel();
1922 setIntegerSpinner(backupfilesRollMaxSpinner, 1, 999, 4, true, c);
1924 backupfilesConfirmDelete.setLabels(
1925 MessageManager.getString("label.confirm_delete"),
1926 MessageManager.getString("label.auto_delete"));
1927 // update the enabled section
1928 keepRollMaxOptionsEnabled(!backupfilesKeepAll.isSelected());
1930 GridBagConstraints kgbc = new GridBagConstraints();
1932 // first row (template text box)
1933 kgbc.anchor = GridBagConstraints.WEST;
1936 kgbc.gridwidth = GridBagConstraints.REMAINDER;
1937 kgbc.gridheight = 1;
1940 kgbc.fill = GridBagConstraints.HORIZONTAL;
1941 keepfilesPanel.add(backupfilesKeepAll.getTrueButton(), kgbc);
1947 kgbc.gridwidth = GridBagConstraints.RELATIVE;
1948 keepfilesPanel.add(backupfilesKeepAll.getFalseButton(), kgbc);
1951 kgbc.gridwidth = GridBagConstraints.REMAINDER;
1952 keepfilesPanel.add(backupfilesRollMaxSpinner, kgbc);
1954 // third row (indented)
1956 kgbc.insets = new Insets(0, 20, 0, 0);
1959 kgbc.gridwidth = GridBagConstraints.REMAINDER;
1960 kgbc.fill = GridBagConstraints.HORIZONTAL;
1963 keepfilesPanel.add(backupfilesConfirmDelete.getTrueButton(), kgbc);
1965 // fourth row (indented)
1967 keepfilesPanel.add(backupfilesConfirmDelete.getFalseButton(), kgbc);
1970 JPanel jp = new JPanel();
1971 jp.setLayout(new FlowLayout());
1973 .setText(MessageManager.getString("label.old_backup_files"));
1974 oldBackupFilesLabel.setFont(LABEL_FONT);
1975 oldBackupFilesLabel.setHorizontalAlignment(SwingConstants.LEFT);
1976 jp.add(oldBackupFilesLabel);
1977 jp.add(backupfilesConfirmDelete.getTrueButton());
1978 jp.add(backupfilesConfirmDelete.getFalseButton());
1979 keepfilesPanel.add(jp, kgbc);
1981 return keepfilesPanel;
1984 private JPanel initBackupsTabFilenameExamplesPanel()
1986 exampleFilesPanel.setBorder(new TitledBorder(
1987 MessageManager.getString("label.example_filenames")));
1988 exampleFilesPanel.setLayout(new GridBagLayout());
1990 backupfilesExampleLabel.setEditable(false);
1991 backupfilesExampleLabel.setPreferredSize(new Dimension(400, 85));
1992 backupfilesExampleLabel.setAlignmentX(LEFT_ALIGNMENT);
1993 backupfilesExampleLabel.setAlignmentY(TOP_ALIGNMENT);
1995 backupfilesExampleLabel.setFont(LABEL_FONT_ITALIC);
1996 backupfilesExampleLabel
1997 .setBackground(exampleFilesPanel.getBackground());
1999 updateBackupFilesExampleLabel();
2001 GridBagConstraints gbc = new GridBagConstraints();
2002 gbc.anchor = GridBagConstraints.WEST;
2003 gbc.fill = GridBagConstraints.NONE;
2006 exampleFilesPanel.add(backupfilesExampleLabel, gbc);
2007 return exampleFilesPanel;
2010 protected void updateBackupFilesExampleLabel()
2012 int exampleindex = 12;
2013 String base = MessageManager.getString("label.filename");
2014 if (base == null || base.length() > 0)
2018 String extension = ".fa";
2020 String suffix = suffixTemplate.getText();
2023 suffixDigitsSpinner.commitEdit();
2024 digits = (Integer) suffixDigitsSpinner.getValue();
2025 digits = digits < 1 ? 1 : digits;
2026 } catch (Exception e)
2028 System.out.println("Failed casting (Integer) suffixTemplateSpinner.getValue()");
2030 boolean reverse = suffixReverse.isSelected();
2031 boolean keepAll = backupfilesKeepAll.isSelected();
2035 backupfilesRollMaxSpinner.commitEdit();
2036 rollMax = (Integer) backupfilesRollMaxSpinner.getValue();
2037 rollMax = rollMax < 1 ? 1 : rollMax;
2038 } catch (Exception e)
2041 "Failed casting (Integer) backupfilesRollMaxSpinner.getValue()");
2044 int lowersurround = 2;
2045 int uppersurround = 0;
2046 StringBuilder exampleSB = new StringBuilder();
2047 boolean firstLine = true;
2052 int max = keepAll ? exampleindex : rollMax;
2053 for (int index = min; index <= max; index++)
2055 if (index == min + lowersurround && index < max - uppersurround - 1)
2057 exampleSB.append("\n...");
2059 else if (index > min + lowersurround && index < max - uppersurround)
2071 exampleSB.append("\n");
2073 exampleSB.append(BackupFilenameFilter.getBackupFilename(index,
2074 base, suffix, digits, extension));
2077 // no extra text needed
2079 else if (index == min)
2081 String newest = MessageManager.getString("label.braced_newest");
2082 if (newest != null && newest.length() > 0)
2084 exampleSB.append(" "+newest);
2087 else if (index == max)
2089 String oldest = MessageManager.getString("label.braced_oldest");
2090 if (oldest != null && oldest.length() > 0)
2092 exampleSB.append(" "+oldest);
2101 int min = (keepAll || exampleindex - rollMax < 0) ? 1
2102 : exampleindex - rollMax + 1;
2103 int max = exampleindex;
2105 for (int index = min; index <= max; index++)
2108 if (index == min + lowersurround && index < max - uppersurround - 1)
2110 exampleSB.append("\n...");
2112 else if (index > min + lowersurround && index < max - uppersurround)
2124 exampleSB.append("\n");
2126 exampleSB.append(BackupFilenameFilter.getBackupFilename(index,
2127 base, suffix, digits, extension));
2130 // no extra text needed
2132 else if (index == min)
2134 String oldest = MessageManager.getString("label.braced_oldest");
2135 if (oldest != null && oldest.length() > 0)
2137 exampleSB.append(" "+oldest);
2140 else if (index == max)
2142 String newest = MessageManager.getString("label.braced_newest");
2143 if (newest != null && newest.length() > 0)
2145 exampleSB.append(" "+newest);
2153 backupfilesExampleLabel.setText(exampleSB.toString());
2156 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2157 boolean useExistingVal, ChangeListener c)
2164 i = Integer.parseInt((String) s.getValue());
2165 } catch (Exception e)
2168 "Exception casting the initial value of s.getValue()");
2172 setIntegerSpinner(s, min, max, i, c);
2175 protected void setIntegerSpinner(JSpinner s, int min, int max, int def,
2178 // integer spinner for number of digits
2183 SpinnerModel sModel = new SpinnerNumberModel(def, min, max, 1);
2186 s.addChangeListener(c);
2190 public static int getSpinnerInt(JSpinner s, int def)
2196 i = (Integer) s.getValue();
2197 } catch (Exception e)
2199 System.out.println("Failed casting (Integer) JSpinner s.getValue()");
2204 private void keepRollMaxOptionsEnabled(boolean enabled)
2206 oldBackupFilesLabel.setEnabled(enabled);
2207 backupfilesRollMaxSpinner.setEnabled(enabled);
2208 backupfilesConfirmDelete.setEnabled(enabled);
2212 protected void backupsOptionsSetEnabled(boolean enabled)
2214 suffixPanel.setEnabled(enabled);
2215 keepfilesPanel.setEnabled(enabled);
2216 exampleFilesPanel.setEnabled(enabled);
2218 suffixTemplate.setEnabled(enabled);
2219 suffixTemplateLabel.setEnabled(enabled);
2220 suffixDigitsLabel.setEnabled(enabled);
2221 suffixDigitsSpinner.setEnabled(enabled);
2222 suffixReverse.setEnabled(enabled);
2223 backupfilesKeepAll.setEnabled(enabled);
2224 backupfilesRollMaxSpinner.setEnabled(enabled);
2225 oldBackupFilesLabel.setEnabled(enabled);
2226 backupfilesConfirmDelete.setEnabled(enabled);
2227 backupfilesExampleLabel.setEnabled(enabled);
2229 keepRollMaxOptionsEnabled(enabled && !backupfilesKeepAll.isSelected());
2232 protected void autoIdWidth_actionPerformed()
2234 // TODO Auto-generated method stub
2238 protected void userIdWidth_actionPerformed()
2240 // TODO Auto-generated method stub
2244 protected void maxColour_actionPerformed(JPanel panel)
2248 protected void minColour_actionPerformed(JPanel panel)
2252 protected void gapColour_actionPerformed(JPanel panel)
2256 protected void hiddenColour_actionPerformed(JPanel panel)
2260 protected void showunconserved_actionPerformed(ActionEvent e)
2262 // TODO Auto-generated method stub
2266 protected void useLegacyGaps_actionPerformed(ActionEvent e)
2270 protected void resetOvDefaults_actionPerformed(ActionEvent e)
2280 public void ok_actionPerformed(ActionEvent e)
2290 public void cancel_actionPerformed(ActionEvent e)
2300 public void annotations_actionPerformed(ActionEvent e)
2307 public void startupFileTextfield_mouseClicked()
2311 public void newLink_actionPerformed(ActionEvent e)
2316 public void editLink_actionPerformed(ActionEvent e)
2321 public void deleteLink_actionPerformed(ActionEvent e)
2326 public void defaultBrowser_mouseClicked(MouseEvent e)
2331 public void linkURLList_keyTyped(KeyEvent e)
2336 public void useProxy_actionPerformed()
2338 boolean enabled = useProxy.isSelected();
2339 portLabel.setEnabled(enabled);
2340 serverLabel.setEnabled(enabled);
2341 proxyServerTB.setEnabled(enabled);
2342 proxyPortTB.setEnabled(enabled);
2346 * Customer renderer for JTable: supports column of radio buttons
2348 public class RadioButtonRenderer extends JRadioButton
2349 implements TableCellRenderer
2351 public RadioButtonRenderer()
2353 setHorizontalAlignment(CENTER);
2354 setToolTipText(MessageManager.getString("label.urltooltip"));
2358 public Component getTableCellRendererComponent(JTable table,
2359 Object value, boolean isSelected, boolean hasFocus, int row,
2362 setSelected((boolean) value);
2364 // set colours to match rest of table
2367 setBackground(table.getSelectionBackground());
2368 setForeground(table.getSelectionForeground());
2372 setBackground(table.getBackground());
2373 setForeground(table.getForeground());
2380 * Customer cell editor for JTable: supports column of radio buttons in
2381 * conjunction with renderer
2383 public class RadioButtonEditor extends AbstractCellEditor
2384 implements TableCellEditor
2386 private JRadioButton button = new JRadioButton();
2388 public RadioButtonEditor()
2390 button.setHorizontalAlignment(SwingConstants.CENTER);
2391 this.button.addActionListener(new ActionListener()
2394 public void actionPerformed(ActionEvent e)
2396 fireEditingStopped();
2402 public Component getTableCellEditorComponent(JTable table, Object value,
2403 boolean isSelected, int row, int column)
2405 button.setSelected((boolean) value);
2410 public Object getCellEditorValue()
2412 return button.isSelected();