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