when the user is not yet logged in. The relevant code is below.
What happens, however, is that the popup panel shows up briefly and is
then overwritten with the DockLayoutPanel, even though I did not yet
add it to the RootPanel! In fact, I clear the RootPanel explicitely.
I am at a loss as to why this is happening. I'd love to hear your
suggestions and ideas. (Everything works as expected when the user is
logged in.)
(I'm using GWT 2.1.0.M2 and GWT-Platform 0.3.)
public class OtherView extends ViewImpl implements OtherPage.View {
public interface UiBinder extends
com.google.gwt.uibinder.client.UiBinder<DockLayoutPanel, OtherView> {
}
private static final UiBinder UI = GWT.create(UiBinder.class);
private final LoginBox loginBox;
private final DockLayoutPanel panel;
private final User user;
@UiField
HorizontalPanel centre;
@Inject
public OtherView(final EventBus eventBus, final User user) {
this.user = user;
panel = UI.createAndBindUi(this);
loginBox = new LoginBox(eventBus, user); // HTMLPanel
refresh();
}
@Override
public Widget asWidget() {
return panel;
}
@Override
public void refresh() {
RootPanel.get().clear();
if (!user.isAuthenticated()) {
final PopupPanel popupPanel = new PopupPanel();
popupPanel.setWidget(loginBox);
popupPanel.setSize("361px", "119px");
popupPanel.setPopupPosition(456, 358);
popupPanel.show();
} else {
final Label loggedIn = new Label("Hi '" + user.getUserName() + "'!");
centre.add(loggedIn);
RootPanel.get().add(panel);
}
}
}
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment