I am looking for example to use code splitting with gin and smartgwt ...
In my simple application I have 2 modules AutoLoadModule
and WindowModule
. In my simple app I just need to load a window when some button is clicked.
My window module contains:
@Override
protected void configure() {
bind(MainWindow.class).in(Singleton.class);
}
and my MainWindow
:
@Singleton
public class MainWindow extends Window implements SessionStatusChangedEvent.Handler {
private final XmppSession session;
@Inject
private MainWindow(XmppSession session) {
Log.debug("Constructor ImMainWindow... !");
this.session = session;
initComponent();
}
....................
In my AutoLoadModule
I have bind AutoLoad
asEagerSingleton();
@Override
protected void configure() {
bind(StartButton.class).toProvider(StartChatButtonProvider.class);
bind(AutoLoader.class).asEagerSingleton();
}
My AutoLoader
class:
@Singleton
public class AutoLoader implements Scheduler.ScheduledCommand {
private final XmppConnection connection;
@Nullable
private final ImStartButton startButton;
@Inject
protected AutoLoader(final XmppConnection connection, final XmppSession session,
final StartButton startButton) {
this.startButton = startButton;
Scheduler.get().scheduleDeferred(this);
}
@Override
public final void execute() {
startButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Log.debug("StartButton click handler...");
//load window in this point but how ? ....
}
});
}
}
Its possible to load a window instance using Code Splitting, when window is in WindowModule
? In my example app I need load the window only on demand using code splitting and that window must be in a gin module.