view settings in view submenu and user preferences to control display of non-position...
authorjprocter <Jim Procter>
Mon, 8 Sep 2008 14:47:49 +0000 (14:47 +0000)
committerjprocter <Jim Procter>
Mon, 8 Sep 2008 14:47:49 +0000 (14:47 +0000)
src/jalview/bin/Cache.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/IdPanel.java
src/jalview/jbgui/GAlignFrame.java

index e5f7f7b..d315626 100755 (executable)
@@ -103,6 +103,8 @@ import org.apache.log4j.*;
  * <li>DAS_ACTIVE_SOURCE list of active sources </li>
  * <li>SHOW_MEMUSAGE boolean show memory usage and warning indicator on desktop
  * (false) </li>
+ * <li>SHOW_NPFEATS_TOOLTIP (true) show non-positional features in the Sequence ID tooltip</li>
+ * <li>SHOW_DBREFS_TOOLTIP (true) show Database Cross References in the Sequence ID tooltip</li>
  * <li> </li>
  * 
  * </ul>
index 7adbd07..be92acf 100755 (executable)
@@ -551,6 +551,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     showSeqFeatures.setSelected(av.showSequenceFeatures);
     hiddenMarkers.setState(av.showHiddenMarkers);
     applyToAllGroups.setState(av.colourAppliesToAllGroups);
+    showNpFeatsMenuitem.setSelected(av.isShowNpFeats());
+    showDbRefsMenuitem.setSelected(av.isShowDbRefs());
 
     setShowProductsEnabled();
 
@@ -4059,6 +4061,22 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       buildSortByAnnotationScoresMenu();
     }
   }
+
+  /* (non-Javadoc)
+   * @see jalview.jbgui.GAlignFrame#showDbRefs_actionPerformed(java.awt.event.ActionEvent)
+   */
+  protected void showDbRefs_actionPerformed(ActionEvent e)
+  {
+    viewport.setShowDbRefs(showDbRefsMenuitem.isSelected());
+  }
+
+  /* (non-Javadoc)
+   * @see jalview.jbgui.GAlignFrame#showNpFeats_actionPerformed(java.awt.event.ActionEvent)
+   */
+  protected void showNpFeats_actionPerformed(ActionEvent e)
+  {
+    viewport.setShowNpFeats(showNpFeatsMenuitem.isSelected());
+  }
 }
 
 class PrintThread extends Thread
index d7a52c2..9f1d3c6 100755 (executable)
@@ -232,7 +232,9 @@ public class AlignViewport
     autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
 
     padGaps = Cache.getDefault("PAD_GAPS", true);
-
+    shownpfeats = Cache.getDefault("SHOW_NPFEATS_TOOLTIP",true);
+    showdbrefs = Cache.getDefault("SHOW_DBREFS_TOOLTIP",true);
+    
     String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
     String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "");
     String fontSize = Cache.getDefault("FONT_SIZE", "10");
@@ -493,6 +495,10 @@ public class AlignViewport
    */
   boolean centreColumnLabels = false;
 
+  private boolean showdbrefs;
+
+  private boolean shownpfeats;
+
   /**
    * trigger update of conservation annotation
    */
@@ -2000,4 +2006,38 @@ public class AlignViewport
       }
     }
   }
+
+  /**
+   *  enable or disable the display of Database Cross References in the sequence ID tooltip
+   */ 
+  public void setShowDbRefs(boolean show)
+  {
+    showdbrefs=show;
+  }
+
+  /**
+   * 
+   * @return true if Database References are to be displayed on tooltips.
+   */
+  public boolean isShowDbRefs()
+  {
+    return showdbrefs;
+  }
+
+  /**
+   * 
+   * @return true if Non-positional features are to be displayed on tooltips.
+   */
+  public boolean isShowNpFeats()
+  {
+    return shownpfeats;
+  }
+  /**
+   * enable or disable the display of Non-Positional sequence features in the sequence ID tooltip 
+   * @param show 
+   */
+  public void setShowNpFeats(boolean show)
+  {
+    shownpfeats=show;
+  }
 }
