Example usage for com.google.gwt.coreext.client DataBag getIntProperty

List of usage examples for com.google.gwt.coreext.client DataBag getIntProperty

Introduction

In this page you can find the example usage for com.google.gwt.coreext.client DataBag getIntProperty.

Prototype

public static final native int getIntProperty(JavaScriptObject obj, String prop) ;

Source Link

Usage

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

License:Apache License

/**
 * Determine the schema of an object by looking at its "type" field.
 * /*  ww  w .  j  a v  a  2s .  com*/
 * @param obj the object with a "type" field
 * @return the corresponding {@link JsonSchema}
 */
public final JsonSchema getSchema(JavaScriptObject obj) {
    if (DataBag.hasOwnProperty(obj, "type")) {
        return getSchema(DataBag.getIntProperty(obj, "type"));
    } else {
        return null;
    }
}

From source file:com.google.speedtracer.client.model.BreakyWorkerHost.java

License:Apache License

/**
 * Initialize the event handlers for the host.
 *//*from w  w w. j ava2s .com*/
private void init() {
    breakyWorker.setOnError(new ErrorHandler() {
        public void onError(ErrorEvent event) {
            UncaughtExceptionHandler ueh = GWT.getUncaughtExceptionHandler();
            if (ueh != null) {
                try {
                    onBreakyException(event);
                } catch (Exception ex) {
                    ueh.onUncaughtException(ex);
                }
            } else {
                onBreakyException(event);
            }
        }
    });

    breakyWorker.setOnMessage(new MessageHandler() {
        public void onMessage(MessageEvent event) {
            UncaughtExceptionHandler ueh = GWT.getUncaughtExceptionHandler();
            if (ueh != null) {
                try {
                    fireOnBreakyMessage(event);
                } catch (Exception ex) {
                    ueh.onUncaughtException(ex);
                }
            } else {
                fireOnBreakyMessage(event);
            }
        }

        /**
         * Turn a breaky message into a synthesized hint record.
         * 
         * @param event breaky message
         */
        private void fireOnBreakyMessage(MessageEvent event) {
            JavaScriptObject breakyMessage = event.getDataAsJSO();
            int sequence = DataBag.getIntProperty(breakyMessage, "sequence");
            String message = DataBag.getStringProperty(breakyMessage, "message");
            Logging.getLogger().logTextError("Breaky Error:(#" + sequence + ") " + message);

            EventRecord record = dataDispatcher.findEventRecordFromSequence(sequence);
            if (record == null) {
                Logging.getLogger().logTextError("Breaky cannot find record with sequence #" + sequence);
            } else {
                HintRecord validationHint = HintRecord.create("Validation Error", record.getTime(),
                        HintRecord.SEVERITY_VALIDATION, message, sequence);
                hintletHost.onSynthesizedHint(validationHint);
            }
        }
    });
}