Eric Clayberg wrote:peterblazejewicz wrote:Is there requirement for Designer/Editor that entry point module defined in .gwt.xml entry point tag should be a base class which implements EntryPoint?
Please give the latest build a try.
The "implements EntryPoint" requirement has been removed.
hi Eric,
Its working but in the way Konstantin hinted. That is there should be overriden (from inherited class) onModuleLoad where designer seeks for RootPanel instance.
If RootPanel reference is put into different method called from inherited class onModuleLoaded Design view engine get it rendered correct on first attempt but after that no content is drawn:
- Code: Select all
/* @Override */
protected void startup() {
System.out.println("startup() in " + GWT.getTypeName(this));
RootPanel rootPanel = RootPanel.get();
welcomeScreen = new WelcomeScreen();
rootPanel.add(welcomeScreen);
}
but guys that is really not an issue and I understand you had to decide where Design engine should look into code insertion point in order to render cotnent and thus "onModuleLoad" in module-referenced class should be either defined or overriden. I could live with that,
I've ended with something:
- Code: Select all
package com.mycompany.project.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.HistoryListener;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.WindowCloseListener;
import com.google.gwt.user.client.ui.Widget;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class MyApplication extends Application implements HistoryListener {
private Widget welcomeScreen;
/* @Override */
protected void initialize() {
System.out.println("initialize() in " + GWT.getTypeName(this));
Window.addWindowCloseListener(new WindowCloseListener() {
/* @Override */
public void onWindowClosed() {
exit(null);
}
/* @Override */
public String onWindowClosing() {
return "Do you really want to exit?";
}
});
History.addHistoryListener(this);
}
/* @Override */
protected void startup() {
System.out.println("startup() in " + GWT.getTypeName(this));
welcomeScreen = new WelcomeScreen();
}
/* @Override */
protected void ready() {
System.out.println("ready() in " + GWT.getTypeName(this));
String token = History.getToken();
if (token == null || token.length() == 0) {
show(welcomeScreen);
} else {
onHistoryChanged(token);
}
}
/*
* last chance to persist data on client
*/
/* @Override */
protected void shutdown() {
System.out.println("shutdown() in " + GWT.getTypeName(this));
}
/* @Override */
public void onHistoryChanged(String historyToken) {
}
}
similiar to Application solution from JSR-296 which beatifully fits currently into project I'm working (using GWT Designer of course
),
thanks,
regards,
Peter