* <pre class="code">\r
* $("#foo").queue("colorQueue", lazy().css(CSS.COLOR.with(RGBColor.RED)).dequeue("colorQueue").done())\r
* .delay(800, "colorQueue")\r
- * .queue("colorQueue", lazy().css(CSS.COLOR.with(RGBColor.BLACK)).done()); \r
+ * .queue("colorQueue", lazy().css(CSS.COLOR.with(RGBColor.BLACK)).dequeue("colorQueue").done()); \r
* </pre>\r
* \r
* When this statement is executed, the text color of the element changes to\r
* Execute the next function on the queue named as queueName for the matched elements. \r
* This method is usefull to tell when a function you add in the Effects queue is\r
* ended and so the next function in the queue can start.\r
- * \r
- * If you are queuing functions in a named queue (not the Effects one), \r
- * you do not need to call dequeue(queueName) since it is preformed automatically. \r
- * \r
*/\r
public GQuery dequeue(String queueName) {\r
return as(Queue).dequeue(queueName);\r
* $("#foo").queue("myQueue", new Function(){\r
* public void f(Element e){\r
* $(e).css(CSS.BACKGROUNG_COLOR.with(RGBColor.RED));\r
+ * dequeue("myQueue");\r
* }\r
* })\r
* .delay(500, "myQueue")\r
- * .queue("myQueue", lazy().css(CSS.COLOR.with(RGBColor.YELLOW)).done());\r
+ * .queue("myQueue", lazy().css(CSS.COLOR.with(RGBColor.YELLOW)).dequeue("myQueue").done());\r
* </pre>\r
* \r
* When this statement is executed, the background color of the element is set\r
* to red, then wait 500ms before to set the text color of the element to\r
* yellow. right for 400ms.\r
* \r
- * NOTE: {@link #dequeue()} function is not needed at the end of your\r
- * function unless you use the Effects ('fx') namespace.\r
+ * Please note that {@link #dequeue()} function is needed at the end of your\r
+ * function to start the next function in the queue. In lazy() methods you should\r
+ * call dequeue() just before the done() call.\r
* {@see #dequeue()}\r
*/\r
public GQuery queue(String queueName, Function... f) {\r
* <pre class="code">
* $("#foo").queue("colorQueue", lazy().css(CSS.COLOR.with(RGBColor.RED)).dequeue("colorQueue").done())
* .delay(800, "colorQueue")
- * .queue("colorQueue", lazy().css(CSS.COLOR.with(RGBColor.BLACK)).done());
+ * .queue("colorQueue", lazy().css(CSS.COLOR.with(RGBColor.BLACK)).dequeue("colorQueue").done());
* </pre>
*
* When this statement is executed, the text color of the element changes to
* Execute the next function on the queue named as queueName for the matched elements.
* This method is usefull to tell when a function you add in the Effects queue is
* ended and so the next function in the queue can start.
- *
- * If you are queuing functions in a named queue (not the Effects one),
- * you do not need to call dequeue(queueName) since it is preformed automatically.
- *
*/
LazyGQuery<T> dequeue(String queueName);
* $("#foo").queue("myQueue", new Function(){
* public void f(Element e){
* $(e).css(CSS.BACKGROUNG_COLOR.with(RGBColor.RED));
+ * dequeue("myQueue");
* }
* })
* .delay(500, "myQueue")
- * .queue("myQueue", lazy().css(CSS.COLOR.with(RGBColor.YELLOW)).done());
+ * .queue("myQueue", lazy().css(CSS.COLOR.with(RGBColor.YELLOW)).dequeue("myQueue").done());
* </pre>
*
* When this statement is executed, the background color of the element is set
* to red, then wait 500ms before to set the text color of the element to
* yellow. right for 400ms.
*
- * NOTE: {@link #dequeue()} function is not needed at the end of your
- * function unless you use the Effects ('fx') namespace.
+ * Please note that {@link #dequeue()} function is needed at the end of your
+ * function to start the next function in the queue. In lazy() methods you should
+ * call dequeue() just before the done() call.
* {@see #dequeue()}
*/
LazyGQuery<T> queue(String queueName, Function... f);
\r
public static Object[] regs = new Object[]{\r
// scape some dots and spaces\r
- "(['\\[])([^'\\]]+)([\\s\\.#])([^'\\]]+)(['\\]])", rc_scp,\r
+ "(['\\[])([^'\\]]*)([\\s\\.#])([^'\\]]*)(['\\]])", rc_scp,\r
// add @ for attrib\r
"\\[([^@\\]~\\$\\*\\^\\|\\!]+)(=[^\\]]+)?\\]", "[@$1$2]",\r
// multiple queries\r
});
protected class DelayFunction extends Function {
-
private class SimpleTimer extends Timer {
- @Override
public void run() {
- dequeue();
g.each(funcs);
+ for (Element e: g.elements()) {
+ dequeueIfNotDoneYet(e, name, DelayFunction.this);
+ }
}
}
private int delay;
Function[] funcs;
GQuery g;
+ String name;
- public DelayFunction(GQuery gquery, int delayInMilliseconds, Function... f) {
+ public DelayFunction(GQuery gquery, String name, int delayInMilliseconds, Function... f) {
this.g = gquery;
this.delay = delayInMilliseconds;
this.funcs = f;
+ this.name = name;
}
@Override
public void f() {
new SimpleTimer().schedule(delay);
-
}
}
*/
@SuppressWarnings("unchecked")
public T delay(int milliseconds, String name, Function... funcs) {
- queue(name, new DelayFunction(this, milliseconds));
+ queue(name, new DelayFunction(this, name, milliseconds, funcs));
return (T) this;
}
public T queue(final String name, Function... funcs) {
for (final Function f: funcs) {
for (Element e: elements()) {
- queue(e, name, new Function(){
- @Override
- public void f(Element e) {
- f.f(e.<com.google.gwt.dom.client.Element>cast());
- dequeueIfNotDoneYet(e, name, this);
- }
- });
+ queue(e, name, f);
}
}
return (T)this;
}\r
\r
private static final String[] ATTRS_TO_SAVE = new String[]{\r
- "overflow", "visibility"};\r
+ "overflow"};\r
\r
private static final JsRegexp REGEX_NUMBER_UNIT = new JsRegexp(\r
"^([0-9+-.]+)(.*)?$");\r
onComplete();\r
} else {\r
g.dequeue();\r
+ g.restoreCssAttrs(ATTRS_TO_SAVE);\r
}\r
}\r
\r
assertEquals(".//div[@class='comment' and (contains(string(.),'John'))]",
sel.css2Xpath("div[@class='comment']:contains('John')"));
-
}
}
assertEquals(".//*[@checked='checked']|.//*[not(@disabled)]|.//*[@disabled]",
sel.css2Xpath(":checked, :enabled, :disabled"));
- assertEquals(".//table[contains(string(.),'String With | @ ~= Space Points.s and Hash#es')]",
- sel.css2Xpath("table:contains('String With | @ ~= Space Points.s and Hash#es')"));
+ assertEquals(".//table[contains(string(.),'#String With | @ ~= Space Points.s and Hash#es#')]",
+ sel.css2Xpath("table:contains('#String With | @ ~= Space Points.s and Hash#es#')"));
assertEquals(".//div[@class='comment' and (contains(string(.),'John'))]",
sel.css2Xpath("div[@class='comment']:contains('John')"));
+
}
public void testReplaceAll() {