Merge branch 'features/mchmmer' into merge/wsinterfaces_mchmmer_JAL-3070_JAL-1950
[jalview.git] / src / jalview / jbgui / GPreferences.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
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.
11  *  
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.
16  * 
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.
20  */
21 package jalview.jbgui;
22
23 import jalview.fts.core.FTSDataColumnPreferences;
24 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
25 import jalview.fts.service.pdb.PDBFTSRestClient;
26 import jalview.gui.JvSwingUtils;
27 import jalview.gui.StructureViewer.ViewerType;
28 import jalview.util.MessageManager;
29 import jalview.util.Platform;
30
31 import java.awt.BorderLayout;
32 import java.awt.Color;
33 import java.awt.Component;
34 import java.awt.Dimension;
35 import java.awt.FlowLayout;
36 import java.awt.Font;
37 import java.awt.GridBagConstraints;
38 import java.awt.GridBagLayout;
39 import java.awt.GridLayout;
40 import java.awt.Insets;
41 import java.awt.Rectangle;
42 import java.awt.event.ActionEvent;
43 import java.awt.event.ActionListener;
44 import java.awt.event.KeyEvent;
45 import java.awt.event.MouseAdapter;
46 import java.awt.event.MouseEvent;
47
48 import javax.swing.AbstractButton;
49 import javax.swing.AbstractCellEditor;
50 import javax.swing.BorderFactory;
51 import javax.swing.BoxLayout;
52 import javax.swing.ButtonGroup;
53 import javax.swing.DefaultListCellRenderer;
54 import javax.swing.JButton;
55 import javax.swing.JCheckBox;
56 import javax.swing.JComboBox;
57 import javax.swing.JComponent;
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.JTabbedPane;
64 import javax.swing.JTable;
65 import javax.swing.JTextField;
66 import javax.swing.ListSelectionModel;
67 import javax.swing.SwingConstants;
68 import javax.swing.border.Border;
69 import javax.swing.border.EmptyBorder;
70 import javax.swing.border.EtchedBorder;
71 import javax.swing.border.TitledBorder;
72 import javax.swing.event.ChangeEvent;
73 import javax.swing.event.ChangeListener;
74 import javax.swing.table.TableCellEditor;
75 import javax.swing.table.TableCellRenderer;
76
77 import net.miginfocom.swing.MigLayout;
78
79 /**
80  * Base class for the Preferences panel.
81  * 
82  * @author $author$
83  * @version $Revision$
84  */
85 public class GPreferences extends JPanel
86 {
87   private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
88
89   private static final Font LABEL_FONT_ITALIC = JvSwingUtils
90           .getLabelFont(false, true);
91
92   /*
93    * Visual tab components
94    */
95   protected JCheckBox fullScreen = new JCheckBox();
96
97   protected JCheckBox openoverv = new JCheckBox();
98
99   protected JCheckBox seqLimit = new JCheckBox();
100
101   protected JCheckBox rightAlign = new JCheckBox();
102
103   protected JComboBox<String> fontSizeCB = new JComboBox<>();
104
105   protected JComboBox<String> fontStyleCB = new JComboBox<>();
106
107   protected JComboBox<String> fontNameCB = new JComboBox<>();
108
109   protected JCheckBox showOccupancy = new JCheckBox();
110
111   protected JCheckBox showUnconserved = new JCheckBox();
112
113   protected JCheckBox idItalics = new JCheckBox();
114
115   protected JCheckBox smoothFont = new JCheckBox();
116
117   protected JCheckBox scaleProteinToCdna = new JCheckBox();
118
119   protected JComboBox<String> gapSymbolCB = new JComboBox<>();
120
121   protected JCheckBox wrap = new JCheckBox();
122
123   protected JComboBox<String> sortby = new JComboBox<>();
124
125   protected JComboBox<String> sortAnnBy = new JComboBox<>();
126
127   protected JComboBox<String> sortAutocalc = new JComboBox<>();
128
129   protected JCheckBox startupCheckbox = new JCheckBox();
130
131   protected JTextField startupFileTextfield = new JTextField();
132
133   // below are in the 'second column'
134   protected JCheckBox annotations = new JCheckBox();
135
136   protected JCheckBox quality = new JCheckBox();
137
138   protected JCheckBox conservation = new JCheckBox();
139
140   protected JCheckBox identity = new JCheckBox();
141
142   protected JCheckBox showGroupConsensus = new JCheckBox();
143
144   protected JCheckBox showGroupConservation = new JCheckBox();
145
146   protected JCheckBox showConsensHistogram = new JCheckBox();
147
148   protected JCheckBox showConsensLogo = new JCheckBox();
149
150   protected JCheckBox showInformationHistogram = new JCheckBox();
151
152   protected JCheckBox showHMMLogo = new JCheckBox();
153
154   protected JCheckBox showDbRefTooltip = new JCheckBox();
155
156   protected JCheckBox showNpTooltip = new JCheckBox();
157
158
159   /*
160    * Structure tab and components
161    */
162   protected JPanel structureTab;
163
164   protected JCheckBox structFromPdb = new JCheckBox();
165
166   protected JCheckBox useRnaView = new JCheckBox();
167
168   protected JCheckBox addSecondaryStructure = new JCheckBox();
169
170   protected JCheckBox addTempFactor = new JCheckBox();
171
172   protected JComboBox<String> structViewer = new JComboBox<>();
173
174   protected JTextField chimeraPath = new JTextField();
175
176   protected ButtonGroup mappingMethod = new ButtonGroup();
177
178   protected JRadioButton siftsMapping = new JRadioButton();
179
180   protected JRadioButton nwMapping = new JRadioButton();
181
182   /*
183    * Colours tab components
184    */
185   protected JPanel minColour = new JPanel();
186
187   protected JPanel maxColour = new JPanel();
188
189   protected JComboBox<String> protColour = new JComboBox<>();
190
191   protected JComboBox<String> nucColour = new JComboBox<>();
192
193   /*
194    * Overview tab components
195    */
196   protected JPanel gapColour = new JPanel();
197
198   protected JPanel hiddenColour = new JPanel();
199
200   protected JCheckBox useLegacyGap;
201
202   protected JCheckBox showHiddenAtStart;
203
204   protected JLabel gapLabel;
205
206   /*
207    * Connections tab components
208    */
209   protected JTable linkUrlTable = new JTable();
210
211   protected JButton editLink = new JButton();
212
213   protected JButton deleteLink = new JButton();
214
215   protected JTextField filterTB = new JTextField();
216
217   protected JButton doReset = new JButton();
218
219   protected JButton userOnly = new JButton();
220
221   protected JLabel portLabel = new JLabel();
222
223   protected JLabel serverLabel = new JLabel();
224
225   protected JTextField proxyServerTB = new JTextField();
226
227   protected JTextField proxyPortTB = new JTextField();
228
229   protected JTextField defaultBrowser = new JTextField();
230
231   protected JCheckBox useProxy = new JCheckBox();
232
233   protected JCheckBox usagestats = new JCheckBox();
234
235   protected JCheckBox questionnaire = new JCheckBox();
236
237   protected JCheckBox versioncheck = new JCheckBox();
238
239   /*
240    * Output tab components
241    */
242   protected JComboBox<Object> epsRendering = new JComboBox<>();
243
244   protected JLabel userIdWidthlabel = new JLabel();
245
246   protected JCheckBox autoIdWidth = new JCheckBox();
247
248   protected JTextField userIdWidth = new JTextField();
249
250   protected JCheckBox blcjv = new JCheckBox();
251
252   protected JCheckBox pileupjv = new JCheckBox();
253
254   protected JCheckBox clustaljv = new JCheckBox();
255
256   protected JCheckBox msfjv = new JCheckBox();
257
258   protected JCheckBox fastajv = new JCheckBox();
259
260   protected JCheckBox pfamjv = new JCheckBox();
261
262   protected JCheckBox pirjv = new JCheckBox();
263
264   protected JCheckBox modellerOutput = new JCheckBox();
265
266   protected JCheckBox embbedBioJSON = new JCheckBox();
267
268   /*
269    * Editing tab components
270    */
271   protected JCheckBox autoCalculateConsCheck = new JCheckBox();
272
273   protected JCheckBox padGaps = new JCheckBox();
274
275   protected JCheckBox sortByTree = new JCheckBox();
276
277   /*
278    * hmmer tab and components
279    */
280   protected JPanel hmmerTab;
281
282   protected JCheckBox hmmrTrimTermini;
283
284   protected AbstractButton hmmerBackgroundUniprot;
285
286   protected AbstractButton hmmerBackgroundAlignment;
287
288   protected JTextField hmmerSequenceCount;
289
290   protected JTextField hmmerPath;
291
292   protected JTextField cygwinPath;
293
294   /*
295    * Web Services tab
296    */
297   protected JPanel wsTab = new JPanel();
298
299
300
301   /**
302    * Creates a new GPreferences object.
303    */
304   public GPreferences()
305   {
306     try
307     {
308       jbInit();
309     } catch (Exception ex)
310     {
311       ex.printStackTrace();
312     }
313   }
314
315   /**
316    * Construct the panel and its tabbed sub-panels.
317    * 
318    * @throws Exception
319    */
320   private void jbInit() throws Exception
321   {
322     final JTabbedPane tabbedPane = new JTabbedPane();
323     this.setLayout(new BorderLayout());
324     JPanel okCancelPanel = initOkCancelPanel();
325     this.add(tabbedPane, BorderLayout.CENTER);
326     this.add(okCancelPanel, BorderLayout.SOUTH);
327
328     tabbedPane.add(initVisualTab(),
329             MessageManager.getString("label.visual"));
330
331     tabbedPane.add(initColoursTab(),
332             MessageManager.getString("label.colours"));
333
334     tabbedPane.add(initOverviewTab(),
335             MessageManager.getString("label.overview"));
336
337     tabbedPane.add(initStructureTab(),
338             MessageManager.getString("label.structure"));
339
340     tabbedPane.add(initConnectionsTab(),
341             MessageManager.getString("label.connections"));
342
343     tabbedPane.add(initLinksTab(),
344             MessageManager.getString("label.urllinks"));
345
346     tabbedPane.add(initOutputTab(),
347             MessageManager.getString("label.output"));
348
349     tabbedPane.add(initEditingTab(),
350             MessageManager.getString("label.editing"));
351
352     tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
353
354     /*
355      * See WsPreferences for the real work of configuring this tab.
356      */
357     wsTab.setLayout(new BorderLayout());
358     tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
359
360     /*
361      * Handler to validate a tab before leaving it - currently only for
362      * Structure
363      */
364     tabbedPane.addChangeListener(new ChangeListener()
365     {
366       private Component lastTab;
367
368       @Override
369       public void stateChanged(ChangeEvent e)
370       {
371         if (lastTab == structureTab
372                 && tabbedPane.getSelectedComponent() != structureTab)
373         {
374           if (!validateStructure())
375           {
376             tabbedPane.setSelectedComponent(structureTab);
377             return;
378           }
379         }
380         lastTab = tabbedPane.getSelectedComponent();
381       }
382
383     });
384   }
385
386   /**
387    * Initialises the Editing tabbed panel.
388    * 
389    * @return
390    */
391   private JPanel initEditingTab()
392   {
393     JPanel editingTab = new JPanel();
394     editingTab.setLayout(null);
395     autoCalculateConsCheck.setFont(LABEL_FONT);
396     autoCalculateConsCheck.setText(
397             MessageManager.getString("label.autocalculate_consensus"));
398     autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
399     padGaps.setFont(LABEL_FONT);
400     padGaps.setText(
401             MessageManager.getString("label.pad_gaps_when_editing"));
402     padGaps.setBounds(new Rectangle(22, 94, 168, 23));
403     sortByTree.setFont(LABEL_FONT);
404     sortByTree
405             .setText(MessageManager.getString("label.sort_with_new_tree"));
406     sortByTree.setToolTipText(MessageManager.getString(
407             "label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
408     sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
409     editingTab.add(autoCalculateConsCheck);
410     editingTab.add(padGaps);
411     editingTab.add(sortByTree);
412     return editingTab;
413   }
414
415   /**
416    * Initialises the hmmer tabbed panel
417    * 
418    * @return
419    */
420   private JPanel initHMMERTab()
421   {
422     hmmerTab = new JPanel();
423     hmmerTab.setLayout(new BoxLayout(hmmerTab, BoxLayout.Y_AXIS));
424     hmmerTab.setLayout(new MigLayout("flowy"));
425
426     /*
427      * path to hmmer binaries folder
428      */
429     JPanel installationPanel = new JPanel(new MigLayout("flowy"));
430     // new FlowLayout(FlowLayout.LEFT));
431     JvSwingUtils.createTitledBorder(installationPanel,
432             MessageManager.getString("label.installation"), true);
433     hmmerTab.add(installationPanel);
434     JLabel hmmerLocation = new JLabel(
435             MessageManager.getString("label.hmmer_location"));
436     hmmerLocation.setFont(LABEL_FONT);
437     final int pathFieldLength = 40;
438     hmmerPath = new JTextField(pathFieldLength);
439     hmmerPath.addMouseListener(new MouseAdapter()
440     {
441       @Override
442       public void mouseClicked(MouseEvent e)
443       {
444         if (e.getClickCount() == 2)
445         {
446           String chosen = openFileChooser(true);
447           if (chosen != null)
448           {
449             hmmerPath.setText(chosen);
450             validateHmmerPath();
451           }
452         }
453       }
454     });
455     installationPanel.add(hmmerLocation);
456     installationPanel.add(hmmerPath);
457
458     /*
459      * path to Cygwin binaries folder (for Windows)
460      */
461     if (Platform.isWindows())
462     {
463       JLabel cygwinLocation = new JLabel(
464               MessageManager.getString("label.cygwin_location"));
465       cygwinLocation.setFont(LABEL_FONT);
466       cygwinPath = new JTextField(pathFieldLength);
467       cygwinPath.addMouseListener(new MouseAdapter()
468       {
469         @Override
470         public void mouseClicked(MouseEvent e)
471         {
472           if (e.getClickCount() == 2)
473           {
474             String chosen = openFileChooser(true);
475             if (chosen != null)
476             {
477               cygwinPath.setText(chosen);
478               validateCygwinPath();
479             }
480           }
481         }
482       });
483       installationPanel.add(cygwinLocation);
484       installationPanel.add(cygwinPath);
485     }
486
487     /*
488      * preferences for hmmalign
489      */
490     JPanel alignOptionsPanel = new JPanel(new MigLayout());
491     // new FlowLayout(FlowLayout.LEFT));
492     JvSwingUtils.createTitledBorder(alignOptionsPanel,
493             MessageManager.getString("label.hmmalign_options"), true);
494     hmmerTab.add(alignOptionsPanel);
495     hmmrTrimTermini = new JCheckBox();
496     hmmrTrimTermini.setFont(LABEL_FONT);
497     hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
498     alignOptionsPanel.add(hmmrTrimTermini);
499
500     /*
501      * preferences for hmmsearch
502      */
503     JPanel searchOptions = new JPanel(new MigLayout());
504     // FlowLayout(FlowLayout.LEFT));
505     JvSwingUtils.createTitledBorder(searchOptions,
506             MessageManager.getString("label.hmmsearch_options"), true);
507     hmmerTab.add(searchOptions);
508     JLabel sequencesToKeep = new JLabel(
509             MessageManager.getString("label.no_of_sequences"));
510     sequencesToKeep.setFont(LABEL_FONT);
511     searchOptions.add(sequencesToKeep);
512     hmmerSequenceCount = new JTextField(5);
513     searchOptions.add(hmmerSequenceCount);
514
515     /*
516      * preferences for Information Content annotation
517      */
518     // JPanel dummy = new JPanel(new FlowLayout(FlowLayout.LEFT));
519     JPanel annotationOptions = new JPanel(new MigLayout("left"));
520     JvSwingUtils.createTitledBorder(annotationOptions,
521             MessageManager.getString("label.information_annotation"), true);
522     // dummy.add(annotationOptions);
523     hmmerTab.add(annotationOptions);
524     ButtonGroup backgroundOptions = new ButtonGroup();
525     hmmerBackgroundUniprot = new JRadioButton(
526             MessageManager.getString("label.freq_uniprot"));
527     hmmerBackgroundUniprot.setFont(LABEL_FONT);
528     hmmerBackgroundAlignment = new JRadioButton(
529             MessageManager.getString("label.freq_alignment"));
530     hmmerBackgroundAlignment.setFont(LABEL_FONT);
531     backgroundOptions.add(hmmerBackgroundUniprot);
532     backgroundOptions.add(hmmerBackgroundAlignment);
533     backgroundOptions.setSelected(hmmerBackgroundUniprot.getModel(), true);
534     // disable buttons for now as annotation only uses Uniprot background
535     hmmerBackgroundAlignment.setEnabled(false);
536     hmmerBackgroundUniprot.setEnabled(false);
537     annotationOptions.add(hmmerBackgroundUniprot, "wrap");
538     annotationOptions.add(hmmerBackgroundAlignment);
539
540     return hmmerTab;
541   }
542
543   /**
544    * Initialises the Output tabbed panel.
545    * 
546    * @return
547    */
548   private JPanel initOutputTab()
549   {
550     JPanel outputTab = new JPanel();
551     outputTab.setLayout(null);
552     JLabel epsLabel = new JLabel();
553     epsLabel.setFont(LABEL_FONT);
554     epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
555     epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
556     epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
557     epsRendering.setFont(LABEL_FONT);
558     epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
559     JLabel jLabel1 = new JLabel();
560     jLabel1.setFont(LABEL_FONT);
561     jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
562     jLabel1.setText(MessageManager.getString("label.append_start_end"));
563     jLabel1.setFont(LABEL_FONT);
564     fastajv.setFont(LABEL_FONT);
565     fastajv.setHorizontalAlignment(SwingConstants.LEFT);
566     clustaljv.setText(MessageManager.getString("label.clustal") + "     ");
567     blcjv.setText(MessageManager.getString("label.blc") + "     ");
568     fastajv.setText(MessageManager.getString("label.fasta") + "     ");
569     msfjv.setText(MessageManager.getString("label.msf") + "     ");
570     pfamjv.setText(MessageManager.getString("label.pfam") + "     ");
571     pileupjv.setText(MessageManager.getString("label.pileup") + "     ");
572     msfjv.setFont(LABEL_FONT);
573     msfjv.setHorizontalAlignment(SwingConstants.LEFT);
574     pirjv.setText(MessageManager.getString("label.pir") + "     ");
575     JPanel jPanel11 = new JPanel();
576     jPanel11.setFont(LABEL_FONT);
577     TitledBorder titledBorder2 = new TitledBorder(
578             MessageManager.getString("label.file_output"));
579     jPanel11.setBorder(titledBorder2);
580     jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
581     GridLayout gridLayout3 = new GridLayout();
582     jPanel11.setLayout(gridLayout3);
583     gridLayout3.setRows(8);
584     blcjv.setFont(LABEL_FONT);
585     blcjv.setHorizontalAlignment(SwingConstants.LEFT);
586     clustaljv.setFont(LABEL_FONT);
587     clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
588     pfamjv.setFont(LABEL_FONT);
589     pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
590     pileupjv.setFont(LABEL_FONT);
591     pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
592     pirjv.setFont(LABEL_FONT);
593     pirjv.setHorizontalAlignment(SwingConstants.LEFT);
594     autoIdWidth.setFont(LABEL_FONT);
595     autoIdWidth.setText(
596             MessageManager.getString("label.automatically_set_id_width"));
597     autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
598             .getString("label.adjusts_width_generated_eps_png")));
599     autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
600     autoIdWidth.addActionListener(new ActionListener()
601     {
602
603       @Override
604       public void actionPerformed(ActionEvent e)
605       {
606         autoIdWidth_actionPerformed();
607       }
608     });
609     userIdWidthlabel.setFont(LABEL_FONT);
610     userIdWidthlabel.setText(
611             MessageManager.getString("label.figure_id_column_width"));
612     userIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
613             .getString("label.manually_specify_width_left_column")));
614     userIdWidthlabel.setToolTipText(
615             JvSwingUtils.wrapTooltip(true, MessageManager.getString(
616                     "label.manually_specify_width_left_column")));
617     userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
618     userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
619     userIdWidth.setText("");
620     userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
621     userIdWidth.addActionListener(new ActionListener()
622     {
623
624       @Override
625       public void actionPerformed(ActionEvent e)
626       {
627         userIdWidth_actionPerformed();
628       }
629     });
630     modellerOutput.setFont(LABEL_FONT);
631     modellerOutput
632             .setText(MessageManager.getString("label.use_modeller_output"));
633     modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
634     embbedBioJSON.setFont(LABEL_FONT);
635     embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
636     embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
637
638     jPanel11.add(jLabel1);
639     jPanel11.add(blcjv);
640     jPanel11.add(clustaljv);
641     jPanel11.add(fastajv);
642     jPanel11.add(msfjv);
643     jPanel11.add(pfamjv);
644     jPanel11.add(pileupjv);
645     jPanel11.add(pirjv);
646     outputTab.add(autoIdWidth);
647     outputTab.add(userIdWidth);
648     outputTab.add(userIdWidthlabel);
649     outputTab.add(modellerOutput);
650     outputTab.add(embbedBioJSON);
651     outputTab.add(epsLabel);
652     outputTab.add(epsRendering);
653     outputTab.add(jPanel11);
654     return outputTab;
655   }
656
657   /**
658    * Initialises the Connections tabbed panel.
659    * 
660    * @return
661    */
662   private JPanel initConnectionsTab()
663   {
664     JPanel connectTab = new JPanel();
665     connectTab.setLayout(new GridBagLayout());
666
667     // Label for browser text box
668     JLabel browserLabel = new JLabel();
669     browserLabel.setFont(LABEL_FONT);
670     browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
671     browserLabel.setText(
672             MessageManager.getString("label.default_browser_unix"));
673     defaultBrowser.setFont(LABEL_FONT);
674     defaultBrowser.setText("");
675     final String tooltip = JvSwingUtils.wrapTooltip(true,
676             MessageManager.getString("label.double_click_to_browse"));
677     defaultBrowser.setToolTipText(tooltip);
678     defaultBrowser.addMouseListener(new MouseAdapter()
679     {
680       @Override
681       public void mouseClicked(MouseEvent e)
682       {
683         if (e.getClickCount() > 1)
684         {
685           defaultBrowser_mouseClicked(e);
686         }
687       }
688     });
689
690     JPanel proxyPanel = initConnTabProxyPanel();
691     initConnTabCheckboxes();
692
693     // Add default Browser text box
694     connectTab.add(browserLabel,
695             new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
696                     GridBagConstraints.WEST, GridBagConstraints.NONE,
697                     new Insets(10, 0, 5, 5), 5, 1));
698     defaultBrowser.setFont(LABEL_FONT);
699     defaultBrowser.setText("");
700
701     connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
702             0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
703             new Insets(10, 0, 5, 10), 30, 1));
704
705     // Add proxy server panel
706     connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
707             GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
708             new Insets(10, 0, 5, 12), 4, 10));
709
710     // Add usage stats, version check and questionnaire checkboxes
711     connectTab.add(usagestats,
712             new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
713                     GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
714                     new Insets(0, 2, 5, 5), 70, 1));
715     connectTab.add(questionnaire,
716             new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
717                     GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
718                     new Insets(0, 2, 5, 10), 70, 1));
719     connectTab.add(versioncheck,
720             new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
721                     GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
722                     new Insets(0, 2, 5, 5), 70, 1));
723
724     // Add padding so the panel doesn't look ridiculous
725     JPanel spacePanel = new JPanel();
726     connectTab.add(spacePanel,
727             new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
728                     GridBagConstraints.WEST, GridBagConstraints.BOTH,
729                     new Insets(0, 0, 0, 5), 70, 1));
730
731     return connectTab;
732   }
733
734   /**
735    * Initialises the Links tabbed panel.
736    * 
737    * @return
738    */
739   private JPanel initLinksTab()
740   {
741     JPanel linkTab = new JPanel();
742     linkTab.setLayout(new GridBagLayout());
743
744     // Set up table for Url links
745     linkUrlTable.setFillsViewportHeight(true);
746     linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
747     linkUrlTable.setAutoCreateRowSorter(true);
748     linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
749
750     // adjust row height so radio buttons actually fit
751     // don't do this in the renderer, it causes the awt thread to activate
752     // constantly
753     JRadioButton temp = new JRadioButton();
754     linkUrlTable.setRowHeight(temp.getMinimumSize().height);
755
756     // Table in scrollpane so that the table is given a scrollbar
757     JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
758     linkScrollPane.setBorder(null);
759
760     // Panel for links functionality
761     JPanel linkPanel = new JPanel(new GridBagLayout());
762     linkPanel.setBorder(new TitledBorder(
763             MessageManager.getString("label.url_linkfrom_sequence_id")));
764
765     // Put the Url links panel together
766
767     // Buttons go at top right, resizing only resizes the blank space vertically
768     JPanel buttonPanel = initLinkTabUrlButtons();
769     GridBagConstraints linkConstraints1 = new GridBagConstraints();
770     linkConstraints1.insets = new Insets(0, 0, 5, 0);
771     linkConstraints1.gridx = 0;
772     linkConstraints1.gridy = 0;
773     linkConstraints1.weightx = 1.0;
774     linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
775     linkTab.add(buttonPanel, linkConstraints1);
776
777     // Links table goes at top left, resizing resizes the table
778     GridBagConstraints linkConstraints2 = new GridBagConstraints();
779     linkConstraints2.insets = new Insets(0, 0, 5, 5);
780     linkConstraints2.gridx = 0;
781     linkConstraints2.gridy = 1;
782     linkConstraints2.weightx = 1.0;
783     linkConstraints2.weighty = 1.0;
784     linkConstraints2.fill = GridBagConstraints.BOTH;
785     linkTab.add(linkScrollPane, linkConstraints2);
786
787     // Filter box and buttons goes at bottom left, resizing resizes the text box
788     JPanel filterPanel = initLinkTabFilterPanel();
789     GridBagConstraints linkConstraints3 = new GridBagConstraints();
790     linkConstraints3.insets = new Insets(0, 0, 0, 5);
791     linkConstraints3.gridx = 0;
792     linkConstraints3.gridy = 2;
793     linkConstraints3.weightx = 1.0;
794     linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
795     linkTab.add(filterPanel, linkConstraints3);
796
797     return linkTab;
798   }
799
800   private JPanel initLinkTabFilterPanel()
801   {
802     // Filter textbox and reset button
803     JLabel filterLabel = new JLabel(
804             MessageManager.getString("label.filter"));
805     filterLabel.setFont(LABEL_FONT);
806     filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
807     filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
808
809     filterTB.setFont(LABEL_FONT);
810     filterTB.setText("");
811
812     doReset.setText(MessageManager.getString("action.showall"));
813     userOnly.setText(MessageManager.getString("action.customfilter"));
814
815     // Panel for filter functionality
816     JPanel filterPanel = new JPanel(new GridBagLayout());
817     filterPanel.setBorder(new TitledBorder("Filter"));
818     GridBagConstraints gbc = new GridBagConstraints();
819     gbc.gridx = 0;
820     gbc.gridy = 0;
821     gbc.fill = GridBagConstraints.NONE;
822     gbc.anchor = GridBagConstraints.WEST;
823
824     filterPanel.add(filterLabel, gbc);
825
826     GridBagConstraints gbc1 = new GridBagConstraints();
827     gbc1.gridx = 1;
828     gbc1.gridwidth = 2;
829     gbc1.fill = GridBagConstraints.HORIZONTAL;
830     gbc1.anchor = GridBagConstraints.WEST;
831     gbc1.weightx = 1.0;
832     filterPanel.add(filterTB, gbc1);
833
834     GridBagConstraints gbc2 = new GridBagConstraints();
835     gbc2.gridx = 3;
836     gbc2.fill = GridBagConstraints.NONE;
837     gbc2.anchor = GridBagConstraints.WEST;
838     filterPanel.add(doReset, gbc2);
839
840     GridBagConstraints gbc3 = new GridBagConstraints();
841     gbc3.gridx = 4;
842     gbc3.fill = GridBagConstraints.NONE;
843     gbc3.anchor = GridBagConstraints.WEST;
844     filterPanel.add(userOnly, gbc3);
845
846     return filterPanel;
847   }
848
849   private JPanel initLinkTabUrlButtons()
850   {
851     // Buttons for new / edit / delete Url links
852     JButton newLink = new JButton();
853     newLink.setText(MessageManager.getString("action.new"));
854
855     editLink.setText(MessageManager.getString("action.edit"));
856
857     deleteLink.setText(MessageManager.getString("action.delete"));
858
859     // no current selection, so initially disable delete/edit buttons
860     editLink.setEnabled(false);
861     deleteLink.setEnabled(false);
862
863     newLink.addActionListener(new java.awt.event.ActionListener()
864     {
865       @Override
866       public void actionPerformed(ActionEvent e)
867       {
868         newLink_actionPerformed(e);
869       }
870     });
871
872     editLink.setText(MessageManager.getString("action.edit"));
873     editLink.addActionListener(new java.awt.event.ActionListener()
874     {
875       @Override
876       public void actionPerformed(ActionEvent e)
877       {
878         editLink_actionPerformed(e);
879       }
880     });
881
882     deleteLink.setText(MessageManager.getString("action.delete"));
883     deleteLink.addActionListener(new java.awt.event.ActionListener()
884     {
885       @Override
886       public void actionPerformed(ActionEvent e)
887       {
888         deleteLink_actionPerformed(e);
889       }
890     });
891
892     JPanel buttonPanel = new JPanel(new GridBagLayout());
893     buttonPanel.setBorder(new TitledBorder("Edit links"));
894     GridBagConstraints gbc = new GridBagConstraints();
895     gbc.gridx = 0;
896     gbc.gridy = 0;
897     gbc.fill = GridBagConstraints.NONE;
898     buttonPanel.add(newLink, gbc);
899
900     GridBagConstraints gbc1 = new GridBagConstraints();
901     gbc1.gridx = 1;
902     gbc1.gridy = 0;
903     gbc1.fill = GridBagConstraints.NONE;
904     buttonPanel.add(editLink, gbc1);
905
906     GridBagConstraints gbc2 = new GridBagConstraints();
907     gbc2.gridx = 2;
908     gbc2.gridy = 0;
909     gbc2.fill = GridBagConstraints.NONE;
910     buttonPanel.add(deleteLink, gbc2);
911
912     GridBagConstraints gbc3 = new GridBagConstraints();
913     gbc3.gridx = 3;
914     gbc3.gridy = 0;
915     gbc3.fill = GridBagConstraints.HORIZONTAL;
916     gbc3.weightx = 1.0;
917     JPanel spacePanel = new JPanel();
918     spacePanel.setBorder(null);
919     buttonPanel.add(spacePanel, gbc3);
920
921     return buttonPanel;
922   }
923
924   /**
925    * Initialises the proxy server panel in the Connections tab
926    * 
927    * @return the proxy server panel
928    */
929   private JPanel initConnTabProxyPanel()
930   {
931     // Label for server text box
932     serverLabel.setText(MessageManager.getString("label.address"));
933     serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
934     serverLabel.setFont(LABEL_FONT);
935
936     // Proxy server and port text boxes
937     proxyServerTB.setFont(LABEL_FONT);
938     proxyPortTB.setFont(LABEL_FONT);
939
940     // Label for Port text box
941     portLabel.setFont(LABEL_FONT);
942     portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
943     portLabel.setText(MessageManager.getString("label.port"));
944
945     // Use proxy server checkbox
946     useProxy.setFont(LABEL_FONT);
947     useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
948     useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
949     useProxy.setText(MessageManager.getString("label.use_proxy_server"));
950     useProxy.addActionListener(new ActionListener()
951     {
952       @Override
953       public void actionPerformed(ActionEvent e)
954       {
955         useProxy_actionPerformed();
956       }
957     });
958
959     // Make proxy server panel
960     JPanel proxyPanel = new JPanel();
961     TitledBorder titledBorder1 = new TitledBorder(
962             MessageManager.getString("label.proxy_server"));
963     proxyPanel.setBorder(titledBorder1);
964     proxyPanel.setLayout(new GridBagLayout());
965     proxyPanel.add(serverLabel,
966             new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
967                     GridBagConstraints.WEST, GridBagConstraints.NONE,
968                     new Insets(0, 2, 2, 0), 5, 0));
969     proxyPanel.add(portLabel,
970             new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
971                     GridBagConstraints.WEST, GridBagConstraints.NONE,
972                     new Insets(0, 0, 2, 0), 11, 0));
973     proxyPanel.add(useProxy,
974             new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
975                     GridBagConstraints.WEST, GridBagConstraints.NONE,
976                     new Insets(0, 2, 5, 185), 2, -4));
977     proxyPanel.add(proxyPortTB,
978             new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
979                     GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
980                     new Insets(0, 2, 2, 2), 54, 1));
981     proxyPanel.add(proxyServerTB,
982             new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
983                     GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
984                     new Insets(0, 2, 2, 0), 263, 1));
985
986     return proxyPanel;
987   }
988
989   /**
990    * Initialises the checkboxes in the Connections tab
991    */
992   private void initConnTabCheckboxes()
993   {
994     // Usage stats checkbox label
995     usagestats.setText(
996             MessageManager.getString("label.send_usage_statistics"));
997     usagestats.setFont(LABEL_FONT);
998     usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
999     usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
1000
1001     // Questionnaire checkbox label
1002     questionnaire.setText(
1003             MessageManager.getString("label.check_for_questionnaires"));
1004     questionnaire.setFont(LABEL_FONT);
1005     questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
1006     questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
1007
1008     // Check for latest version checkbox label
1009     versioncheck.setText(
1010             MessageManager.getString("label.check_for_latest_version"));
1011     versioncheck.setFont(LABEL_FONT);
1012     versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
1013     versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
1014   }
1015
1016   /**
1017    * Initialises the parent panel which contains the tabbed sections.
1018    * 
1019    * @return
1020    */
1021   private JPanel initOkCancelPanel()
1022   {
1023     JButton ok = new JButton();
1024     ok.setText(MessageManager.getString("action.ok"));
1025     ok.addActionListener(new ActionListener()
1026     {
1027       @Override
1028       public void actionPerformed(ActionEvent e)
1029       {
1030         ok_actionPerformed(e);
1031       }
1032     });
1033     JButton cancel = new JButton();
1034     cancel.setText(MessageManager.getString("action.cancel"));
1035     cancel.addActionListener(new ActionListener()
1036     {
1037       @Override
1038       public void actionPerformed(ActionEvent e)
1039       {
1040         cancel_actionPerformed(e);
1041       }
1042     });
1043     JPanel okCancelPanel = new JPanel();
1044     okCancelPanel.add(ok);
1045     okCancelPanel.add(cancel);
1046     return okCancelPanel;
1047   }
1048
1049   /**
1050    * Initialises the Colours tabbed panel.
1051    * 
1052    * @return
1053    */
1054   private JPanel initColoursTab()
1055   {
1056     JPanel coloursTab = new JPanel();
1057     coloursTab.setBorder(new TitledBorder(
1058             MessageManager.getString("action.open_new_alignment")));
1059     coloursTab.setLayout(new FlowLayout());
1060     JLabel mincolourLabel = new JLabel();
1061     mincolourLabel.setFont(LABEL_FONT);
1062     mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1063     mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1064     minColour.setFont(LABEL_FONT);
1065     minColour.setBorder(BorderFactory.createEtchedBorder());
1066     minColour.setPreferredSize(new Dimension(40, 20));
1067     minColour.addMouseListener(new MouseAdapter()
1068     {
1069       @Override
1070       public void mousePressed(MouseEvent e)
1071       {
1072         minColour_actionPerformed(minColour);
1073       }
1074     });
1075     JLabel maxcolourLabel = new JLabel();
1076     maxcolourLabel.setFont(LABEL_FONT);
1077     maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1078     maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1079     maxColour.setFont(LABEL_FONT);
1080     maxColour.setBorder(BorderFactory.createEtchedBorder());
1081     maxColour.setPreferredSize(new Dimension(40, 20));
1082     maxColour.addMouseListener(new MouseAdapter()
1083     {
1084       @Override
1085       public void mousePressed(MouseEvent e)
1086       {
1087         maxColour_actionPerformed(maxColour);
1088       }
1089     });
1090
1091     protColour.setFont(LABEL_FONT);
1092     protColour.setBounds(new Rectangle(172, 225, 155, 21));
1093     JLabel protColourLabel = new JLabel();
1094     protColourLabel.setFont(LABEL_FONT);
1095     protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1096     protColourLabel.setText(
1097             MessageManager.getString("label.prot_alignment_colour") + " ");
1098     GPreferences.addtoLayout(coloursTab,
1099             MessageManager
1100                     .getString("label.default_colour_scheme_for_alignment"),
1101             protColourLabel, protColour);
1102
1103     nucColour.setFont(LABEL_FONT);
1104     nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1105     JLabel nucColourLabel = new JLabel();
1106     nucColourLabel.setFont(LABEL_FONT);
1107     nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1108     nucColourLabel.setText(
1109             MessageManager.getString("label.nuc_alignment_colour") + " ");
1110     GPreferences.addtoLayout(coloursTab,
1111             MessageManager
1112                     .getString("label.default_colour_scheme_for_alignment"),
1113             nucColourLabel, nucColour);
1114
1115     JPanel annotationShding = new JPanel();
1116     annotationShding.setBorder(new TitledBorder(
1117             MessageManager.getString("label.annotation_shading_default")));
1118     annotationShding.setLayout(new GridLayout(1, 2));
1119     GPreferences.addtoLayout(annotationShding,
1120             MessageManager.getString(
1121                     "label.default_minimum_colour_annotation_shading"),
1122             mincolourLabel, minColour);
1123     GPreferences.addtoLayout(annotationShding,
1124             MessageManager.getString(
1125                     "label.default_maximum_colour_annotation_shading"),
1126             maxcolourLabel, maxColour);
1127     coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1128     return coloursTab;
1129   }
1130
1131   /**
1132    * Initialises the Overview tabbed panel.
1133    * 
1134    * @return
1135    */
1136   private JPanel initOverviewTab()
1137   {
1138     JPanel overviewPanel = new JPanel();
1139     overviewPanel.setBorder(new TitledBorder(
1140             MessageManager.getString("label.overview_settings")));
1141
1142     gapColour.setFont(LABEL_FONT);
1143     // fixing the border colours stops apparent colour bleed from the panel
1144     gapColour.setBorder(
1145             BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1146     gapColour.setPreferredSize(new Dimension(40, 20));
1147     gapColour.addMouseListener(new MouseAdapter()
1148     {
1149       @Override
1150       public void mousePressed(MouseEvent e)
1151       {
1152         gapColour_actionPerformed(gapColour);
1153       }
1154     });
1155
1156     hiddenColour.setFont(LABEL_FONT);
1157     // fixing the border colours stops apparent colour bleed from the panel
1158     hiddenColour.setBorder(
1159             BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1160     hiddenColour.setPreferredSize(new Dimension(40, 20));
1161     hiddenColour.addMouseListener(new MouseAdapter()
1162     {
1163       @Override
1164       public void mousePressed(MouseEvent e)
1165       {
1166         hiddenColour_actionPerformed(hiddenColour);
1167       }
1168     });
1169     
1170     useLegacyGap = new JCheckBox(
1171             MessageManager.getString("label.ov_legacy_gap"));
1172     useLegacyGap.setFont(LABEL_FONT);
1173     useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1174     useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1175     gapLabel = new JLabel(
1176             MessageManager.getString("label.gap_colour"));
1177     gapLabel.setFont(LABEL_FONT);
1178     gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1179     gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1180     showHiddenAtStart = new JCheckBox(
1181             MessageManager.getString("label.ov_show_hide_default"));
1182     showHiddenAtStart.setFont(LABEL_FONT);
1183     showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1184     showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1185     JLabel hiddenLabel = new JLabel(
1186             MessageManager.getString("label.hidden_colour"));
1187     hiddenLabel.setFont(LABEL_FONT);
1188     hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1189     hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1190
1191     useLegacyGap.addActionListener(new ActionListener()
1192     {
1193       @Override
1194       public void actionPerformed(ActionEvent e)
1195       {
1196         useLegacyGaps_actionPerformed(e);
1197       }
1198     });
1199
1200     overviewPanel.setLayout(new GridBagLayout());
1201     GridBagConstraints c1 = new GridBagConstraints();
1202
1203     c1.fill = GridBagConstraints.HORIZONTAL;
1204     c1.gridx = 0;
1205     c1.gridy = 0;
1206     c1.weightx = 1;
1207     c1.ipady = 20;
1208     c1.anchor = GridBagConstraints.FIRST_LINE_START;
1209     overviewPanel.add(useLegacyGap, c1);
1210
1211     GridBagConstraints c2 = new GridBagConstraints();
1212     c2.fill = GridBagConstraints.HORIZONTAL;
1213     c2.gridx = 1;
1214     c2.gridy = 0;
1215     c2.insets = new Insets(0, 15, 0, 10);
1216     overviewPanel.add(gapLabel, c2);
1217
1218     GridBagConstraints c3 = new GridBagConstraints();
1219     c3.fill = GridBagConstraints.HORIZONTAL;
1220     c3.gridx = 2;
1221     c3.gridy = 0;
1222     c3.insets = new Insets(0, 0, 0, 15);
1223     overviewPanel.add(gapColour, c3);
1224
1225     GridBagConstraints c4 = new GridBagConstraints();
1226     c4.fill = GridBagConstraints.HORIZONTAL;
1227     c4.gridx = 0;
1228     c4.gridy = 1;
1229     c4.weightx = 1;
1230     overviewPanel.add(showHiddenAtStart, c4);
1231
1232     GridBagConstraints c5 = new GridBagConstraints();
1233     c5.fill = GridBagConstraints.HORIZONTAL;
1234     c5.gridx = 1;
1235     c5.gridy = 1;
1236     c5.insets = new Insets(0, 15, 0, 10);
1237     overviewPanel.add(hiddenLabel, c5);
1238
1239     GridBagConstraints c6 = new GridBagConstraints();
1240     c6.fill = GridBagConstraints.HORIZONTAL;
1241     c6.gridx = 2;
1242     c6.gridy = 1;
1243     c6.insets = new Insets(0, 0, 0, 15);
1244     overviewPanel.add(hiddenColour, c6);
1245
1246     JButton resetButton = new JButton(
1247             MessageManager.getString("label.reset_to_defaults"));
1248
1249     resetButton.addActionListener(new ActionListener()
1250     {
1251       @Override
1252       public void actionPerformed(ActionEvent e)
1253       {
1254         resetOvDefaults_actionPerformed(e);
1255       }
1256     });
1257
1258     GridBagConstraints c7 = new GridBagConstraints();
1259     c7.fill = GridBagConstraints.NONE;
1260     c7.gridx = 0;
1261     c7.gridy = 2;
1262     c7.insets = new Insets(10, 0, 0, 0);
1263     c7.anchor = GridBagConstraints.WEST;
1264     overviewPanel.add(resetButton, c7);
1265
1266     // Add padding so the panel doesn't look ridiculous
1267     JPanel spacePanel = new JPanel();
1268     overviewPanel.add(spacePanel,
1269             new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1270                     GridBagConstraints.WEST, GridBagConstraints.BOTH,
1271                     new Insets(0, 0, 0, 5), 0, 0));
1272
1273     return overviewPanel;
1274   }
1275
1276   /**
1277    * Initialises the Structure tabbed panel.
1278    * 
1279    * @return
1280    */
1281   private JPanel initStructureTab()
1282   {
1283     structureTab = new JPanel();
1284
1285     structureTab.setBorder(new TitledBorder(
1286             MessageManager.getString("label.structure_options")));
1287     structureTab.setLayout(null);
1288     final int width = 400;
1289     final int height = 22;
1290     final int lineSpacing = 25;
1291     int ypos = 15;
1292
1293     structFromPdb.setFont(LABEL_FONT);
1294     structFromPdb
1295             .setText(MessageManager.getString("label.struct_from_pdb"));
1296     structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1297     structFromPdb.addActionListener(new ActionListener()
1298     {
1299       @Override
1300       public void actionPerformed(ActionEvent e)
1301       {
1302         boolean selected = structFromPdb.isSelected();
1303         // enable other options only when the first is checked
1304         useRnaView.setEnabled(selected);
1305         addSecondaryStructure.setEnabled(selected);
1306         addTempFactor.setEnabled(selected);
1307       }
1308     });
1309     structureTab.add(structFromPdb);
1310
1311     // indent checkboxes that are conditional on the first one
1312     ypos += lineSpacing;
1313     useRnaView.setFont(LABEL_FONT);
1314     useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1315     useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1316     structureTab.add(useRnaView);
1317
1318     ypos += lineSpacing;
1319     addSecondaryStructure.setFont(LABEL_FONT);
1320     addSecondaryStructure
1321             .setText(MessageManager.getString("label.autoadd_secstr"));
1322     addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1323     structureTab.add(addSecondaryStructure);
1324
1325     ypos += lineSpacing;
1326     addTempFactor.setFont(LABEL_FONT);
1327     addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1328     addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1329     structureTab.add(addTempFactor);
1330
1331     ypos += lineSpacing;
1332     JLabel viewerLabel = new JLabel();
1333     viewerLabel.setFont(LABEL_FONT);
1334     viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1335     viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1336     viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1337     structureTab.add(viewerLabel);
1338
1339     structViewer.setFont(LABEL_FONT);
1340     structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1341     structViewer.addItem(ViewerType.JMOL.name());
1342     structViewer.addItem(ViewerType.CHIMERA.name());
1343     structViewer.addActionListener(new ActionListener()
1344     {
1345       @Override
1346       public void actionPerformed(ActionEvent e)
1347       {
1348         structureViewer_actionPerformed(
1349                 (String) structViewer.getSelectedItem());
1350       }
1351     });
1352     structureTab.add(structViewer);
1353
1354     ypos += lineSpacing;
1355     JLabel pathLabel = new JLabel();
1356     pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1357     pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1358     pathLabel.setText(MessageManager.getString("label.chimera_path"));
1359     pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1360     structureTab.add(pathLabel);
1361
1362     chimeraPath.setFont(LABEL_FONT);
1363     chimeraPath.setText("");
1364     final String tooltip = JvSwingUtils.wrapTooltip(true,
1365             MessageManager.getString("label.chimera_path_tip"));
1366     chimeraPath.setToolTipText(tooltip);
1367     chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1368     chimeraPath.addMouseListener(new MouseAdapter()
1369     {
1370       @Override
1371       public void mouseClicked(MouseEvent e)
1372       {
1373         if (e.getClickCount() == 2)
1374         {
1375           String chosen = openFileChooser(false);
1376           if (chosen != null)
1377           {
1378             chimeraPath.setText(chosen);
1379           }
1380         }
1381       }
1382     });
1383     structureTab.add(chimeraPath);
1384
1385     ypos += lineSpacing;
1386     nwMapping.setFont(LABEL_FONT);
1387     nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1388     siftsMapping.setFont(LABEL_FONT);
1389     siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1390     mappingMethod.add(nwMapping);
1391     mappingMethod.add(siftsMapping);
1392     JPanel mappingPanel = new JPanel();
1393     mappingPanel.setFont(LABEL_FONT);
1394     TitledBorder mmTitledBorder = new TitledBorder(
1395             MessageManager.getString("label.mapping_method"));
1396     mmTitledBorder.setTitleFont(LABEL_FONT);
1397     mappingPanel.setBorder(mmTitledBorder);
1398     mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1399     // GridLayout mappingLayout = new GridLayout();
1400     mappingPanel.setLayout(new GridLayout());
1401     mappingPanel.add(nwMapping);
1402     mappingPanel.add(siftsMapping);
1403     structureTab.add(mappingPanel);
1404
1405     ypos += lineSpacing;
1406     ypos += lineSpacing;
1407     FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1408             PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1409     docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1410     structureTab.add(docFieldPref);
1411
1412     return structureTab;
1413   }
1414
1415   /**
1416    * Action on choosing a structure viewer from combobox options.
1417    * 
1418    * @param selectedItem
1419    */
1420   protected void structureViewer_actionPerformed(String selectedItem)
1421   {
1422   }
1423
1424   /**
1425    * Show a dialog for the user to choose a file. Returns the chosen path, or
1426    * null on Cancel.
1427    * 
1428    * @return
1429    */
1430   protected String openFileChooser(boolean forFolder)
1431   {
1432     String choice = null;
1433     JFileChooser chooser = new JFileChooser();
1434     if (forFolder)
1435     {
1436       chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1437     }
1438
1439     // chooser.setFileView(new JalviewFileView());
1440     chooser.setDialogTitle(
1441             MessageManager.getString("label.open_local_file"));
1442     chooser.setToolTipText(MessageManager.getString("action.open"));
1443
1444     int value = chooser.showOpenDialog(this);
1445
1446     if (value == JFileChooser.APPROVE_OPTION)
1447     {
1448       choice = chooser.getSelectedFile().getPath();
1449     }
1450     return choice;
1451   }
1452
1453   protected boolean validateStructure()
1454   {
1455     return false;
1456   }
1457
1458   /**
1459    * Initialises the Visual tabbed panel.
1460    * 
1461    * @return
1462    */
1463   private JPanel initVisualTab()
1464   {
1465     JPanel visualTab = new JPanel();
1466     visualTab.setBorder(new TitledBorder(
1467             MessageManager.getString("action.open_new_alignment")));
1468     visualTab.setLayout(null);
1469     fullScreen.setFont(LABEL_FONT);
1470     fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1471     fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1472     fullScreen.setText(MessageManager.getString("label.maximize_window"));
1473     quality.setEnabled(false);
1474     quality.setFont(LABEL_FONT);
1475     quality.setHorizontalAlignment(SwingConstants.RIGHT);
1476     quality.setHorizontalTextPosition(SwingConstants.LEFT);
1477     quality.setSelected(true);
1478     quality.setText(MessageManager.getString("label.quality"));
1479     conservation.setEnabled(false);
1480     conservation.setFont(LABEL_FONT);
1481     conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1482     conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1483     conservation.setSelected(true);
1484     conservation.setText(MessageManager.getString("label.conservation"));
1485     identity.setEnabled(false);
1486     identity.setFont(LABEL_FONT);
1487     identity.setHorizontalAlignment(SwingConstants.RIGHT);
1488     identity.setHorizontalTextPosition(SwingConstants.LEFT);
1489     identity.setSelected(true);
1490     identity.setText(MessageManager.getString("label.consensus"));
1491     showOccupancy.setFont(LABEL_FONT);
1492     showOccupancy.setEnabled(false);
1493     showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1494     showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1495     showOccupancy.setSelected(true);
1496     showOccupancy.setText(MessageManager.getString("label.occupancy"));
1497
1498     JLabel showGroupbits = new JLabel();
1499     showGroupbits.setFont(LABEL_FONT);
1500     showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1501     showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1502     showGroupbits
1503             .setText(MessageManager.getString("action.show_group") + ":");
1504     JLabel showConsensbits = new JLabel();
1505     showConsensbits.setFont(LABEL_FONT);
1506     showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1507     showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1508     showConsensbits
1509             .setText(MessageManager.getString("label.consensus") + ":");
1510     showConsensHistogram.setEnabled(false);
1511     showConsensHistogram.setFont(LABEL_FONT);
1512     showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1513     showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1514     showConsensHistogram.setSelected(true);
1515     showConsensHistogram
1516             .setText(MessageManager.getString("label.histogram"));
1517     showConsensLogo.setEnabled(false);
1518     showConsensLogo.setFont(LABEL_FONT);
1519     showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1520     showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1521     showConsensLogo.setSelected(true);
1522     showConsensLogo.setText(MessageManager.getString("label.logo"));
1523     showGroupConsensus.setEnabled(false);
1524     showGroupConsensus.setFont(LABEL_FONT);
1525     showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1526     showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1527     showGroupConsensus.setSelected(true);
1528     showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1529     showGroupConservation.setEnabled(false);
1530     showGroupConservation.setFont(LABEL_FONT);
1531     showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1532     showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1533     showGroupConservation.setSelected(true);
1534     showGroupConservation
1535             .setText(MessageManager.getString("label.conservation"));
1536     showNpTooltip.setEnabled(true);
1537     showNpTooltip.setFont(LABEL_FONT);
1538     showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1539     showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1540     showNpTooltip.setSelected(true);
1541     showNpTooltip.setText(
1542             MessageManager.getString("label.non_positional_features"));
1543     showDbRefTooltip.setEnabled(true);
1544     showDbRefTooltip.setFont(LABEL_FONT);
1545     showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1546     showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1547     showDbRefTooltip.setSelected(true);
1548     showDbRefTooltip
1549             .setText(MessageManager.getString("label.database_references"));
1550     annotations.setFont(LABEL_FONT);
1551     annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1552     annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1553     annotations.setSelected(true);
1554     annotations.setText(MessageManager.getString("label.show_annotations"));
1555     // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1556     annotations.addActionListener(new ActionListener()
1557     {
1558       @Override
1559       public void actionPerformed(ActionEvent e)
1560       {
1561         annotations_actionPerformed(e);
1562       }
1563     });
1564     identity.addActionListener(new ActionListener()
1565     {
1566       @Override
1567       public void actionPerformed(ActionEvent e)
1568       {
1569         annotations_actionPerformed(e);
1570       }
1571     });
1572     showGroupConsensus.addActionListener(new ActionListener()
1573     {
1574       @Override
1575       public void actionPerformed(ActionEvent e)
1576       {
1577         annotations_actionPerformed(e);
1578       }
1579     });
1580     showUnconserved.setFont(LABEL_FONT);
1581     showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1582     showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1583     showUnconserved.setSelected(true);
1584     showUnconserved
1585             .setText(MessageManager.getString("action.show_unconserved"));
1586     showUnconserved.addActionListener(new ActionListener()
1587     {
1588       @Override
1589       public void actionPerformed(ActionEvent e)
1590       {
1591         showunconserved_actionPerformed(e);
1592       }
1593     });
1594
1595     // TODO these are not yet added to / action from Preferences
1596     // JCheckBox shareSelections = new JCheckBox();
1597     // shareSelections.setFont(verdana11);
1598     // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1599     // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1600     // shareSelections.setSelected(true);
1601     // shareSelections.setText(MessageManager
1602     // .getString("label.share_selection_across_views"));
1603     // JCheckBox followHighlight = new JCheckBox();
1604     // followHighlight.setFont(verdana11);
1605     // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1606     // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1607     // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1608     // followHighlight.setSelected(true);
1609     // followHighlight.setText(MessageManager
1610     // .getString("label.scroll_highlighted_regions"));
1611
1612     seqLimit.setFont(LABEL_FONT);
1613     seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1614     seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1615     seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1616     smoothFont.setFont(LABEL_FONT);
1617     smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1618     smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1619     smoothFont.setText(MessageManager.getString("label.smooth_font"));
1620     scaleProteinToCdna.setFont(LABEL_FONT);
1621     scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1622     scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1623     scaleProteinToCdna.setText(
1624             MessageManager.getString("label.scale_protein_to_cdna"));
1625     scaleProteinToCdna.setToolTipText(
1626             MessageManager.getString("label.scale_protein_to_cdna_tip"));
1627     JLabel gapLabel = new JLabel();
1628     gapLabel.setFont(LABEL_FONT);
1629     gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1630     gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1631     JLabel fontLabel = new JLabel();
1632     fontLabel.setFont(LABEL_FONT);
1633     fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1634     fontLabel.setText(MessageManager.getString("label.font"));
1635     fontSizeCB.setFont(LABEL_FONT);
1636     fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1637     fontStyleCB.setFont(LABEL_FONT);
1638     fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1639     fontNameCB.setFont(LABEL_FONT);
1640     fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1641     gapSymbolCB.setFont(LABEL_FONT);
1642     gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1643     DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1644     dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1645     gapSymbolCB.setRenderer(dlcr);
1646
1647     startupCheckbox.setText(MessageManager.getString("action.open_file"));
1648     startupCheckbox.setFont(LABEL_FONT);
1649     startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1650     startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1651     startupCheckbox.setSelected(true);
1652     startupFileTextfield.setFont(LABEL_FONT);
1653     startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1654     final String tooltip = JvSwingUtils.wrapTooltip(true,
1655             MessageManager.getString("label.double_click_to_browse"));
1656     startupFileTextfield.setToolTipText(tooltip);
1657     startupFileTextfield.addMouseListener(new MouseAdapter()
1658     {
1659       @Override
1660       public void mouseClicked(MouseEvent e)
1661       {
1662         if (e.getClickCount() > 1)
1663         {
1664           startupFileTextfield_mouseClicked();
1665         }
1666       }
1667     });
1668
1669     sortby.setFont(LABEL_FONT);
1670     sortby.setBounds(new Rectangle(172, 260, 155, 21));
1671     JLabel sortLabel = new JLabel();
1672     sortLabel.setFont(LABEL_FONT);
1673     sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1674     sortLabel.setText(MessageManager.getString("label.sort_by"));
1675     sortAnnBy.setFont(LABEL_FONT);
1676     sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1677     JLabel sortAnnLabel = new JLabel();
1678     sortAnnLabel.setFont(LABEL_FONT);
1679     sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1680     sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1681     sortAutocalc.setFont(LABEL_FONT);
1682     sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1683
1684     JPanel annsettingsPanel = new JPanel();
1685     annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1686     annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1687     annsettingsPanel.setBorder(new EtchedBorder());
1688     visualTab.add(annsettingsPanel);
1689     Border jb = new EmptyBorder(1, 1, 4, 5);
1690     annotations.setBorder(jb);
1691     showOccupancy.setBorder(jb);
1692     quality.setBorder(jb);
1693     conservation.setBorder(jb);
1694     identity.setBorder(jb);
1695     showConsensbits.setBorder(jb);
1696     showGroupbits.setBorder(jb);
1697     showGroupConsensus.setBorder(jb);
1698     showGroupConservation.setBorder(jb);
1699     showConsensHistogram.setBorder(jb);
1700     showConsensLogo.setBorder(jb);
1701
1702     JPanel autoAnnotSettings = new JPanel();
1703     annsettingsPanel.add(autoAnnotSettings);
1704     autoAnnotSettings.setLayout(new GridLayout(0, 2));
1705     autoAnnotSettings.add(annotations);
1706     autoAnnotSettings.add(quality);
1707     // second row of autoannotation box
1708     autoAnnotSettings = new JPanel();
1709     annsettingsPanel.add(autoAnnotSettings);
1710
1711     autoAnnotSettings.setLayout(new GridLayout(0, 3));
1712     autoAnnotSettings.add(conservation);
1713     autoAnnotSettings.add(identity);
1714     autoAnnotSettings.add(showOccupancy);
1715     autoAnnotSettings.add(showGroupbits);
1716     autoAnnotSettings.add(showGroupConservation);
1717     autoAnnotSettings.add(showGroupConsensus);
1718     autoAnnotSettings.add(showConsensbits);
1719     autoAnnotSettings.add(showConsensHistogram);
1720     autoAnnotSettings.add(showConsensLogo);
1721
1722     JPanel tooltipSettings = new JPanel();
1723     tooltipSettings.setBorder(new TitledBorder(
1724             MessageManager.getString("label.sequence_id_tooltip")));
1725     tooltipSettings.setBounds(173, 140, 220, 62);
1726     tooltipSettings.setLayout(new GridLayout(2, 1));
1727     tooltipSettings.add(showDbRefTooltip);
1728     tooltipSettings.add(showNpTooltip);
1729     visualTab.add(tooltipSettings);
1730
1731     wrap.setFont(LABEL_FONT);
1732     wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1733     wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1734     wrap.setText(MessageManager.getString("label.wrap_alignment"));
1735     rightAlign.setFont(LABEL_FONT);
1736     rightAlign.setForeground(Color.black);
1737     rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1738     rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1739     rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1740     idItalics.setFont(LABEL_FONT_ITALIC);
1741     idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1742     idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1743     idItalics.setText(
1744             MessageManager.getString("label.sequence_name_italics"));
1745     openoverv.setFont(LABEL_FONT);
1746     openoverv.setActionCommand(
1747             MessageManager.getString("label.open_overview"));
1748     openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1749     openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1750     openoverv.setText(MessageManager.getString("label.open_overview"));
1751     JPanel jPanel2 = new JPanel();
1752     jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1753     jPanel2.setLayout(new GridLayout(14, 1));
1754     jPanel2.add(fullScreen);
1755     jPanel2.add(openoverv);
1756     jPanel2.add(seqLimit);
1757     jPanel2.add(rightAlign);
1758     jPanel2.add(fontLabel);
1759     jPanel2.add(showUnconserved);
1760     jPanel2.add(idItalics);
1761     jPanel2.add(smoothFont);
1762     jPanel2.add(scaleProteinToCdna);
1763     jPanel2.add(gapLabel);
1764     jPanel2.add(wrap);
1765     jPanel2.add(sortLabel);
1766     jPanel2.add(sortAnnLabel);
1767     jPanel2.add(startupCheckbox);
1768     visualTab.add(jPanel2);
1769     visualTab.add(startupFileTextfield);
1770     visualTab.add(sortby);
1771     visualTab.add(sortAnnBy);
1772     visualTab.add(sortAutocalc);
1773     visualTab.add(gapSymbolCB);
1774     visualTab.add(fontNameCB);
1775     visualTab.add(fontSizeCB);
1776     visualTab.add(fontStyleCB);
1777     return visualTab;
1778   }
1779
1780   protected void autoIdWidth_actionPerformed()
1781   {
1782     // TODO Auto-generated method stub
1783
1784   }
1785
1786   protected void userIdWidth_actionPerformed()
1787   {
1788     // TODO Auto-generated method stub
1789
1790   }
1791
1792   protected void maxColour_actionPerformed(JPanel panel)
1793   {
1794   }
1795
1796   protected void minColour_actionPerformed(JPanel panel)
1797   {
1798   }
1799
1800   protected void gapColour_actionPerformed(JPanel panel)
1801   {
1802   }
1803
1804   protected void hiddenColour_actionPerformed(JPanel panel)
1805   {
1806   }
1807
1808   protected void showunconserved_actionPerformed(ActionEvent e)
1809   {
1810     // TODO Auto-generated method stub
1811
1812   }
1813
1814   protected void useLegacyGaps_actionPerformed(ActionEvent e)
1815   {
1816   }
1817
1818   protected void resetOvDefaults_actionPerformed(ActionEvent e)
1819   {
1820   }
1821
1822   /**
1823    * DOCUMENT ME!
1824    * 
1825    * @param e
1826    *          DOCUMENT ME!
1827    */
1828   public void ok_actionPerformed(ActionEvent e)
1829   {
1830   }
1831
1832   /**
1833    * DOCUMENT ME!
1834    * 
1835    * @param e
1836    *          DOCUMENT ME!
1837    */
1838   public void cancel_actionPerformed(ActionEvent e)
1839   {
1840   }
1841
1842   /**
1843    * DOCUMENT ME!
1844    * 
1845    * @param e
1846    *          DOCUMENT ME!
1847    */
1848   public void annotations_actionPerformed(ActionEvent e)
1849   {
1850   }
1851
1852   /**
1853    * DOCUMENT ME!
1854    */
1855   public void startupFileTextfield_mouseClicked()
1856   {
1857   }
1858
1859   public void newLink_actionPerformed(ActionEvent e)
1860   {
1861
1862   }
1863
1864   public void editLink_actionPerformed(ActionEvent e)
1865   {
1866
1867   }
1868
1869   public void deleteLink_actionPerformed(ActionEvent e)
1870   {
1871
1872   }
1873
1874   public void defaultBrowser_mouseClicked(MouseEvent e)
1875   {
1876
1877   }
1878
1879   public void linkURLList_keyTyped(KeyEvent e)
1880   {
1881
1882   }
1883
1884   public void useProxy_actionPerformed()
1885   {
1886     boolean enabled = useProxy.isSelected();
1887     portLabel.setEnabled(enabled);
1888     serverLabel.setEnabled(enabled);
1889     proxyServerTB.setEnabled(enabled);
1890     proxyPortTB.setEnabled(enabled);
1891   }
1892
1893   /**
1894    * Customer renderer for JTable: supports column of radio buttons
1895    */
1896   public class RadioButtonRenderer extends JRadioButton
1897           implements TableCellRenderer
1898   {
1899     public RadioButtonRenderer()
1900     {
1901       setHorizontalAlignment(CENTER);
1902       setToolTipText(MessageManager.getString("label.urltooltip"));
1903     }
1904
1905     @Override
1906     public Component getTableCellRendererComponent(JTable table,
1907             Object value, boolean isSelected, boolean hasFocus, int row,
1908             int column)
1909     {
1910       setSelected((boolean) value);
1911
1912       // set colours to match rest of table
1913       if (isSelected)
1914       {
1915         setBackground(table.getSelectionBackground());
1916         setForeground(table.getSelectionForeground());
1917       }
1918       else
1919       {
1920         setBackground(table.getBackground());
1921         setForeground(table.getForeground());
1922       }
1923       return this;
1924     }
1925   }
1926
1927   /**
1928    * Customer cell editor for JTable: supports column of radio buttons in
1929    * conjunction with renderer
1930    */
1931   public class RadioButtonEditor extends AbstractCellEditor
1932           implements TableCellEditor
1933   {
1934     private JRadioButton button = new JRadioButton();
1935
1936     public RadioButtonEditor()
1937     {
1938       button.setHorizontalAlignment(SwingConstants.CENTER);
1939       this.button.addActionListener(new ActionListener()
1940       {
1941         @Override
1942         public void actionPerformed(ActionEvent e)
1943         {
1944           fireEditingStopped();
1945         }
1946       });
1947     }
1948
1949     @Override
1950     public Component getTableCellEditorComponent(JTable table, Object value,
1951             boolean isSelected, int row, int column)
1952     {
1953       button.setSelected((boolean) value);
1954       return button;
1955     }
1956
1957     @Override
1958     public Object getCellEditorValue()
1959     {
1960       return button.isSelected();
1961     }
1962
1963   }
1964
1965   protected void validateHmmerPath()
1966   {
1967   }
1968
1969   protected void validateCygwinPath()
1970   {
1971   }
1972
1973   /**
1974    * A helper method to add a panel containing a label and a component to a
1975    * panel
1976    * 
1977    * @param panel
1978    * @param tooltip
1979    * @param label
1980    * @param valBox
1981    */
1982   protected static void addtoLayout(JPanel panel, String tooltip,
1983           JComponent label, JComponent valBox)
1984   {
1985     JPanel laypanel = new JPanel(new GridLayout(1, 2));
1986     JPanel labPanel = new JPanel(new BorderLayout());
1987     JPanel valPanel = new JPanel();
1988     labPanel.setBounds(new Rectangle(7, 7, 158, 23));
1989     valPanel.setBounds(new Rectangle(172, 7, 270, 23));
1990     labPanel.add(label, BorderLayout.WEST);
1991     valPanel.add(valBox);
1992     laypanel.add(labPanel);
1993     laypanel.add(valPanel);
1994     valPanel.setToolTipText(tooltip);
1995     labPanel.setToolTipText(tooltip);
1996     valBox.setToolTipText(tooltip);
1997     panel.add(laypanel);
1998     panel.validate();
1999   }
2000 }