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