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.client.core.image.filter.AbstractImageDataFilter.java

License:Open Source License

protected AbstractImageDataFilter(JSONObject node, ValidationContext ctx) throws ValidationException {
    m_type = ClassUtils.getSimpleName(getClass());

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

        m_meta = new MetaData();

        return;//from  w w w  .j  a  v a2  s. c  om
    }
    JSONValue aval = node.get("attributes");

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

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

            if (null == ajso) {
                m_attr = new Attributes(this);
            } else {
                m_attr = new Attributes(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);
            }
        }
    }
}

From source file:com.ait.lienzo.client.core.palette.AbstractPaletteBase.java

License:Open Source License

protected AbstractPaletteBase(final PaletteType type, final JSONObject node, final ValidationContext ctx)
        throws ValidationException {
    m_type = type;/*from   w w w.  ja  v a  2s .c  o  m*/

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

        m_meta = new MetaData();

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

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

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

            if (null == ajso) {
                m_attr = new Attributes(this);
            } else {
                m_attr = new Attributes(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 {
                NObjectJSO jso = mjso.cast();

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

From source file:com.ait.lienzo.client.core.shape.Attributes.java

License:Open Source License

public Attributes(final JavaScriptObject jso, final IJSONSerializable<?> ser) {
    m_ser = ser;/*from  w  w w.j a  v a2  s  .co  m*/

    if ((null != jso) && (NFastStringMapMixedJSO.typeOf(jso) == NativeInternalType.OBJECT)) {
        m_jso = jso.cast();
    } else {
        m_jso = NFastStringMapMixedJSO.make();
    }
}

From source file:com.ait.lienzo.client.core.shape.Attributes.java

License:Open Source License

public final Point2D getViewLocation() {
    final JavaScriptObject view = getObject(Attribute.VIEW_LOCATION.getProperty());

    if (null != view) {
        final Point2DJSO pjso = view.cast();

        return new Point2D(pjso);
    }/*w  w w  .j  av  a2  s . c  o  m*/
    return null;
}

From source file:com.ait.lienzo.client.core.shape.Attributes.java

License:Open Source License

public final Point2D getScale() {
    JavaScriptObject scale = getObject(Attribute.SCALE.getProperty());

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

        return new Point2D(pjso);
    }//from   w  ww  .j  a v  a2  s.co m
    return null;
}

From source file:com.ait.lienzo.client.core.shape.Attributes.java

License:Open Source License

public final Point2D getShear() {
    JavaScriptObject shear = getObject(Attribute.SHEAR.getProperty());

    if (null != shear) {
        Point2DJSO pjso = shear.cast();

        return new Point2D(pjso);
    }/*from w  w  w.j  a  va2 s . com*/
    return null;
}

From source file:com.ait.lienzo.client.core.shape.Attributes.java

License:Open Source License

public final Point2D getOffset() {
    JavaScriptObject offset = getObject(Attribute.OFFSET.getProperty());

    if (null != offset) {
        Point2DJSO pjso = offset.cast();

        return new Point2D(pjso);
    }/*from w  w  w.  j a v  a2 s . c  o  m*/
    return null;
}

From source file:com.ait.lienzo.client.core.shape.Attributes.java

License:Open Source License

public final Transform getTransform() {
    JavaScriptObject xrfm = getArray(Attribute.TRANSFORM.getProperty());

    if (null != xrfm) {
        TransformJSO pjso = xrfm.cast();

        return new Transform(pjso);
    }//from   w w w  .j a v  a  2 s .com
    return null;
}

From source file:com.ait.lienzo.client.core.shape.Attributes.java

License:Open Source License

public final Shadow getShadow() {
    JavaScriptObject shadow = getObject(Attribute.SHADOW.getProperty());

    if (null != shadow) {
        ShadowJSO sjso = shadow.cast();

        return new Shadow(sjso);
    }//w  w w. j  a  va 2s. c  om
    return null;
}

From source file:com.ait.lienzo.client.core.shape.Attributes.java

License:Open Source License

public final DragBounds getDragBounds() {
    JavaScriptObject bounds = getObject(Attribute.DRAG_BOUNDS.getProperty());

    if (null != bounds) {
        DragBoundsJSO djso = bounds.cast();

        return new DragBounds(djso);
    }// w  w w. ja v  a2  s.  com
    return null;
}