JAL-2050 only hide introns if exons are present! Removed 'hide introns'
[jalview.git] / src / jalview / jbgui / GPreferences.java
index 97edb36..b5c1804 100755 (executable)
  */
 package jalview.jbgui;
 
+import jalview.gui.JvSwingUtils;
+import jalview.gui.StructureViewer.ViewerType;
+import jalview.jbgui.PDBDocFieldPreferences.PreferenceSource;
+import jalview.util.MessageManager;
+
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Component;
@@ -39,6 +44,7 @@ import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 
 import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
 import javax.swing.DefaultListCellRenderer;
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
@@ -47,6 +53,7 @@ import javax.swing.JFileChooser;
 import javax.swing.JLabel;
 import javax.swing.JList;
 import javax.swing.JPanel;
+import javax.swing.JRadioButton;
 import javax.swing.JScrollPane;
 import javax.swing.JTabbedPane;
 import javax.swing.JTextField;
@@ -61,11 +68,6 @@ import javax.swing.event.ChangeListener;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
 
-import jalview.gui.JvSwingUtils;
-import jalview.gui.StructureViewer.ViewerType;
-import jalview.jbgui.PDBDocFieldPreferences.PreferenceSource;
-import jalview.util.MessageManager;
-
 /**
  * Base class for the Preferences panel.
  * 
@@ -76,8 +78,8 @@ public class GPreferences extends JPanel
 {
   private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
 
-  private static final Font LABEL_FONT_ITALIC = JvSwingUtils
-          .getLabelFont(false, true);
+  private static final Font LABEL_FONT_ITALIC = JvSwingUtils.getLabelFont(
+          false, true);
 
   /*
    * Visual tab components
@@ -156,6 +158,11 @@ public class GPreferences extends JPanel
 
   protected JTextField chimeraPath = new JTextField();
 
+  protected ButtonGroup mappingMethod = new ButtonGroup();
+
+  protected JRadioButton siftsMapping = new JRadioButton();
+
+  protected JRadioButton nwMapping = new JRadioButton();
 
   /*
    * Colours tab components
@@ -216,6 +223,8 @@ public class GPreferences extends JPanel
 
   protected JCheckBox modellerOutput = new JCheckBox();
 
+  protected JCheckBox embbedBioJSON = new JCheckBox();
+
   /*
    * Editing tab components
    */
@@ -274,16 +283,17 @@ public class GPreferences extends JPanel
     tabbedPane.add(initConnectionsTab(),
             MessageManager.getString("label.connections"));
 
-    tabbedPane.add(initOutputTab(), MessageManager.getString("label.output"));
+    tabbedPane.add(initOutputTab(),
+            MessageManager.getString("label.output"));
 
-    tabbedPane.add(initEditingTab(), MessageManager.getString("label.editing"));
+    tabbedPane.add(initEditingTab(),
+            MessageManager.getString("label.editing"));
 
     /*
      * See DasSourceBrowser for the real work of configuring this tab.
      */
     dasTab.setLayout(new BorderLayout());
