List of usage examples for com.google.gwt.query.client Function f
public void f(Widget w)
From source file:eu.europeana.web.timeline.client.ui.effects.Tween.java
License:EUPL
private void notifyListeners(Element e) { for (Function function : listeners) { function.f(e); } }
From source file:org.lirazs.gbackbone.client.core.collection.Collection.java
License:Apache License
public T create(final T model, Options options) { if (options == null) options = new Options(); T preparedModel = prepareModel(model); if (preparedModel == null) return null; if (!options.getBoolean("wait")) this.add(model, options); final Options finalOptions = options; final Function success = options.get("success"); options.put("success", new Function() { @Override//from w ww.j av a 2 s . co m public void f() { if (finalOptions.getBoolean("wait")) add(model, finalOptions); if (success != null) success.f(getArguments()); } }); preparedModel.save(null, options); return preparedModel; }
From source file:org.lirazs.gbackbone.client.core.navigation.History.java
License:Apache License
private boolean loadUrl(String fragmentOverride) { // If the root doesn't match, no routes can match either. if (!matchRoot()) return false; String fragment = this.fragment = this.getFragment(fragmentOverride); for (int i = 0; i < handlers.length(); i++) { Properties handler = handlers.get(i); RegExp route = handler.get("route"); Function callback = handler.getFunction("callback"); if (route.test(fragment)) { callback.f(fragment); return true; }// w w w . j a v a 2s .c o m } return false; }
From source file:org.lirazs.gbackbone.client.core.navigation.Router.java
License:Apache License
/**execute: function(callback, args, name) { if (callback) callback.apply(this, args); },*/// w w w . java2 s . com protected boolean execute(Function callback, String[] args, String name) { if (callback != null) { callback.f(args); } return true; }
From source file:org.lirazs.gbackbone.client.core.net.LocalStorageSyncStrategy.java
License:Apache License
@Override public Promise sync(String method, Synchronized syncModel, Options options) { JSONValue response = null;/* w w w.j a v a2 s . com*/ String errorMessage = null; Deferred syncDfd = new Deferred(); try { if (method.equals("read")) { if (syncModel instanceof Model) { Model model = (Model) syncModel; response = find(model.getId()).toJsonValue(); } else if (syncModel instanceof Collection) { response = findAll().toJsonValue(); } } else if (method.equals("create")) { response = create((Options) syncModel.toJSON()).toJsonValue(); } else if (method.equals("update")) { response = update((Options) syncModel.toJSON()).toJsonValue(); } else if (method.equals("delete")) { response = destroy((Options) syncModel.toJSON()).toJsonValue(); } } catch (Exception e) { errorMessage = e.getMessage(); } if (response != null) { syncModel.trigger("sync", syncModel, response, options); if (options != null && options.containsKey("success")) { Function success = options.get("success"); success.f(response); } syncDfd.resolve(response); } else { errorMessage = errorMessage != null ? errorMessage : "Record Not Found"; if (options != null && options.containsKey("error")) { Function error = options.get("error"); error.f(errorMessage); } syncDfd.reject(errorMessage); } // add compatibility with $.ajax // always execute callback for success and error if (options != null && options.containsKey("complete")) { Function complete = options.get("complete"); complete.f(response); } return syncDfd.promise(); }