wulfgarpro
wulfgarpro

Reputation: 6934

ext-gwt (gxt) onRender entry point class

I have a basic class that extends LayoutContainer with the method onRender. How can I assign this as my EntryPoint? Traditionally I would define a class that implements EntryPoint, overriding onModuleLoad?

public class TheRoarChronicles extends LayoutContainer  {
    protected void onRender(Element parent, int index) {
        super.onRender(parent, index);
        setSize(600, 400);
        setLayout(new CenterLayout());

        ContentPanel panel = new ContentPanel();
        panel.setBodyStyle("padding: 6px");
        panel.setFrame(true);
        panel.setHeading("CenterLayout");
        panel.addText("I should be centered");
        panel.setWidth(200);

        add(panel);
    }
}

Upvotes: 1

Views: 1420

Answers (1)

Travis Webb
Travis Webb

Reputation: 15018

You're going to hate me for this, but you do not want to make this class an EntryPoint. The fact that you're asking this question indicates that you are very new to GWT. This class defines a particular Component of your view--this should not be an EntryPoint. An EntryPoint should be thought of like a main method for a normal Java application, it is the beginning of all execution of your program. You do not want to assign a particular view Component to this role.

It'd be much cleaner to simply define an EntryPoint that has the sole responsibility of adding this single Component to the RootPanel, e.g.

RootPanel.get().add(new TheRoarChronicles());

Upvotes: 4

Related Questions