’µ±-€°·€°±¾‚° ½° GWT ¸ mvp4g

  • View
    1.291

  • Download
    0

Embed Size (px)

DESCRIPTION

Google Docs source: https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B9lKUPDNyz1vYTViZjYwZTEtODNmNC00OWZlLWFhODUtMDNkYzE5N2NjM2Fk&hl=en

Text of ’µ±-€°·€°±¾‚° ½° GWT...

-

GWT mvp4g , iPark ventures 2011

Application Developer Days 2011-,

goo.gl/4GgnS

6- Java EE 6- UI :

6- Java EE 6- UI : http://shamansir.madfire.net http://zokotuhaFly.habrahabr.ru http://twitter.com/shaman_sir http://profiles.google.com/shaman.sir

1. . GWT 2. : - MVP / Reverse MVP - EventBus - Dependency Injection 3. mvp4g - (R)MVP GWT - EventBus - - HistoryConverter - /

4. GWT - UiBinder, - 5. Layouting- 6. -Java Server-Side-API ( RPC-) - - callback vs. GwtEvent - / 7. i18n GWT 8. .

( ) : (). :

!

.

1. GWT

GWT

Google Web Toolkit

/wt/code.google.com/webtoolkit/

GWT/wt/

/wt/

:Google Wave wave.google.com Google Checkout checkout.google.com Google Moderator google.com/moderator Whirled whirled.com Lombardi Blueprint blueprint.lombardi.com ContactOffice beta.contactoffice.com

:GoGrid gogrid.com Curriki curriki.org OpenKM openkm.com Kdice kdice.com SeeMap seemap.ru odnoklassniki.ru

-

http://old.ongwt.com/public/WindowsLiveWriter_GWTMosaicnicewidgetlibrary_D777_image_2.png

http://radar.oreilly.com/200912081729.jpg

-!

http://2.bp.blogspot.com/_VzXmgKXrn6Y/TKB2a3eZTBI/AAAAAAAAAaQ/mn7NmabwO8U/s1600/browsers%5Btsksoft.blogspot.com%5D.jpg

-! on-the-fly

http://lh4.ggpht.com/_a0imbbK4r5U/Sxwd1oVpXiI/AAAAAAAAAjc/gsRkQUn9kZI/gwt-dev-mode.png

-! on-the-fly

-! on-the-fly

debug

http://www.ibm.com/developerworks/library/j-ajax4/eclipse-debug.jpg

-! on-the-fly

debug

RPC

API/DB

-! on-the-fly

debug

RPC

i18nhttp://test.ical.ly/wp-content/uploads/2010/04/i18n.png

-! on-the-fly

debug

RPC

i18n

Code Splitting

-! on-the-fly

debug

RPC

i18n

Code Splitting

http://www.safetylca.org/images/toolbox.jpg

http://blog.ericlamb.net/wp-content/uploads/2009/08/toolbox.jpg http://www.safetylca.org/images/toolbox.jpg

GWT

/wt/

1.0 2006-

1.0 2006- 1.6 Google Eclipse Plugin Web Application

2.0- Development Mode - Code Splitting - UI - Client Bundle

2.1 MVP- RequestFactory / Editors

2.1 MVP- RequestFactory / Editors 2.2 UI Designer HTML5 Canvas, Java 1.6

quake2-gwt-port.appspot.com

Quake 2

https://y2mzuw.blu.livefilestore.com/y1m9Pc7Xi6qtMdKU_hGCv7VZrEKiIZTYqDIC5laL9A0LxracK6AN8EAet90MRtWlBJISphNp_Y8QCxpb0p9v1y lTCdwATCweUs9496DC14_ijBjhnpj2oRWme9B1SC2C0t9HJ1wX8RTsVQAhyDYCsqfeg/quake-html5-04-02-2010.jpg

quake2-gwt-port.appspot.com

Quake 2

GWT ,

/wt/

2. GWT

almaer.com/blog/rotating-java-and-javascript-on-the-server

EntryPoint GWT-

Java JavaScript, JSNI Development Mode Code Splitting .gwt.xml MVC, MVP, RMVP, EventBus Deferred Binding Dependency Injection Remote Service JUnit

JavaScript Logo is from marakana.com

JavaScript Native Interface

JSNI

public native static void () /*-{ . . . @.::( /L;/L;...)(); . . . }-*/;

JSNI

public native static void getJson(int requestId, String url, StockWatcher handler) /*-{ var callback = "callback" + requestId; var script = document.createElement("script"); script.setAttribute("src", url+callback); script.setAttribute("type", "text/javascript"); window[callback] = function(jsonObj) { handler.@com.google.gwt.sample.stockwatcher .client.StockWatcher::handleJsonResponse( Lcom/google/gwt/core/client/JavaScriptObject;)(jsonObj); window[callback + "done"] = true; } setTimeout(function() { if (!window[callback + "done"]) { handler.@com.google.gwt.sample.stockwatcher .client.StockWatcher::handleJsonResponse( Lcom/google/gwt/core/client/JavaScriptObject;)(null); } document.body.removeChild(script); delete window[callback]; delete window[callback + "done"]; }, 1000); document.body.appendChild(script); }-*/;

JSNI

JavaScript . , Google Maps WYSIWYG-

