background preloader

Développement Google

Facebook Twitter

Best Practices for Architecting GWT App. Mvp4g - Project Hosting on Google Code. Gwt-presenter - Project Hosting on Google Code. Google. Code Conventions for the Java(TM) Programming Language: Contents. GinTutorial - google-gin - Using GIN to create a GWT widget - Pr. This tutorial will show how a simple GWT widget can be constructed with GIN. You should be already familiar with Guice - if not, then please read the Guice User Guide for an introductory overview of Guice concepts. In regular Guice, you would use: // Does NOT work in GWT code! MyWidgetMainPanel mainPanel = injector.getInstance(MyWidgetMainPanel.class); However, as the comment points out that won't work in GWT: There is no actual class available in the resulting JavaScript. Fortunately in GWT there is a different idiom which accomplishes the same purpose. Step 1. <module> ... Step 2. Declare an interface with methods that return the desired types: public interface MyWidgetGinjector extends Ginjector { MyWidgetMainPanel getMainPanel();} Experienced GWT users will notice the similarity to the way GWT image bundles and messages are done: You simply create a method for each object type you want to create, and the an implementation of the interface gets generated for you at compile time.

Step 3.