380db74e29ceef6a677422e15731876225579bd6
[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
687     defaultBrowser.addMouseListener(new MouseAdapter()
688     {
689       @Override
690       public void mouseClicked(MouseEvent e)
691       {
692         if (e.getClickCount() > 1)
693         {
694           defaultBrowser_mouseClicked(e);
695         }
696       }
697     });
698
699     JPanel proxyPanel = initConnTabProxyPanel();
700     initConnTabCheckboxes();
701
702     // Add default Browser text box
703     connectTab.add(browserLabel,
704             new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
705                     GridBagConstraints.WEST, GridBagConstraints.NONE,
706                     new Insets(10, 0, 5, 5), 5, 1));
707     defaultBrowser.setFont(LABEL_FONT);
708     defaultBrowser.setText("");
709
710     connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
711             0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
712             new Insets(10, 0, 5, 10), 30, 1));
713
714     // Add proxy server panel
715     connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
716             GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
717             new Insets(10, 0, 5, 12), 4, 10));
718
719     // Add usage stats, version check and questionnaire checkboxes
720     connectTab.add(usagestats,
721             new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
722                     GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
723                     new Insets(0, 2, 5, 5), 70, 1));
724     connectTab.add(questionnaire,
725             new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
726                     GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
727                     new Insets(0, 2, 5, 10), 70, 1));
728     connectTab.add(versioncheck,
729             new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
730                     GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
731                     new Insets(0, 2, 5, 5), 70, 1));
732
733     // Add padding so the panel doesn't look ridiculous
734     JPanel spacePanel = new JPanel();
735     connectTab.add(spacePanel,
736             new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
737                     GridBagConstraints.WEST, GridBagConstraints.BOTH,
738                     new Insets(0, 0, 0, 5), 70, 1));
739
740     return connectTab;
741   }
742
743   /**
744    * Initialises the Links tabbed panel.
745    * 
746    * @return
747    */
748   private JPanel initLinksTab()
749   {
750     JPanel linkTab = new JPanel();
751     linkTab.setLayout(new GridBagLayout());
752
753     // Set up table for Url links
754     linkUrlTable.setFillsViewportHeight(true);
755     linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
756     linkUrlTable.setAutoCreateRowSorter(true);
757     linkUrlTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
758
759     // adjust row height so radio buttons actually fit
760     // don't do this in the renderer, it causes the awt thread to activate
761     // constantly
762     JRadioButton temp = new JRadioButton();
763     linkUrlTable.setRowHeight(temp.getMinimumSize().height);
764
765     // Table in scrollpane so that the table is given a scrollbar
766     JScrollPane linkScrollPane = new JScrollPane(linkUrlTable);
767     linkScrollPane.setBorder(null);
768
769     // Panel for links functionality
770     JPanel linkPanel = new JPanel(new GridBagLayout());
771     linkPanel.setBorder(new TitledBorder(
772             MessageManager.getString("label.url_linkfrom_sequence_id")));
773
774     // Put the Url links panel together
775
776     // Buttons go at top right, resizing only resizes the blank space vertically
777     JPanel buttonPanel = initLinkTabUrlButtons();
778     GridBagConstraints linkConstraints1 = new GridBagConstraints();
779     linkConstraints1.insets = new Insets(0, 0, 5, 0);
780     linkConstraints1.gridx = 0;
781     linkConstraints1.gridy = 0;
782     linkConstraints1.weightx = 1.0;
783     linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
784     linkTab.add(buttonPanel, linkConstraints1);
785
786     // Links table goes at top left, resizing resizes the table
787     GridBagConstraints linkConstraints2 = new GridBagConstraints();
788     linkConstraints2.insets = new Insets(0, 0, 5, 5);
789     linkConstraints2.gridx = 0;
790     linkConstraints2.gridy = 1;
791     linkConstraints2.weightx = 1.0;
792     linkConstraints2.weighty = 1.0;
793     linkConstraints2.fill = GridBagConstraints.BOTH;
794     linkTab.add(linkScrollPane, linkConstraints2);
795
796     // Filter box and buttons goes at bottom left, resizing resizes the text box
797     JPanel filterPanel = initLinkTabFilterPanel();
798     GridBagConstraints linkConstraints3 = new GridBagConstraints();
799     linkConstraints3.insets = new Insets(0, 0, 0, 5);
800     linkConstraints3.gridx = 0;
801     linkConstraints3.gridy = 2;
802     linkConstraints3.weightx = 1.0;
803     linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
804     linkTab.add(filterPanel, linkConstraints3);
805
806     return linkTab;
807   }
808
809   private JPanel initLinkTabFilterPanel()
810   {
811     // Filter textbox and reset button
812     JLabel filterLabel = new JLabel(
813             MessageManager.getString("label.filter"));
814     filterLabel.setFont(LABEL_FONT);
815     filterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
816     filterLabel.setHorizontalTextPosition(SwingConstants.LEADING);
817
818     filterTB.setFont(LABEL_FONT);
819     filterTB.setText("");
820
821     doReset.setText(MessageManager.getString("action.showall"));
822     userOnly.setText(MessageManager.getString("action.customfilter"));
823
824     // Panel for filter functionality
825     JPanel filterPanel = new JPanel(new GridBagLayout());
826     filterPanel.setBorder(new TitledBorder("Filter"));
827     GridBagConstraints gbc = new GridBagConstraints();
828     gbc.gridx = 0;
829     gbc.gridy = 0;
830     gbc.fill = GridBagConstraints.NONE;
831     gbc.anchor = GridBagConstraints.WEST;
832
833     filterPanel.add(filterLabel, gbc);
834
835     GridBagConstraints gbc1 = new GridBagConstraints();
836     gbc1.gridx = 1;
837     gbc1.gridwidth = 2;
838     gbc1.fill = GridBagConstraints.HORIZONTAL;
839     gbc1.anchor = GridBagConstraints.WEST;
840     gbc1.weightx = 1.0;
841     filterPanel.add(filterTB, gbc1);
842
843     GridBagConstraints gbc2 = new GridBagConstraints();
844     gbc2.gridx = 3;
845     gbc2.fill = GridBagConstraints.NONE;
846     gbc2.anchor = GridBagConstraints.WEST;
847     filterPanel.add(doReset, gbc2);
848
849     GridBagConstraints gbc3 = new GridBagConstraints();
850     gbc3.gridx = 4;
851     gbc3.fill = GridBagConstraints.NONE;
852     gbc3.anchor = GridBagConstraints.WEST;
853     filterPanel.add(userOnly, gbc3);
854
855     return filterPanel;
856   }
857
858   private JPanel initLinkTabUrlButtons()
859   {
860     // Buttons for new / edit / delete Url links
861     JButton newLink = new JButton();
862     newLink.setText(MessageManager.getString("action.new"));
863
864     editLink.setText(MessageManager.getString("action.edit"));
865
866     deleteLink.setText(MessageManager.getString("action.delete"));
867
868     // no current selection, so initially disable delete/edit buttons
869     editLink.setEnabled(false);
870     deleteLink.setEnabled(false);
871
872     newLink.addActionListener(new java.awt.event.ActionListener()
873     {
874       @Override
875       public void actionPerformed(ActionEvent e)
876       {
877         newLink_actionPerformed(e);
878       }
879     });
880
881     editLink.setText(MessageManager.getString("action.edit"));
882     editLink.addActionListener(new java.awt.event.ActionListener()
883     {
884       @Override
885       public void actionPerformed(ActionEvent e)
886       {
887         editLink_actionPerformed(e);
888       }
889     });
890
891     deleteLink.setText(MessageManager.getString("action.delete"));
892     deleteLink.addActionListener(new java.awt.event.ActionListener()
893     {
894       @Override
895       public void actionPerformed(ActionEvent e)
896       {
897         deleteLink_actionPerformed(e);
898       }
899     });
900
901     JPanel buttonPanel = new JPanel(new GridBagLayout());
902     buttonPanel.setBorder(new TitledBorder("Edit links"));
903     GridBagConstraints gbc = new GridBagConstraints();
904     gbc.gridx = 0;
905     gbc.gridy = 0;
906     gbc.fill = GridBagConstraints.NONE;
907     buttonPanel.add(newLink, gbc);
908
909     GridBagConstraints gbc1 = new GridBagConstraints();
910     gbc1.gridx = 1;
911     gbc1.gridy = 0;
912     gbc1.fill = GridBagConstraints.NONE;
913     buttonPanel.add(editLink, gbc1);
914
915     GridBagConstraints gbc2 = new GridBagConstraints();
916     gbc2.gridx = 2;
917     gbc2.gridy = 0;
918     gbc2.fill = GridBagConstraints.NONE;
919     buttonPanel.add(deleteLink, gbc2);
920
921     GridBagConstraints gbc3 = new GridBagConstraints();
922     gbc3.gridx = 3;
923     gbc3.gridy = 0;
924     gbc3.fill = GridBagConstraints.HORIZONTAL;
925     gbc3.weightx = 1.0;
926     JPanel spacePanel = new JPanel();
927     spacePanel.setBorder(null);
928     buttonPanel.add(spacePanel, gbc3);
929
930     return buttonPanel;
931   }
932
933   /**
934    * Initialises the proxy server panel in the Connections tab
935    * 
936    * @return the proxy server panel
937    */
938   private JPanel initConnTabProxyPanel()
939   {
940     // Label for server text box
941     serverLabel.setText(MessageManager.getString("label.address"));
942     serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
943     serverLabel.setFont(LABEL_FONT);
944
945     // Proxy server and port text boxes
946     proxyServerTB.setFont(LABEL_FONT);
947     proxyPortTB.setFont(LABEL_FONT);
948
949     // Label for Port text box
950     portLabel.setFont(LABEL_FONT);
951     portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
952     portLabel.setText(MessageManager.getString("label.port"));
953
954     // Use proxy server checkbox
955     useProxy.setFont(LABEL_FONT);
956     useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
957     useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
958     useProxy.setText(MessageManager.getString("label.use_proxy_server"));
959     useProxy.addActionListener(new ActionListener()
960     {
961       @Override
962       public void actionPerformed(ActionEvent e)
963       {
964         useProxy_actionPerformed();
965       }
966     });
967
968     // Make proxy server panel
969     JPanel proxyPanel = new JPanel();
970     TitledBorder titledBorder1 = new TitledBorder(
971             MessageManager.getString("label.proxy_server"));
972     proxyPanel.setBorder(titledBorder1);
973     proxyPanel.setLayout(new GridBagLayout());
974     proxyPanel.add(serverLabel,
975             new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
976                     GridBagConstraints.WEST, GridBagConstraints.NONE,
977                     new Insets(0, 2, 2, 0), 5, 0));
978     proxyPanel.add(portLabel,
979             new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
980                     GridBagConstraints.WEST, GridBagConstraints.NONE,
981                     new Insets(0, 0, 2, 0), 11, 0));
982     proxyPanel.add(useProxy,
983             new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
984                     GridBagConstraints.WEST, GridBagConstraints.NONE,
985                     new Insets(0, 2, 5, 185), 2, -4));
986     proxyPanel.add(proxyPortTB,
987             new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
988                     GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
989                     new Insets(0, 2, 2, 2), 54, 1));
990     proxyPanel.add(proxyServerTB,
991             new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
992                     GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
993                     new Insets(0, 2, 2, 0), 263, 1));
994
995     return proxyPanel;
996   }
997
998   /**
999    * Initialises the checkboxes in the Connections tab
1000    */
1001   private void initConnTabCheckboxes()
1002   {
1003     // Usage stats checkbox label
1004     usagestats.setText(
1005             MessageManager.getString("label.send_usage_statistics"));
1006     usagestats.setFont(LABEL_FONT);
1007     usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
1008     usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
1009
1010     // Questionnaire checkbox label
1011     questionnaire.setText(
1012             MessageManager.getString("label.check_for_questionnaires"));
1013     questionnaire.setFont(LABEL_FONT);
1014     questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
1015     questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
1016
1017     // Check for latest version checkbox label
1018     versioncheck.setText(
1019             MessageManager.getString("label.check_for_latest_version"));
1020     versioncheck.setFont(LABEL_FONT);
1021     versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
1022     versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
1023   }
1024
1025   /**
1026    * Initialises the parent panel which contains the tabbed sections.
1027    * 
1028    * @return
1029    */
1030   private JPanel initOkCancelPanel()
1031   {
1032     JButton ok = new JButton();
1033     ok.setText(MessageManager.getString("action.ok"));
1034     ok.addActionListener(new ActionListener()
1035     {
1036       @Override
1037       public void actionPerformed(ActionEvent e)
1038       {
1039         ok_actionPerformed(e);
1040       }
1041     });
1042     JButton cancel = new JButton();
1043     cancel.setText(MessageManager.getString("action.cancel"));
1044     cancel.addActionListener(new ActionListener()
1045     {
1046       @Override
1047       public void actionPerformed(ActionEvent e)
1048       {
1049         cancel_actionPerformed(e);
1050       }
1051     });
1052     JPanel okCancelPanel = new JPanel();
1053     okCancelPanel.add(ok);
1054     okCancelPanel.add(cancel);
1055     return okCancelPanel;
1056   }
1057
1058   /**
1059    * Initialises the Colours tabbed panel.
1060    * 
1061    * @return
1062    */
1063   private JPanel initColoursTab()
1064   {
1065     JPanel coloursTab = new JPanel();
1066     coloursTab.setBorder(new TitledBorder(
1067             MessageManager.getString("action.open_new_alignment")));
1068     coloursTab.setLayout(new FlowLayout());
1069     JLabel mincolourLabel = new JLabel();
1070     mincolourLabel.setFont(LABEL_FONT);
1071     mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1072     mincolourLabel.setText(MessageManager.getString("label.min_colour"));
1073     minColour.setFont(LABEL_FONT);
1074     minColour.setBorder(BorderFactory.createEtchedBorder());
1075     minColour.setPreferredSize(new Dimension(40, 20));
1076     minColour.addMouseListener(new MouseAdapter()
1077     {
1078       @Override
1079       public void mousePressed(MouseEvent e)
1080       {
1081         minColour_actionPerformed(minColour);
1082       }
1083     });
1084     JLabel maxcolourLabel = new JLabel();
1085     maxcolourLabel.setFont(LABEL_FONT);
1086     maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1087     maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
1088     maxColour.setFont(LABEL_FONT);
1089     maxColour.setBorder(BorderFactory.createEtchedBorder());
1090     maxColour.setPreferredSize(new Dimension(40, 20));
1091     maxColour.addMouseListener(new MouseAdapter()
1092     {
1093       @Override
1094       public void mousePressed(MouseEvent e)
1095       {
1096         maxColour_actionPerformed(maxColour);
1097       }
1098     });
1099
1100     protColour.setFont(LABEL_FONT);
1101     protColour.setBounds(new Rectangle(172, 225, 155, 21));
1102     JLabel protColourLabel = new JLabel();
1103     protColourLabel.setFont(LABEL_FONT);
1104     protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1105     protColourLabel.setText(
1106             MessageManager.getString("label.prot_alignment_colour") + " ");
1107     GPreferences.addtoLayout(coloursTab,
1108             MessageManager
1109                     .getString("label.default_colour_scheme_for_alignment"),
1110             protColourLabel, protColour);
1111
1112     nucColour.setFont(LABEL_FONT);
1113     nucColour.setBounds(new Rectangle(172, 240, 155, 21));
1114     JLabel nucColourLabel = new JLabel();
1115     nucColourLabel.setFont(LABEL_FONT);
1116     nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
1117     nucColourLabel.setText(
1118             MessageManager.getString("label.nuc_alignment_colour") + " ");
1119     GPreferences.addtoLayout(coloursTab,
1120             MessageManager
1121                     .getString("label.default_colour_scheme_for_alignment"),
1122             nucColourLabel, nucColour);
1123
1124     JPanel annotationShding = new JPanel();
1125     annotationShding.setBorder(new TitledBorder(
1126             MessageManager.getString("label.annotation_shading_default")));
1127     annotationShding.setLayout(new GridLayout(1, 2));
1128     GPreferences.addtoLayout(annotationShding,
1129             MessageManager.getString(
1130                     "label.default_minimum_colour_annotation_shading"),
1131             mincolourLabel, minColour);
1132     GPreferences.addtoLayout(annotationShding,
1133             MessageManager.getString(
1134                     "label.default_maximum_colour_annotation_shading"),
1135             maxcolourLabel, maxColour);
1136     coloursTab.add(annotationShding); // , FlowLayout.LEFT);
1137     return coloursTab;
1138   }
1139
1140   /**
1141    * Initialises the Overview tabbed panel.
1142    * 
1143    * @return
1144    */
1145   private JPanel initOverviewTab()
1146   {
1147     JPanel overviewPanel = new JPanel();
1148     overviewPanel.setBorder(new TitledBorder(
1149             MessageManager.getString("label.overview_settings")));
1150
1151     gapColour.setFont(LABEL_FONT);
1152     // fixing the border colours stops apparent colour bleed from the panel
1153     gapColour.setBorder(
1154             BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1155     gapColour.setPreferredSize(new Dimension(40, 20));
1156     gapColour.addMouseListener(new MouseAdapter()
1157     {
1158       @Override
1159       public void mousePressed(MouseEvent e)
1160       {
1161         gapColour_actionPerformed(gapColour);
1162       }
1163     });
1164
1165     hiddenColour.setFont(LABEL_FONT);
1166     // fixing the border colours stops apparent colour bleed from the panel
1167     hiddenColour.setBorder(
1168             BorderFactory.createEtchedBorder(Color.white, Color.lightGray));
1169     hiddenColour.setPreferredSize(new Dimension(40, 20));
1170     hiddenColour.addMouseListener(new MouseAdapter()
1171     {
1172       @Override
1173       public void mousePressed(MouseEvent e)
1174       {
1175         hiddenColour_actionPerformed(hiddenColour);
1176       }
1177     });
1178     
1179     useLegacyGap = new JCheckBox(
1180             MessageManager.getString("label.ov_legacy_gap"));
1181     useLegacyGap.setFont(LABEL_FONT);
1182     useLegacyGap.setHorizontalAlignment(SwingConstants.LEFT);
1183     useLegacyGap.setVerticalTextPosition(SwingConstants.TOP);
1184     gapLabel = new JLabel(
1185             MessageManager.getString("label.gap_colour"));
1186     gapLabel.setFont(LABEL_FONT);
1187     gapLabel.setHorizontalAlignment(SwingConstants.LEFT);
1188     gapLabel.setVerticalTextPosition(SwingConstants.TOP);
1189     showHiddenAtStart = new JCheckBox(
1190             MessageManager.getString("label.ov_show_hide_default"));
1191     showHiddenAtStart.setFont(LABEL_FONT);
1192     showHiddenAtStart.setHorizontalAlignment(SwingConstants.LEFT);
1193     showHiddenAtStart.setVerticalTextPosition(SwingConstants.TOP);
1194     JLabel hiddenLabel = new JLabel(
1195             MessageManager.getString("label.hidden_colour"));
1196     hiddenLabel.setFont(LABEL_FONT);
1197     hiddenLabel.setHorizontalAlignment(SwingConstants.LEFT);
1198     hiddenLabel.setVerticalTextPosition(SwingConstants.TOP);
1199
1200     useLegacyGap.addActionListener(new ActionListener()
1201     {
1202       @Override
1203       public void actionPerformed(ActionEvent e)
1204       {
1205         useLegacyGaps_actionPerformed(e);
1206       }
1207     });
1208
1209     overviewPanel.setLayout(new GridBagLayout());
1210     GridBagConstraints c1 = new GridBagConstraints();
1211
1212     c1.fill = GridBagConstraints.HORIZONTAL;
1213     c1.gridx = 0;
1214     c1.gridy = 0;
1215     c1.weightx = 1;
1216     c1.ipady = 20;
1217     c1.anchor = GridBagConstraints.FIRST_LINE_START;
1218     overviewPanel.add(useLegacyGap, c1);
1219
1220     GridBagConstraints c2 = new GridBagConstraints();
1221     c2.fill = GridBagConstraints.HORIZONTAL;
1222     c2.gridx = 1;
1223     c2.gridy = 0;
1224     c2.insets = new Insets(0, 15, 0, 10);
1225     overviewPanel.add(gapLabel, c2);
1226
1227     GridBagConstraints c3 = new GridBagConstraints();
1228     c3.fill = GridBagConstraints.HORIZONTAL;
1229     c3.gridx = 2;
1230     c3.gridy = 0;
1231     c3.insets = new Insets(0, 0, 0, 15);
1232     overviewPanel.add(gapColour, c3);
1233
1234     GridBagConstraints c4 = new GridBagConstraints();
1235     c4.fill = GridBagConstraints.HORIZONTAL;
1236     c4.gridx = 0;
1237     c4.gridy = 1;
1238     c4.weightx = 1;
1239     overviewPanel.add(showHiddenAtStart, c4);
1240
1241     GridBagConstraints c5 = new GridBagConstraints();
1242     c5.fill = GridBagConstraints.HORIZONTAL;
1243     c5.gridx = 1;
1244     c5.gridy = 1;
1245     c5.insets = new Insets(0, 15, 0, 10);
1246     overviewPanel.add(hiddenLabel, c5);
1247
1248     GridBagConstraints c6 = new GridBagConstraints();
1249     c6.fill = GridBagConstraints.HORIZONTAL;
1250     c6.gridx = 2;
1251     c6.gridy = 1;
1252     c6.insets = new Insets(0, 0, 0, 15);
1253     overviewPanel.add(hiddenColour, c6);
1254
1255     JButton resetButton = new JButton(
1256             MessageManager.getString("label.reset_to_defaults"));
1257
1258     resetButton.addActionListener(new ActionListener()
1259     {
1260       @Override
1261       public void actionPerformed(ActionEvent e)
1262       {
1263         resetOvDefaults_actionPerformed(e);
1264       }
1265     });
1266
1267     GridBagConstraints c7 = new GridBagConstraints();
1268     c7.fill = GridBagConstraints.NONE;
1269     c7.gridx = 0;
1270     c7.gridy = 2;
1271     c7.insets = new Insets(10, 0, 0, 0);
1272     c7.anchor = GridBagConstraints.WEST;
1273     overviewPanel.add(resetButton, c7);
1274
1275     // Add padding so the panel doesn't look ridiculous
1276     JPanel spacePanel = new JPanel();
1277     overviewPanel.add(spacePanel,
1278             new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
1279                     GridBagConstraints.WEST, GridBagConstraints.BOTH,
1280                     new Insets(0, 0, 0, 5), 0, 0));
1281
1282     return overviewPanel;
1283   }
1284
1285   /**
1286    * Initialises the Structure tabbed panel.
1287    * 
1288    * @return
1289    */
1290   private JPanel initStructureTab()
1291   {
1292     structureTab = new JPanel();
1293
1294     structureTab.setBorder(new TitledBorder(
1295             MessageManager.getString("label.structure_options")));
1296     structureTab.setLayout(null);
1297     final int width = 400;
1298     final int height = 22;
1299     final int lineSpacing = 25;
1300     int ypos = 15;
1301
1302     structFromPdb.setFont(LABEL_FONT);
1303     structFromPdb
1304             .setText(MessageManager.getString("label.struct_from_pdb"));
1305     structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
1306     structFromPdb.addActionListener(new ActionListener()
1307     {
1308       @Override
1309       public void actionPerformed(ActionEvent e)
1310       {
1311         boolean selected = structFromPdb.isSelected();
1312         // enable other options only when the first is checked
1313         useRnaView.setEnabled(selected);
1314         addSecondaryStructure.setEnabled(selected);
1315         addTempFactor.setEnabled(selected);
1316       }
1317     });
1318     structureTab.add(structFromPdb);
1319
1320     // indent checkboxes that are conditional on the first one
1321     ypos += lineSpacing;
1322     useRnaView.setFont(LABEL_FONT);
1323     useRnaView.setText(MessageManager.getString("label.use_rnaview"));
1324     useRnaView.setBounds(new Rectangle(25, ypos, width, height));
1325     structureTab.add(useRnaView);
1326
1327     ypos += lineSpacing;
1328     addSecondaryStructure.setFont(LABEL_FONT);
1329     addSecondaryStructure
1330             .setText(MessageManager.getString("label.autoadd_secstr"));
1331     addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
1332     structureTab.add(addSecondaryStructure);
1333
1334     ypos += lineSpacing;
1335     addTempFactor.setFont(LABEL_FONT);
1336     addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
1337     addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
1338     structureTab.add(addTempFactor);
1339
1340     ypos += lineSpacing;
1341     JLabel viewerLabel = new JLabel();
1342     viewerLabel.setFont(LABEL_FONT);
1343     viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
1344     viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
1345     viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
1346     structureTab.add(viewerLabel);
1347
1348     structViewer.setFont(LABEL_FONT);
1349     structViewer.setBounds(new Rectangle(160, ypos, 120, height));
1350     structViewer.addItem(ViewerType.JMOL.name());
1351     structViewer.addItem(ViewerType.CHIMERA.name());
1352     structViewer.addActionListener(new ActionListener()
1353     {
1354       @Override
1355       public void actionPerformed(ActionEvent e)
1356       {
1357         structureViewer_actionPerformed(
1358                 (String) structViewer.getSelectedItem());
1359       }
1360     });
1361     structureTab.add(structViewer);
1362
1363     ypos += lineSpacing;
1364     JLabel pathLabel = new JLabel();
1365     pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
1366     pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
1367     pathLabel.setText(MessageManager.getString("label.chimera_path"));
1368     final String tooltip = JvSwingUtils.wrapTooltip(true,
1369             MessageManager.getString("label.chimera_path_tip"));
1370     pathLabel.setToolTipText(tooltip);
1371     pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
1372     structureTab.add(pathLabel);
1373
1374     chimeraPath.setFont(LABEL_FONT);
1375     chimeraPath.setText("");
1376     chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
1377     chimeraPath.addMouseListener(new MouseAdapter()
1378     {
1379       @Override
1380       public void mouseClicked(MouseEvent e)
1381       {
1382         if (e.getClickCount() == 2)
1383         {
1384           String chosen = openFileChooser(false);
1385           if (chosen != null)
1386           {
1387             chimeraPath.setText(chosen);
1388           }
1389         }
1390       }
1391     });
1392     structureTab.add(chimeraPath);
1393
1394     ypos += lineSpacing;
1395     nwMapping.setFont(LABEL_FONT);
1396     nwMapping.setText(MessageManager.getString("label.nw_mapping"));
1397     siftsMapping.setFont(LABEL_FONT);
1398     siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
1399     mappingMethod.add(nwMapping);
1400     mappingMethod.add(siftsMapping);
1401     JPanel mappingPanel = new JPanel();
1402     mappingPanel.setFont(LABEL_FONT);
1403     TitledBorder mmTitledBorder = new TitledBorder(
1404             MessageManager.getString("label.mapping_method"));
1405     mmTitledBorder.setTitleFont(LABEL_FONT);
1406     mappingPanel.setBorder(mmTitledBorder);
1407     mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
1408     // GridLayout mappingLayout = new GridLayout();
1409     mappingPanel.setLayout(new GridLayout());
1410     mappingPanel.add(nwMapping);
1411     mappingPanel.add(siftsMapping);
1412     structureTab.add(mappingPanel);
1413
1414     ypos += lineSpacing;
1415     ypos += lineSpacing;
1416     FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
1417             PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
1418     docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
1419     structureTab.add(docFieldPref);
1420
1421     return structureTab;
1422   }
1423
1424   /**
1425    * Action on choosing a structure viewer from combobox options.
1426    * 
1427    * @param selectedItem
1428    */
1429   protected void structureViewer_actionPerformed(String selectedItem)
1430   {
1431   }
1432
1433   /**
1434    * Show a dialog for the user to choose a file. Returns the chosen path, or
1435    * null on Cancel.
1436    * 
1437    * @return
1438    */
1439   protected String openFileChooser(boolean forFolder)
1440   {
1441     String choice = null;
1442     JFileChooser chooser = new JFileChooser();
1443     if (forFolder)
1444     {
1445       chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
1446     }
1447
1448     // chooser.setFileView(new JalviewFileView());
1449     chooser.setDialogTitle(
1450             MessageManager.getString("label.open_local_file"));
1451     chooser.setToolTipText(MessageManager.getString("action.open"));
1452
1453     int value = chooser.showOpenDialog(this);
1454
1455     if (value == JFileChooser.APPROVE_OPTION)
1456     {
1457       choice = chooser.getSelectedFile().getPath();
1458     }
1459     return choice;
1460   }
1461
1462   protected boolean validateStructure()
1463   {
1464     return false;
1465   }
1466
1467   /**
1468    * Initialises the Visual tabbed panel.
1469    * 
1470    * @return
1471    */
1472   private JPanel initVisualTab()
1473   {
1474     JPanel visualTab = new JPanel();
1475     visualTab.setBorder(new TitledBorder(
1476             MessageManager.getString("action.open_new_alignment")));
1477     visualTab.setLayout(null);
1478     fullScreen.setFont(LABEL_FONT);
1479     fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
1480     fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
1481     fullScreen.setText(MessageManager.getString("label.maximize_window"));
1482     quality.setEnabled(false);
1483     quality.setFont(LABEL_FONT);
1484     quality.setHorizontalAlignment(SwingConstants.RIGHT);
1485     quality.setHorizontalTextPosition(SwingConstants.LEFT);
1486     quality.setSelected(true);
1487     quality.setText(MessageManager.getString("label.quality"));
1488     conservation.setEnabled(false);
1489     conservation.setFont(LABEL_FONT);
1490     conservation.setHorizontalAlignment(SwingConstants.RIGHT);
1491     conservation.setHorizontalTextPosition(SwingConstants.LEFT);
1492     conservation.setSelected(true);
1493     conservation.setText(MessageManager.getString("label.conservation"));
1494     identity.setEnabled(false);
1495     identity.setFont(LABEL_FONT);
1496     identity.setHorizontalAlignment(SwingConstants.RIGHT);
1497     identity.setHorizontalTextPosition(SwingConstants.LEFT);
1498     identity.setSelected(true);
1499     identity.setText(MessageManager.getString("label.consensus"));
1500     showOccupancy.setFont(LABEL_FONT);
1501     showOccupancy.setEnabled(false);
1502     showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
1503     showOccupancy.setHorizontalTextPosition(SwingConstants.LEFT);
1504     showOccupancy.setSelected(true);
1505     showOccupancy.setText(MessageManager.getString("label.occupancy"));
1506
1507     JLabel showGroupbits = new JLabel();
1508     showGroupbits.setFont(LABEL_FONT);
1509     showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
1510     showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
1511     showGroupbits
1512             .setText(MessageManager.getString("action.show_group") + ":");
1513     JLabel showConsensbits = new JLabel();
1514     showConsensbits.setFont(LABEL_FONT);
1515     showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
1516     showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
1517     showConsensbits
1518             .setText(MessageManager.getString("label.consensus") + ":");
1519     showConsensHistogram.setEnabled(false);
1520     showConsensHistogram.setFont(LABEL_FONT);
1521     showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
1522     showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
1523     showConsensHistogram.setSelected(true);
1524     showConsensHistogram
1525             .setText(MessageManager.getString("label.histogram"));
1526     showConsensLogo.setEnabled(false);
1527     showConsensLogo.setFont(LABEL_FONT);
1528     showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
1529     showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
1530     showConsensLogo.setSelected(true);
1531     showConsensLogo.setText(MessageManager.getString("label.logo"));
1532     showGroupConsensus.setEnabled(false);
1533     showGroupConsensus.setFont(LABEL_FONT);
1534     showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
1535     showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
1536     showGroupConsensus.setSelected(true);
1537     showGroupConsensus.setText(MessageManager.getString("label.consensus"));
1538     showGroupConservation.setEnabled(false);
1539     showGroupConservation.setFont(LABEL_FONT);
1540     showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
1541     showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
1542     showGroupConservation.setSelected(true);
1543     showGroupConservation
1544             .setText(MessageManager.getString("label.conservation"));
1545     showNpTooltip.setEnabled(true);
1546     showNpTooltip.setFont(LABEL_FONT);
1547     showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1548     showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1549     showNpTooltip.setSelected(true);
1550     showNpTooltip.setText(
1551             MessageManager.getString("label.non_positional_features"));
1552     showDbRefTooltip.setEnabled(true);
1553     showDbRefTooltip.setFont(LABEL_FONT);
1554     showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1555     showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1556     showDbRefTooltip.setSelected(true);
1557     showDbRefTooltip
1558             .setText(MessageManager.getString("label.database_references"));
1559     annotations.setFont(LABEL_FONT);
1560     annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1561     annotations.setHorizontalTextPosition(SwingConstants.LEFT);
1562     annotations.setSelected(true);
1563     annotations.setText(MessageManager.getString("label.show_annotations"));
1564     // annotations.setBounds(new Rectangle(169, 12, 200, 23));
1565     annotations.addActionListener(new ActionListener()
1566     {
1567       @Override
1568       public void actionPerformed(ActionEvent e)
1569       {
1570         annotations_actionPerformed(e);
1571       }
1572     });
1573     identity.addActionListener(new ActionListener()
1574     {
1575       @Override
1576       public void actionPerformed(ActionEvent e)
1577       {
1578         annotations_actionPerformed(e);
1579       }
1580     });
1581     showGroupConsensus.addActionListener(new ActionListener()
1582     {
1583       @Override
1584       public void actionPerformed(ActionEvent e)
1585       {
1586         annotations_actionPerformed(e);
1587       }
1588     });
1589     showUnconserved.setFont(LABEL_FONT);
1590     showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1591     showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1592     showUnconserved.setSelected(true);
1593     showUnconserved
1594             .setText(MessageManager.getString("action.show_unconserved"));
1595     showUnconserved.addActionListener(new ActionListener()
1596     {
1597       @Override
1598       public void actionPerformed(ActionEvent e)
1599       {
1600         showunconserved_actionPerformed(e);
1601       }
1602     });
1603
1604     // TODO these are not yet added to / action from Preferences
1605     // JCheckBox shareSelections = new JCheckBox();
1606     // shareSelections.setFont(verdana11);
1607     // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1608     // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1609     // shareSelections.setSelected(true);
1610     // shareSelections.setText(MessageManager
1611     // .getString("label.share_selection_across_views"));
1612     // JCheckBox followHighlight = new JCheckBox();
1613     // followHighlight.setFont(verdana11);
1614     // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1615     // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1616     // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1617     // followHighlight.setSelected(true);
1618     // followHighlight.setText(MessageManager
1619     // .getString("label.scroll_highlighted_regions"));
1620
1621     seqLimit.setFont(LABEL_FONT);
1622     seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1623     seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1624     seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1625     smoothFont.setFont(LABEL_FONT);
1626     smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1627     smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1628     smoothFont.setText(MessageManager.getString("label.smooth_font"));
1629     scaleProteinToCdna.setFont(LABEL_FONT);
1630     scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1631     scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1632     scaleProteinToCdna.setText(
1633             MessageManager.getString("label.scale_protein_to_cdna"));
1634     scaleProteinToCdna.setToolTipText(
1635             MessageManager.getString("label.scale_protein_to_cdna_tip"));
1636     JLabel gapLabel = new JLabel();
1637     gapLabel.setFont(LABEL_FONT);
1638     gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1639     gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1640     JLabel fontLabel = new JLabel();
1641     fontLabel.setFont(LABEL_FONT);
1642     fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1643     fontLabel.setText(MessageManager.getString("label.font"));
1644     fontSizeCB.setFont(LABEL_FONT);
1645     fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1646     fontStyleCB.setFont(LABEL_FONT);
1647     fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1648     fontNameCB.setFont(LABEL_FONT);
1649     fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1650     gapSymbolCB.setFont(LABEL_FONT);
1651     gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1652     DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1653     dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1654     gapSymbolCB.setRenderer(dlcr);
1655
1656     startupCheckbox.setText(MessageManager.getString("action.open_file"));
1657     startupCheckbox.setFont(LABEL_FONT);
1658     startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1659     startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1660     startupCheckbox.setSelected(true);
1661     startupFileTextfield.setFont(LABEL_FONT);
1662     startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1663     startupFileTextfield.addMouseListener(new MouseAdapter()
1664     {
1665       @Override
1666       public void mouseClicked(MouseEvent e)
1667       {
1668         if (e.getClickCount() > 1)
1669         {
1670           startupFileTextfield_mouseClicked();
1671         }
1672       }
1673     });
1674
1675     sortby.setFont(LABEL_FONT);
1676     sortby.setBounds(new Rectangle(172, 260, 155, 21));
1677     JLabel sortLabel = new JLabel();
1678     sortLabel.setFont(LABEL_FONT);
1679     sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1680     sortLabel.setText(MessageManager.getString("label.sort_by"));
1681     sortAnnBy.setFont(LABEL_FONT);
1682     sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1683     JLabel sortAnnLabel = new JLabel();
1684     sortAnnLabel.setFont(LABEL_FONT);
1685     sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1686     sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1687     sortAutocalc.setFont(LABEL_FONT);
1688     sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1689
1690     JPanel annsettingsPanel = new JPanel();
1691     annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
1692     annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1693     annsettingsPanel.setBorder(new EtchedBorder());
1694     visualTab.add(annsettingsPanel);
1695     Border jb = new EmptyBorder(1, 1, 4, 5);
1696     annotations.setBorder(jb);
1697     showOccupancy.setBorder(jb);
1698     quality.setBorder(jb);
1699     conservation.setBorder(jb);
1700     identity.setBorder(jb);
1701     showConsensbits.setBorder(jb);
1702     showGroupbits.setBorder(jb);
1703     showGroupConsensus.setBorder(jb);
1704     showGroupConservation.setBorder(jb);
1705     showConsensHistogram.setBorder(jb);
1706     showConsensLogo.setBorder(jb);
1707
1708     JPanel autoAnnotSettings = new JPanel();
1709     annsettingsPanel.add(autoAnnotSettings);
1710     autoAnnotSettings.setLayout(new GridLayout(0, 2));
1711     autoAnnotSettings.add(annotations);
1712     autoAnnotSettings.add(quality);
1713     // second row of autoannotation box
1714     autoAnnotSettings = new JPanel();
1715     annsettingsPanel.add(autoAnnotSettings);
1716
1717     autoAnnotSettings.setLayout(new GridLayout(0, 3));
1718     autoAnnotSettings.add(conservation);
1719     autoAnnotSettings.add(identity);
1720     autoAnnotSettings.add(showOccupancy);
1721     autoAnnotSettings.add(showGroupbits);
1722     autoAnnotSettings.add(showGroupConservation);
1723     autoAnnotSettings.add(showGroupConsensus);
1724     autoAnnotSettings.add(showConsensbits);
1725     autoAnnotSettings.add(showConsensHistogram);
1726     autoAnnotSettings.add(showConsensLogo);
1727
1728     JPanel tooltipSettings = new JPanel();
1729     tooltipSettings.setBorder(new TitledBorder(
1730             MessageManager.getString("label.sequence_id_tooltip")));
1731     tooltipSettings.setBounds(173, 140, 220, 62);
1732     tooltipSettings.setLayout(new GridLayout(2, 1));
1733     tooltipSettings.add(showDbRefTooltip);
1734     tooltipSettings.add(showNpTooltip);
1735     visualTab.add(tooltipSettings);
1736
1737     wrap.setFont(LABEL_FONT);
1738     wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1739     wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1740     wrap.setText(MessageManager.getString("label.wrap_alignment"));
1741     rightAlign.setFont(LABEL_FONT);
1742     rightAlign.setForeground(Color.black);
1743     rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1744     rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1745     rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1746     idItalics.setFont(LABEL_FONT_ITALIC);
1747     idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1748     idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1749     idItalics.setText(
1750             MessageManager.getString("label.sequence_name_italics"));
1751     openoverv.setFont(LABEL_FONT);
1752     openoverv.setActionCommand(
1753             MessageManager.getString("label.open_overview"));
1754     openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1755     openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1756     openoverv.setText(MessageManager.getString("label.open_overview"));
1757     JPanel jPanel2 = new JPanel();
1758     jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1759     jPanel2.setLayout(new GridLayout(14, 1));
1760     jPanel2.add(fullScreen);
1761     jPanel2.add(openoverv);
1762     jPanel2.add(seqLimit);
1763     jPanel2.add(rightAlign);
1764     jPanel2.add(fontLabel);
1765     jPanel2.add(showUnconserved);
1766     jPanel2.add(idItalics);
1767     jPanel2.add(smoothFont);
1768     jPanel2.add(scaleProteinToCdna);
1769     jPanel2.add(gapLabel);
1770     jPanel2.add(wrap);
1771     jPanel2.add(sortLabel);
1772     jPanel2.add(sortAnnLabel);
1773     jPanel2.add(startupCheckbox);
1774     visualTab.add(jPanel2);
1775     visualTab.add(startupFileTextfield);
1776     visualTab.add(sortby);
1777     visualTab.add(sortAnnBy);
1778     visualTab.add(sortAutocalc);
1779     visualTab.add(gapSymbolCB);
1780     visualTab.add(fontNameCB);
1781     visualTab.add(fontSizeCB);
1782     visualTab.add(fontStyleCB);
1783     return visualTab;
1784   }
1785
1786   protected void autoIdWidth_actionPerformed()
1787   {
1788     // TODO Auto-generated method stub
1789
1790   }
1791
1792   protected void userIdWidth_actionPerformed()
1793   {
1794     // TODO Auto-generated method stub
1795
1796   }
1797
1798   protected void maxColour_actionPerformed(JPanel panel)
1799   {
1800   }
1801
1802   protected void minColour_actionPerformed(JPanel panel)
1803   {
1804   }
1805
1806   protected void gapColour_actionPerformed(JPanel panel)
1807   {
1808   }
1809
1810   protected void hiddenColour_actionPerformed(JPanel panel)
1811   {
1812   }
1813
1814   protected void showunconserved_actionPerformed(ActionEvent e)
1815   {
1816     // TODO Auto-generated method stub
1817
1818   }
1819
1820   protected void useLegacyGaps_actionPerformed(ActionEvent e)
1821   {
1822   }
1823
1824   protected void resetOvDefaults_actionPerformed(ActionEvent e)
1825   {
1826   }
1827
1828   /**
1829    * DOCUMENT ME!
1830    * 
1831    * @param e
1832    *          DOCUMENT ME!
1833    */
1834   public void ok_actionPerformed(ActionEvent e)
1835   {
1836   }
1837
1838   /**
1839    * DOCUMENT ME!
1840    * 
1841    * @param e
1842    *          DOCUMENT ME!
1843    */
1844   public void cancel_actionPerformed(ActionEvent e)
1845   {
1846   }
1847
1848   /**
1849    * DOCUMENT ME!
1850    * 
1851    * @param e
1852    *          DOCUMENT ME!
1853    */
1854   public void annotations_actionPerformed(ActionEvent e)
1855   {
1856   }
1857
1858   /**
1859    * DOCUMENT ME!
1860    */
1861   public void startupFileTextfield_mouseClicked()
1862   {
1863   }
1864
1865   public void newLink_actionPerformed(ActionEvent e)
1866   {
1867
1868   }
1869
1870   public void editLink_actionPerformed(ActionEvent e)
1871   {
1872
1873   }
1874
1875   public void deleteLink_actionPerformed(ActionEvent e)
1876   {
1877
1878   }
1879
1880   public void defaultBrowser_mouseClicked(MouseEvent e)
1881   {
1882
1883   }
1884
1885   public void linkURLList_keyTyped(KeyEvent e)
1886   {
1887
1888   }
1889
1890   public void useProxy_actionPerformed()
1891   {
1892     boolean enabled = useProxy.isSelected();
1893     portLabel.setEnabled(enabled);
1894     serverLabel.setEnabled(enabled);
1895     proxyServerTB.setEnabled(enabled);
1896     proxyPortTB.setEnabled(enabled);
1897   }
1898
1899   /**
1900    * Customer renderer for JTable: supports column of radio buttons
1901    */
1902   public class RadioButtonRenderer extends JRadioButton
1903           implements TableCellRenderer
1904   {
1905     public RadioButtonRenderer()
1906     {
1907       setHorizontalAlignment(CENTER);
1908       setToolTipText(MessageManager.getString("label.urltooltip"));
1909     }
1910
1911     @Override
1912     public Component getTableCellRendererComponent(JTable table,
1913             Object value, boolean isSelected, boolean hasFocus, int row,
1914             int column)
1915     {
1916       setSelected((boolean) value);
1917
1918       // set colours to match rest of table
1919       if (isSelected)
1920       {
1921         setBackground(table.getSelectionBackground());
1922         setForeground(table.getSelectionForeground());
1923       }
1924       else
1925       {
1926         setBackground(table.getBackground());
1927         setForeground(table.getForeground());
1928       }
1929       return this;
1930     }
1931   }
1932
1933   /**
1934    * Customer cell editor for JTable: supports column of radio buttons in
1935    * conjunction with renderer
1936    */
1937   public class RadioButtonEditor extends AbstractCellEditor
1938           implements TableCellEditor
1939   {
1940     private JRadioButton button = new JRadioButton();
1941
1942     public RadioButtonEditor()
1943     {
1944       button.setHorizontalAlignment(SwingConstants.CENTER);
1945       this.button.addActionListener(new ActionListener()
1946       {
1947         @Override
1948         public void actionPerformed(ActionEvent e)
1949         {
1950           fireEditingStopped();
1951         }
1952       });
1953     }
1954
1955     @Override
1956     public Component getTableCellEditorComponent(JTable table, Object value,
1957             boolean isSelected, int row, int column)
1958     {
1959       button.setSelected((boolean) value);
1960       return button;
1961     }
1962
1963     @Override
1964     public Object getCellEditorValue()
1965     {
1966       return button.isSelected();
1967     }
1968
1969   }
1970
1971   protected void validateHmmerPath()
1972   {
1973   }
1974
1975   protected void validateCygwinPath()
1976   {
1977   }
1978
1979   /**
1980    * A helper method to add a panel containing a label and a component to a
1981    * panel
1982    * 
1983    * @param panel
1984    * @param tooltip
1985    * @param label
1986    * @param valBox
1987    */
1988   protected static void addtoLayout(JPanel panel, String tooltip,
1989           JComponent label, JComponent valBox)
1990   {
1991     JPanel laypanel = new JPanel(new GridLayout(1, 2));
1992     JPanel labPanel = new JPanel(new BorderLayout());
1993     JPanel valPanel = new JPanel();
1994     labPanel.setBounds(new Rectangle(7, 7, 158, 23));
1995     valPanel.setBounds(new Rectangle(172, 7, 270, 23));
1996     labPanel.add(label, BorderLayout.WEST);
1997     valPanel.add(valBox);
1998     laypanel.add(labPanel);
1999     laypanel.add(valPanel);
2000     valPanel.setToolTipText(tooltip);
2001     labPanel.setToolTipText(tooltip);
2002     valBox.setToolTipText(tooltip);
2003     panel.add(laypanel);
2004     panel.validate();
2005   }
2006 }