private void createLayoutWindowPanel() {
windowPanel = new WindowPanel("Authentication required");
Widget closeBtn = windowPanel.getHeader().getWidget(0, Caption.CaptionRegion.RIGHT);
closeBtn.setVisible(false);
windowPanel.setAnimationEnabled(false);
LayoutPanel panel = new LayoutPanel();
//panel.addStyleName("WSLogin");
windowPanel.setWidget(panel);
// create contents
panel.setLayout(new BoxLayout(BoxLayout.Orientation.VERTICAL));
Grid grid = new Grid(3, 2);
grid.setWidget(0, 0, new Label("Username:"));
grid.setWidget(0, 1, userNameInput);
grid.setWidget(1, 0, new Label("Password:"));
grid.setWidget(1, 1, passwordInput);
grid.setWidget(2, 0, new HTML(""));
grid.setWidget(2, 1, loginButton);
/**
* Create a handler so that striking enter automatically
* submits the login.
*/
KeyDownHandler clickOnEnter = new KeyDownHandler() {
public void onKeyDown(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
loginButton.click();
}
}
};
userNameInput.addKeyDownHandler(clickOnEnter);
passwordInput.addKeyDownHandler(clickOnEnter);
/**
* Close the window immediately upon submission.
*/
loginButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
windowPanel.hide();
}
});
panel.add(grid);
windowPanel.getHeader().add(Caption.IMAGES.window().createImage());
windowPanel.addCloseHandler(new CloseHandler<PopupPanel>() {
public void onClose(CloseEvent<PopupPanel> event) {