setOutputMarkupId(true);
form = new Form("userForm", userModel);
if (userModel == null){
User user = new User();
user.setRoles(new ArrayList<Role>());
form.setModel(new CompoundPropertyModel(user));
}
add(form);
name = new TextField("name");
password = new TextField("password");
name.setOutputMarkupId(true);
form.add(name);
form.add(password);
Roles roles = settings.getUserManagement().getAllRoles();
Palette role = new Palette("roles", new Model(roles), new ChoiceRenderer("label", "label"), 6, false);
form.add(role);
CheckBox admin = new CheckBox("admin");
form.add(admin);
form.add(new AjaxButton("save",form){
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
User user = (User)form.getModelObject();
settings.getUserManagement().addUser(user);
onSave(target);
}
});