Example usage for com.google.gwt.core.client JavaScriptObject toString

List of usage examples for com.google.gwt.core.client JavaScriptObject toString

Introduction

In this page you can find the example usage for com.google.gwt.core.client JavaScriptObject toString.

Prototype

@Override
public final String toString() 

Source Link

Document

Makes a best-effort attempt to get a useful debugging string describing the given JavaScriptObject.

Usage

From source file:client.net.sf.saxon.ce.xmldom.XMLParserImpl.java

License:Mozilla Public License

public final Document wrapJsDocument(JavaScriptObject jso) {
    try {//from w ww . j  a  v  a 2s.  co  m
        return (Document) NodeXml.build(jso);
    } catch (JavaScriptException e) {
        throw new DOMParseException(DOMNodeExceptionXml.summarize(jso.toString()), e);
    }
}

From source file:client.net.sf.saxon.ce.Xslt20ProcessorImpl.java

License:Mozilla Public License

public void applyEventTemplates(String mode, NodeInfo start, JavaScriptObject event, JavaScriptObject object) {
    try {/*w  w w  .j a  va2 s  . c o  m*/
        // for case where this is a non-user event - to prevent error
        if (start == null) {
            start = config.getHostPage();
        }
        logger.log(Level.FINER, "OnEvent Apply-Templates - Mode: " + mode + " Event: " + event.toString());
        Controller controller = stylesheet.newTransformer();

        controller.importControllerSettings(localController);
        // override any imported initial mode with that for the event
        controller.setInitialTemplate(null);
        controller.setInitialMode(mode);
        controller.setUserData("Saxon-CE", "current-event", event);
        controller.setUserData("Saxon-CE", "current-object", object);

        controller.transform(start, controller.getTargetNode());
    } catch (Exception err) {
        handleException(err, "mode: '" + mode + "' event: '" + event.toString());
    }
}

From source file:com.cgxlib.xq.client.Function.java

License:Apache License

private String dumpArguments(Object[] arguments, String sep) {
    StringBuilder b = new StringBuilder();
    for (int i = 0, l = arguments.length; i < l; i++) {
        b.append("[").append(i).append("]");
        Object o = arguments[i];/*  w ww  .  j av a 2 s  .  com*/
        if (o == null) {
            b.append(" null");
        } else if (o.getClass().isArray()) {
            b.append(dumpArguments((Object[]) o, sep + "   "));
        } else if (o instanceof JavaScriptObject) {
            JavaScriptObject jso = (JavaScriptObject) o;
            if (JsUtils.isElement(jso)) {
                b.append("(Element) ").append(jso.toString());
            } else {
                b.append("(JSO) ").append(jso.<Properties>cast().toJsonString());
            }
        } else {
            b.append("(").append(o.getClass().getName()).append(") ").append(o);
        }
        if (i < l - 1)
            b.append(sep);
    }
    return b.toString();
}

From source file:com.google.gwt.sample.hello.client.HelloJsonp.java

@Override
public void onRequestComplete(JavaScriptObject json) {
    GWT.log(json.toString(), null);
    str.append("Return:\n");

    JSONObject jo = new JSONObject(json);
    decodeJson(jo);/*from   www  .j a  v  a 2 s  .  c o  m*/

    Hello.callback(str.toString());
    removeScript();
}

From source file:com.google.speedtracer.breaky.client.DumpValidator.java

License:Apache License

/**
 * Validate a Speedtracer dump object.//w ww  .j  a  v  a  2 s  . c o  m
 * 
 * @param obj a speedtracer dump object to be validated
 * @return {@link JsonSchemaResults} object indicating that the entire object
 *         is valid or containing the error that caused it to be invalid.
 */
public JsonSchemaResults validate(JavaScriptObject obj) {
    JsonSchema concreteSchema = getSchema(obj);
    if (concreteSchema == null) {
        return JsonSchemaResults.create("", "No schema found for " + obj.toString());
    }

    JsonSchemaResults results = JsonSchemaValidator.validate(obj, concreteSchema);
    if (!results.isValid()) {
        return results;
    }

    if (DataBag.hasOwnProperty(obj, "children")) {
        JsArray<JavaScriptObject> children = DataBag.getJSObjectProperty(obj, "children");
        for (int i = 0; i < children.length() && results.isValid(); i++) {
            // TODO(conroy): make child validation incremental?
            results = this.validate(children.get(i));
        }
    }
    return results;
}

