Using the HomePage instance in EntryPoint
To see the output of the created home page layout, we must add the HomePage instance in
the root panel at the entry point class.
Open the file MainEntryPoint.java.
How to do it…
- Remove all previous code from the method onModuleLoad:
- Create an instance of the HomePage class in this method:
HomePage homePage =new HomePage();
- Add the homepage instance in the RootPanel:
How it works…
After adding the HomePage instance in the RootPanel, if we run the project, we will get the
EntryPoint is an interface that allows a class to act as a module entry point. When a
module is loaded, each entry point class listed in the Main.gwt.xml file is instantiated and
its onModuleLoad method is called. When the host page is accessed by the browser, the
onModuleLoad function is called to display the first panels and widgets.
RootPanel corresponds to an HTML element on the host page. It can be used to add other
panels and widgets. A RootPanel is accessed by calling RootPanel.get(id), where id is
the value of the HTML ID attribute. The <body> element of the host page can be accessed by
RootPanels are never created directly. Instead, they are accessed via get().
Class and packages
The following table shows the class and its corresponding package
- The Creating the home page layout class recipe
- The Adding the banner recipe
- The Adding menus recipe
- The Creating the left-hand sidebar recipe
- The Creating the right-hand sidebar recipe
- The Creating the main content panel recipe
- The Creating the footer recipe
GWT Articles & Books
Latest posts by Krishna Srinivasan (see all)
- 5 New Features in HTML5 - November 29, 2013
- How To Set Tomcat JVM Heap Size in Eclipse? - November 28, 2013
- How To Resolve “Resource Is Out Of Sync With The Filesystem” Error in Eclipse? - November 28, 2013