Created
March 20, 2018 08:50
-
-
Save lofidewanto/2262441fe61f887158347f68418f04e3 to your computer and use it in GitHub Desktop.
GWT Boot - Better Implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hello.client; | |
import com.google.gwt.core.client.*; | |
import com.google.gwt.user.client.ui.*; | |
@GwtModule(renameTo="basic") | |
public class YourEntryPoint implements EntryPoint { | |
@Override | |
public void onModuleLoad() { | |
Button button = new Button("Click me"); | |
button.addClickHandler(clickEvent -> { | |
Window.alert("Hello World!"); | |
}); | |
RootPanel.get("helloButton").add(button); | |
} | |
@GwtModuleProperty | |
public String inherits() { | |
return "com.github.gwtboot.starter.Starter"; | |
} | |
@GwtModuleProperty | |
public String sourcePath() { | |
return "client"; | |
} | |
@GwtModuleProperty | |
public Map setProperty() { | |
Map<String, String> map = new HashMap<>(); | |
map.add("gwt.logging.logLevel", "INFO"); | |
map.add("gwt.logging.enabled", "TRUE"); | |
return map; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think the current design of GWT modules is centered around the whole module, not just the entry point. Sooner or later, J2CL will have to adopt the new Java 9+ modular system. Therefore, a better approach might be to start fresh with Java 9 and J2CL and implement modular annotations as shown in this GWT example
module-info.java
:notice the use of
static
- this is typically the case with GWT where the transpiler converts Java->JS, but none of the original code is needed at run-time.