import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JalviewJmolBinding;
- import jalview.gui.IProgressIndicator;
import jalview.io.DataSourceType;
import jalview.structure.StructureSelectionManager;
import org.jmol.api.JmolAppConsoleInterface;
import org.jmol.console.AppletConsole;
-import org.jmol.java.BS;
+import javajs.util.BS;
class AppletJmolBinding extends JalviewJmolBinding
{
@Override
public int[] resizeInnerPanel(String data)
{
- // TODO Auto-generated method stub
return null;
}
@Override
public Map<String, Object> getJSpecViewProperty(String arg0)
{
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected IProgressIndicator getIProgressIndicator()
- {
- // no progress indicators on the applet
return null;
}
}
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JalviewJmolBinding;
- import jalview.gui.IProgressIndicator;
import jalview.io.DataSourceType;
import java.awt.Container;
import java.util.Vector;
import org.jmol.api.JmolAppConsoleInterface;
-import org.jmol.java.BS;
+import javajs.util.BS;
import org.jmol.viewer.Viewer;
/**
}
@Override
- protected IProgressIndicator getIProgressIndicator()
- {
- // no progress indicators on applet (could access javascript for this)
- return null;
- }
-
- @Override
public void updateColours(Object source)
{
-
- // TODO Auto-generated method stub
-
}
@Override
protected JmolAppConsoleInterface createJmolConsole(
Container consolePanel, String buttonsToShow)
{
- // TODO Auto-generated method stub
return null;
}
@Override
public void releaseReferences(Object svl)
{
- // TODO Auto-generated method stub
-
}
@Override
public Map<String, Object> getJSpecViewProperty(String arg0)
{
- // TODO Auto-generated method stub
return null;
}
{
// remove listeners for all structures in viewer
getSsm().removeStructureViewerListener(this, this.getStructureFiles());
- viewer.dispose();
+ if (viewer != null)
+ viewer.dispose();
lastCommand = null;
viewer = null;
releaseUIResources();
jmolHistory(false);
if (lastCommand == null || !lastCommand.equals(command))
{
- viewer.evalStringQuiet(command + "\n");
+ jmolScript(command + "\n");
}
jmolHistory(true);
lastCommand = command;
{
if (resetLastRes.length() > 0)
{
- viewer.evalStringQuiet(resetLastRes.toString());
+ jmolScript(resetLastRes.toString());
resetLastRes.setLength(0);
}
for (AtomSpec atom : atoms)
cmd.append("spacefill 200;select none");
- viewer.evalStringQuiet(cmd.toString());
+ jmolScript(cmd.toString());
jmolHistory(true);
}
private void jmolHistory(boolean enable)
{
- viewer.evalStringQuiet("History " + ((debug || enable) ? "on" : "off"));
+ jmolScript("History " + ((debug || enable) ? "on" : "off"));
}
public void loadInline(String string)
{
/**
* this implements the toggle label behaviour copied from the original
- * structure viewer, MCView
+ * structure viewer, mc_view
*/
if (strData != null)
{
if (!atomsPicked.contains(picked))
{
- viewer.evalStringQuiet("select " + picked + ";label %n %r:%c");
+ jmolScript("select " + picked + ";label %n %r:%c");
atomsPicked.addElement(picked);
}
else
// }
if (!isLoadingFromArchive())
{
- viewer.evalStringQuiet(
+ jmolScript(
"model *; select backbone;restrict;cartoon;wireframe off;spacefill off");
}
// register ourselves as a listener and notify the gui that it needs to
return chainNames;
}
- protected abstract IProgressIndicator getIProgressIndicator();
+ protected IProgressIndicator getIProgressIndicator()
+ {
+ return null;
+ }
public void notifyNewPickingModeMeasurement(int iatom, String strMeasure)
{
*/
public abstract void showConsole(boolean show);
+
+ public static Viewer getJmolData(JmolParser jmolParser)
+ {
+ return (Viewer) JmolViewer.allocateViewer(null, null, null, null, null,
+ "-x -o -n", jmolParser);
+ }
+
/**
+ *
+ *
+ *
* @param renderPanel
* @param jmolfileio
* - when true will initialise jmol's file IO system (should be false
* @param consolePanel
* - panel to contain Jmol console
* @param buttonsToShow
- * - buttons to show on the console, in ordr
+ * - buttons to show on the console, in order
*/
public void allocateViewer(Container renderPanel, boolean jmolfileio,
String htmlName, URL documentBase, URL codeBase,
String commandOptions, final Container consolePanel,
String buttonsToShow)
{
+
+ System.err.println("Allocating Jmol Viewer: " + commandOptions);
+
if (commandOptions == null)
{
commandOptions = "";
viewer.setJmolStatusListener(this); // extends JmolCallbackListener
- console = createJmolConsole(consolePanel, buttonsToShow);
+ try {
+ console = createJmolConsole(consolePanel, buttonsToShow);
+ } catch (Throwable e) {
+ System.err.println("Could not create Jmol application console. " + e.getMessage());
+ e.printStackTrace();
+ }
if (consolePanel != null)
{
consolePanel.addComponentListener(this);
protected abstract JmolAppConsoleInterface createJmolConsole(
Container consolePanel, String buttonsToShow);
+ // BH 2018 -- Jmol console is not working due to problems with styled documents.
+
+
protected org.jmol.api.JmolAppConsoleInterface console = null;
@Override
public void setBackgroundColour(java.awt.Color col)
{
jmolHistory(false);
- viewer.evalStringQuiet("background [" + col.getRed() + ","
+ jmolScript("background [" + col.getRed() + ","
+ col.getGreen() + "," + col.getBlue() + "];");
jmolHistory(true);
}
+ private String jmolScript(String script)
+ {
+
+ System.err.println(">>Jmol>> " + script);
+
+ String s = viewer.scriptWait(script);
+
+ System.err.println("<<Jmol<< " + s);
+
+ return s;
+ }
+
@Override
public int[] resizeInnerPanel(String data)
{
{
showConsole(false);
}
+
}