How Does GWT Work Or Rather How Does GWT Load The Code Into The App.html File?
I would like to know what the rootPanel (which is in the entryClass) exactly is, and how GWT loads the Java code into the appname.html file via rootpanel. What happens there exactl
Solution 1:
Have you checked the sources for RootPanel
class?
There is a method RootPanel get(String id)
that returns element (well, widget) from the page depending on the element id you pass in. If you don't pass anything and for example ask for get()
or get(null)
you will receive <body>
as your requested RootPanel instance.
So, you have your index.html with contents:
<body>
<div id="myPanel"></div>
</body>
in it.
In onModuleLoad()
method of your entry class you do
FlowPanel myNewDiv = new FlowPanel();
// add some styles, more elements and event handlers to myNewDiv
// ...
RootPanel.get("myPanel").add(myNewDiv);
Which adds your new div as a child to myPanel
div which was originally in the html file.
Did this help?
Post a Comment for "How Does GWT Work Or Rather How Does GWT Load The Code Into The App.html File?"