JAL-824 - additional methods to allow jmol colouring state indicator to be passed...
authorjprocter <Jim Procter>
Mon, 25 Apr 2011 16:22:19 +0000 (16:22 +0000)
committerjprocter <Jim Procter>
Mon, 25 Apr 2011 16:22:19 +0000 (16:22 +0000)
src/jalview/gui/AppJmol.java

index f71cd30..62f4d13 100644 (file)
@@ -79,7 +79,7 @@ public class AppJmol extends GStructureViewer implements Runnable,
     this(new String[]
     { file }, new String[]
     { id }, new SequenceI[][]
-    { seq }, ap, true, true, loadStatus, bounds, viewid);
+    { seq }, ap, true, true, false, loadStatus, bounds, viewid);
   }
 
   ViewSelectionMenu seqColourBy;
@@ -96,12 +96,14 @@ public class AppJmol extends GStructureViewer implements Runnable,
    * @param useToAlign
    *          - add the alignment panel to the list used for aligning these
    *          structures
+   * @param leaveColouringToJmol
+   *          - do not update the colours from any other source. Jmol is handling them
    * @param loadStatus
    * @param bounds
    * @param viewid
    */
   public AppJmol(String[] files, String[] ids, SequenceI[][] seqs,
-          AlignmentPanel ap, boolean usetoColour, boolean useToAlign,
+          AlignmentPanel ap, boolean usetoColour, boolean useToAlign, boolean leaveColouringToJmol,
           String loadStatus, Rectangle bounds, String viewid)
   {
     PDBEntry[] pdbentrys = new PDBEntry[files.length];
@@ -122,15 +124,18 @@ public class AppJmol extends GStructureViewer implements Runnable,
     {
       useAlignmentPanelForSuperposition(ap);
     }
+    if (leaveColouringToJmol || !usetoColour)
+    {
+      jmb.setColourBySequence(false);
+      seqColour.setSelected(false);
+      jmolColour.setSelected(true);
+    }
     if (usetoColour)
     {
       useAlignmentPanelForColourbyseq(ap);
       jmb.setColourBySequence(true);
       seqColour.setSelected(true);
-    } else {
-      jmb.setColourBySequence(false);
-      seqColour.setSelected(false);
-      jmolColour.setSelected(true);
+      jmolColour.setSelected(false);
     }
     this.setBounds(bounds);
     initMenus();
@@ -435,6 +440,13 @@ public class AppJmol extends GStructureViewer implements Runnable,
     }
   }
 
+  public void useAlignmentPanelForColourbyseq(AlignmentPanel nap, boolean enableColourBySeq)
+  {
+    useAlignmentPanelForColourbyseq(nap);
+    jmb.setColourBySequence(enableColourBySeq);
+    seqColour.setSelected(enableColourBySeq);
+    jmolColour.setSelected(!enableColourBySeq);
+  }
   public void useAlignmentPanelForColourbyseq(AlignmentPanel nap)
   {
     addAlignmentPanel(nap);
@@ -1267,4 +1279,14 @@ public class AppJmol extends GStructureViewer implements Runnable,
     return (_colourwith != null) && _colourwith.contains(ap2);
   }
 
+  /**
+   * 
+   * @return TRUE if the view is NOT being coloured by sequence associations.
+   */
+  public boolean isColouredByJmol()
+  {
+    return !jmb.isColourBySequence();
+    }
+  
+
 }