List of usage examples for com.google.gwt.core.client JsArray cast
@Override @SuppressWarnings("unchecked") public <T extends JavascriptObjectEquivalent> T cast()
From source file:com.ait.lienzo.client.core.types.Point2DArray.java
License:Open Source License
public Point2DArray(final JsArray<JavaScriptObject> jso) { m_jso = jso.cast(); }
From source file:com.ait.lienzo3d.client.types.Point3DArray.java
License:Open Source License
public Point3DArray(JsArray<JavaScriptObject> jso) { m_jso = jso.cast(); }
From source file:com.colinalworth.xmlview.client.schema.impl.AbstractSchemaImpl.java
License:Apache License
/** * /*from ww w. j a v a2s . com*/ */ public AbstractSchemaImpl(JsArray<NamespacedNodeJSO> attrs, JsArray<NamespacedNodeJSO> elts) { this.attrs = attrs.cast(); this.elts = elts.cast(); }
From source file:com.emitrom.lienzo.client.core.types.Point2DArray.java
License:Open Source License
public Point2DArray(JsArray<JavaScriptObject> jso) { m_jso = jso.cast(); }
From source file:com.google.speedtracer.client.model.WhitelistModel.java
License:Apache License
public void saveEntries(JsArray<WhitelistEntry> entries) { localStorage.setItem(WHITELIST_KEY, entries.cast()); }
From source file:org.senchalabs.gwt.gwtdriver.client.SeleniumExporter.java
License:Apache License
@Override public void onModuleLoad() { export(GWT.getModuleName());//from ww w .j ava 2 s. c o m registerFunction("isWidget", new Function() { @Override public Object apply(JsArray<?> args) { Element elt = args.get(0).cast(); EventListener listener = DOM.getEventListener(elt); return "" + (listener instanceof Widget); } }); registerFunction("instanceofwidget", new Function() { @Override public Object apply(JsArray<?> args) { Element elt = args.get(0).cast(); String type = ((JsArrayString) args.cast()).get(1); Object instance = DOM.getEventListener(elt); if (instance == null) { return "null"; } return "" + isOfType(type, instance); } }); registerFunction("getContainingWidgetClass", new Function() { @Override public Object apply(JsArray<?> args) { Element elt = args.get(0).cast(); EventListener listener = DOM.getEventListener(elt); while (listener instanceof Widget == false) { if (elt == null) { return null; } elt = elt.getParentElement().cast(); listener = DOM.getEventListener(elt); } return listener.getClass().getName(); } }); registerFunction("getContainingWidgetElt", new Function() { @Override public Object apply(JsArray<?> args) { Element elt = args.get(0).cast(); EventListener listener = DOM.getEventListener(elt); while (listener instanceof Widget == false) { if (elt == null) { return null; } elt = elt.getParentElement().cast(); if (elt == elt.getOwnerDocument().cast()) { return null; } listener = DOM.getEventListener(elt); } return elt; } }); registerFunction("getContainingWidgetEltOfType", new Function() { @Override public Object apply(JsArray<?> args) { Element elt = args.get(0).cast(); String type = ((JsArrayString) args.cast()).get(1); EventListener listener = DOM.getEventListener(elt); while (listener instanceof Widget == false) { if (elt == null) { return null; } elt = elt.getParentElement().cast(); if (elt == elt.getOwnerDocument().cast()) { return null; } listener = DOM.getEventListener(elt); } //found a real widget Widget w = (Widget) listener; while (w != null && !isOfType(type, w)) { w = w.getParent(); } return w == null ? null : w.getElement(); } }); // registerFunction("getClass", new Function() { // @Override // public Object apply(JsArray<?> args) { // Object obj = get(args, 1); // return obj.getClass().getName(); // } // }); // registerFunction("instanceOf", new Function() { // @Override // public Object apply(JsArray<?> args) { // String type = (args.<JsArrayString>cast().get(0)); // Object instance = (get(args, 1)); // // Class<?> currentType = instance.getClass(); // while (currentType != null && !currentType.getName().equals(Object.class.getName())) { // if (type.equals(currentType.getName())) { // return "" + true; // } // currentType = currentType.getSuperclass(); // } // return "" + false; // } // }); }
From source file:org.waveprotocol.wave.client.common.util.DomHelper.java
License:Apache License
/** * Gets a list of descendants of e that match the given class name. * * If the browser has the native method, that will be called. Otherwise, it * traverses descendents of the given element and returns the list of elements * with matching classname.//from ww w . jav a 2 s . c om * * @param e * @param className */ public static NodeList<Element> getElementsByClassName(Element e, String className) { if (QuirksConstants.SUPPORTS_GET_ELEMENTS_BY_CLASSNAME) { return getElementsByClassNameNative(e, className); } else { NodeList<Element> all = e.getElementsByTagName("*"); if (all == null) { return null; } JsArray<Element> ret = JavaScriptObject.createArray().cast(); for (int i = 0; i < all.getLength(); ++i) { Element item = all.getItem(i); if (className.equals(item.getClassName())) { ret.push(item); } } return ret.cast(); } }