public RowRenderer getAllUserRolesRenderer() {
return new RowRenderer() {
@Override
public void render(Row row, Object data) throws Exception {
final UserRole role = (UserRole) data;
row.appendChild(new Label(role.getDisplayName()));
final Textbox tempTextbox = new Textbox();
Textbox textbox = Util.bind(tempTextbox, new Util.Getter<String>() {
@Override
public String get() {
List<String> listRoles = configurationModel.
getLdapConfiguration().getMapMatchingRoles().get(role.name());
Collections.sort(listRoles);
return StringUtils.join(listRoles, ";");
}
}, new Util.Setter<String>() {
@Override
public void set(String value) {
// Created a set in order to avoid duplicates
Set<String> rolesLdap = new HashSet<String>(
Arrays.asList(StringUtils.split(value,
";")));
configurationModel.getLdapConfiguration()
.setConfigurationRolesLdap(role.name(),
rolesLdap);
}
});
textbox.setWidth("300px");
row.appendChild(textbox);