When the login subwindow is displayed in IE, a scrollbar is shown, although there’s nothing to scroll. I know it has something to do with the width being 100%. I’m guessing that this is some IE quirk, but just wanted to see how I might do it differently. Just trying to figure out how to get a consistent look across browsers. If not, it’s no big deal.
public class LoginWindow extends AbstractWindow implements ClickListener {
private TextField username;
private TextField password;
public void postConstruct() {
username = new TextField("Username");
password = new TextField("Password");
password.setSecret(true);
VerticalLayout layout = new VerticalLayout();
layout.setSizeUndefined();
layout.setSpacing(true);
layout.addComponent(username);
layout.addComponent(password);
layout.addComponent(new Button("Login", this));
Window window = new Window(
"Please Login",
new VerticalLayout() {
{
setMargin(true, false, false, false);
}
public void addComponent(Component c) {
super.addComponent(c);
setComponentAlignment(c, Alignment.TOP_CENTER);
}
}
);
window.setWidth("225px");
window.setHeight("200px");
window.setDraggable(false);
window.setModal(true);
window.setClosable(false);
window.setResizable(false);
window.addComponent(layout);
addWindow(window);
}
@Override
public void buttonClick(ClickEvent event) {
try {
fireEvent(
new AuthenticatedEvent(
this,
getService().authenticate(
username.getValue().toString(),
password.getValue().toString()
)
)
);
} catch (AuthenticationException e) {
showNotification("Login Failed",Notification.TYPE_ERROR_MESSAGE);
} finally {
username.setValue("");
password.setValue("");
}
}
}