JAL-3374 "noannotation" and menu sync
authorhansonr <hansonr@STO24954W.ad.stolaf.edu>
Wed, 24 Jul 2019 05:31:01 +0000 (06:31 +0100)
committerhansonr <hansonr@STO24954W.ad.stolaf.edu>
Wed, 24 Jul 2019 05:31:01 +0000 (06:31 +0100)
site-resources/jalview_embedded_example1.html
src/jalview/bin/Jalview.java
src/jalview/bin/JalviewJS2.java
src/jalview/gui/AlignFrame.java

index c9d00d5..7163d57 100644 (file)
@@ -47,7 +47,8 @@ jvGet = function(what) {
 </tr><tr>
 
 
-<td valign=top style="padding:20px" >
+<td valign=top style="padding:20px;background-color:lightgray">
+<div style="padding:20px;width:600px;height:400px;overflow-y:auto;background-color:white">
 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 &mdash; some sort of scientific context &mdash; something we want to get 
 across to our visitors with more than just text and images. The idea is to have a <b>dynamic</b> page that will involve <b>user interaction</b>. 
@@ -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 <b>scroll to the right</b>. 
 See the big block of red color? That's the <i>Ferredoxin fold</i>domain.
 
-
+</div>
 </td><td style="background-color:lightgray;padding:20px">
-<div id="jalview-alignment-div" style="position:relative;top:0px;left:0px;width:600px;height:400px">
+<div id="jalview-alignment-div" style="padding:20px;position:relative;top:0px;left:0px;width:680px;height:400px">
 <br><br>
 The alignment frame will appear here momentarily. When it does, you can go ahead and manipulate the alignment with your mouse.
 </div>
index 2cf6f37..bb2038e 100755 (executable)
@@ -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)
         {
index 5079dee..12dc147 100644 (file)
@@ -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();
index 386c39b..3b53f18 100644 (file)
@@ -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()
   {