Example usage for com.google.gwt.dom.client FormElement is

List of usage examples for com.google.gwt.dom.client FormElement is

Introduction

In this page you can find the example usage for com.google.gwt.dom.client FormElement is.

Prototype

public static boolean is(Node node) 

Source Link

Document

Determine whether the given Node can be cast to this class.

Usage

From source file:com.cgxlib.xq.client.plugins.Events.java

License:Apache License

/**
 * Trigger a html event in all matched elements.
 *
 * @param htmlEvent An string representing the desired html event.
 * @param datas     a set of object passed as data when executed the handlers
 * @param functions a set of function to run.
 *///from   w ww .  j a  v  a  2s .  c o m
public Events triggerHtmlEvent(String htmlEvent, Object[] datas, final Function... functions) {
    for (EventName part : EventName.split(htmlEvent)) {
        NativeEvent e = document.createHtmlEvent(part.eventName, true, true);
        JsUtils.prop(e, "namespace", part.nameSpace);
        if ("submit".equals(part.eventName)) {
            Function submitFunction = new Function() {
                public void f(Element e) {
                    // first submit the form then call the others functions
                    if (FormElement.is(e)) {
                        e.<FormElement>cast().submit();
                    }
                    callHandlers(e, getEvent(), functions);
                }
            };
            dispatchEvent(e, datas, submitFunction);
        } else {
            dispatchEvent(e, datas, functions);
        }
    }

    return this;
}