index a781830..222cf8d 100755 (executable)
@@ -95,7 +95,7 @@ public class IdPanel extends JPanel implements MouseListener,
       }
 
       DBRefEntry[] dbrefs = sequence.getDatasetSequence().getDBRef();
-      if (dbrefs != null)
+      if (av.isShowDbRefs() && dbrefs != null)
       {
         for (int i = 0; i < dbrefs.length; i++)
         {
@@ -109,7 +109,7 @@ public class IdPanel extends JPanel implements MouseListener,
       // ADD NON POSITIONAL SEQUENCE INFO
       SequenceFeature[] features = sequence.getDatasetSequence()
               .getSequenceFeatures();
-      if (features != null)
+      if (av.isShowNpFeats() && features != null)
       {
         for (int i = 0; i < features.length; i++)
         {
index a12a74f..5f9f6e2 100755 (executable)
@@ -191,6 +191,8 @@ public class GAlignFrame extends JInternalFrame
   JMenu jMenu2 = new JMenu();
 
   protected JCheckBoxMenuItem padGapsMenuitem = new JCheckBoxMenuItem();
+  protected JCheckBoxMenuItem showNpFeatsMenuitem = new JCheckBoxMenuItem();
+  protected JCheckBoxMenuItem showDbRefsMenuitem = new JCheckBoxMenuItem();
 
   protected ButtonGroup colours = new ButtonGroup();
 
@@ -229,7 +231,7 @@ public class GAlignFrame extends JInternalFrame
   GridLayout gridLayout1 = new GridLayout();
 
   JMenu jMenu3 = new JMenu();
-
+  
   JMenuItem showAllSeqs = new JMenuItem();
 
   JMenuItem showAllColumns = new JMenuItem();
@@ -269,7 +271,9 @@ public class GAlignFrame extends JInternalFrame
   JMenuItem pageSetup = new JMenuItem();
 
   JMenuItem alignmentProperties = new JMenuItem();
-
+  
+  JMenu tooltipSettingsMenu = new JMenu();
+  
   public GAlignFrame()
   {
     try
@@ -914,6 +918,26 @@ public class GAlignFrame extends JInternalFrame
         showSeqFeatures_actionPerformed(actionEvent);
       }
     });
+    showDbRefsMenuitem.setText("Show Database Refs");
+    showDbRefsMenuitem.addActionListener(new ActionListener()
+    {
+
+      public void actionPerformed(ActionEvent e)
+      {
+        showDbRefs_actionPerformed(e);
+      }
+      
+    });
+    showNpFeatsMenuitem.setText("Show Non-Positional Features");
+    showNpFeatsMenuitem.addActionListener(new ActionListener()
+    {
+
+      public void actionPerformed(ActionEvent e)
+      {
+        showNpFeats_actionPerformed(e);
+      }
+      
+    });
     nucleotideColour.setText("Nucleotide");
     nucleotideColour.addActionListener(new java.awt.event.ActionListener()
     {
@@ -1435,7 +1459,7 @@ public class GAlignFrame extends JInternalFrame
         alignmentProperties();
       }
     });
-
+    tooltipSettingsMenu.setText("Sequence ID Tooltip");
     alignFrameMenuBar.add(fileMenu);
     alignFrameMenuBar.add(editMenu);
     alignFrameMenuBar.add(selectMenu);
@@ -1487,6 +1511,9 @@ public class GAlignFrame extends JInternalFrame
     viewMenu.addSeparator();
     viewMenu.add(showSeqFeatures);
     viewMenu.add(featureSettings);
+    tooltipSettingsMenu.add(showDbRefsMenuitem);
+    tooltipSettingsMenu.add(showNpFeatsMenuitem);
+    viewMenu.add(tooltipSettingsMenu);
     viewMenu.addSeparator();
     viewMenu.add(alignmentProperties);
     viewMenu.addSeparator();
@@ -1572,6 +1599,18 @@ public class GAlignFrame extends JInternalFrame
     selectMenu.add(deleteGroups);
   }
 
+  protected void showNpFeats_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
+  protected void showDbRefs_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
   protected void centreColumnLabels_actionPerformed(ActionEvent e)
   {
   }