JAL-4159 fix PairwiseAlignmentPanelTest - reinstate correct recording of the endRes...
[jalview.git] / src / jalview / jbgui / GPreferences.java
index 37ba654..e574327 100755 (executable)
@@ -39,6 +39,7 @@ import java.awt.event.KeyListener;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.util.Arrays;
+import java.util.EnumSet;
 import java.util.List;
 
 import javax.swing.AbstractCellEditor;
@@ -77,6 +78,7 @@ import javax.swing.table.TableCellEditor;
 import javax.swing.table.TableCellRenderer;
 
 import jalview.bin.Cache;
+import jalview.bin.Console;
 import jalview.bin.MemorySetting;
 import jalview.fts.core.FTSDataColumnPreferences;
 import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
@@ -158,7 +160,9 @@ public class GPreferences extends JPanel
 
   protected JCheckBox conservation = new JCheckBox();
 
-  protected JCheckBox identity = new JCheckBox();
+  protected JCheckBox identity = new JCheckBox();  
+
+  protected JCheckBox ssConsensus = new JCheckBox();
 
   protected JCheckBox showGroupConsensus = new JCheckBox();
 
@@ -268,8 +272,6 @@ public class GPreferences extends JPanel
 
   protected JPasswordField proxyAuthPasswordPB = new JPasswordField();
 
-  protected JTextField defaultBrowser = new JTextField();
-
   protected ButtonGroup proxyType = new ButtonGroup();
 
   protected JRadioButton noProxy = new JRadioButton();
@@ -739,44 +741,9 @@ public class GPreferences extends JPanel
     connectTab = new JPanel();
     connectTab.setLayout(new GridBagLayout());
 
-    // Label for browser text box
-    JLabel browserLabel = new JLabel();
-    browserLabel.setFont(LABEL_FONT);
-    browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
-    browserLabel.setText(
-            MessageManager.getString("label.default_browser_unix"));
-    defaultBrowser.setFont(LABEL_FONT);
-    defaultBrowser.setText("");
-    final String tooltip = JvSwingUtils.wrapTooltip(true,
-            MessageManager.getString("label.double_click_to_browse"));
-    defaultBrowser.setToolTipText(tooltip);
-    defaultBrowser.addMouseListener(new MouseAdapter()
-    {
-      @Override
-      public void mouseClicked(MouseEvent e)
-      {
-        if (e.getClickCount() > 1)
-        {
-          defaultBrowser_mouseClicked(e);
-        }
-      }
-    });
-
     JPanel proxyPanel = initConnTabProxyPanel();
     initConnTabCheckboxes();
 
-    // Add default Browser text box
-    connectTab.add(browserLabel,
-            new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
-                    GridBagConstraints.WEST, GridBagConstraints.NONE,
-                    new Insets(10, 0, 5, 5), 5, 1));
-    defaultBrowser.setFont(LABEL_FONT);
-    defaultBrowser.setText("");
-
-    connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
-            0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
-            new Insets(10, 0, 5, 10), 30, 1));
-
     // Add proxy server panel
     connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
             GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
@@ -1715,10 +1682,16 @@ public class GPreferences extends JPanel
      */
     structViewer.setFont(LABEL_FONT);
     structViewer.setBounds(new Rectangle(190, ypos, 120, height));
+    for (ViewerType v : EnumSet.allOf(ViewerType.class))
+    {
+      structViewer.addItem(v.name());
+    }
+    /*
     structViewer.addItem(ViewerType.JMOL.name());
     structViewer.addItem(ViewerType.CHIMERA.name());
     structViewer.addItem(ViewerType.CHIMERAX.name());
     structViewer.addItem(ViewerType.PYMOL.name());
+    */
     structViewer.addActionListener(new ActionListener()
     {
       @Override
@@ -1817,8 +1790,8 @@ public class GPreferences extends JPanel
   }
 
   /**
-   * Show a dialog for the user to choose a file. Returns the chosen path, or null
-   * on Cancel.
+   * Show a dialog for the user to choose a file. Returns the chosen path, or
+   * null on Cancel.
    * 
    * @return
    */
@@ -1902,6 +1875,12 @@ public class GPreferences extends JPanel
     identity.setHorizontalTextPosition(SwingConstants.LEFT);
     identity.setSelected(true);
     identity.setText(MessageManager.getString("label.consensus"));
+    ssConsensus.setEnabled(false);
+    ssConsensus.setFont(LABEL_FONT);
+    ssConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
+    ssConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
+    ssConsensus.setSelected(false);
+    ssConsensus.setText(MessageManager.getString("label.ssConsensus"));
     showOccupancy.setFont(LABEL_FONT);
     showOccupancy.setEnabled(false);
     showOccupancy.setHorizontalAlignment(SwingConstants.RIGHT);
@@ -2096,7 +2075,7 @@ public class GPreferences extends JPanel
     sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
 
     JPanel annsettingsPanel = new JPanel();
-    annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 96));
+    annsettingsPanel.setBounds(new Rectangle(173, 13, 320, 101));
     annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
     annsettingsPanel.setBorder(new EtchedBorder());
     visualTab.add(annsettingsPanel);
