import netscape.javascript.JSObject; import oracle.forms.handler.IHandler; import oracle.forms.properties.ID; import oracle.forms.ui.VBean; public class GetjsWindowProp extends VBean { String mExprResult; static IHandler mHandler; protected static final ID PROP_EVAL_EXPR = ID.registerProperty("EvalExpression"); protected static final ID PROP_EVAL_RESULT = ID.registerProperty("EvalResult"); public GetjsWindowProp() { super(); } public void init(IHandler handler) { super.init(handler); mHandler = handler; // ji/applet/jiApplet.class } // warning dialog box private void message(String message) { JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE); } public boolean setProperty(ID property, Object value) { if (PROP_EVAL_EXPR == property) { JSObject appletWindow = JSObject.getWindow(mHandler.getApplet()); Object evalResult = appletWindow.eval(value.toString()); setProperty(PROP_EVAL_RESULT, evalResult); return true; } else if (PROP_EVAL_RESULT == property) { mExprResult = (value == null ? null : value.toString()); return true; }else { return super.setProperty(property, value); } } public Object getProperty(ID property) { if (PROP_EVAL_RESULT == property) { return mExprResult; } else { return super.getProperty(property); } } }