a2323778999d2aa332e63fa2ae7863039f55cf40
[jalview.git] / src / jalview / jbgui / GPreferences.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3  * Copyright (C) 2014 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.gui.JvSwingUtils;
24 import jalview.gui.StructureViewer.Viewer;
25 import jalview.util.MessageManager;
26
27 import java.awt.BorderLayout;
28 import java.awt.Color;
29 import java.awt.Dimension;
30 import java.awt.FlowLayout;
31 import java.awt.Font;
32 import java.awt.GridBagConstraints;
33 import java.awt.GridBagLayout;
34 import java.awt.GridLayout;
35 import java.awt.Insets;
36 import java.awt.Rectangle;
37 import java.awt.event.ActionEvent;
38 import java.awt.event.ActionListener;
39 import java.awt.event.KeyEvent;
40 import java.awt.event.MouseAdapter;
41 import java.awt.event.MouseEvent;
42
43 import javax.swing.BorderFactory;
44 import javax.swing.DefaultListCellRenderer;
45 import javax.swing.JButton;
46 import javax.swing.JCheckBox;
47 import javax.swing.JComboBox;
48 import javax.swing.JLabel;
49 import javax.swing.JList;
50 import javax.swing.JPanel;
51 import javax.swing.JScrollPane;
52 import javax.swing.JTabbedPane;
53 import javax.swing.JTextField;
54 import javax.swing.ListSelectionModel;
55 import javax.swing.SwingConstants;
56 import javax.swing.border.Border;
57 import javax.swing.border.EmptyBorder;
58 import javax.swing.border.TitledBorder;
59 import javax.swing.event.ListSelectionEvent;
60 import javax.swing.event.ListSelectionListener;
61
62 /**
63  * Base class for the Preferences panel.
64  * 
65  * @author $author$
66  * @version $Revision$
67  */
68 public class GPreferences extends JPanel
69 {
70   private static final Font verdana11 = JvSwingUtils.getLabelFont();
71
72   /*
73    * Visual tab components
74    */
75   protected JCheckBox fullScreen = new JCheckBox();
76
77   protected JCheckBox openoverv = new JCheckBox();
78
79   protected JCheckBox seqLimit = new JCheckBox();
80
81   protected JCheckBox rightAlign = new JCheckBox();
82
83   protected JComboBox<String> fontSizeCB = new JComboBox<String>();
84
85   protected JComboBox<String> fontStyleCB = new JComboBox<String>();
86
87   protected JComboBox<String> fontNameCB = new JComboBox<String>();
88
89   protected JCheckBox showUnconserved = new JCheckBox();
90
91   protected JCheckBox idItalics = new JCheckBox();
92
93   protected JCheckBox smoothFont = new JCheckBox();
94
95   protected JComboBox<String> gapSymbolCB = new JComboBox<String>();
96
97   protected JCheckBox wrap = new JCheckBox();
98
99   protected JComboBox<String> sortby = new JComboBox<String>();
100
101   protected JComboBox<String> sortAnnBy = new JComboBox<String>();
102
103   protected JComboBox<String> sortAutocalc = new JComboBox<String>();
104
105   protected JCheckBox startupCheckbox = new JCheckBox();
106
107   protected JTextField startupFileTextfield = new JTextField();
108
109   // below are in the 'second column'
110   protected JCheckBox annotations = new JCheckBox();
111
112   protected JCheckBox quality = new JCheckBox();
113
114   protected JCheckBox conservation = new JCheckBox();
115
116   protected JCheckBox identity = new JCheckBox();
117
118   protected JCheckBox showGroupConsensus = new JCheckBox();
119
120   protected JCheckBox showGroupConservation = new JCheckBox();
121
122   protected JCheckBox showConsensHistogram = new JCheckBox();
123
124   protected JCheckBox showConsensLogo = new JCheckBox();
125
126   protected JCheckBox showDbRefTooltip = new JCheckBox();
127
128   protected JCheckBox showNpTooltip = new JCheckBox();
129
130   /*
131    * Annotations tab components
132    */
133   protected JCheckBox structFromPdb = new JCheckBox();
134
135   protected JCheckBox useRnaView = new JCheckBox();
136
137   protected JCheckBox addSecondaryStructure = new JCheckBox();
138
139   protected JCheckBox addTempFactor = new JCheckBox();
140
141   protected JComboBox<String> structViewer = new JComboBox<String>();
142
143   protected JTextField chimeraPath = new JTextField();
144
145   /*
146    * Colours tab components
147    */
148   protected JPanel minColour = new JPanel();
149
150   protected JPanel maxColour = new JPanel();
151
152   protected JComboBox<String> colour = new JComboBox<String>();
153
154   /*
155    * Connections tab components
156    */
157   protected JList linkURLList = new JList();
158
159   protected JTextField proxyServerTB = new JTextField();
160
161   protected JTextField proxyPortTB = new JTextField();
162
163   protected JTextField defaultBrowser = new JTextField();
164
165   protected JList linkNameList = new JList();
166
167   protected JCheckBox useProxy = new JCheckBox();
168
169   protected JCheckBox usagestats = new JCheckBox();
170
171   protected JCheckBox questionnaire = new JCheckBox();
172
173   protected JCheckBox versioncheck = new JCheckBox();
174
175   /*
176    * Output tab components
177    */
178   protected JComboBox<String> epsRendering = new JComboBox<String>();
179
180   protected JLabel userIdWidthlabel = new JLabel();
181
182   protected JCheckBox autoIdWidth = new JCheckBox();
183
184   protected JTextField userIdWidth = new JTextField();
185
186   protected JCheckBox blcjv = new JCheckBox();
187
188   protected JCheckBox pileupjv = new JCheckBox();
189
190   protected JCheckBox clustaljv = new JCheckBox();
191
192   protected JCheckBox msfjv = new JCheckBox();
193
194   protected JCheckBox fastajv = new JCheckBox();
195
196   protected JCheckBox pfamjv = new JCheckBox();
197
198   protected JCheckBox pirjv = new JCheckBox();
199
200   protected JCheckBox modellerOutput = new JCheckBox();
201
202   /*
203    * Editing tab components
204    */
205   protected JCheckBox autoCalculateConsCheck = new JCheckBox();
206
207   protected JCheckBox padGaps = new JCheckBox();
208
209   protected JCheckBox sortByTree = new JCheckBox();
210
211   /*
212    * DAS Settings tab
213    */
214   protected JPanel dasTab = new JPanel();
215
216   /*
217    * Web Services tab
218    */
219   protected JPanel wsTab = new JPanel();
220
221   /**
222    * Creates a new GPreferences object.
223    */
224   public GPreferences()
225   {
226     try
227     {
228       jbInit();
229     } catch (Exception ex)
230     {
231       ex.printStackTrace();
232     }
233   }
234
235   /**
236    * Construct the panel and its tabbed sub-panels.
237    * 
238    * @throws Exception
239    */
240   private void jbInit() throws Exception
241   {
242     JTabbedPane tabbedPane = new JTabbedPane();
243     this.setLayout(new BorderLayout());
244     JPanel okCancelPanel = initOkCancelPanel();
245     this.add(tabbedPane, BorderLayout.CENTER);
246     this.add(okCancelPanel, BorderLayout.SOUTH);
247
248     tabbedPane.add(initVisualTab(),
249             MessageManager.getString("label.visual"));
250
251     tabbedPane.add(initColoursTab(),
252             MessageManager.getString("label.colours"));
253
254     tabbedPane.add(initStructureTab(),
255             MessageManager.getString("label.structure"));
256
257     tabbedPane.add(initConnectionsTab(),
258             MessageManager.getString("label.connections"));
259
260     tabbedPane.add(initOutputTab(), MessageManager.getString("label.output"));
261
262     tabbedPane.add(initEditingTab(), MessageManager.getString("label.editing"));
263
264     /*
265      * See DasSourceBrowser for the real work of configuring this tab.
266      */
267     dasTab.setLayout(new BorderLayout());
268     tabbedPane
269             .add(dasTab, MessageManager.getString("label.das_settings"));
270
271     /*
272      * See WsPreferences for the real work of configuring this tab.
273      */
274     wsTab.setLayout(new BorderLayout());
275     tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
276   }
277
278   /**
279    * Initialises the Editing tabbed panel.
280    * 
281    * @return
282    */
283   private JPanel initEditingTab()
284   {
285     JPanel editingTab = new JPanel();
286     editingTab.setLayout(null);
287     autoCalculateConsCheck.setFont(verdana11);
288     autoCalculateConsCheck.setText(MessageManager
289             .getString("label.autocalculate_consensus"));
290     autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
291     padGaps.setFont(verdana11);
292     padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
293     padGaps.setBounds(new Rectangle(22, 94, 168, 23));
294     sortByTree.setFont(verdana11);
295     sortByTree
296             .setText(MessageManager.getString("label.sort_with_new_tree"));
297     sortByTree
298             .setToolTipText(MessageManager
299                     .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
300     sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
301     editingTab.add(autoCalculateConsCheck);
302     editingTab.add(padGaps);
303     editingTab.add(sortByTree);
304     return editingTab;
305   }
306
307   /**
308    * Initialises the Output tabbed panel.
309    * 
310    * @return
311    */
312   private JPanel initOutputTab()
313   {
314     JPanel outputTab = new JPanel();
315     outputTab.setLayout(null);
316     JLabel epsLabel = new JLabel();
317     epsLabel.setFont(verdana11);
318     epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
319     epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
320     epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
321     epsRendering.setFont(verdana11);
322     epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
323     JLabel jLabel1 = new JLabel();
324     jLabel1.setFont(verdana11);
325     jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
326     jLabel1.setText(MessageManager.getString("label.append_start_end"));
327     jLabel1.setFont(verdana11);
328     fastajv.setFont(verdana11);
329     fastajv.setHorizontalAlignment(SwingConstants.LEFT);
330     clustaljv.setText(MessageManager.getString("label.clustal") + "     ");
331     blcjv.setText(MessageManager.getString("label.blc") + "     ");
332     fastajv.setText(MessageManager.getString("label.fasta") + "     ");
333     msfjv.setText(MessageManager.getString("label.msf") + "     ");
334     pfamjv.setText(MessageManager.getString("label.pfam") + "     ");
335     pileupjv.setText(MessageManager.getString("label.pileup") + "     ");
336     msfjv.setFont(verdana11);
337     msfjv.setHorizontalAlignment(SwingConstants.LEFT);
338     pirjv.setText(MessageManager.getString("label.pir") + "     ");
339     JPanel jPanel11 = new JPanel();
340     jPanel11.setFont(verdana11);
341     TitledBorder titledBorder2 = new TitledBorder(
342             MessageManager.getString("label.file_output"));
343     jPanel11.setBorder(titledBorder2);
344     jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
345     GridLayout gridLayout3 = new GridLayout();
346     jPanel11.setLayout(gridLayout3);
347     gridLayout3.setRows(8);
348     blcjv.setFont(verdana11);
349     blcjv.setHorizontalAlignment(SwingConstants.LEFT);
350     clustaljv.setFont(verdana11);
351     clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
352     pfamjv.setFont(verdana11);
353     pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
354     pileupjv.setFont(verdana11);
355     pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
356     pirjv.setFont(verdana11);
357     pirjv.setHorizontalAlignment(SwingConstants.LEFT);
358     autoIdWidth.setFont(verdana11);
359     autoIdWidth.setText(MessageManager
360             .getString("label.automatically_set_id_width"));
361     autoIdWidth
362             .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.adjusts_width_generated_eps_png")));
363     autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
364     autoIdWidth.addActionListener(new ActionListener()
365     {
366
367       @Override
368       public void actionPerformed(ActionEvent e)
369       {
370         autoIdWidth_actionPerformed();
371       }
372     });
373     userIdWidthlabel.setFont(verdana11);
374     userIdWidthlabel.setText(MessageManager
375             .getString("label.figure_id_column_width"));
376     userIdWidth
377             .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
378     userIdWidthlabel
379             .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
380     userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
381     userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
382     userIdWidth.setText("");
383     userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
384     userIdWidth.addActionListener(new ActionListener()
385     {
386
387       @Override
388       public void actionPerformed(ActionEvent e)
389       {
390         userIdWidth_actionPerformed();
391       }
392     });
393     jPanel11.add(jLabel1);
394     jPanel11.add(blcjv);
395     jPanel11.add(clustaljv);
396     jPanel11.add(fastajv);
397     jPanel11.add(msfjv);
398     jPanel11.add(pfamjv);
399     jPanel11.add(pileupjv);
400     jPanel11.add(pirjv);
401     outputTab.add(autoIdWidth);
402     outputTab.add(userIdWidth);
403     outputTab.add(userIdWidthlabel);
404     outputTab.add(modellerOutput);
405     outputTab.add(epsLabel);
406     outputTab.add(epsRendering);
407     outputTab.add(jPanel11);
408     modellerOutput.setFont(verdana11);
409     modellerOutput.setText(MessageManager
410             .getString("label.use_modeller_output"));
411     modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
412     return outputTab;
413   }
414
415   /**
416    * Initialises the Connections tabbed panel.
417    * 
418    * @return
419    */
420   private JPanel initConnectionsTab()
421   {
422     JPanel connectTab = new JPanel();
423     connectTab.setLayout(new GridBagLayout());
424     JLabel serverLabel = new JLabel();
425     serverLabel.setText(MessageManager.getString("label.address"));
426     serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
427     serverLabel.setFont(verdana11);
428     proxyServerTB.setFont(verdana11);
429     proxyPortTB.setFont(verdana11);
430     JLabel portLabel = new JLabel();
431     portLabel.setFont(verdana11);
432     portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
433     portLabel.setText(MessageManager.getString("label.port"));
434     JLabel browserLabel = new JLabel();
435     browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
436     browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
437     browserLabel.setText(MessageManager
438             .getString("label.default_browser_unix"));
439     defaultBrowser.setFont(verdana11);
440     defaultBrowser.setText("");
441     usagestats.setText(MessageManager
442             .getString("label.send_usage_statistics"));
443     usagestats.setFont(verdana11);
444     usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
445     usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
446     questionnaire.setText(MessageManager
447             .getString("label.check_for_questionnaires"));
448     questionnaire.setFont(verdana11);
449     questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
450     questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
451     versioncheck.setText(MessageManager
452             .getString("label.check_for_latest_version"));
453     versioncheck.setFont(verdana11);
454     versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
455     versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
456     JButton newLink = new JButton();
457     newLink.setText(MessageManager.getString("action.new"));
458     newLink.addActionListener(new java.awt.event.ActionListener()
459     {
460       public void actionPerformed(ActionEvent e)
461       {
462         newLink_actionPerformed(e);
463       }
464     });
465     JButton editLink = new JButton();
466     editLink.setText(MessageManager.getString("action.edit"));
467     editLink.addActionListener(new java.awt.event.ActionListener()
468     {
469       public void actionPerformed(ActionEvent e)
470       {
471         editLink_actionPerformed(e);
472       }
473     });
474     JButton deleteLink = new JButton();
475     deleteLink.setText(MessageManager.getString("action.delete"));
476     deleteLink.addActionListener(new java.awt.event.ActionListener()
477     {
478       public void actionPerformed(ActionEvent e)
479       {
480         deleteLink_actionPerformed(e);
481       }
482     });
483
484     linkURLList.addListSelectionListener(new ListSelectionListener()
485     {
486       public void valueChanged(ListSelectionEvent e)
487       {
488         int index = linkURLList.getSelectedIndex();
489         linkNameList.setSelectedIndex(index);
490       }
491     });
492
493     linkNameList.addListSelectionListener(new ListSelectionListener()
494     {
495       public void valueChanged(ListSelectionEvent e)
496       {
497         int index = linkNameList.getSelectedIndex();
498         linkURLList.setSelectedIndex(index);
499       }
500     });
501
502     JScrollPane linkScrollPane = new JScrollPane();
503     linkScrollPane.setBorder(null);
504     JPanel linkPanel = new JPanel();
505     linkPanel.setBorder(new TitledBorder(MessageManager
506             .getString("label.url_linkfrom_sequence_id")));
507     linkPanel.setLayout(new BorderLayout());
508     GridLayout gridLayout1 = new GridLayout();
509     JPanel editLinkButtons = new JPanel();
510     editLinkButtons.setLayout(gridLayout1);
511     gridLayout1.setRows(3);
512     linkNameList.setFont(verdana11);
513     linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
514     BorderLayout borderLayout3 = new BorderLayout();
515     JPanel linkPanel2 = new JPanel();
516     linkPanel2.setLayout(borderLayout3);
517     linkURLList.setFont(verdana11);
518     linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
519
520     defaultBrowser.addMouseListener(new MouseAdapter()
521     {
522       public void mouseClicked(MouseEvent e)
523       {
524         if (e.getClickCount() > 1)
525         {
526           defaultBrowser_mouseClicked(e);
527         }
528       }
529     });
530     useProxy.setFont(verdana11);
531     useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
532     useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
533     useProxy.setText(MessageManager.getString("label.use_proxy_server"));
534     useProxy.addActionListener(new ActionListener()
535     {
536       public void actionPerformed(ActionEvent e)
537       {
538         useProxy_actionPerformed();
539       }
540     });
541     linkPanel.add(editLinkButtons, BorderLayout.EAST);
542     editLinkButtons.add(newLink, null);
543     editLinkButtons.add(editLink, null);
544     editLinkButtons.add(deleteLink, null);
545     linkPanel.add(linkScrollPane, BorderLayout.CENTER);
546     linkScrollPane.getViewport().add(linkPanel2, null);
547     linkPanel2.add(linkURLList, BorderLayout.CENTER);
548     linkPanel2.add(linkNameList, BorderLayout.WEST);
549     JPanel jPanel1 = new JPanel();
550     TitledBorder titledBorder1 = new TitledBorder(
551             MessageManager.getString("label.proxy_server"));
552     jPanel1.setBorder(titledBorder1);
553     jPanel1.setLayout(new GridBagLayout());
554     jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
555             GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
556                     2, 4, 0), 5, 0));
557     jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
558             GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
559                     0, 4, 0), 11, 6));
560     connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
561             GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
562                     16, 0, 0, 12), 359, -17));
563     connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0,
564             GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
565                     21, 0, 35, 12), 4, 6));
566     connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
567             0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
568             new Insets(16, 0, 0, 0), 5, 1));
569     jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
570             GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
571                     2, 5, 185), 2, -4));
572     jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
573             GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
574             new Insets(0, 2, 4, 2), 54, 1));
575     jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
576             GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
577             new Insets(0, 2, 4, 0), 263, 1));
578     connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
579             0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
580             new Insets(15, 0, 0, 15), 307, 1));
581     connectTab.add(usagestats, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0,
582             GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
583             new Insets(0, 2, 4, 2), 70, 1));
584     connectTab.add(questionnaire, new GridBagConstraints(1, 4, 1, 1, 1.0,
585             0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
586             new Insets(0, 2, 4, 2), 70, 1));
587     connectTab.add(versioncheck, new GridBagConstraints(0, 5, 1, 1, 1.0,
588             0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
589             new Insets(0, 2, 4, 2), 70, 1));
590     return connectTab;
591   }
592
593   /**
594    * Initialises the parent panel which contains the tabbed sections.
595    * 
596    * @return
597    */
598   private JPanel initOkCancelPanel()
599   {
600     JButton ok = new JButton();
601     ok.setText(MessageManager.getString("action.ok"));
602     ok.addActionListener(new ActionListener()
603     {
604       public void actionPerformed(ActionEvent e)
605       {
606         ok_actionPerformed(e);
607       }
608     });
609     JButton cancel = new JButton();
610     cancel.setText(MessageManager.getString("action.cancel"));
611     cancel.addActionListener(new ActionListener()
612     {
613       public void actionPerformed(ActionEvent e)
614       {
615         cancel_actionPerformed(e);
616       }
617     });
618     JPanel okCancelPanel = new JPanel();
619     okCancelPanel.add(ok);
620     okCancelPanel.add(cancel);
621     return okCancelPanel;
622   }
623
624   /**
625    * Initialises the Colours tabbed panel.
626    * 
627    * @return
628    */
629   private JPanel initColoursTab()
630   {
631     JPanel coloursTab = new JPanel();
632     coloursTab.setBorder(new TitledBorder(MessageManager
633             .getString("action.open_new_alignment")));
634     coloursTab.setLayout(new FlowLayout());
635     JLabel mincolourLabel = new JLabel();
636     mincolourLabel.setFont(verdana11);
637     mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
638     mincolourLabel.setText(MessageManager.getString("label.min_colour"));
639     minColour.setFont(verdana11);
640     minColour.setBorder(BorderFactory.createEtchedBorder());
641     minColour.setPreferredSize(new Dimension(40, 20));
642     minColour.addMouseListener(new MouseAdapter()
643     {
644       public void mousePressed(MouseEvent e)
645       {
646         minColour_actionPerformed(minColour);
647       }
648     });
649     JLabel maxcolourLabel = new JLabel();
650     maxcolourLabel.setFont(verdana11);
651     maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
652     maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
653     maxColour.setFont(verdana11);
654     maxColour.setBorder(BorderFactory.createEtchedBorder());
655     maxColour.setPreferredSize(new Dimension(40, 20));
656     maxColour.addMouseListener(new MouseAdapter()
657     {
658       public void mousePressed(MouseEvent e)
659       {
660         maxColour_actionPerformed(maxColour);
661       }
662     });
663     colour.setFont(verdana11);
664     colour.setBounds(new Rectangle(172, 225, 155, 21));
665     JLabel colourLabel = new JLabel();
666     colourLabel.setFont(verdana11);
667     colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
668     colourLabel.setText(MessageManager.getString("label.alignment_colour")
669             + " ");
670     JvSwingUtils.addtoLayout(coloursTab, MessageManager
671             .getString("label.default_colour_scheme_for_alignment"),
672             colourLabel, colour);
673     JPanel annotationShding = new JPanel();
674     annotationShding.setBorder(new TitledBorder(MessageManager
675             .getString("label.annotation_shading_default")));
676     annotationShding.setLayout(new GridLayout(1, 2));
677     JvSwingUtils.addtoLayout(annotationShding, MessageManager
678             .getString("label.default_minimum_colour_annotation_shading"),
679             mincolourLabel, minColour);
680     JvSwingUtils.addtoLayout(annotationShding, MessageManager
681             .getString("label.default_maximum_colour_annotation_shading"),
682             maxcolourLabel, maxColour);
683     coloursTab.add(annotationShding); // , FlowLayout.LEFT);
684     return coloursTab;
685   }
686
687   /**
688    * Initialises the Structure tabbed panel.
689    * 
690    * @return
691    */
692   private JPanel initStructureTab()
693   {
694     JPanel structureTab = new JPanel();
695     structureTab.setBorder(new TitledBorder(MessageManager
696             .getString("label.structure_options")));
697     structureTab.setLayout(null);
698     final int width = 400;
699     final int height = 23;
700     final int lineSpacing = 30;
701     int ypos = 30;
702
703     structFromPdb.setFont(verdana11);
704     structFromPdb.setText(MessageManager.getString("label.struct_from_pdb"));
705     structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
706     structFromPdb.addActionListener(new ActionListener()
707     {
708       @Override
709       public void actionPerformed(ActionEvent e)
710       {
711         boolean selected = structFromPdb.isSelected();
712         // enable other options only when the first is checked
713         useRnaView.setEnabled(selected);
714         addSecondaryStructure.setEnabled(selected);
715         addTempFactor.setEnabled(selected);
716       }
717     });
718     structureTab.add(structFromPdb);
719
720     // indent checkboxes that are conditional on the first one
721     ypos += lineSpacing;
722     useRnaView.setFont(verdana11);
723     useRnaView.setText(MessageManager.getString("label.use_rnaview"));
724     useRnaView.setBounds(new Rectangle(25, ypos, width, height));
725     structureTab.add(useRnaView);
726
727     ypos += lineSpacing;
728     addSecondaryStructure.setFont(verdana11);
729     addSecondaryStructure.setText(MessageManager
730             .getString("label.autoadd_secstr"));
731     addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
732     structureTab.add(addSecondaryStructure);
733
734     ypos += lineSpacing;
735     addTempFactor.setFont(verdana11);
736     addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
737     addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
738     structureTab.add(addTempFactor);
739
740     ypos += lineSpacing;
741     JLabel viewerLabel = new JLabel();
742     viewerLabel.setFont(verdana11);
743     viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
744     viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
745     viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
746     structureTab.add(viewerLabel);
747
748     structViewer.setFont(verdana11);
749     structViewer.setBounds(new Rectangle(160, ypos, 120, height));
750     structViewer.addItem(Viewer.JMOL.name());
751     structViewer.addItem(Viewer.CHIMERA.name());
752     structureTab.add(structViewer);
753
754     ypos += lineSpacing;
755     JLabel pathLabel = new JLabel();
756     pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
757     pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
758     pathLabel.setText(MessageManager.getString("label.chimera_path"));
759     pathLabel.setToolTipText(MessageManager
760             .getString("label.chimera_path_tip"));
761     pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
762     structureTab.add(pathLabel);
763
764     chimeraPath.setFont(verdana11);
765     chimeraPath.setText("");
766     chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
767     structureTab.add(chimeraPath);
768
769     return structureTab;
770   }
771
772   /**
773    * Initialises the Visual tabbed panel.
774    * 
775    * @return
776    */
777   private JPanel initVisualTab()
778   {
779     JPanel visualTab = new JPanel();
780     visualTab.setBorder(new TitledBorder(MessageManager
781             .getString("action.open_new_alignment")));
782     visualTab.setLayout(null);
783     fullScreen.setFont(verdana11);
784     fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
785     fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
786     fullScreen.setText(MessageManager.getString("label.maximize_window"));
787     quality.setEnabled(false);
788     quality.setFont(verdana11);
789     quality.setHorizontalAlignment(SwingConstants.RIGHT);
790     quality.setHorizontalTextPosition(SwingConstants.LEFT);
791     quality.setSelected(true);
792     quality.setText(MessageManager.getString("label.quality"));
793     conservation.setEnabled(false);
794     conservation.setFont(verdana11);
795     conservation.setHorizontalAlignment(SwingConstants.RIGHT);
796     conservation.setHorizontalTextPosition(SwingConstants.LEFT);
797     conservation.setSelected(true);
798     conservation.setText(MessageManager.getString("label.conservation"));
799     identity.setEnabled(false);
800     identity.setFont(verdana11);
801     identity.setHorizontalAlignment(SwingConstants.RIGHT);
802     identity.setHorizontalTextPosition(SwingConstants.LEFT);
803     identity.setSelected(true);
804     identity.setText(MessageManager.getString("label.consensus"));
805     JLabel showGroupbits = new JLabel();
806     showGroupbits.setFont(verdana11);
807     showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
808     showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
809     showGroupbits.setText(MessageManager.getString("action.show_group")
810             + ":");
811     JLabel showConsensbits = new JLabel();
812     showConsensbits.setFont(verdana11);
813     showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
814     showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
815     showConsensbits.setText(MessageManager.getString("label.consensus")
816             + ":");
817     showConsensHistogram.setEnabled(false);
818     showConsensHistogram.setFont(verdana11);
819     showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
820     showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
821     showConsensHistogram.setSelected(true);
822     showConsensHistogram.setText(MessageManager
823             .getString("label.histogram"));
824     showConsensLogo.setEnabled(false);
825     showConsensLogo.setFont(verdana11);
826     showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
827     showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
828     showConsensLogo.setSelected(true);
829     showConsensLogo.setText(MessageManager.getString("label.logo"));
830     showGroupConsensus.setEnabled(false);
831     showGroupConsensus.setFont(verdana11);
832     showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
833     showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
834     showGroupConsensus.setSelected(true);
835     showGroupConsensus.setText(MessageManager.getString("label.consensus"));
836     showGroupConservation.setEnabled(false);
837     showGroupConservation.setFont(verdana11);
838     showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
839     showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
840     showGroupConservation.setSelected(true);
841     showGroupConservation.setText(MessageManager
842             .getString("label.conservation"));
843     showNpTooltip.setEnabled(true);
844     showNpTooltip.setFont(verdana11);
845     showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
846     showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
847     showNpTooltip.setSelected(true);
848     showNpTooltip.setText(MessageManager
849             .getString("label.non_positional_features"));
850     showDbRefTooltip.setEnabled(true);
851     showDbRefTooltip.setFont(verdana11);
852     showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
853     showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
854     showDbRefTooltip.setSelected(true);
855     showDbRefTooltip.setText(MessageManager
856             .getString("label.database_references"));
857     annotations.setFont(verdana11);
858     annotations.setHorizontalAlignment(SwingConstants.RIGHT);
859     annotations.setHorizontalTextPosition(SwingConstants.LEADING);
860     annotations.setSelected(true);
861     annotations.setText(MessageManager.getString("label.show_annotations"));
862     annotations.setBounds(new Rectangle(169, 12, 200, 23));
863     annotations.addActionListener(new ActionListener()
864     {
865       public void actionPerformed(ActionEvent e)
866       {
867         annotations_actionPerformed(e);
868       }
869     });
870     identity.addActionListener(new ActionListener()
871     {
872       public void actionPerformed(ActionEvent e)
873       {
874         annotations_actionPerformed(e);
875       }
876     });
877     showGroupConsensus.addActionListener(new ActionListener()
878     {
879       public void actionPerformed(ActionEvent e)
880       {
881         annotations_actionPerformed(e);
882       }
883     });
884     showUnconserved.setFont(verdana11);
885     showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
886     showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
887     showUnconserved.setSelected(true);
888     showUnconserved.setText(MessageManager
889             .getString("action.show_unconserved"));
890     showUnconserved.addActionListener(new ActionListener()
891     {
892       public void actionPerformed(ActionEvent e)
893       {
894         showunconserved_actionPerformed(e);
895       }
896     });
897
898     // TODO these are not yet added to / action from Preferences
899     // JCheckBox shareSelections = new JCheckBox();
900     // shareSelections.setFont(verdana11);
901     // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
902     // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
903     // shareSelections.setSelected(true);
904     // shareSelections.setText(MessageManager
905     // .getString("label.share_selection_across_views"));
906     // JCheckBox followHighlight = new JCheckBox();
907     // followHighlight.setFont(verdana11);
908     // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
909     // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
910     // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
911     // followHighlight.setSelected(true);
912     // followHighlight.setText(MessageManager
913     // .getString("label.scroll_highlighted_regions"));
914
915     seqLimit.setFont(verdana11);
916     seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
917     seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
918     seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
919     smoothFont.setFont(verdana11);
920     smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
921     smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
922     smoothFont.setText(MessageManager.getString("label.smooth_font"));
923     JLabel gapLabel = new JLabel();
924     gapLabel.setFont(verdana11);
925     gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
926     gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
927     JLabel fontLabel = new JLabel();
928     fontLabel.setFont(verdana11);
929     fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
930     fontLabel.setText(MessageManager.getString("label.font"));
931     fontSizeCB.setFont(verdana11);
932     fontSizeCB.setBounds(new Rectangle(320, 104, 65, 23));
933     fontStyleCB.setFont(verdana11);
934     fontStyleCB.setBounds(new Rectangle(382, 104, 80, 23));
935     fontNameCB.setFont(verdana11);
936     fontNameCB.setBounds(new Rectangle(172, 104, 147, 23));
937     gapSymbolCB.setFont(verdana11);
938     gapSymbolCB.setBounds(new Rectangle(172, 196, 69, 23));
939     DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
940     dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
941     gapSymbolCB.setRenderer(dlcr);
942
943     startupCheckbox.setText(MessageManager.getString("action.open_file"));
944     startupCheckbox.setFont(verdana11);
945     startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
946     startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
947     startupCheckbox.setSelected(true);
948     startupFileTextfield.setFont(verdana11);
949     startupFileTextfield.setBounds(new Rectangle(172, 290, 270, 20));
950     startupFileTextfield.addMouseListener(new MouseAdapter()
951     {
952       public void mouseClicked(MouseEvent e)
953       {
954         if (e.getClickCount() > 1)
955         {
956           startupFileTextfield_mouseClicked();
957         }
958       }
959     });
960  
961     sortby.setFont(verdana11);
962     sortby.setBounds(new Rectangle(172, 240, 155, 21));
963     JLabel sortLabel = new JLabel();
964     sortLabel.setFont(verdana11);
965     sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
966     sortLabel.setText(MessageManager.getString("label.sort_by"));
967     sortAnnBy.setFont(verdana11);
968     sortAnnBy.setBounds(new Rectangle(172, 265, 110, 21));
969     JLabel sortAnnLabel = new JLabel();
970     sortAnnLabel.setFont(verdana11);
971     sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
972     sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
973     sortAutocalc.setFont(verdana11);
974     sortAutocalc.setBounds(new Rectangle(290, 265, 165, 21));
975     JPanel annsettingsPanel = new JPanel();
976     annsettingsPanel.setBounds(new Rectangle(173, 34, 300, 61));
977     annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
978     JPanel autoAnnotSettings1 = new JPanel();
979     autoAnnotSettings1.setLayout(new GridLayout(3, 1, 0, 0));
980     annsettingsPanel.add(autoAnnotSettings1);
981     JPanel autoAnnotSettings2 = new JPanel();
982     autoAnnotSettings2.setLayout(new GridLayout(3, 1, 0, 0));
983     annsettingsPanel.add(autoAnnotSettings2);
984     JPanel autoAnnotSettings3 = new JPanel();
985     autoAnnotSettings3.setLayout(new GridLayout(3, 1, 0, 0));
986     annsettingsPanel.add(autoAnnotSettings3);
987     visualTab.add(annsettingsPanel);
988     Border jb = new EmptyBorder(1, 1, 4, 5);
989     quality.setBorder(jb);
990     conservation.setBorder(jb);
991     identity.setBorder(jb);
992     showConsensbits.setBorder(jb);
993     showGroupbits.setBorder(jb);
994     showGroupConsensus.setBorder(jb);
995     showGroupConservation.setBorder(jb);
996     showConsensHistogram.setBorder(jb);
997     showConsensLogo.setBorder(jb);
998
999     autoAnnotSettings2.add(conservation);
1000     autoAnnotSettings1.add(quality);
1001     autoAnnotSettings3.add(identity);
1002     autoAnnotSettings1.add(showGroupbits);
1003     autoAnnotSettings3.add(showGroupConsensus);
1004     autoAnnotSettings2.add(showGroupConservation);
1005     autoAnnotSettings1.add(showConsensbits);
1006     autoAnnotSettings2.add(showConsensHistogram);
1007     autoAnnotSettings3.add(showConsensLogo);
1008
1009     JPanel tooltipSettings = new JPanel();
1010     tooltipSettings.setBorder(new TitledBorder(MessageManager
1011             .getString("label.sequence_id_tooltip")));
1012     tooltipSettings.setBounds(173, 130, 200, 62);
1013     tooltipSettings.setLayout(new GridLayout(2, 1));
1014     tooltipSettings.add(showDbRefTooltip);
1015     tooltipSettings.add(showNpTooltip);
1016     visualTab.add(tooltipSettings);
1017
1018     wrap.setFont(verdana11);
1019     wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1020     wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1021     wrap.setText(MessageManager.getString("label.wrap_alignment"));
1022     rightAlign.setFont(verdana11);
1023     rightAlign.setForeground(Color.black);
1024     rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1025     rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1026     rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1027     idItalics.setFont(verdana11);
1028     idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1029     idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1030     idItalics.setText(MessageManager
1031             .getString("label.sequence_name_italics"));
1032     openoverv.setFont(verdana11);
1033     openoverv.setActionCommand(MessageManager
1034             .getString("label.open_overview"));
1035     openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1036     openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1037     openoverv.setText(MessageManager.getString(("label.open_overview")));
1038     JPanel jPanel2 = new JPanel();
1039     jPanel2.setBounds(new Rectangle(7, 17, 158, 297));
1040     GridLayout gridLayout2 = new GridLayout();
1041     jPanel2.setLayout(gridLayout2);
1042     gridLayout2.setRows(13);
1043     jPanel2.add(fullScreen);
1044     jPanel2.add(openoverv);
1045     jPanel2.add(seqLimit);
1046     jPanel2.add(rightAlign);
1047     jPanel2.add(fontLabel);
1048     jPanel2.add(showUnconserved);
1049     jPanel2.add(idItalics);
1050     jPanel2.add(smoothFont);
1051     jPanel2.add(gapLabel);
1052     jPanel2.add(wrap);
1053     jPanel2.add(sortLabel);
1054     jPanel2.add(sortAnnLabel);
1055     jPanel2.add(startupCheckbox);
1056     visualTab.add(jPanel2);
1057     visualTab.add(annotations);
1058     visualTab.add(startupFileTextfield);
1059     visualTab.add(sortby);
1060     visualTab.add(sortAnnBy);
1061     visualTab.add(sortAutocalc);
1062     visualTab.add(gapSymbolCB);
1063     visualTab.add(fontNameCB);
1064     visualTab.add(fontSizeCB);
1065     visualTab.add(fontStyleCB);
1066     return visualTab;
1067   }
1068
1069   protected void autoIdWidth_actionPerformed()
1070   {
1071     // TODO Auto-generated method stub
1072
1073   }
1074
1075   protected void userIdWidth_actionPerformed()
1076   {
1077     // TODO Auto-generated method stub
1078
1079   }
1080
1081   protected void maxColour_actionPerformed(JPanel panel)
1082   {
1083   }
1084
1085   protected void minColour_actionPerformed(JPanel panel)
1086   {
1087   }
1088
1089   protected void showunconserved_actionPerformed(ActionEvent e)
1090   {
1091     // TODO Auto-generated method stub
1092
1093   }
1094
1095   /**
1096    * DOCUMENT ME!
1097    * 
1098    * @param e
1099    *          DOCUMENT ME!
1100    */
1101   public void ok_actionPerformed(ActionEvent e)
1102   {
1103   }
1104
1105   /**
1106    * DOCUMENT ME!
1107    * 
1108    * @param e
1109    *          DOCUMENT ME!
1110    */
1111   public void cancel_actionPerformed(ActionEvent e)
1112   {
1113   }
1114
1115   /**
1116    * DOCUMENT ME!
1117    * 
1118    * @param e
1119    *          DOCUMENT ME!
1120    */
1121   public void annotations_actionPerformed(ActionEvent e)
1122   {
1123   }
1124
1125   /**
1126    * DOCUMENT ME!
1127    */
1128   public void startupFileTextfield_mouseClicked()
1129   {
1130   }
1131
1132   public void newLink_actionPerformed(ActionEvent e)
1133   {
1134
1135   }
1136
1137   public void editLink_actionPerformed(ActionEvent e)
1138   {
1139
1140   }
1141
1142   public void deleteLink_actionPerformed(ActionEvent e)
1143   {
1144
1145   }
1146
1147   public void defaultBrowser_mouseClicked(MouseEvent e)
1148   {
1149
1150   }
1151
1152   public void linkURLList_keyTyped(KeyEvent e)
1153   {
1154
1155   }
1156
1157   public void useProxy_actionPerformed()
1158   {
1159     proxyServerTB.setEnabled(useProxy.isSelected());
1160     proxyPortTB.setEnabled(useProxy.isSelected());
1161   }
1162
1163 }