GWT的jQuery框架 GwtQuery
GwtQuery 又被稱為gQuery,是一個使用GWT編寫的jQuery-like API。允許GWT用在逐步增強的情景下,可能GWT部件過于重量級的地方。它同樣可以用來查找和改善你的GWT部件。
GwtQuery 對于使用jQuery的開發者來說,易于學習,因為它們共享相同的API,除此之外,gquery增添了很好的特性,比如類型安全的CSS、編譯時間最佳化等。
示例代碼:
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); } }); }
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!