/**
* Class used in plugins which need a queue system.
*/
-public abstract class GQueryQueue extends GQuery {
+public abstract class GQueryQueue<T extends GQueryQueue<?>> extends GQuery {
private static final String QUEUE_DATA_PREFIX = "GQueryQueue_";
/**
* Removes a queued function from the front of the queue and executes it.
*/
- public GQueryQueue dequeue() {
+ @SuppressWarnings("unchecked")
+ public T dequeue() {
for (Element e : elements()) {
dequeue(e);
}
- return this;
+ return (T)this;
}
/**
* Adds a new function, to be executed, onto the end of the queue of all
* matched elements.
*/
- public GQueryQueue queue(Function func) {
+ @SuppressWarnings("unchecked")
+ public T queue(Function func) {
for (Element e : elements()) {
queue(e, func);
}
- return this;
+ return (T)this;
}
/**
* Replaces the current queue with the given queue on all matched elements.
*/
- public GQueryQueue queue(Queue<?> queue) {
+ @SuppressWarnings("unchecked")
+ public T queue(Queue<?> queue) {
for (Element e : elements()) {
replacequeue(e, queue);
}
- return this;
+ return (T)this;
}
/**
* Stop the function which is currently in execution, remove it
* from the queue an start the next one.
*/
- public GQueryQueue stop() {
+ @SuppressWarnings("unchecked")
+ public T stop() {
for (Element e : elements()) {
stop(e);
}
- return this;
+ return (T)this;
}
protected String getQueueType() {
$("ul.thumb li").hover(new Function() {\r
public void f(Element e) {\r
$(e).css("z-index", "10").find("img").addClass("hover")\r
- .as(Effects.Effects).stop().as(Effects.Effects)\r
+ .as(Effects.Effects).stop()\r
.animate("marginTop: '-110px', marginLeft: '-110px', top: '50%', left: '50%', width: '174px', height: '174px', padding: '20px'", 200);\r
}} , new Function() {\r
public void f(Element e) {\r
$(e).css("z-index", "0").find("img").removeClass("hover")\r
- .as(Effects.Effects).stop().as(Effects.Effects)\r
+ .as(Effects.Effects).stop()\r
.animate("marginTop: '0', marginLeft: '0', top: '0%', left: '0%', width: '100px', height: '100px', padding: '5px'", 600);\r
}});\r
\r