import java.awt.*;
import java.awt.event.*;
+import javax.swing.JPanel;
+
import jalview.api.FeatureRenderer;
import jalview.api.SequenceRenderer;
import jalview.api.SequenceStructureBinding;
import org.jmol.popup.*;
import org.jmol.viewer.JmolConstants;
+import org.jmol.viewer.Viewer;
+import org.openscience.jmol.app.jmolpanel.AppConsole;
import jalview.schemes.*;
case JmolConstants.CALLBACK_MEASURE:
case JmolConstants.CALLBACK_CLICK:
-
default:
System.err.println("Unhandled callback " + type + " "
+ data[1].toString());
public abstract void refreshGUI();
/**
+ * called to show or hide the associated console window container.
+ * @param show
+ */
+ public abstract void showConsole(boolean show);
+ /**
* @param renderPanel
* @param jmolfileio
* - when true will initialise jmol's file IO system (should be false
String htmlName, URL documentBase, URL codeBase,
String commandOptions)
{
- viewer = JmolViewer.allocateViewer(renderPanel,
+ allocateViewer(renderPanel, jmolfileio, htmlName, documentBase, codeBase, commandOptions, null,null);
+ }
+ /**
+ *
+ * @param renderPanel
+ * @param jmolfileio
+ * - when true will initialise jmol's file IO system (should be false
+ * in applet context)
+ * @param htmlName
+ * @param documentBase
+ * @param codeBase
+ * @param commandOptions
+ * @param consolePanel - panel to contain Jmol console
+ * @param buttonsToShow - buttons to show on the console, in ordr
+ */
+ public void allocateViewer(Component renderPanel, boolean jmolfileio,
+ String htmlName, URL documentBase, URL codeBase,
+ String commandOptions, final Container consolePanel, String buttonsToShow)
+ {
+ viewer = JmolViewer.allocateViewer(renderPanel,
(jmolfileio ? new SmarterJmolAdapter() : null), htmlName
+ ((Object) this).toString(), documentBase, codeBase,
commandOptions, this);
+ console = new AppConsole(viewer, null, consolePanel,
+ buttonsToShow);
+ viewer.setConsole(new JmolAppConsoleInterface() {
+
+ @Override
+ public JmolScriptEditorInterface getScriptEditor()
+ {
+ return console.getScriptEditor();
+ }
+
+ @Override
+ public JmolAppConsoleInterface getAppConsole(Viewer viewer,
+ Component display)
+ {
+ return console;
+ }
+
+ public String getText()
+ {
+ return console.getText();
+ }
+
+ @Override
+ public Object getMyMenuBar()
+ {
+ return console.getMyMenuBar();
+ }
+
+ @Override
+ public void setVisible(boolean b)
+ {
+ showConsole(b);
+ }
+
+ @Override
+ public void sendConsoleEcho(String strEcho)
+ {
+ console.sendConsoleEcho(strEcho);
+
+ }
+
+ @Override
+ public void sendConsoleMessage(String strInfo)
+ {
+ console.sendConsoleMessage(strInfo);
+ }
+
+ @Override
+ public void zap()
+ {
+ console.zap();
+ }
+
+ @Override
+ public void dispose()
+ {
+ console.dispose();
+ }
+
+
+ });
+
+
}
+
+ protected org.jmol.api.JmolAppConsoleInterface console = null;
public void setLoadingFromArchive(boolean loadingFromArchive)
{