I use Google Gin and switch Ginjectors based on a form factor property in 
my module XML so its basically the factory approach.

interface AppInjector extends Ginjector {
  App getApp();
}

@GinModule(DesktopModule.class)
interface DesktopAppInjector extends AppInjector {}

// just for illustration you can also use custom multi valued config 
properties of your *.gwt.xml file that contain full qualified class names 
of gin modules
@GinModules(value = { TabletModule.class }, properties = {"common.config", 
"tablet.config"})
interface TabletAppInjector extends AppInjector {}


Because you can not use GWT.create(AppInjector.class) to initialize GIN 
(because of the GinModule annotations being defined on sub interfaces) you 
need additional classes for deferred binding:

interface AppInjectorProvider {
  AppInjector get();
}

class DesktopAppInjectorProvider implements AppInjectorProvider {
  public AppInjector get() {
     return GWT.create(DesktopAppInjector.class);
  }
}

class TabletAppInjectorProvider implements AppInjectorProvider {
  public AppInjector get() {
     return GWT.create(TabletAppInjector.class);
  }
}


And finally the entry point

class AppEntryPoint implements EntryPoint {
  void onModuleLoad() {
    AppInjectorProvider injector = GWT.create(AppInjectorProvider.class);
    injector.get().getApp().start();
  }
}


With the code above I can pretty much configure everything inside gin 
modules. 

For high resolution images its a lot better to extend the ClientBundle 
mechanism. An example for retina images can be found 
at https://github.com/kDCYorke/RetinaImages

In general I would recommend using vector icons (e.g. "Font Awesome" or 
http://glyphicons.com/) so you don't need that retina image thing just for 
icons.



-- J.


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to