-    tabbedPane
-            .add(dasTab, MessageManager.getString("label.das_settings"));
+    tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
 
     /*
      * See WsPreferences for the real work of configuring this tab.
@@ -400,8 +410,9 @@ public class GPreferences extends JPanel
     autoIdWidth.setFont(LABEL_FONT);
     autoIdWidth.setText(MessageManager
             .getString("label.automatically_set_id_width"));
-    autoIdWidth
-            .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.adjusts_width_generated_eps_png")));
+    autoIdWidth.setToolTipText(JvSwingUtils.wrapTooltip(true,
+            MessageManager
+                    .getString("label.adjusts_width_generated_eps_png")));
     autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
     autoIdWidth.addActionListener(new ActionListener()
     {
@@ -416,9 +427,11 @@ public class GPreferences extends JPanel
     userIdWidthlabel.setText(MessageManager
             .getString("label.figure_id_column_width"));
     userIdWidth
-            .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
+            .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
+                    .getString("label.manually_specify_width_left_column")));
     userIdWidthlabel
-            .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
+            .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
+                    .getString("label.manually_specify_width_left_column")));
     userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
     userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
     userIdWidth.setText("");
@@ -432,6 +445,14 @@ public class GPreferences extends JPanel
         userIdWidth_actionPerformed();
       }
     });
+    modellerOutput.setFont(LABEL_FONT);
+    modellerOutput.setText(MessageManager
+            .getString("label.use_modeller_output"));
+    modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
+    embbedBioJSON.setFont(LABEL_FONT);
+    embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
+    embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
+
     jPanel11.add(jLabel1);
     jPanel11.add(blcjv);
     jPanel11.add(clustaljv);
@@ -444,13 +465,10 @@ public class GPreferences extends JPanel
     outputTab.add(userIdWidth);
     outputTab.add(userIdWidthlabel);
     outputTab.add(modellerOutput);
+    outputTab.add(embbedBioJSON);
     outputTab.add(epsLabel);
     outputTab.add(epsRendering);
     outputTab.add(jPanel11);
-    modellerOutput.setFont(LABEL_FONT);
-    modellerOutput.setText(MessageManager
-            .getString("label.use_modeller_output"));
-    modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
     return outputTab;
   }
 
@@ -499,6 +517,7 @@ public class GPreferences extends JPanel
     newLink.setText(MessageManager.getString("action.new"));
     newLink.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         newLink_actionPerformed(e);
@@ -508,6 +527,7 @@ public class GPreferences extends JPanel
     editLink.setText(MessageManager.getString("action.edit"));
     editLink.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         editLink_actionPerformed(e);
@@ -517,6 +537,7 @@ public class GPreferences extends JPanel
     deleteLink.setText(MessageManager.getString("action.delete"));
     deleteLink.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         deleteLink_actionPerformed(e);
@@ -525,6 +546,7 @@ public class GPreferences extends JPanel
 
     linkURLList.addListSelectionListener(new ListSelectionListener()
     {
+      @Override
       public void valueChanged(ListSelectionEvent e)
       {
         int index = linkURLList.getSelectedIndex();
@@ -534,6 +556,7 @@ public class GPreferences extends JPanel
 
     linkNameList.addListSelectionListener(new ListSelectionListener()
     {
+      @Override
       public void valueChanged(ListSelectionEvent e)
       {
         int index = linkNameList.getSelectedIndex();
@@ -561,6 +584,7 @@ public class GPreferences extends JPanel
 
     defaultBrowser.addMouseListener(new MouseAdapter()
     {
+      @Override
       public void mouseClicked(MouseEvent e)
       {
         if (e.getClickCount() > 1)
@@ -575,6 +599,7 @@ public class GPreferences extends JPanel
     useProxy.setText(MessageManager.getString("label.use_proxy_server"));
     useProxy.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         useProxy_actionPerformed();
@@ -643,6 +668,7 @@ public class GPreferences extends JPanel
     ok.setText(MessageManager.getString("action.ok"));
     ok.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         ok_actionPerformed(e);
@@ -652,6 +678,7 @@ public class GPreferences extends JPanel
     cancel.setText(MessageManager.getString("action.cancel"));
     cancel.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         cancel_actionPerformed(e);
@@ -683,6 +710,7 @@ public class GPreferences extends JPanel
     minColour.setPreferredSize(new Dimension(40, 20));
     minColour.addMouseListener(new MouseAdapter()
     {
+      @Override
       public void mousePressed(MouseEvent e)
       {
         minColour_actionPerformed(minColour);
@@ -697,6 +725,7 @@ public class GPreferences extends JPanel
     maxColour.setPreferredSize(new Dimension(40, 20));
     maxColour.addMouseListener(new MouseAdapter()
     {
+      @Override
       public void mousePressed(MouseEvent e)
       {
         maxColour_actionPerformed(maxColour);
@@ -720,8 +749,7 @@ public class GPreferences extends JPanel
     nucColourLabel.setFont(LABEL_FONT);
     nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
     nucColourLabel.setText(MessageManager
-            .getString("label.nuc_alignment_colour")
-            + " ");
+            .getString("label.nuc_alignment_colour") + " ");
     JvSwingUtils.addtoLayout(coloursTab, MessageManager
             .getString("label.default_colour_scheme_for_alignment"),
             nucColourLabel, nucColour);
@@ -755,10 +783,11 @@ public class GPreferences extends JPanel
     final int width = 400;
     final int height = 22;
     final int lineSpacing = 25;
-    int ypos = 30;
+    int ypos = 15;
 
     structFromPdb.setFont(LABEL_FONT);
-    structFromPdb.setText(MessageManager.getString("label.struct_from_pdb"));
+    structFromPdb
+            .setText(MessageManager.getString("label.struct_from_pdb"));
     structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
     structFromPdb.addActionListener(new ActionListener()
     {
@@ -849,22 +878,35 @@ public class GPreferences extends JPanel
     structureTab.add(chimeraPath);
 
     ypos += lineSpacing;
-    // scrl_pdbDocFieldConfig.setPreferredSize(new Dimension(450, 100));
-    // scrl_pdbDocFieldConfig
-    // .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-    // scrl_pdbDocFieldConfig.setBounds();
+    nwMapping.setFont(LABEL_FONT);
+    nwMapping.setText(MessageManager.getString("label.nw_mapping"));
+    siftsMapping.setFont(LABEL_FONT);
+    siftsMapping.setText(MessageManager.getString("label.sifts_mapping"));
+    mappingMethod.add(nwMapping);
+    mappingMethod.add(siftsMapping);
+    JPanel mappingPanel = new JPanel();
+    mappingPanel.setFont(LABEL_FONT);
+    TitledBorder mmTitledBorder = new TitledBorder(
+            MessageManager.getString("label.mapping_method"));
+    mmTitledBorder.setTitleFont(LABEL_FONT);
+    mappingPanel.setBorder(mmTitledBorder);
+    mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
+    // GridLayout mappingLayout = new GridLayout();
+    mappingPanel.setLayout(new GridLayout());
+    mappingPanel.add(nwMapping);
+    mappingPanel.add(siftsMapping);
+    structureTab.add(mappingPanel);
+
+    ypos += lineSpacing;
+    ypos += lineSpacing;
     PDBDocFieldPreferences docFieldPref = new PDBDocFieldPreferences(
             PreferenceSource.PREFERENCES);
-    docFieldPref.setBounds(new Rectangle(10, ypos + 5, 450, 120));
+    docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
     structureTab.add(docFieldPref);
 
-
-
-
     return structureTab;
   }
 
-
   /**
    * Action on choosing a structure viewer from combobox options.
    * 
@@ -1012,6 +1054,7 @@ public class GPreferences extends JPanel
     annotations.setBounds(new Rectangle(169, 12, 200, 23));
     annotations.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         annotations_actionPerformed(e);
@@ -1019,6 +1062,7 @@ public class GPreferences extends JPanel
     });
     identity.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         annotations_actionPerformed(e);
@@ -1026,6 +1070,7 @@ public class GPreferences extends JPanel
     });
     showGroupConsensus.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         annotations_actionPerformed(e);
@@ -1039,6 +1084,7 @@ public class GPreferences extends JPanel
             .getString("action.show_unconserved"));
     showUnconserved.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         showunconserved_actionPerformed(e);
@@ -1106,6 +1152,7 @@ public class GPreferences extends JPanel
     startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
     startupFileTextfield.addMouseListener(new MouseAdapter()
     {
+      @Override
       public void mouseClicked(MouseEvent e)
       {
         if (e.getClickCount() > 1)
@@ -1114,7 +1161,7 @@ public class GPreferences extends JPanel
         }
       }
     });
+
     sortby.setFont(LABEL_FONT);
     sortby.setBounds(new Rectangle(172, 260, 155, 21));
     JLabel sortLabel = new JLabel();