From 26ee59562604fa9164e895e3ca07e11398a6c8a0 Mon Sep 17 00:00:00 2001 From: hansonr Date: Wed, 24 Jul 2019 06:31:01 +0100 Subject: [PATCH] JAL-3374 "noannotation" and menu sync --- site-resources/jalview_embedded_example1.html | 7 ++++--- src/jalview/bin/Jalview.java | 11 +++++++++++ src/jalview/bin/JalviewJS2.java | 4 ++-- src/jalview/gui/AlignFrame.java | 21 +++++++++++++-------- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/site-resources/jalview_embedded_example1.html b/site-resources/jalview_embedded_example1.html index c9d00d5..7163d57 100644 --- a/site-resources/jalview_embedded_example1.html +++ b/site-resources/jalview_embedded_example1.html @@ -47,7 +47,8 @@ jvGet = function(what) { - + +
This simple page illustrates how one can embed the JalviewJS desktop into a web page. The basic idea is that we have something interesting to say — some sort of scientific context — something we want to get across to our visitors with more than just text and images. The idea is to have a dynamic page that will involve user interaction. @@ -62,9 +63,9 @@ For example, in the space to the right, after a few seconds, you will see an ali What you see initially is just the first few residues. Doesn't look like much of an alignment, does it? But scroll to the right. See the big block of red color? That's the Ferredoxin folddomain. - +
-
+


The alignment frame will appear here momentarily. When it does, you can go ahead and manipulate the alignment with your mouse.
diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 2cf6f37..bb2038e 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -739,12 +739,17 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi System.out.println("CMD [-sortbytree] executed successfully!"); } } + + boolean doUpdateAnnotation = false; + + if (aparser.contains(ArgsParser.NOANNOTATION) || aparser.contains(ArgsParser.NOANNOTATION2)) { af.getViewport().setShowAnnotation(false); if (!af.getViewport().isShowAnnotation()) { + doUpdateAnnotation = true; System.out.println("CMD no-annotation executed successfully!"); } } @@ -753,10 +758,16 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi af.getViewport().setSortByTree(false); if (!af.getViewport().getSortByTree()) { + doUpdateAnnotation = true; System.out .println("CMD [-nosortbytree] executed successfully!"); } } + if (doUpdateAnnotation) + { // BH 2019.07.24 + af.setMenusForViewport(); + af.alignPanel.updateLayout(); + } data = aparser.getValue(ArgsParser.TREE, true); if (data != null) { diff --git a/src/jalview/bin/JalviewJS2.java b/src/jalview/bin/JalviewJS2.java index 5079dee..12dc147 100644 --- a/src/jalview/bin/JalviewJS2.java +++ b/src/jalview/bin/JalviewJS2.java @@ -25,7 +25,7 @@ public class JalviewJS2 * j2sNative * * J2S.thisApplet.__Info.args = [ "open","examples/uniref50.fa", - * "features","examples/exampleFeatures.txt" ]; + * "features","examples/exampleFeatures.txt", "noannotation" ]; */ } @@ -34,7 +34,7 @@ public class JalviewJS2 if (args.length == 0) { args = new String[] { "open", "examples/uniref50.fa", "features", - "examples/exampleFeatures.txt" }; + "examples/exampleFeatures.txt", "noannotation" }; } Jalview.main(args); //showFocusTimer(); diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 386c39b..3b53f18 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -926,10 +926,8 @@ public class AlignFrame extends GAlignFrame /* * Show/hide annotations only enabled if annotation panel is shown */ - showAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState()); - hideAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState()); - showAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState()); - hideAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState()); + syncAnnotationMenuItems(); + viewBoxesMenuItem.setSelected(av.getShowBoxes()); viewTextMenuItem.setSelected(av.getShowText()); showNonconservedMenuItem.setSelected(av.getShowUnconserved()); @@ -3297,13 +3295,20 @@ public class AlignFrame extends GAlignFrame { final boolean setVisible = annotationPanelMenuItem.isSelected(); viewport.setShowAnnotation(setVisible); - this.showAllSeqAnnotations.setEnabled(setVisible); - this.hideAllSeqAnnotations.setEnabled(setVisible); - this.showAllAlAnnotations.setEnabled(setVisible); - this.hideAllAlAnnotations.setEnabled(setVisible); + syncAnnotationMenuItems(); alignPanel.updateLayout(); } + private void syncAnnotationMenuItems() + { + final boolean setVisible = annotationPanelMenuItem.isSelected(); + showAllSeqAnnotations.setEnabled(setVisible); + hideAllSeqAnnotations.setEnabled(setVisible); + showAllAlAnnotations.setEnabled(setVisible); + hideAllAlAnnotations.setEnabled(setVisible); + } + + @Override public void alignmentProperties() { -- 1.7.10.2