*/
package jalview.ext.jmol;
-import java.awt.Color;
import java.awt.Container;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.util.StringTokenizer;
import java.util.Vector;
+import javax.swing.SwingUtilities;
+
import org.jmol.adapter.smarter.SmarterJmolAdapter;
import org.jmol.api.JmolAppConsoleInterface;
import org.jmol.api.JmolSelectionListener;
setStructureCommands(new JmolCommands());
/*
* viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(),
- * "jalviewJmol", ap.av.applet .getDocumentBase(),
- * ap.av.applet.getCodeBase(), "", this);
+ * "jalviewJmol", ap.av.applet .getDocumentBase(), ap.av.applet.getCodeBase(),
+ * "", this);
*
* jmolpopup = JmolPopup.newJmolPopup(viewer, true, "Jmol", true);
*/
for (int i = 0; i < modelCount; ++i)
{
/*
- * defensive check for null as getModelFileName can return null
- * even when model count ms.mc is > 0
+ * defensive check for null as getModelFileName can return null even when model
+ * count ms.mc is > 0
*/
filePath = jmolViewer.ms.getModelFileName(i);
if (filePath != null && !mset.contains(filePath))
}
/*
- * highlight position on alignment(s); if some text is returned,
- * show this as a second line on the structure hover tooltip
+ * highlight position on alignment(s); if some text is returned, show this as a
+ * second line on the structure hover tooltip
*/
String label = getSsm().mouseOverStructure(pdbResNum, chainId,
pdbfilename);
/*
* { if (history != null && strStatus != null &&
- * !strStatus.equals("Script completed")) { history.append("\n" + strStatus);
- * } }
+ * !strStatus.equals("Script completed")) { history.append("\n" + strStatus); }
+ * }
*/
public void notifyAtomPicked(int atomIndex, String strInfo,
@Override
public void notifyCallback(CBK type, Object[] data)
{
+ /*
+ * ensure processed in AWT thread to avoid risk of deadlocks
+ */
+ SwingUtilities.invokeLater(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ processCallback(type, data);
+ }
+ });
+ }
+
+ /**
+ * Processes one callback notification from Jmol
+ *
+ * @param type
+ * @param data
+ */
+ protected void processCallback(CBK type, Object[] data)
+ {
try
{
switch (type)
FeatureRenderer fr = getFeatureRenderer(null);
if (fr != null)
{
- // JAL-1842 ensure FeatureRenderer knows about RESNUM
- fr.featuresAdded();
- // ... apply feature settings (e.g. to hide RESNUM)
FeatureSettingsModelI colours = new Pdb().getFeatureColourScheme();
((AppJmol) getViewer()).getAlignmentPanel().av
.applyFeaturesStyle(colours);
public abstract void sendConsoleEcho(String strEcho); /*
* { showConsole(true);
*
- * history.append("\n" +
- * strEcho); }
+ * history.append("\n" + strEcho); }
*/
// /End JmolStatusListener