From: megacz Date: Fri, 30 Jan 2004 06:50:14 +0000 (+0000) Subject: 2002/08/18 10:55:12 X-Git-Tag: RC3~1555 X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=4b148707e5045554564c33532b18d00b72cec33a 2002/08/18 10:55:12 darcs-hash:20040130065014-2ba56-ad67acae58c0fe17dd5e3bc6d5e25b7b1f3fc1c6.gz --- diff --git a/README b/README index e3ca552..8d202f5 100644 --- a/README +++ b/README @@ -42,6 +42,7 @@ ______________________________________________________________________________ Directory Structure / + AUTHORS - people involved in developing XWT README - this file COPYING - copyright information for all files in this distro TM - trademark information for XWT @@ -54,33 +55,15 @@ Directory Structure ant.jar - the Jakarta project's ANT build tool, including Sun's XML parser netscape.jar - minimal set of classes required for compiling against Netcape's Applet interfaces msjvm.jar - minimal set of classes required for compiling against Microsoft's Applet interfaces - signtool - the Netscape Object Signing tool, for signing applets - signcode.exe - the Microsoft ActiveX Signing tool, for signing ActiveX controls - guidgen.exe - the Microsoft GUID generator, for generating OLE clsid's - cabarc.exe - the Microsoft CAB file generator, for creating .cab archives javasrc.jar - javasrc, a tool for generating hyperlinked, syntax-colored html from java code src/ - all java source files and xwt sources go here jazz/ - jazzlib, which XWT currently uses since libgcj's java.util.zip.* is broken - org/ bouncycastle/ - the BouncyCastle Crypto Library - gimp/tigert/ - some icons used in XWT Mail, by Tigert Labs mozilla/ - a copy of Rhino, the Mozilla JavaScript interpreter - - xwt/ - the source code for the XWT engine - demo/ - the XWT widget sampler - chess/ - XWT Chess - fonts/ - some XWF fonts - mail/ - XWT Mail - plat/ - platform abstraction classes for XWT - tasks/ - source code for some ANT tasks used in the XWT build process - themes/ - some XWT themes - util/ - some helper classes - - xwt/standard/ - the XWT standard library - - + xwt/builtin/ - .xwt's and .png's that are essential to bootstrapping the engine + xwt/plat/ - platform-specific code ______________________________________________________________________________ Build Targets diff --git a/build.xml b/build.xml index 4d14b5c..e4a4bf8 100644 --- a/build.xml +++ b/build.xml @@ -66,12 +66,3 @@ - - - diff --git a/src/org/xwt/XWT.java b/src/org/xwt/XWT.java index 1d2326d..156fc0e 100644 --- a/src/org/xwt/XWT.java +++ b/src/org/xwt/XWT.java @@ -65,6 +65,7 @@ public final class XWT extends JSObject { else if (name.equals("math")) return org.xwt.util.JSObject.defaultObjects.get("Math", null); else if (name.equals("loadArchive")) return loadArchive; else if (name.equals("prefetchImage")) return prefetchImage; + else if (name.equals("prefs")) return prefs; else if (name.equals("encodeURI")) return JSObject.defaultObjects.get("encodeURI", null); else if (name.equals("encodeURIComponent")) return JSObject.defaultObjects.get("encodeURIComponent", null); else if (name.equals("decodeURI")) return JSObject.defaultObjects.get("decodeURI", null); @@ -87,6 +88,89 @@ public final class XWT extends JSObject { } + // Prefs Object ////////////////////////////////////////////////////////////////////////// + + static Scriptable prefsRPC = new XMLRPC("http://megacz:mypassword@localhost/RPC2", "prefs"); + + private static final JSObject prefs = new JSObject(false, true) { + public Object get(String name, Scriptable start) { + if (name.equals("get")) return prefsGet; + else if (name.equals("list")) return prefsList; + else if (name.equals("put")) return prefsPut; + else return null; + } + }; + + private static final JSObject.JSFunction prefsGet = new JSObject.JSFunction() { + public Object call(Context cx, Scriptable thisObj, Scriptable ctorObj, Object[] args) throws JavaScriptException { + if (args.length != 1 || args[0] == null) return null; + try { + return ((Function)prefsRPC.get("get", null)).call(cx, null, null, new Object[] { args[0] }); + } catch (JavaScriptException jse) { + Object val = jse.getValue(); + if (val instanceof JSObject && new Integer(1).equals(((JSObject)val).get("faultCode"))) + return null; + throw jse; + } catch (Exception e) { + // FIXME + throw new JavaScriptException(e.toString()); + } + } + }; + + private static final JSObject.JSFunction prefsPut = new JSObject.JSFunction() { + public Object call(Context cx, Scriptable thisObj, Scriptable ctorObj, Object[] args) throws JavaScriptException { + if (args.length < 2 || args[0] == null) return null; + try { + return ((Function)prefsRPC.get("put", null)).call(cx, null, null, new Object[] { args[0].toString(), args[1] }); + } catch (JavaScriptException jse) { + Object val = jse.getValue(); + if (val instanceof JSObject && new Integer(1).equals(((JSObject)val).get("faultCode"))) + return null; + throw jse; + } catch (Exception e) { + // FIXME + throw new JavaScriptException(e.toString()); + } + } + }; + + private static final JSObject.JSFunction prefsList = new JSObject.JSFunction() { + public Object call(Context cx, Scriptable thisObj, Scriptable ctorObj, Object[] args) throws JavaScriptException { + if (args.length < 2 || args[0] == null) return null; + try { + return ((Function)prefsRPC.get("list", null)).call(cx, null, null, new Object[] { args[0].toString(), args[1] }); + } catch (JavaScriptException jse) { + Object val = jse.getValue(); + if (val instanceof JSObject && new Integer(1).equals(((JSObject)val).get("faultCode"))) + return null; + throw jse; + } catch (Exception e) { + // FIXME + throw new JavaScriptException(e.toString()); + } + } + }; + + private static final JSObject.JSFunction prefsInvoke = new JSObject.JSFunction() { + public Object call(Context cx, Scriptable thisObj, Scriptable ctorObj, Object[] args) throws JavaScriptException { + if (args.length < 2 || args[0] == null) return null; + try { + return ((Function)prefs.get("invoke")).call(cx, null, null, new Object[] { args[0].toString(), args[1], "megacz", "mypassword" }); + } catch (JavaScriptException jse) { + Object val = jse.getValue(); + if (val instanceof JSObject && new Integer(1).equals(((JSObject)val).get("faultCode"))) + return null; + throw jse; + } catch (Exception e) { + // FIXME + throw new JavaScriptException(e.toString()); + } + } + }; + + + // JSFunction Instances /////////////////////////////////////////////////////////////////// private static final JSObject.JSFunction newBrowserWindow = new JSObject.JSFunction() {