* Example:
* <pre>
if (GQuery.browser.ie6) {
- // this code will be removed on non-ie6 permutations
+ // this code will be removed on non-ie6 permutations
Window.alert("IE6");
} else if (!browser.webkit) {
- // this code will be only in the webkit permutation
+ // this code will be only in the webkit permutation
Window.alert("NOT WEBKIT");
- }
+ }
* </pre>
*
*/
* @return true if webkit
* @deprecated use webkit() instead
*/
- @Deprecated
+ @Deprecated
public final boolean safari = isWebkit();
/**
* @return true if webkit
* of the arguments array. It recursively visits arrays and inspect
* object to print an appropriate representation of them.
*
- * It is very useful to debug arguments passed in nested promises.
+ * It is very useful to debug arguments passed in nested promises.
*
* It is protected so as it can be used in Inner functions.
*
}
/**
- * @deprecated use getArgument instead
+ * @deprecated use getArgument instead
*/
@Deprecated
public Object getDataObject(int idx) {
* Utility method for safety getting an array present at a certain
* position in the list of arguments.
*
- * Useful for Deferred chains where result of each resolved
+ * Useful for Deferred chains where result of each resolved
* promise is set as an array in the arguments list.
*
* Always returns an array.
* Return the argument in the position idx or null if it doesn't exist.
*
* Note: if the return type doesn't match the object, you
- * will get a casting exception.
+ * will get a casting exception.
*/
public <T> T getArgument(int idx) {
return getArgument(-1, idx, null);
}
/**
- * Convenience alias for the getArguments(idx) method thought just to
+ * Convenience alias for the getArguments(idx) method thought just to
* make gQuery code look closed to jQuery.
*/
public <T> T arguments(int idx) {
* Utility method for safety getting an object present at a certain
* position in the list of arguments composed by arrays.
*
- * Useful for Deferred chains where result of each resolved
+ * Useful for Deferred chains where result of each resolved
* promise is set as an array in the arguments list.
*
* When the object found in the array doesn't match the type required it returns a null.
*
* Note: If type is null, we don't check the class of the object found andd you could
- * eventually get a casting exception.
+ * eventually get a casting exception.
*
*/
@SuppressWarnings("unchecked")
if (jsonFactory == null) {
try {
// We use reflection because the server side should not
- // depend on gwt-servlet nor gwt-dev. Hence if GWT is not
+ // depend on gwt-servlet nor gwt-dev. Hence if GWT is not
// in our classpath means that we are in server side, otherwise
// we use GWT to figure out if we are running devmode.
// This is run once, so no performance issues to worry about.
String toJson();
/**
- * return a string which represents the object with an alias for the
+ * return a string which represents the object with an alias for the
* className useful for serialization.
*
* Example {"user":{"name":"manolo","surname":"carrasco"}}
/**
* converts a JsonBuilder instance into another JsonBuilder type but
- * preserving the underlying data object.
+ * preserving the underlying data object.
*/
<T extends JsonBuilder> T as (Class<T> clz);
}
import com.google.gwt.query.client.Function;
/**
- * Definition of jquery Promise interface used in gquery.
+ * Definition of jquery Promise interface used in gquery.
*/
public interface Promise {
/**
- * Definition of jquery Deferred interface used in gquery.
+ * Definition of jquery Deferred interface used in gquery.
*/
public interface Deferred {
/**
/**
* Utility method to filter and/or chain Deferreds.
*
- * @deprecated use 'then' instead.
+ * @deprecated use 'then' instead.
* it was deprecated in jquery, and we maintain it here for compatibility.
*/
@Deprecated
* @param f a list of 1, 2, or 3 functions, which will be used in this way:
* 1st function will be called when the deferred is resolved.
* 2nd function that is called when the deferred is rejected.
- * 3rd one will be called when progress notifications are sent.
+ * 3rd one will be called when progress notifications are sent.
*/
Promise then(Function... f);
* Add filters to be called just in case the Deferred object is rejected returning
* a new valid promise so as we can continue the flow control of the chain.
*
- * It works in the same way than adding a second parameter to {@link then} method but
+ * It works in the same way than adding a second parameter to {@link then} method but
* continuing the flow and making more readable the code.
*
* Example:
try {
return SelectorEngine.querySelectorAllImpl(selector, ctx);
} catch (Exception e) {
- console.error("GwtQuery: Selector '" + selector +
+ console.error("GwtQuery: Selector '" + selector +
"' is unsupported in this SelectorEngineNativeMin engine."
+ " Do not use this syntax or configure your module to use a JS fallback. " + e.getMessage());
return null;
}
/**
- * Returns a dynamically generated Promise that is resolved once all actions
+ * Returns a dynamically generated Promise that is resolved once all actions
* in the queue have ended.
*/
public Promise promise() {
}
/**
- * Returns a dynamically generated Promise that is resolved once all actions
+ * Returns a dynamically generated Promise that is resolved once all actions
* in the named queue have ended.
*/
public Promise promise(final String name) {
// Inner functions don't have constructors, we use a block to initialize it
{
for (Element elem: elements()) {
- // Add this resolve function only to those elements with active queue
+ // Add this resolve function only to those elements with active queue
if (queue(elem, name, null) != null) {
emptyHooks(elem, name).add(this);
count++;
public static Settings createSettings(String prop) {
Settings s = GQ.create(Settings.class);
- if (prop != null && !prop.isEmpty())
+ if (prop != null && !prop.isEmpty())
s.parse(prop);
return s;
}
public class Callbacks {
/**
- * Iterface used for callbacks which could cancel the execution
+ * Iterface used for callbacks which could cancel the execution
* when returning false;
*
*/
public static interface Callback {
/**
- * Return false to avoid executing the rest of functions
+ * Return false to avoid executing the rest of functions
*/
boolean f(Object ...objects);
}
run(c, memory.toArray());
}
}
- }
+ }
@SuppressWarnings({"unchecked", "rawtypes"})
private boolean run(Object c, Object...o) {
import com.google.gwt.query.client.Promise.Deferred;
/**
- * Utility class used to create customized functions with a deferred
+ * Utility class used to create customized functions with a deferred
* execution in pipelined processes.
*
* They have access to the associated deferred object via a method which
/**
* This function is called when the previous promise in the pipe
- * is resolved.
+ * is resolved.
*/
public final Object f(Object... args) {
return dfd != null &&
* dfd.resolve("done");
* }
* };
- *
+ *
* doSomething.progress(new Function() {
* public void f() {
* String hi = arguments(0);
* Utility class used to create promises for RPC services.
* <pre>
* PromiseRPC<String> greeting = new PromiseRPC<String>();
- *
+ *
* GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
* greetingService.greetServer("hi", greeting);
- *
+ *
* greeting.fail(new Function(){
* public void f() {
* Throwable error = arguments(0);
* Utility class used to create promises for JsonpRequestBuilder.
* <pre>
* Promise p = new PromiseJsonpReqBuilder(url, 4000);
- *
+ *
* p.done(new Function() {
* public void f() {
* Properties p = arguments(0);
}
public String toString() {
- return super.toString() + " transitStart=" + transitStart + " transitEnd=" + transitEnd;
+ return super.toString() + " transitStart=" + transitStart + " transitEnd=" + transitEnd;
}
}
private static JsNamedArray<int[]> htmlColorToRgb;
// rgb and rgba regex
- public static RegExp REGEX_RGB_COLOR_PATTERN =
+ public static RegExp REGEX_RGB_COLOR_PATTERN =
RegExp.compile("rgba?\\(\\s*([0-9]{1,3}%?)\\s*,\\s*([0-9]{1,3}%?)\\s*,\\s*([0-9]{1,3}%?).*\\)$");
static {
/**
* We have to set the gQuery event listener to the element again when
- * the element is a widget, because when GWT detaches a widget it removes the
+ * the element is a widget, because when GWT detaches a widget it removes the
* event listener.
*/
public static void rebind(Element e) {
/**
* Return the first widget parent of the element, or null if it is not
- * attached to any widget yet.
+ * attached to any widget yet.
*/
private static Widget getFirstParentWidgetElement(Element element) {
return $(element).parents().widget();
" + \" msie=\" + msie" +
" + \" ie6=\" + ie6" +
" + \" ie8=\" + ie8" +
- " + \" ie9=\" + ie9" +
+ " + \" ie9=\" + ie9" +
";}");
writer.commit(logger);
}
* <pre>
* Request<SessionProxy> req1 = loginFact.api().login(null, null);
* Request<UserProxy> req2 = srvFact.api().getCurrentUser();
- *
+ *
* // We can use `when` to append different requests
* Promise requestingAll = Deferred.when(new PromiseRF(req1), new PromiseRF(req2);
* // Or we can use just one promise for multiple RF requests
* Promise requestingAll = new PromiseRF(req1, req2);
- *
+ *
* requestingAll.done(new Function() {
* public void f() {
* SessionProxy session = arguments(0, 0);
* public void f() {
* ServerFailure failure = arguments(0);
* }
- * });
+ * });
* </pre>
*/
public class PromiseRF extends DeferredPromiseImpl {