/**
* Creates and displays invitation window when user clicks invitation URL.
* @param invitationId
*/
public void updateInvitationAccount(final String invitationId) {
final Window win = new Window();
FormPanel newUserformPanel = new FormPanel();
Label label = new Label("Welcome! Please enter your Name and Password");
label.setStyleName("login-welcome-msg");
FlexTable newUserTable = new FlexTable();
newUserTable.setWidget(0, 0, label);
newUserTable.getFlexCellFormatter().setColSpan(0, 0, 2);
newUserTable.getFlexCellFormatter().setHeight(1, 0, "15px");
newUserTable.getFlexCellFormatter().setHeight(2, 0, "25px");
newUserTable.getFlexCellFormatter().setHeight(3, 0, "25px");
newUserTable.getFlexCellFormatter().setHeight(4, 0, "25px");
newUserTable.getFlexCellFormatter().setHeight(5, 0, "25px");
newUserTable.getFlexCellFormatter().setHeight(6, 0, "50px");
newUserformPanel.add(newUserTable);
final TextBox newUserID = new TextBox();
newUserID.setWidth("250px");
Label userIdLabel = new Label("User ID:");
userIdLabel.setStyleName("label");
newUserTable.setWidget(2, 0, userIdLabel);
newUserTable.setWidget(2, 1, newUserID);
final TextBox newUserEmailID = new TextBox();
newUserEmailID.setWidth("250px");
newUserEmailID.setEnabled(false);
newUserEmailID.setText(invitationId);
Label emailIDLabel = new Label("Email:");
emailIDLabel.setStyleName("label");
newUserTable.setWidget(3, 0, emailIDLabel);
newUserTable.setWidget(3, 1, newUserEmailID);
final PasswordTextBox newUserPassword = new PasswordTextBox();
newUserPassword.setWidth("250px");
Label newPasswordLabel = new Label("New Password:");
newPasswordLabel.setStyleName("label");
newUserTable.setWidget(4, 0, newPasswordLabel);
newUserTable.setWidget(4, 1, newUserPassword);
final PasswordTextBox confirmPassword = new PasswordTextBox();
confirmPassword.setWidth("250px");
Label newConfirmPassLabel = new Label("Confirm Password:");
newConfirmPassLabel.setStyleName("label");
newUserTable.setWidget(5, 0, newConfirmPassLabel);
newUserTable.setWidget(5, 1, confirmPassword);
confirmPassword.addKeyDownHandler(new KeyDownHandler() {
public void onKeyDown(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
if (newUserEmailID.getText().trim().equals("") || newUserPassword.getText().trim().equals("")
|| confirmPassword.getText().trim().equals("")) {
MessageBox.showAlert("User ID and Password both are required.");
} else {
updateInvitationTemporaryAccount(newUserID.getText(), newUserPassword, confirmPassword,
invitationId, win);
}
}
}
});
com.gwtext.client.widgets.Button register = new com.gwtext.client.widgets.Button("Register", new ButtonListenerAdapter() {
@Override
public void onClick(com.gwtext.client.widgets.Button button, EventObject e) {
if (newUserEmailID.getText().trim().equals("") || newUserPassword.getText().trim().equals("")
|| confirmPassword.getText().trim().equals("")) {
MessageBox.showAlert("User ID and Password both are required.");
} else {
updateInvitationTemporaryAccount(newUserID.getText(), newUserPassword, confirmPassword,
invitationId, win);
}
}
});
com.gwtext.client.widgets.Button cancel = new com.gwtext.client.widgets.Button("Cancel", new ButtonListenerAdapter() {
@Override
public void onClick(com.gwtext.client.widgets.Button button, EventObject e) {
win.close();
}
});
HorizontalPanel buttonPanel = new HorizontalPanel();
buttonPanel.add(register);
HorizontalPanel spacingPanel = new HorizontalPanel();
spacingPanel.setWidth("20px");
buttonPanel.add(spacingPanel);
buttonPanel.add(cancel);
newUserTable.setWidget(6, 1, buttonPanel);
newUserTable.getFlexCellFormatter().setAlignment(6, 1, HasAlignment.ALIGN_CENTER, HasAlignment.ALIGN_MIDDLE);
win.setTitle("Invitation Account Registration");
win.setClosable(true);
win.setWidth(428);
win.setHeight(240);
win.setClosable(true);
win.setPaddings(7);
win.setCloseAction(Window.HIDE);
win.add(newUserformPanel);
win.show();
}