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