Example usage for com.google.gwt.core.client JsArray createArray

List of usage examples for com.google.gwt.core.client JsArray createArray

Introduction

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

Prototype

public static native JavaScriptObject createArray() ;

Source Link

Document

Returns a new array.

Usage

From source file:org.eclipse.che.ide.editor.orion.client.OrionEditorWidget.java

License:Open Source License

public void showErrors(AnnotationModelEvent event) {
    List<Annotation> addedAnnotations = event.getAddedAnnotations();
    JsArray<OrionProblemOverlay> jsArray = JsArray.createArray().cast();
    AnnotationModel annotationModel = event.getAnnotationModel();
    for (Annotation annotation : addedAnnotations) {
        Position position = annotationModel.getPosition(annotation);

        OrionProblemOverlay problem = JavaScriptObject.createObject().cast();
        problem.setDescription(annotation.getText());
        problem.setStart(position.getOffset());
        problem.setEnd(position.getOffset() + position.getLength());
        problem.setId("che-annotation");
        problem.setSeverity(getSeverity(annotation.getType()));
        jsArray.push(problem);/*  w  ww  .  ja  va2 s .c om*/
    }
    editorOverlay.showProblems(jsArray);
}

From source file:org.turbogwt.net.serialization.client.json.OverlaySerdes.java

License:Apache License

@Override
public String serializeFromCollection(Collection<T> c, SerializationContext context) {
    if (c instanceof JsArrayList) {
        return Overlays.stringify(((JsArrayList<T>) c).asJsArray());
    }/*w  w  w .j  av a 2 s .c o m*/

    if (c instanceof JavaScriptObject) {
        return Overlays.stringify((JavaScriptObject) c);
    }

    @SuppressWarnings("unchecked")
    JsArray<T> jsArray = (JsArray<T>) JsArray.createArray();
    for (T t : c) {
        jsArray.push(t);
    }
    return Overlays.stringify(jsArray);
}