Example usage for com.google.gwt.user.client Element as

List of usage examples for com.google.gwt.user.client Element as

Introduction

In this page you can find the example usage for com.google.gwt.user.client Element as.

Prototype

public static Element as(JavascriptObjectEquivalent o) 

Source Link

Document

Assert that the given Node is an Element and automatically typecast it.

Usage

From source file:com.extjs.gxt.ui.client.event.DomEvent.java

License:sencha.com license

/**
 * Returns <code>true</code> if the target of this event equals or is a child
 * of the given element./*  www.  ja va2s.c o  m*/
 * 
 * @param element the element
 * @param toElement true to use {@link Event#getRelatedEventTarget()}
 * @return the within state
 */
public boolean within(Element element, boolean toElement) {
    if (event != null && Element.is(element)) {
        EventTarget target = toElement ? event.getRelatedEventTarget() : event.getEventTarget();
        if (Element.is(target)) {
            return DOM.isOrHasChild(element, (Element) Element.as(target));
        }
    }
    return false;
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.FormPopup.java

License:Apache License

private boolean isCaptionEvent(NativeEvent event) {
    EventTarget target = event.getEventTarget();
    if (Element.is(target)) {
        com.google.gwt.dom.client.Element element = Element.as(target);
        if (decPanel.getElement().isOrHasChild(element)) {
            String tag = element.getTagName();
            String className = element.getClassName();
            if (tag.equalsIgnoreCase("tr")) {
                if ("top".equalsIgnoreCase(className)) {
                    return true;
                }//from   w  w  w  .  j  a  v a2  s  . c o  m
            } else if (tag.equalsIgnoreCase("td")) {
                if ("topLeft".equalsIgnoreCase(className) || "topCenter".equalsIgnoreCase(className)
                        || "topRight".equalsIgnoreCase(className)) {
                    return true;
                }
            } else if (tag.equalsIgnoreCase("div")) {
                if ("topLeftInner".equalsIgnoreCase(className) || "topCenterInner".equalsIgnoreCase(className)
                        || "topRightInner".equalsIgnoreCase(className)) {
                    return true;
                }
            }
        }
    }
    return false;
}