From: <ha...@us...> - 2011-10-26 05:15:58
|
Revision: 16406 http://jmol.svn.sourceforge.net/jmol/?rev=16406&view=rev Author: hansonr Date: 2011-10-26 05:15:52 +0000 (Wed, 26 Oct 2011) Log Message: ----------- full console for MPJmolApp (including echo/message callback) Modified Paths: -------------- trunk/Jmol/src/org/molecularplayground/MPJmolApp.java Modified: trunk/Jmol/src/org/molecularplayground/MPJmolApp.java =================================================================== --- trunk/Jmol/src/org/molecularplayground/MPJmolApp.java 2011-10-26 04:49:26 UTC (rev 16405) +++ trunk/Jmol/src/org/molecularplayground/MPJmolApp.java 2011-10-26 05:15:52 UTC (rev 16406) @@ -25,7 +25,9 @@ import javax.swing.JPanel; import org.jmol.adapter.smarter.SmarterJmolAdapter; +import org.jmol.api.JmolCallbackListener; import org.jmol.api.JmolViewer; +import org.jmol.constant.EnumCallback; import org.openscience.jmol.app.jsonkiosk.BannerFrame; import org.openscience.jmol.app.jsonkiosk.JsonNioClient; import org.openscience.jmol.app.jsonkiosk.JsonNioService; @@ -99,13 +101,14 @@ //////////////////////// - class KioskPanel extends JPanel { + class KioskPanel extends JPanel implements JmolCallbackListener { private final Dimension currentSize = new Dimension(); KioskPanel() { jmolViewer = JmolViewer.allocateViewer(this, new SmarterJmolAdapter(), null, null, null, ""/*-multitouch-mp"*/, null); + jmolViewer.setJmolCallbackListener(this); } @Override @@ -114,6 +117,43 @@ jmolViewer.renderScreenImage(g, currentSize.width, currentSize.height); } + // / JmolCallbackListener interface /// + public boolean notifyEnabled(EnumCallback type) { + switch (type) { + case ECHO: + case MESSAGE: + return true; + case ANIMFRAME: + case LOADSTRUCT: + case MEASURE: + case PICK: + case SCRIPT: + case EVAL: + case ATOMMOVED: + case CLICK: + case ERROR: + case HOVER: + case MINIMIZATION: + case RESIZE: + case SYNC: + case APPLETREADY: + // applet only (but you could change this for your listener) + break; + } + return false; + } + + public void notifyCallback(EnumCallback type, Object[] data) { + JmolCallbackListener appConsole = (JmolCallbackListener) jmolViewer + .getProperty("DATA_API", "getAppConsole", null); + if (appConsole != null) + appConsole.notifyCallback(type, data); + } + + public void setCallbackFunction(String callbackType, String callbackFunction) { + // ignore + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |