Package com.google.gwt.core.client

Examples of com.google.gwt.core.client.JavaScriptObject


  @Override
  public void declarePackage(String packageName,
      String enclosingClassesString) {
    String superPackages[] = packageName.split("\\.");
    JavaScriptObject prefix = getWindow();
    for (int i = 0; i < superPackages.length; i++) {
      if (!superPackages[i].equals("client")) {
        declarePackage0(prefix, superPackages[i]);
        prefix = getProp(prefix, superPackages[i]);
      }
View Full Code Here


        arguments.length());

    for (int i = 0; i < sigs.length(); i++) {
      SignatureJSO sig = sigs.get(i);
      if (sig.matches(arguments)) {
        JavaScriptObject javaFunc = sig.getFunction();
        if (!GWT.isScript()) {
          JavaScriptObject wrapFunc = sig.getWrapperFunc();
          return wrapFunc != null ? wrapFunction(wrapFunc, javaFunc) : javaFunc;
        } else {
          return javaFunc;
        }
      }
View Full Code Here

            return SingletonIterator.makeIterator(BooleanValue.get((Boolean)jsValue));
        } else if (!(jsValue instanceof JavaScriptObject)) {
          return EmptyIterator.getInstance();
        }
       
      JavaScriptObject jsObj = (JavaScriptObject)jsValue;    
      short nodeType = getNodeType(jsObj);
      if (nodeType == -1) {
          if (isJsArray(jsObj) && jsGetArrayLength(jsObj) > 1) {
            return new JsArrayIterator((JsArray)jsObj, config);
          } else {
View Full Code Here

            }
        }
    }
   
    private static JavaScriptObject convertSequenceToArray(ValueRepresentation val, int seqLength) throws XPathException {
        JavaScriptObject jsItems = jsArray(seqLength);
        SequenceIterator iterator = Value.getIterator(val);
        int i = 0;
        while (true) {
            Item item = iterator.next();
            if (item == null) {
View Full Code Here

        injectCount++;
        String fnName = "fnName" + injectCount;
        script = script.trim();
        String fnScript = "function " + fnName + "() { return " + script + "; }";
        JSObjectValue item =  new JSObjectValue(jsWindow());
        JavaScriptObject target = (JavaScriptObject)convertToJavaScript(item);
         
          ScriptInjector.FromString fs = new ScriptInjector.FromString(fnScript);
          fs.setWindow(target);
          fs.inject();
          JavaScriptObject jsArgs = jsArray(0);
          try {
            Object result = getValueFromTypeValuePair(jsCall(target, fnName, jsArgs));
            return convertFromJavaScript(result, context.getConfiguration());
          } catch(JavaScriptException jexc) {
            throw(new XPathException("JavaScriptException: " + jexc.getDescription() +
View Full Code Here

          String script = argument[0].evaluateAsString(context).toString();
          return evaluateJsFunction(script, context);
         
        } else if (localName.equals("call")) {
          ValueRepresentation itemVal = (ValueRepresentation)argument[0].evaluateItem(context);
          JavaScriptObject target = (JavaScriptObject)convertToJavaScript(itemVal);
          if (target != null) {
              String method = argument[1].evaluateAsString(context).toString();
              JavaScriptObject jsArgs = jsArray(argument.length - 2);
              for (int i=2; i<argument.length; i++) {
                  ValueRepresentation val = SequenceExtent.makeSequenceExtent(argument[i].iterate(context));
                  jsSetArrayItem(jsArgs, i-2, convertToJavaScript(val));
              }
              // Issue: if following throws an exception - GWT doesn't always allow it to be caught - it's rethrown
              // as a GWT unhandled exception
              try {
                JavaScriptObject jsObj = jsCall(target, method, jsArgs);
                Object result = getValueFromTypeValuePair(jsObj);
                return convertFromJavaScript(result, context.getConfiguration());
              } catch(Exception e) {
                boolean doRetry = false;
               
                // try again setting any null values to zero-length arrays
                for (int i = 0; i < argument.length - 2; i++) {
                  if (jsGetArrayItem(jsArgs, i) == null) {
                    jsSetArrayItem(jsArgs, i, jsArray(0));
                    doRetry = true;
                  }
                }
                if (doRetry) {
                    try {
                      Object result = getValueFromTypeValuePair(jsCall(target, method, jsArgs));
                      return convertFromJavaScript(result, context.getConfiguration());
                    } catch(Exception e2) {}                 
                }
                // if we get this far then throw exception - recovery failed
                throw(new XPathException("JavaScriptException in ixsl:call(): Object does not support property or method '" +
                    method + "' with " + (argument.length - 2) + " argument(s)."));
              }
          } else {
              throw(new XPathException("JavaScriptException in ixsl:call(): Call target object is null or undefined"));
          }
        } else if (localName.equals("get")) {
          ValueRepresentation itemVal = (ValueRepresentation)argument[0].evaluateItem(context);
          JavaScriptObject target = (JavaScriptObject)convertToJavaScript(itemVal);
          if (target != null) {
                String property = argument[1].evaluateAsString(context).toString();
                Object result;
                try {
                  result = getValueFromTypeValuePair(jsSplitPropertyTypeAndValue(target, property));
View Full Code Here

   
    public Rule getVirtualRule(XPathContext context){
      if (virtualRuleChain == null) {
        return null;
      }
      JavaScriptObject eventObject = (JavaScriptObject)context.getController().getUserData("Saxon-CE", "current-object");
      for (Rule r : virtualRuleChain) {
        JSObjectPattern jso = (JSObjectPattern)r.getPattern();
        if (jso.matchesObject(eventObject)) {
          return r;
        }
View Full Code Here

   * This function delegates to the native method <code>appendChild</code> in
   * XMLParserImpl.
   */
  public Node appendChild(Node newChild) {
    try {
      final JavaScriptObject newChildJs = ((DomItemXml) newChild).getJsObject();
      final JavaScriptObject appendChildResults = XMLParserImpl.appendChild(
          this.getJsObject(), newChildJs);
      return NodeXml.build(appendChildResults);
    } catch (JavaScriptException e) {
      throw new DOMNodeExceptionXml(DOMException.INVALID_MODIFICATION_ERR, e, this);
    }
View Full Code Here

   * This function delegates to the native method <code>insertBefore</code> in
   * XMLParserImpl.
   */
  public Node insertBefore(Node newChild, Node refChild) {
    try {
      final JavaScriptObject newChildJs = ((DomItemXml) newChild).getJsObject();
      final JavaScriptObject refChildJs;
      if (refChild != null) {
        refChildJs = ((DomItemXml) refChild).getJsObject();
      } else {
        refChildJs = null;
      }
      final JavaScriptObject insertBeforeResults = XMLParserImpl.insertBefore(
          this.getJsObject(), newChildJs, refChildJs);
      return NodeXml.build(insertBeforeResults);
    } catch (JavaScriptException e) {
      throw new DOMNodeExceptionXml(DOMException.INVALID_MODIFICATION_ERR, e, this);
    }
View Full Code Here

   * This function delegates to the native method <code>removeChild</code> in
   * XMLParserImpl.
   */
  public Node removeChild(Node oldChild) {
    try {
      final JavaScriptObject oldChildJs = ((DomItemXml) oldChild).getJsObject();
      final JavaScriptObject removeChildResults = XMLParserImpl.removeChild(
          this.getJsObject(), oldChildJs);
      return NodeXml.build(removeChildResults);
    } catch (JavaScriptException e) {
      throw new DOMNodeExceptionXml(DOMException.INVALID_MODIFICATION_ERR, e, this);
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.core.client.JavaScriptObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.