Gwt jug basic

  • View
    632

  • Download
    1

Embed Size (px)

DESCRIPTION

Gwt jug basic by Antonov Anton

Transcript

  • 1. Google Web Toolkit WEB Anton Antonovanton.antonov@sigmaukraine.com2011

2. GWT GWT? GWT 3. WEB : 4. GWT IDE, , , Java (Tomcat, Jboss, ..) PHP/CGI (Apache) .Net (IIS) 5. GWT: Java Java JavaScript JavaScript 6. GWT: HelloWorldpublic class HelloWorld implements EntryPoint {public void onModuleLoad() { RootPanel panel = RootPanel.get(); Label message = new Label("Hello World!!!"); panel.add(message); Button button = new Button("Click ME"); panel.add(button); button.addClickHandler(new ClickHandler() {public void onClick(ClickEvent event) { Window.alert("Hello World!");} });}} 7. Google Wave https://wave.google.com Google AdWords https://adwords.google.com http://gwtgallery.appspot.com 8. GWT http://www.slideshare.net/dgirard/introduction-to-google-web-toolkit 9. http://gwt.google.com/samples/Showcase/Showcase.html 10. (back button) GWT ShowCase - History.addValueChangeHandler(new ValueChangeHandler() {public void onValueChange(ValueChangeEventstringValueChangeEvent) { //do something on history change }}); 11. (UiBinder) XML Java (CSS, ) 12. AJAX: RPC private void getData() { DataServiceAsync rpc = (DataServiceAsync) GWT.create(DataService.class); rpc.getDataModel(5, 6, new AsyncCallback() {public void onFailure(Throwable throwable) {Window.alert("Unable get data from server"+ throwable);}public void onSuccess(DataModel dataModel) {Window.alert("Server response:n"+ dataModel.getDataString()+ dataModel.getDataInt());}});} 13. java.io.Serializable * java.io.Serializable ( ) non-final non-transient 14. Java JavaScript (JSNI) JS GWT Java private native void someJSFunction(Date value) /*-{$wnd.someJSFunction(value);}-*/; GWT JS JS (Google Charts, JQuery ..) 15. JavaScript Overlay private native void registerGWTFunction() /*-{ var _this = this; $wnd.registeredGWTFunction = function (v) {_this.@com.sigmaukraine.jug.jsni.client.JSNI ::jsAccessibleFunction (Lcom/sigmaukraine/jug/jsni/client/overlay/JSOverlay;) (v); };}-*/;private void jsAccessibleFunction(JSOverlay overlay) { Window.alert("Im GWT:nstr:"+ overlay.getStr() + "nvalue:"+ overlay.getValue());} 16. 17. Cross-browser JavaScript API () IE JS IE, FireFox JS FF API JS 18. 1 12ClientBundle CSSResource ImageResource TextResource ..(http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#ClientBundle ) 19. GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable reason) { Window.alert("Cant load script part"); } public void onSuccess() { //The following code will be loaded on demand root.add(new HelloWorldPanel(textCell.getValue())); } }); 20. 21. JS ! -style pretty * * JSNI 22. JUnit JUnit GWTTestCase , DOM ,DeferredBinding JSNI. IDE 23. MVP (GWT pattern) Model , View (UiBinder widget, GWT plain widget, etc.) Presenter 24. Activities & Places (GWT pattern) (Place) UI / URL hash (#...) (Activity) Wake up Set up Show up 25. GWT MVP (Model View Presenter) GWT-Platform http://code.google.com/webtoolkit/articles/mvp-architecture.html http://code.google.com/p/gwt-platform/ Activities & Places http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html Gin (Dependency injection for GWT, based on Guice) http://code.google.com/p/google-gin/ Spring MVC RPC integration (gwt-widget SL) http://gwt-widget.sourceforge.net/gwt-sl/reference-1.0/index.html 26. Q&A