Search code examples
javagwterrai

Navigation on Errai-UI based GWT application


I'm having some problem with Errai-UI based GWT application, trying to create a page with navigation tabs. The problem I face is that the navigation and footer is not being rendered and it seems that my application WelcomePage is the only one being rendered on the browser:

@Dependent
@Templated("#home")
@Page(startingPage=true)
public class WelcomePage extends Composite { 
 // stuff
}

The associated HTML of the above WelcomePage is the only one being rendered on the browser.

The Bootstrap code:

@Templated("#main")
@ApplicationScoped
@EntryPoint
public class Bootstrap extends Composite
{

    @Inject
    Navigation navigation;

    @Inject @DataField
    private NavBar navbar;

    @PostConstruct
    public void buildUI()
    {
        RootPanel.get().add(navigation.getContentPanel());
    }

}

And this is the corresponding httml:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="utf-8">
    <title>Title</title>
    <link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
    <div data-field="main">
        <!--top part start -->
        <div id="top">
            <a href="index.html"><img src="images/logo.gif" alt="individual" width="286" height="66" border="0" /></a>
            <div data-field="navbar">Navbar Goes here</div>
        </div>
        <!--top part end -->

        <div data-field="content"></div>

        <!--footer start -->
        <div id="footerMain">
            <div id="footer">
                <ul>
                        <li><a href="#">Home</a>|</li>
                </ul>
            </div>
        </div>
        <!--footer end -->          
    </div>
    <!-- main end -->
</body>
</html>

My application works fine, its just that the navigation and footer is not being rendered. What could I be missing?


Solution

  • Solution was to do:

    @PostConstruct
    public void buildUI()
    {
        content.add(navigation.getContentPanel()); // Just a SimplePanel with data-field in the Bootstrap html
        RootPanel.get("rootPanel").add(this);
    }