X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fjavascript%2FMouseOverStructureListener.java;h=581c3f94b12f396bf862ddd17c1679c220a51258;hb=1933431422afc7955684a0bae6c7028a2f8484c8;hp=41af88e54c914699e3f8895369fec5afbd16fce1;hpb=fb919eea777481decc7873efacbefbaf5bb0f05a;p=jalview.git
diff --git a/src/jalview/javascript/MouseOverStructureListener.java b/src/jalview/javascript/MouseOverStructureListener.java
index 41af88e..581c3f9 100644
--- a/src/jalview/javascript/MouseOverStructureListener.java
+++ b/src/jalview/javascript/MouseOverStructureListener.java
@@ -1,6 +1,25 @@
+/*******************************************************************************
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ *******************************************************************************/
package jalview.javascript;
import java.awt.Color;
+import java.util.ArrayList;
+
import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureRenderer;
import jalview.api.SequenceRenderer;
@@ -10,6 +29,7 @@ import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JmolCommands;
import jalview.structure.StructureListener;
import jalview.structure.StructureMapping;
+import jalview.structure.StructureMappingcommandSet;
import jalview.structure.StructureSelectionManager;
/**
@@ -179,26 +199,41 @@ public class MouseOverStructureListener extends JSFunctionExec implements
}
;
- // Form a colour command for the given alignment panel
- final String[] colcommands = JmolCommands.getColourBySequenceCommand(
+
+ // Form a colour command from the given alignment panel for each distinct structure
+ ArrayList ccomands=new ArrayList();
+ ArrayList pdbfn=new ArrayList();
+ StructureMappingcommandSet[] colcommands=JmolCommands.getColourBySequenceCommand(
ssm, modelSet, sequence, sr, fr,
((AlignmentViewPanel) source).getAlignment());
- if (colcommands==null)
- {
- //
+ if (colcommands==null) {
return;
}
+ int sz=0;
+ for (jalview.structure.StructureMappingcommandSet ccset: colcommands) {
+ sz+=ccset.commands.length;
+ ccomands.add(ccset.commands);
+ pdbfn.add(ccset.mapping);
+ }
+
String mclass,mhandle;
+ String ccomandset[] = new String[sz];
+ sz=0;
+ for (String[] ccset: ccomands) {
+ System.arraycopy(ccset, 0, ccomandset, sz, ccset.length);
+ sz+=ccset.length;
+ }
if (jvlite.isJsMessageSetChanged(mclass="colourstruct",mhandle=((jalview.appletgui.AlignmentPanel) source).av
- .getViewId(), colcommands)) {
- jvlite.setJsMessageSet(mclass, mhandle , colcommands);
+ .getViewId(), ccomandset)) {
+ jvlite.setJsMessageSet(mclass, mhandle , ccomandset);
// and notify javascript handler
String st[] = new String[]
{
"colourstruct",
""
+ ((jalview.appletgui.AlignmentPanel) source).av
- .getViewId(), ""+colcommands.length, ""+(colcommands[0]!=null ? colcommands[0].length() : 0)};
+ .getViewId(), ""+ccomandset.length, jvlite.arrayToSeparatorList(pdbfn.toArray(new String[pdbfn.size()]))
+ };
try
{
executeJavascriptFunction(
@@ -209,7 +244,7 @@ public class MouseOverStructureListener extends JSFunctionExec implements
{
System.err.println("Couldn't execute callback with "
+ _listenerfn + " using args { " + st[0] + ", "
- + st[1] + ", " + st[2] + "," + st[3] + "\n");
+ + st[1] + ", " + st[2] + "," + st[3]+"}"); // + ","+st[4]+"\n");
ex.printStackTrace();
}