From 1576c6118a09c59098483daa16a94e9cca8de260 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 8 Sep 2008 14:47:49 +0000 Subject: [PATCH] view settings in view submenu and user preferences to control display of non-positional features and database cross references in sequence ID tooltip --- src/jalview/bin/Cache.java | 2 ++ src/jalview/gui/AlignFrame.java | 18 +++++++++++++++ src/jalview/gui/AlignViewport.java | 42 ++++++++++++++++++++++++++++++++- src/jalview/gui/IdPanel.java | 4 ++-- src/jalview/jbgui/GAlignFrame.java | 45 +++++++++++++++++++++++++++++++++--- 5 files changed, 105 insertions(+), 6 deletions(-) diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index e5f7f7b..d315626 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -103,6 +103,8 @@ import org.apache.log4j.*; *
  • DAS_ACTIVE_SOURCE list of active sources
  • *
  • SHOW_MEMUSAGE boolean show memory usage and warning indicator on desktop * (false)
  • + *
  • SHOW_NPFEATS_TOOLTIP (true) show non-positional features in the Sequence ID tooltip
  • + *
  • SHOW_DBREFS_TOOLTIP (true) show Database Cross References in the Sequence ID tooltip
  • *
  • * * diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 7adbd07..be92acf 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -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 diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index d7a52c2..9f1d3c6 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -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; + } } diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index a781830..222cf8d 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -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++) { diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index a12a74f..5f9f6e2 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -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) { } -- 1.7.10.2