GwtQueryGWT的jQuery框架
GwtQuery 又被稱為gQuery,是一個(gè)使用GWT編寫的jQuery-like API。允許GWT用在逐步增強(qiáng)的情景下,可能GWT部件過于重量級(jí)的地方。它同樣可以用來查找和改善你的GWT部件。
GwtQuery 對(duì)于使用jQuery的開發(fā)者來說,易于學(xué)習(xí),因?yàn)樗鼈児蚕硐嗤腁PI,除此之外,gquery增添了很好的特性,比如類型安全的CSS、編譯時(shí)間最佳化等。
示例代碼:
import static com.google.gwt.query.client.GQuery.*;
import com.google.gwt.query.client.Function;
public void onModuleLoad() {
//Hide the text and set the width and append an h1 element
$("#text").hide()
.css("width", "400px")
.prepend("<h1>GwtQuery Rocks !</h1>");
//add a click handler on the button
$("button").click(new Function(){
public void f() {
//display the text with effects and animate its background color
$("#text").as(Effects)
.clipDown()
.animate("backgroundColor: 'yellow'", 500)
.delay(1000)
.animate("backgroundColor: '#fff'", 1500);
}
});
}評(píng)論
圖片
表情