From source file:com.gwittit.client.facebook.FacebookApi.java

License:Apache License

/**
 * <p/>/*w ww. java2 s .  co m*/
 * Checks whether the user has opted in to an extended application
 * permission.
 * <p/>
 * For non-desktop applications, you may pass the ID of the user on whose
 * behalf you're making this call. If you don't specify a user with the uid
 * parameter but you do specify a session_key, then that user whose session
 * it is will be the target of the call.
 * <p/>
 * However, if your application is a desktop application, you must pass a
 * valid session key for security reasons. Passing a uid parameter will
 * result in an error.
 * 
 * @param ext_perm
 *            string String identifier for the extended permission that is
 *            being checked for. Must be one of email, read_stream,
 *            publish_stream, offline_access, status_update, photo_upload,
 *            create_event, rsvp_event, sms, video_upload, create_note,
 *            share_item. optional
 * @param session_key
 *            string The session key of the user whose permissions you are
 *            checking. Note: A session key is always required for desktop
 *            applications. It is required for Web applications only when
 *            the uid is not specified.
 * @param uid
 *            int The user ID of the user whose permissions you are
 *            checking. If this parameter is not specified, then it defaults
 *            to the session user. Note: This parameter applies only to Web
 *            applications and is required by them only if the session_key
 *            is not specified. Facebook ignores this parameter if it is
 *            passed by a desktop application.
 * 
 * @see <a
 *      href="http://wiki.developers.facebook.com/index.php/JS_API_M_FB.ApiClient.Users_hasAppPermission">Users_hasAppPermission</a>
 */
public void usersHasAppPermission(Permission permission, final AsyncCallback<Boolean> callback) {
    GWT.log("users_hasAppPermission: " + permission.toString(), null);

    Json j = new Json().put("ext_perm", permission.toString());

    Callback<JavaScriptObject> nativeCallback = new Callback<JavaScriptObject>(callback) {
        public void onSuccess(JavaScriptObject jso) {
            callback.onSuccess("1".equals(jso.toString()));
        }
    };
    callMethod("users.hasAppPermission", j.getJavaScriptObject(), nativeCallback);
}

From source file:com.gwittit.client.facebook.FacebookApi.java

License:Apache License

private void callMethodRetInteger(final String method, final JavaScriptObject params,
        final AsyncCallback<Integer> callback) {

    callMethod(method, params, new Callback<JavaScriptObject>(callback) {
        public void onSuccess(JavaScriptObject jso) {
            callback.onSuccess(new Integer(jso.toString()));
        }//from w ww.  j  av  a 2 s.  c o m
    });
}

From source file:com.gwittit.client.facebook.FacebookApi.java

License:Apache License

private void callMethodRetLong(final String method, final JavaScriptObject params,
        final AsyncCallback<Long> callback) {

    callMethod(method, params, new Callback<JavaScriptObject>(callback) {
        public void onSuccess(JavaScriptObject jso) {
            callback.onSuccess(new Long(jso.toString()));
        }//  w w  w  . j  a  va  2 s .co  m
    });
}

From source file:com.gwittit.client.facebook.FacebookApi.java

License:Apache License

private void callMethodRetBoolean(final String method, final JavaScriptObject params,
        final AsyncCallback<Boolean> callback) {

    callMethod(method, params, new Callback<JavaScriptObject>(callback) {

        public void onSuccess(JavaScriptObject response) {

            // Hackarond facebook bug, data.setCookie returns an empty
            // object, should return 0 or 1.
            if (response.toString().equals("{}")) {
                callback.onSuccess(true);
                return;
            }//from  w  w  w  .  j av  a2s.  c om
            callback.onSuccess(("1".equals(response.toString()) || "true".equals(response.toString())));
        }
    });
}

From source file:com.gwtdaily.interapp.eventbus.client.ModuleBEntryPoint.java

License:Apache License

@Override
public void onModuleLoad() {
    InterAppEventBus.addListener(new InterAppEventHandler() {

        @Override//www .ja  va2s  .  c om
        public void onEvent(JavaScriptObject data) {
            Window.alert(getType() + " event captured in peer module and data is " + data.toString());
        }

        @Override
        public String getType() {
            return "test1";
        }
    });
}