View Full Version : Composite Replacement

20 Dec 2009, 12:26 AM
I have a composite that is my main app.

If the user is not logged in I need it to show a login screen.

Upon login they need to get the app screen.

I can't seem to get GXT to replace to login with the app. This is GXT 101 that I am not getting, I anticipate the answer is pretty simple..

public class MainTabPanel extends Composite implements LoginSuccessEvent.Handler {
LoginPanel loginPanel;
MainTabs theTabs;

public MainTabPanel() {
loginPanel = new LoginPanel();
theTabs = new MainTabs();

EventBus.get().addHandler(LoginSuccessEvent.TYPE, this);

public void onLoginSuccess(LoginSuccessEvent p) {
GWT.log("MainTabPanel is now aware of success..",null);
// Here I want to replace loginPanel with theTabs

Kevin Daly
20 Dec 2009, 8:01 AM
When replacing the content of any panel, you need to call .layout() to get GWT ext to redraw the component.

Our application uses a viewport and replaces what is in that viewport by calling .removeAll() to remove the contents, then we add new contents, then we call .layout();

20 Dec 2009, 8:11 AM
You just saved me hours. I had not used Viewport before and it did the trick!