Example usage for com.google.gwt.query.client Function f

List of usage examples for com.google.gwt.query.client Function f

Introduction

In this page you can find the example usage for com.google.gwt.query.client Function f.

Prototype

public boolean f(Event e, Object data) 

Source Link

Document

Override this method for bound event handlers if you wish to deal with per-handler user data.

Usage

From source file:org.lirazs.gbackbone.client.core.model.Model.java

License:Apache License

public Promise destroy(final Options options) {

    final Function success = options.get("success");
    options.put("success", new Function() {
        @Override/*w w  w .  j  a  va 2s .co  m*/
        public void f() {
            JSONValue response = processAjaxJsonResponse(getArgument(0));

            if (options.getBoolean("wait") || Model.this.isNew()) {
                Model.this.trigger("destroy", Model.this, Model.this.collection, options);
            }

            if (success != null) {
                success.f(response, options);
            }
            if (!Model.this.isNew())
                Model.this.trigger("sync", Model.this, response, options);
        }
    });

    if (this.isNew()) {
        Function successFunction = options.get("success");
        successFunction.f();
        return null;
    }

    final Function error = options.get("error");
    options.put("error", new Function() {
        @Override
        public void f() {
            JSONValue response = processAjaxJsonResponse(getArgument(0));
            if (error != null) {
                error.f(response, options);
            }
            Model.this.trigger("error", Model.this, response, options);
        }
    });

    Promise deferred = this.sync("delete", options);
    if (!options.getBoolean("wait"))
        Model.this.trigger("destroy", Model.this, Model.this.collection, options);

    return deferred;
}