JSNI

Google Maps, JSNI

WYSIWYG-, Closure JSNI

Flash- JavaScript-, JSNI

JSNI

JSNI , JavaScript, GWT-

Development Mode

Development Modehttp://lc:8080/ui/?gwt.codesvr=lc:9997#!job/start

Development Modehttp://lc:8080/ui/?gwt.codesvr=lc:9997#!job/start IDE ( Opera)

Development Modehttp://lc:8080/ui/?gwt.codesvr=lc:9997#!job/start

http://lh4.ggpht.com/_a0imbbK4r5U/Sxwd1oVpXiI/AAAAAAAAAjc/gsRkQUn9kZI/gwt-dev-mode.png

Development Modehttp://lc:8080/ui/?gwt.codesvr=lc:9997#!job/start

http://lh4.ggpht.com/_a0imbbK4r5U/Sxwd1oVpXiI/AAAAAAAAAjc/gsRkQUn9kZI/gwt-dev-mode.png

Development Mode : Java- Ctrl+F5 !

Code Splitting

Code Splittingoid createAsync(final MClient client) { } GWT.runAsync(...) public void onFailure(Throwable err) { . . . } public void onSuccess() { if (instance == null) { . . . instance = new Module(); . . . client.onSuccess(instance); } });

Code Splittingoid createAsync(final MClient client) { } GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable err) { . . . } public void onSuccess() { if (instance == null) { . . . instance = new Module(); . . . client.onSuccess(instance); } });

Code Splittingpublic static void createAsync(final MClient client) { } GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable err) { client.onUnavailable(); } public void onSuccess() { if (instance == null) { instance = new Module(); } client.onSuccess(instance); } });

Code Splitting : ! !

.gwt.xml

.gwt.xml ,

.gwt.xml , ,

.gwt.xml , , ,

.gwt.xml , , , /

.gwt.xml

.gwt.xml

.gwt.xml

.gwt.xml [Debug.gwt.xml]

.gwt.xml [Debug.gwt.xml]

.gwt.xml [Debug.gwt.xml]

.gwt.xml- , web.xml -:

R M V P

Model View Controller

Model View ControllerAPI/DB

Model View Controllercalls

Model View Presenter

Model View Presenterevents

update

Reverse Model View Presenter

Reverse Model View Presenter

PresenterEvent Bus

er

Presenter PreEvent Bus

P

PEB

P P P P P

... , , ----

MVC MVP

geekswithblogs.net/kobush/archive/2006/01/09/65305.aspx

MVC/MVP

geekswithblogs.net/kobush/archive/2006/01/09/65305.aspx

EventBus

tv.jetbrains.net/videocontent/gwt-event-bus-basics

EventBus

tv.jetbrains.net/videocontent/gwt-event-bus-basics

EventBus

Deferred Binding

Deferred Binding Reflection

Deferred Binding Reflection ( ).

Deferred Binding Reflection ( ) GWT.create(....class)

Deferred Binding Reflection ( ). GWT.create(....class) CompileTime-

Deferred Binding Reflection ( ). GWT.create(....class) CompileTime-

Deferred BindingPopupImpl: public void setVisible(boolean visible) { // ... common code for all implementations of PopupPanel ... // If the PopupImpl creates an iframe shim, it's also // necessary to hide it as well. impl.setVisible(getElement(), visible);

}

Deferred BindingPopupImpl: public void setVisible(boolean visible) { // ... common code for all implementations of PopupPanel ... // If the PopupImpl creates an iframe shim, it's also // necessary to hide it as well. impl.setVisible(getElement(), visible);

}

PopupImplIE6: public native void setVisible(Element popup, boolean visible) /*-{ if (popup.__frame) { popup.__frame.style.visibility = visible ? 'visible' : 'hidden'; } }-*/;

Deferred Binding

Deferred Binding private static final PopupImpl impl = GWT.create(PopupImpl.class);

Deferred Binding

www.docstoc.com/docs/53396874/Deferred-Binding-The-Magic-of-GWT

Deferred Binding

www.docstoc.com/docs/53396874/Deferred-Binding-The-Magic-of-GWT

Deferred Binding . , .

!

Dependency Injection

Dependency Injection GWT INjection / Guice

Dependency Injection GWT INjection / Guice ( )

Dependency Injection GWT INjection / Guice ( ) XML-

Dependency Injection GWT INjection / Guice ( ) XML- Runtime-

Dependency Injection GWT INjection / Guice ( ) XML- Runtime-

Dependency Injectionclass MyModule extends AbstractGinModule { @Override protected void configure() { bind(Something.class).toProvider(SomethingProvider.class); bind(Any.class).in(Singleton.class); bind(Foo.class).to(SomeFooImpl.class); } } class Bar { @Inject private Any any; private final Something something; private final Foo foo; @Inject public Bar(Something something, Foo foo) { }

}

Dependency Injection@GinModules(MyModule.class) interface class MyGinjector extends Ginjector { public Something getSomething(); public Foo getFoo(); }

- Guice

code.google.com/p/google-guice/wiki/Motivation?tm=6

Dependency Injection .

, . , application-context.xml Spring, .

!

Remote Service

Remote Servicepublic interface StringReverserService extends RemoteService { public String reverseString(String stringToReverse); }