Main Features
Total Page:16
File Type:pdf, Size:1020Kb
GWT http://code.google.com/webtoolkit/ Main Features - Write AJAX apps in Java, compile to JavaScript - View code changes immediately without re-compiling - Step through live AJAX code with Java Debugger - Compile and deploy optimized cross-browser JavaScript More Features.. - Communicate with your server through really simple RPC (transfer serializable object graphs between client and server) - Optimize JavaScript downloads based on client profile (Ex. Firefox in English, Opera in French, etc..) - Reuse UI components across projects - Use other JavaScript libraries and native JavaScript code (Ex. Prototype, JQuery, ExtJs, etc..) - Debug your code using Eclipse and hosted mode browser - Test with JUnit Google Wave - built with GWT Development Environment Google Eclipse Plugin - Easily create/compile/deploy your web apps - Use proven fully-featured IDE Google App Engine (GAE) - Run your web apps on Google's infrastructure - Use built-in support for storing data, caching, admin features, etc.. GWT Compiled JavaScript Inside a GWT App Script tag points to the location of optimized JavaScript Body tag provides a number of elements with specified IDs GWT Java code uses HTML IDs to insert 'widgets' into HTML pages Entry Point - Implement EntryPoint Interface - Implement onModuleLoad method JSNI - JavaScript Native Interface - Implement Java method directly in JavaScript - Wrap type-safe Java method signatures around existing JavaScript - Call from JavaScript code into Java code and vice-versa - Throw exceptions across Java/JavaScript boundaries - Read and write Java fields from JavaScript Building User Interfaces - RootPanel (parent container) - Layouts (used for laying out widgets and panels) - Widgets and Panels (all UI components fall in this category) - Accessing Browser's DOM (widget.getElement()) - Events & Handlers (widget.addClickHandler(handler)) - Applying Style (widget.addStyleName('some-style')) - Image Bundles (packs images into single file to be downloaded from the server and managed as a Java object) Internationalization (I18N) English Spanish Constants Interface Your application code Communicating with Server (RPC) Synchronous Interface @RemoteServiceRelativePath("myServiceImpl") Asynchronous Interface Making HTTP Requests RPC - continue... Registering Service with web.xml MyServiceAsync myService = (MyServiceAsync) GWT.create(MyService.class); AsyncCallback callback = new AsyncCallback() { public void onSuccess(String result) { // do some UI stuff to show success } public void onFailure(Throwable caught) { // do some UI stuff to show failure } }; // (3) Make the call. Control flow will continue immediately and later // 'callback' will be invoked when the RPC completes. // myService.myMethod("some text here", callback); GWT & Embedded Flex Components http://extjs.com/products/gxt/.