public static void build(State s) { PROTOTYPE = new ObjectLabel(DOMObjects.MOUSE_EVENT_PROTOTYPE, ObjectLabel.Kind.OBJECT); INSTANCES = new ObjectLabel(DOMObjects.MOUSE_EVENT_INSTANCES, ObjectLabel.Kind.OBJECT); // Prototype object s.newObject(PROTOTYPE); s.writeInternalPrototype(PROTOTYPE, Value.makeObject(UIEvent.PROTOTYPE)); // Multiplied object s.newObject(INSTANCES); s.writeInternalPrototype(INSTANCES, Value.makeObject(PROTOTYPE)); /* * Properties. */ createDOMProperty(s, INSTANCES, "screenX", Value.makeAnyNum().setReadOnly()); createDOMProperty(s, INSTANCES, "screenY", Value.makeAnyNum().setReadOnly()); createDOMProperty(s, INSTANCES, "clientX", Value.makeAnyNum().setReadOnly()); createDOMProperty(s, INSTANCES, "clientY", Value.makeAnyNum().setReadOnly()); createDOMProperty(s, INSTANCES, "ctrlKey", Value.makeAnyBool().setReadOnly()); createDOMProperty(s, INSTANCES, "shiftKey", Value.makeAnyBool().setReadOnly()); createDOMProperty(s, INSTANCES, "altKey", Value.makeAnyBool().setReadOnly()); createDOMProperty(s, INSTANCES, "metaKey", Value.makeAnyBool().setReadOnly()); createDOMProperty(s, INSTANCES, "button", Value.makeAnyNumUInt().setReadOnly()); createDOMProperty( s, INSTANCES, "relatedTarget", DOMFunctions.makeAnyHTMLElement().setReadOnly()); // DOM Level 0 createDOMProperty(s, INSTANCES, "offsetX", Value.makeAnyNum().setReadOnly()); createDOMProperty(s, INSTANCES, "offsetY", Value.makeAnyNum().setReadOnly()); createDOMProperty(s, INSTANCES, "layerX", Value.makeAnyNum().setReadOnly()); createDOMProperty(s, INSTANCES, "layerY", Value.makeAnyNum().setReadOnly()); /* * Functions. */ createDOMFunction(s, PROTOTYPE, DOMObjects.MOUSE_EVENT_INIT_MOUSE_EVENT, "initMouseEvent", 15); // Multiplied Object s.multiplyObject(INSTANCES); INSTANCES = INSTANCES.makeSingleton().makeSummary(); // DOM Registry DOMRegistry.registerMouseEventLabel(INSTANCES); }
public static void build(State s) { CONSTRUCTOR = new ObjectLabel(DOMObjects.ACTIVE_X_OBJECT_CONSTRUCTOR, ObjectLabel.Kind.FUNCTION); PROTOTYPE = new ObjectLabel(DOMObjects.ACTIVE_X_OBJECT_PROTOTYPE, ObjectLabel.Kind.OBJECT); INSTANCES = new ObjectLabel(DOMObjects.ACTIVE_X_OBJECT_INSTANCES, ObjectLabel.Kind.OBJECT); // Constructor Object s.newObject(CONSTRUCTOR); s.writePropertyWithAttributes( CONSTRUCTOR, "length", Value.makeNum(0).setAttributes(true, true, true)); s.writePropertyWithAttributes( CONSTRUCTOR, "prototype", Value.makeObject(PROTOTYPE).setAttributes(true, true, true)); s.writeInternalPrototype(CONSTRUCTOR, Value.makeObject(InitialStateBuilder.OBJECT_PROTOTYPE)); // TODO modelling choice: ActiveXObject is IE only.. // s.writeProperty(DOMWindow.WINDOW, "ActiveXObject", Value.makeObject(CONSTRUCTOR)); // Prototype object s.newObject(PROTOTYPE); s.writeInternalPrototype(PROTOTYPE, Value.makeObject(InitialStateBuilder.OBJECT_PROTOTYPE)); // Multiplied object s.newObject(INSTANCES); s.writeInternalPrototype(INSTANCES, Value.makeObject(PROTOTYPE)); /* * Constants. */ createDOMProperty(s, PROTOTYPE, "UNSENT", Value.makeNum(0)); createDOMProperty(s, PROTOTYPE, "OPENED", Value.makeNum(1)); createDOMProperty(s, PROTOTYPE, "HEADERS_RECEIVED", Value.makeNum(2)); createDOMProperty(s, PROTOTYPE, "LOADING", Value.makeNum(3)); createDOMProperty(s, PROTOTYPE, "DONE", Value.makeNum(4)); /* * Properties. */ createDOMProperty(s, INSTANCES, "readyState", Value.makeAnyNumUInt().setReadOnly()); createDOMProperty(s, INSTANCES, "status", Value.makeAnyNumUInt().setReadOnly()); createDOMProperty(s, INSTANCES, "statusText", Value.makeAnyStr().setReadOnly()); if (Options.get().isReturnJSON()) { createDOMProperty(s, INSTANCES, "responseText", Value.makeJSONStr()); } else { createDOMProperty(s, INSTANCES, "responseText", Value.makeAnyStr()); } // TODO createDOMProperty(s, INSTANCES, "responseXML", // Value.makeObject(DOMDocument.DOCUMENT).setReadOnly(), DOMSpec.LEVEL_2); /* * Functions. */ createDOMFunction(s, PROTOTYPE, DOMObjects.ACTIVE_X_OBJECT_OPEN, "open", 5); createDOMFunction(s, PROTOTYPE, DOMObjects.ACTIVE_X_OBJECT_SEND, "send", 1); createDOMFunction( s, PROTOTYPE, DOMObjects.ACTIVE_X_OBJECT_SET_REQUEST_HEADER, "setRequestHeader", 2); createDOMFunction(s, PROTOTYPE, DOMObjects.ACTIVE_X_OBJECT_ABORT, "abort", 0); createDOMFunction( s, PROTOTYPE, DOMObjects.ACTIVE_X_OBJECT_GET_RESPONSE_HEADER, "getResponseHeader", 1); createDOMFunction( s, PROTOTYPE, DOMObjects.ACTIVE_X_OBJECT_GET_ALL_RESPONSE_HEADERS, "getAllResponseHeaders", 0); // Multiply object s.multiplyObject(INSTANCES); INSTANCES = INSTANCES.makeSingleton().makeSummary(); }