private boolean validateFields() { if (Utils.safeString(nameTextBox.getValue()).equals("")) { MessageBox.alert(textMessages.error(), textMessages.mustEnterName(), null); return false; } if (Utils.safeString(nameTextBox.getValue()).length() > Group.LENGTH_NAME) { MessageBox.alert(textMessages.error(), textMessages.tooLongName(), null); return false; } return true; }
public GroupDialog(Group pGroup) { this.group = pGroup; this.setHeading(textMessages.group()); this.setModal(true); this.setLayout(new AbsoluteLayout()); this.setSize("455", "355"); this.setResizable(false); LabelField lblfldName = new LabelField(textMessages.name_()); add(lblfldName, new AbsoluteData(6, 13)); lblfldName.setSize("82px", "19px"); nameTextBox = new TextField<String>(); add(nameTextBox, new AbsoluteData(128, 13)); nameTextBox.setSize("306px", "22px"); LabelField lblfldUsers = new LabelField(textMessages.users_()); add(lblfldUsers, new AbsoluteData(6, 49)); lblfldUsers.setSize("54px", "19px"); LabelField lblfldAvailable = new LabelField(textMessages.available()); add(lblfldAvailable, new AbsoluteData(6, 74)); lblfldAvailable.setSize("67px", "19px"); LabelField lblfldMembers = new LabelField(textMessages.members()); add(lblfldMembers, new AbsoluteData(232, 74)); lblfldMembers.setSize("74px", "19px"); DualListField<UserData> membersListBox = new DualListField<UserData>(); add(membersListBox, new AbsoluteData(6, 96)); membersListBox.setSize("428px", "183px"); ListField<UserData> from = membersListBox.getFromList(); ListField<UserData> to = membersListBox.getToList(); from.setSize(300, 100); from.setDisplayField(Constants.FULLNAME); fromUserStore = new ListStore<UserData>(); fromUserStore.sort(Constants.FULLNAME, SortDir.ASC); from.setStore(fromUserStore); to.setDisplayField(Constants.FULLNAME); to.setSize(300, 100); toUserStore = new ListStore<UserData>(); toUserStore.sort(Constants.FULLNAME, SortDir.ASC); to.setStore(toUserStore); Button saveButton = new Button( textMessages.save(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { doSave(); } }); Button cancelButton = new Button( textMessages.cancel(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { doCancel(); } }); setButtonAlign(HorizontalAlignment.CENTER); addButton(saveButton); addButton(cancelButton); setFields(); }
public UserDialog(User pUser) { this.user = pUser; this.setHeading(textMessages.user()); this.setModal(true); this.setLayout(new AbsoluteLayout()); this.setSize("455", "475"); this.setResizable(false); LabelField lblfldUsername = new LabelField(textMessages.username_()); add(lblfldUsername, new AbsoluteData(6, 6)); usernameTextBox = new TextField<String>(); usernameTextBox.setReadOnly(user.getId() > 0); add(usernameTextBox, new AbsoluteData(144, 6)); usernameTextBox.setSize("271px", "22px"); LabelField lblfldFullName = new LabelField(textMessages.fullname_()); add(lblfldFullName, new AbsoluteData(6, 34)); fullnameTextBox = new TextField<String>(); add(fullnameTextBox, new AbsoluteData(144, 34)); fullnameTextBox.setSize("271px", "22px"); LabelField lblfldEmail = new LabelField(textMessages.email_()); add(lblfldEmail, new AbsoluteData(6, 62)); emailTextBox = new TextField<String>(); add(emailTextBox, new AbsoluteData(144, 62)); emailTextBox.setSize("271px", "22px"); LabelField lblfldPassword = new LabelField(textMessages.password_()); add(lblfldPassword, new AbsoluteData(6, 90)); password1TextBox = new TextField<String>(); password1TextBox.setPassword(true); add(password1TextBox, new AbsoluteData(144, 90)); password1TextBox.setSize("271px", "22px"); password2TextBox = new TextField<String>(); password2TextBox.setPassword(true); add(password2TextBox, new AbsoluteData(144, 118)); password2TextBox.setSize("271px", "22px"); enabledCheckBox = new CheckBox(); enabledCheckBox.setBoxLabel(textMessages.enabled()); add(enabledCheckBox, new AbsoluteData(144, 146)); enabledCheckBox.setSize("76px", "22px"); LabelField lblfldGroups = new LabelField(textMessages.groups_()); add(lblfldGroups, new AbsoluteData(6, 170)); LabelField lblfldAvailable = new LabelField(textMessages.available()); add(lblfldAvailable, new AbsoluteData(6, 195)); LabelField lblfldMembers = new LabelField(textMessages.memberOf()); add(lblfldMembers, new AbsoluteData(233, 195)); DualListField<GroupData> membersListBox = new DualListField<GroupData>(); add(membersListBox, new AbsoluteData(6, 216)); membersListBox.setSize("424px", "183px"); ListField<GroupData> from = membersListBox.getFromList(); ListField<GroupData> to = membersListBox.getToList(); from.setSize(300, 100); from.setDisplayField(Constants.NAME); fromGroupStore = new ListStore<GroupData>(); fromGroupStore.sort(Constants.NAME, SortDir.ASC); from.setStore(fromGroupStore); to.setDisplayField(Constants.NAME); to.setSize(300, 100); toGroupStore = new ListStore<GroupData>(); toGroupStore.sort(Constants.NAME, SortDir.ASC); to.setStore(toGroupStore); Button saveButton = new Button( textMessages.save(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { doSave(); } }); Button cancelButton = new Button( textMessages.cancel(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { doCancel(); } }); setButtonAlign(HorizontalAlignment.CENTER); addButton(saveButton); addButton(cancelButton); setFields(); }
private boolean validateFields() { if (!(Utils.safeString(password2TextBox.getValue())) .equals(Utils.safeString(password1TextBox.getValue()))) { MessageBox.alert(textMessages.error(), textMessages.passwordsNotMatch(), null); return false; } if (Utils.safeString(password1TextBox.getValue()).length() > UserAuthnPassword.LENGTH_PASSWORD) { MessageBox.alert(textMessages.error(), textMessages.tooLongPassword(), null); return false; } if (Utils.safeString(usernameTextBox.getValue()).equals("")) { MessageBox.alert(textMessages.error(), textMessages.mustEnterUsername(), null); return false; } if (Utils.safeString(usernameTextBox.getValue()).length() > User.LENGTH_USERNAME) { MessageBox.alert(textMessages.error(), textMessages.tooLongUsername(), null); return false; } if (Utils.safeString(fullnameTextBox.getValue()).equals("")) { MessageBox.alert(textMessages.error(), textMessages.mustEnterFullName(), null); return false; } if (Utils.safeString(fullnameTextBox.getValue()).length() > User.LENGTH_FULLNAME) { MessageBox.alert(textMessages.error(), textMessages.tooLongFullName(), null); return false; } if (Utils.safeString(emailTextBox.getValue()).equals("")) { MessageBox.alert(textMessages.error(), textMessages.mustEnterEmail(), null); return false; } if (Utils.safeString(emailTextBox.getValue()).length() > User.LENGTH_EMAIL) { MessageBox.alert(textMessages.error(), textMessages.tooLongEmail(), null); return false; } if (!Utils.isValidEmail(Utils.safeString(emailTextBox.getValue()))) { MessageBox.alert(textMessages.error(), textMessages.invalidEmail(), null); return false; } return true; }