@@ -2106,6 +2085,7 @@ public class GPreferences extends JPanel
     quality.setBorder(jb);
     conservation.setBorder(jb);
     identity.setBorder(jb);
+    ssConsensus.setBorder(jb);
     showConsensbits.setBorder(jb);
     showGroupbits.setBorder(jb);
     showGroupConsensus.setBorder(jb);
@@ -2121,6 +2101,12 @@ public class GPreferences extends JPanel
     // second row of autoannotation box
     autoAnnotSettings = new JPanel();
     annsettingsPanel.add(autoAnnotSettings);
+    autoAnnotSettings.setLayout(new GridLayout(0, 1));
+    autoAnnotSettings.add(ssConsensus);
+
+    // third row of autoannotation box
+    autoAnnotSettings = new JPanel();
+    annsettingsPanel.add(autoAnnotSettings);
 
     autoAnnotSettings.setLayout(new GridLayout(0, 3));
     autoAnnotSettings.add(conservation);
@@ -2793,7 +2779,7 @@ public class GPreferences extends JPanel
     }
     else
     {
-      Cache.log.error(
+      Console.error(
               "Preset '" + value + "' [key:" + key + "] not implemented");
     }
 
@@ -2813,7 +2799,7 @@ public class GPreferences extends JPanel
               .getSelectedItem();
     } catch (Exception ex)
     {
-      Cache.log.error(
+      Console.error(
               "Problem casting Combo entry to IntKeyStringValueEntry.");
       e = null;
     }
@@ -2831,7 +2817,7 @@ public class GPreferences extends JPanel
         e = (IntKeyStringValueEntry) backupfilesPresetsCombo2.getItemAt(i);
       } catch (Exception ex)
       {
-        Cache.log.error(
+        Console.error(
                 "Problem casting Combo entry to IntKeyStringValueEntry. Skipping item. ");
         continue;
       }
@@ -3279,7 +3265,7 @@ public class GPreferences extends JPanel
         i = ((Integer) s.getValue()).intValue();
       } catch (Exception e)
       {
-        Cache.log.error(
+        Console.error(
                 "Exception casting the initial value of s.getValue()");
       }
     }
@@ -3315,7 +3301,7 @@ public class GPreferences extends JPanel
       i = (Integer) s.getValue();
     } catch (Exception e)
     {
-      Cache.log.error("Failed casting (Integer) JSpinner s.getValue()");
+      Console.error("Failed casting (Integer) JSpinner s.getValue()");
     }
     return i;
   }
@@ -3486,7 +3472,7 @@ public class GPreferences extends JPanel
    * DOCUMENT ME!
    * 
    * @param e
-   *            DOCUMENT ME!
+   *          DOCUMENT ME!
    */
   public void ok_actionPerformed(ActionEvent e)
   {
@@ -3496,7 +3482,7 @@ public class GPreferences extends JPanel
    * DOCUMENT ME!
    * 
    * @param e
-   *            DOCUMENT ME!
+   *          DOCUMENT ME!
    */
   public void cancel_actionPerformed(ActionEvent e)
   {
@@ -3506,7 +3492,7 @@ public class GPreferences extends JPanel
    * DOCUMENT ME!
    * 
    * @param e
-   *            DOCUMENT ME!
+   *          DOCUMENT ME!
    */
   public void annotations_actionPerformed(ActionEvent e)
   {
@@ -3534,11 +3520,6 @@ public class GPreferences extends JPanel
 
   }
 
-  public void defaultBrowser_mouseClicked(MouseEvent e)
-  {
-
-  }
-
   public void linkURLList_keyTyped(KeyEvent e)
   {