use of org.apache.openmeetings.db.entity.user.User.Salutation in project openmeetings by apache.
the class GeneralUserForm method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
add(email);
email.setLabel(Model.of(getString("119")));
email.add(RfcCompliantEmailAddressValidator.getInstance());
add(new DropDownChoice<>("salutation", Arrays.asList(Salutation.values()), new ChoiceRenderer<Salutation>() {
private static final long serialVersionUID = 1L;
@Override
public Object getDisplayValue(Salutation object) {
return getString("user.salutation." + object.name());
}
@Override
public String getIdValue(Salutation object, int index) {
return object.name();
}
}));
add(new TextField<String>("firstname"));
add(new TextField<String>("lastname"));
add(new DropDownChoice<>("timeZoneId", AVAILABLE_TIMEZONES));
add(new LanguageDropDown("languageId"));
add(new TextField<String>("address.phone"));
add(new CheckBox("sendSMS"));
add(new AjaxDatePicker("age", new PropertyModel<LocalDate>(this, "age"), WebSession.get().getLocale()) {
private static final long serialVersionUID = 1L;
@Override
public void onValueChanged(IPartialPageRequestHandler target) {
User u = GeneralUserForm.this.getModelObject();
u.setAge(CalendarHelper.getDate(age, u.getTimeZoneId()));
}
});
add(new TextField<String>("address.street"));
add(new TextField<String>("address.additionalname"));
add(new TextField<String>("address.zip"));
add(new TextField<String>("address.town"));
add(new CountryDropDown("address.country"));
add(new TextArea<String>("address.comment"));
add(new Select2MultiChoice<>("groupUsers", null, new RestrictiveChoiceProvider<GroupUser>() {
private static final long serialVersionUID = 1L;
@Override
public String getDisplayValue(GroupUser choice) {
return choice.getGroup().getName();
}
@Override
public String toId(GroupUser choice) {
Long id = choice.getGroup().getId();
return id == null ? null : "" + id;
}
@Override
public void query(String term, int page, Response<GroupUser> response) {
for (GroupUser ou : grpUsers) {
if (Strings.isEmpty(term) || ou.getGroup().getName().contains(term)) {
response.add(ou);
}
}
}
@Override
public GroupUser fromId(String _id) {
Long id = Long.parseLong(_id);
User u = GeneralUserForm.this.getModelObject();
Group g = groupDao.get(id);
GroupUser gu = new GroupUser(g, u);
int idx = grpUsers.indexOf(gu);
return idx < 0 ? gu : grpUsers.get(idx);
}
}).setLabel(Model.of(getString("161"))).setRequired(isAdminForm && hasGroupAdminLevel(getRights())).setEnabled(isAdminForm));
}
Aggregations