CDPHelperAppSimple

This is the source code for the Java helper Applet that is used with the plugin. It uses the CDPHelperSimple class to create a connection to the plugin and then publishes methods so that other Java classes may call the plugin's methods.

// Simplest version of helper applet interacting with ChemDraw plug-in.
// It has no user interface.
// It wraps the CDPHelper functionalities with its own API
// so that they can be invoked by JavaScript.
package camsoft.cdp;

import java.applet.Applet;

public class CDPHelperAppSimple extends Applet
{
        protected CDPHelperSimple mCDPHelper;

        public void init()
        {
                try {
                        int externalID = Integer.valueOf(getParameter("ID")).intValue();
                        mCDPHelper = new CDPHelperSimple(externalID, this);
                }
        }

        public void clear()
        {
                mCDPHelper.clear();
        }
        public String getData(int type)
        {
                return mCDPHelper.getData(type);
        }
        public String getFormula(int selection)
        {
                return mCDPHelper.getFormula(selection);
        }
        public String getAnalysis(int selection)
        {
                return mCDPHelper.getAnalysis(selection);
        }
        public double getExactMass(int selection)
        {
                return mCDPHelper.getExactMass(selection);
        }
        public double getMolWeight(int selection)
        {
                return mCDPHelper.getMolWeight(selection);
        }
        public String getCDXData()
        {
                return getData(CDPHelper.kPluginCDX);
        }
        public String getMolData()
        {
                return getData(CDPHelper.kPluginMol);
        }
        public String getSMILESData()
        {
                return getData(CDPHelper.kPluginSMILES);
        }
        public void putData(int type, String data)
        {
                mCDPHelper.putData(type, data);
        }
        public void putCDXData(String data)
        {
                putData(CDPHelper.kPluginCDX, data);
        }
        public void putMolData(String data)
        {
                putData(CDPHelper.kPluginMol, data);
        }
        public void putSMILESData(String data)
        {
                putData(CDPHelper.kPluginSMILES, data);
        }
}

Go Back