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

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

Introduction

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

Prototype

@Override
@SuppressWarnings("unchecked")
public <T extends JavascriptObjectEquivalent> T cast() 

Source Link

Document

A helper method to enable cross-casting from any JavaScriptObject type to any other JavaScriptObject type.

Usage

From source file:com.ait.lienzo.test.stub.Attributes.java

License:Open Source License

public final SpriteBehaviorMap getSpriteBehaviorMap() {
    final JavaScriptObject object = getObject(Attribute.SPRITE_BEHAVIOR_MAP.getProperty());

    if (null != object) {
        final SpriteBehaviorMap.SpriteBehaviorMapJSO sjso = object.cast();

        return new SpriteBehaviorMap(sjso);
    }/*from   w  w  w  . jav a 2 s.c  o  m*/
    return null;
}

From source file:com.ait.lienzo.test.stub.Attributes.java

License:Open Source License

public final ImageDataFilter.FilterConvolveMatrix getMatrix() {
    final JavaScriptObject mjso = getArray(Attribute.MATRIX.getProperty());

    if (null != mjso) {
        return mjso.cast();
    }//w  w w  .j a  va 2s .  c om
    return ImageDataFilter.FilterConvolveMatrix.make().cast();
}

From source file:com.ait.lienzo3d.client.Attributes3D.java

License:Open Source License

public final Point3D getCameraArmLocation() {
    final JavaScriptObject location = getObject(Attribute3D.CAMERA_ARM_LOCATION.getProperty());

    if (null != location) {
        final Point3DJSO pjso = location.cast();

        return new Point3D(pjso);
    }/*from  w  ww . j  av a  2 s .  c  om*/
    return new Point3D();
}

From source file:com.ait.lienzo3d.client.Attributes3D.java

License:Open Source License

public final CameraArmRotation getCameraArmRotation() {
    final JavaScriptObject rotation = getObject(Attribute3D.CAMERA_ARM_ROTATION.getProperty());

    if (null != rotation) {
        final CameraArmRotationJSO pjso = rotation.cast();

        return new CameraArmRotation(pjso);
    }/*from   w  w  w .jav  a  2s .com*/
    return new CameraArmRotation();
}

From source file:com.ait.lienzo3d.client.Attributes3D.java

License:Open Source License

public final Point3D getViewScale() {
    final JavaScriptObject scale = getObject(Attribute3D.VIEW_SCALE.getProperty());

    if (null != scale) {
        final Point3DJSO pjso = scale.cast();

        return new Point3D(pjso);
    }// ww w  .j  ava2 s  .co  m
    return new Point3D(1, 1, 1);
}

From source file:com.ait.lienzo3d.client.Attributes3D.java

License:Open Source License

public final Point3D getViewPosition() {
    final JavaScriptObject position = getObject(Attribute3D.VIEW_POSITION.getProperty());

    if (null != position) {
        final Point3DJSO pjso = position.cast();

        return new Point3D(pjso);
    }//w w  w  . ja  v  a  2 s . c o  m
    return new Point3D(0, 0, 0 - 1);
}

From source file:com.ait.lienzo3d.client.shape.BaseObject3D.java

License:Open Source License

protected BaseObject3D(final Type3D type, final JSONObject node, final ValidationContext ctx)
        throws ValidationException {
    m_type = type;//from   w ww .  j av  a 2  s .  c o m

    if (null == node) {
        m_attr = new Attributes3D(this);

        m_meta = new MetaData();

        return;
    }
    JSONValue aval = node.get("attributes");

    if (null == aval) {
        m_attr = new Attributes3D(this);
    } else {
        JSONObject aobj = aval.isObject();

        if (null == aobj) {
            m_attr = new Attributes3D(this);
        } else {
            JavaScriptObject ajso = aobj.getJavaScriptObject();

            if (null == ajso) {
                m_attr = new Attributes3D(this);
            } else {
                m_attr = new Attributes3D(ajso, this);
            }
        }
    }
    JSONValue mval = node.get("meta");

    if (null == mval) {
        m_meta = new MetaData();
    } else {
        JSONObject mobj = mval.isObject();

        if (null == mobj) {
            m_meta = new MetaData();
        } else {
            JavaScriptObject mjso = mobj.getJavaScriptObject();

            if (null == mjso) {
                m_meta = new MetaData();
            } else {
                NFastStringMapMixedJSO jso = mjso.cast();

                m_meta = new MetaData(jso);
            }
        }
    }
    refresh();
}

From source file:com.ait.tooling.nativetools.client.collection.MetaData.java

License:Open Source License

public MetaData(final JavaScriptObject jso) {
    if ((null != jso) && (JSONType.OBJECT == Native.getNativeTypeOfJSO(jso))) {
        m_jso = jso.cast();
    } else {/*from w ww  . j  av a  2s. c o  m*/
        m_jso = NObjectJSO.make();
    }
}

From source file:com.ait.tooling.nativetools.client.collection.MetaDataArray.java

License:Open Source License

public MetaDataArray(final JavaScriptObject jso) {
    if ((null != jso) && (JSONType.ARRAY == Native.getNativeTypeOfJSO(jso))) {
        m_jso = jso.cast();
    } else {//from   w  ww.j  av  a  2  s .  c o m
        m_jso = NArrayJSO.make();
    }
}

From source file:com.ait.tooling.nativetools.client.NArray.java

License:Open Source License

public final <T extends JavaScriptObject> T getAsJSO(final int index) {
    if ((index >= 0) && (index < size())) {
        final JavaScriptObject mjso = m_jso.getAsJSO(index);

        if (null != mjso) {
            return mjso.cast();
        }//w w w  .  ja  v  a 2  s.co m
    }
    return null;
}