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.
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.