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