Merge branch 'develop' into features/mchmmer
[jalview.git] / src / jalview / jbgui / GPreferences.java
index 1ca0802..358298d 100755 (executable)
@@ -40,11 +40,11 @@ import java.awt.Insets;
 import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 
+import javax.swing.AbstractButton;
 import javax.swing.AbstractCellEditor;
 import javax.swing.BorderFactory;
 import javax.swing.ButtonGroup;
@@ -142,10 +142,15 @@ public class GPreferences extends JPanel
 
   protected JCheckBox showConsensLogo = new JCheckBox();
 
+  protected JCheckBox showInformationHistogram = new JCheckBox();
+
+  protected JCheckBox showHMMLogo = new JCheckBox();
+
   protected JCheckBox showDbRefTooltip = new JCheckBox();
 
   protected JCheckBox showNpTooltip = new JCheckBox();
 
+
   /*
    * Structure tab and components
    */
@@ -265,6 +270,21 @@ public class GPreferences extends JPanel
   protected JCheckBox sortByTree = new JCheckBox();
 
   /*
+   * hmmer tab and components
+   */
+  protected JPanel hmmerTab = new JPanel();
+
+  protected JCheckBox hmmrTrimTermini = new JCheckBox();
+
+  protected AbstractButton hmmerBackgroundUniprot = new JCheckBox();
+
+  protected AbstractButton hmmerBackgroundAlignment = new JCheckBox();
+
+  protected JTextField hmmerSequenceCount = new JTextField();
+
+  protected JTextField hmmerPath = new JTextField();
+
+  /*
    * DAS Settings tab
    */
   protected JPanel dasTab = new JPanel();
@@ -274,6 +294,8 @@ public class GPreferences extends JPanel
    */
   protected JPanel wsTab = new JPanel();
 
+
+
   /**
    * Creates a new GPreferences object.
    */
@@ -325,6 +347,8 @@ public class GPreferences extends JPanel
     tabbedPane.add(initEditingTab(),
             MessageManager.getString("label.editing"));
 
+    tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
+
     /*
      * See DasSourceBrowser for the real work of configuring this tab.
      */
@@ -339,7 +363,7 @@ public class GPreferences extends JPanel
 
     /*
      * Handler to validate a tab before leaving it - currently only for
-     * Structure.
+     * Structure
      */
     tabbedPane.addChangeListener(new ChangeListener()
     {
@@ -393,6 +417,83 @@ public class GPreferences extends JPanel
   }
 
   /**
+   * Initialises the hmmer tabbed panel
+   * 
+   * @return
+   */
+  private JPanel initHMMERTab()
+  {
+    hmmerTab.setLayout(null);
+
+    JLabel installationLocation = new JLabel(
+            MessageManager.getString("label.hmmer_location"));
+    installationLocation.setFont(LABEL_FONT);
+    installationLocation.setBounds(new Rectangle(22, 10, 250, 23));
+    hmmerPath.setBounds(new Rectangle(22, 30, 300, 23));
+    hmmerPath.addMouseListener(new MouseAdapter()
+    {
+      @Override
+      public void mouseClicked(MouseEvent e)
+      {
+        if (e.getClickCount() == 2)
+        {
+          String chosen = openFileChooser(true);
+          if (chosen != null)
+          {
+            hmmerPath.setText(chosen);
+          }
+        }
+      }
+    });
+
+    JLabel hmmalign = new JLabel(
+            MessageManager.getString("label.hmmalign_label"));
+    hmmalign.setFont(LABEL_FONT);
+    hmmalign.setBounds(new Rectangle(22, 50, 200, 23));
+
+    hmmrTrimTermini.setFont(LABEL_FONT);
+    hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
+    hmmrTrimTermini.setBounds(new Rectangle(22, 70, 200, 23));
+
+    JLabel hmmsearch = new JLabel(
+            MessageManager.getString("label.hmmsearch_label"));
+    hmmsearch.setFont(LABEL_FONT);
+    hmmsearch.setBounds(new Rectangle(22, 90, 200, 23));
+
+    JLabel sequencesToKeep = new JLabel(
+            MessageManager.getString("label.no_of_sequences"));
+    sequencesToKeep.setFont(LABEL_FONT);
+    sequencesToKeep.setBounds(new Rectangle(22, 110, 125, 23));
+    hmmerSequenceCount.setBounds(new Rectangle(150, 110, 40, 23));
+
+    ButtonGroup backgroundFreqSource = new ButtonGroup();
+    backgroundFreqSource.add(hmmerBackgroundUniprot);
+    backgroundFreqSource.add(hmmerBackgroundAlignment);
+    backgroundFreqSource.setSelected(hmmerBackgroundUniprot.getModel(), true);
+
+    hmmerBackgroundUniprot.setText(MessageManager.getString("label.freq_uniprot"));
+    hmmerBackgroundUniprot.setFont(LABEL_FONT);
+    hmmerBackgroundUniprot.setBounds(new Rectangle(22, 130, 255, 23));
+
+    hmmerBackgroundAlignment.setText(MessageManager.getString("label.freq_alignment"));
+    hmmerBackgroundAlignment.setFont(LABEL_FONT);
+    hmmerBackgroundAlignment.setBounds(new Rectangle(22, 150, 300, 23));
+
+    hmmerTab.add(hmmerBackgroundUniprot);
+    hmmerTab.add(hmmerBackgroundAlignment);
+    hmmerTab.add(hmmalign);
+    hmmerTab.add(hmmsearch);
+    hmmerTab.add(installationLocation);
+    hmmerTab.add(hmmerPath);
+    hmmerTab.add(hmmrTrimTermini);
+    hmmerTab.add(sequencesToKeep);
+    hmmerTab.add(sequencesToKeep);
+    hmmerTab.add(hmmerSequenceCount);
+
+    return hmmerTab;
+  }
+
+  /**
    * Initialises the Output tabbed panel.
    * 
    * @return
@@ -1222,7 +1323,7 @@ public class GPreferences extends JPanel
       {
         if (e.getClickCount() == 2)
         {
-          String chosen = openFileChooser();
+          String chosen = openFileChooser(false);
           if (chosen != null)
           {
             chimeraPath.setText(chosen);
@@ -1277,10 +1378,14 @@ public class GPreferences extends JPanel
    * 
    * @return
    */
-  protected String openFileChooser()
+  protected String openFileChooser(boolean forFolder)
   {
     String choice = null;
     JFileChooser chooser = new JFileChooser();
+    if (forFolder)
+    {
+      chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+    }
 
     // chooser.setFileView(new JalviewFileView());
     chooser.setDialogTitle(
@@ -1296,22 +1401,12 @@ public class GPreferences extends JPanel
     return choice;
   }
 
-  /**
-   * Validate the structure tab preferences; if invalid, set focus on this tab.
-   * 
-   * @param e
-   */
-  protected boolean validateStructure(FocusEvent e)
+  protected boolean validateStructure()
   {
-    if (!validateStructure())
-    {
-      e.getComponent().requestFocusInWindow();
-      return false;
-    }
-    return true;
+    return false;
   }
 
-  protected boolean validateStructure()
+  protected boolean validateHMMERPath(boolean showWarning)
   {
     return false;
   }
@@ -1819,4 +1914,9 @@ public class GPreferences extends JPanel
     }
 
   }
+
+  public void hmmerPath_actionPerformed(ActionEvent e)
+  {
+
+  }
 }