for (String userGroup : userGroups) {
userList.addAll(userDao.findByGroup(userGroup));
}
}
HtmlTableWidget userListComponent = (HtmlTableWidget) getWidgetManager(session).getWidget("USERLIST");
if (userListComponent == null) {
DefaultTableModelColumn usernameColumn = new DefaultTableModelColumn("base.user.table.username", "username");
usernameColumn.setStyleClass("emphasize");
usernameColumn.setRenderer(new TableColumnRenderer() {
public String getTemplate() {
return "v2js_widgets_username";
}
public Object getData(Object obj) {
JSONObject jLink = new JSONObject();
jLink.element("username", ((ZeroUser) obj).getUsername());
jLink.element("deleted", ((ZeroUser) obj).isDeleted());
return jLink;
}
});
/* usernameColumn.addClickListener(new TableClickListener() {
public void fireClicked(TableClickEvent event) {
log.debug("fireClicked: " + event.getWidget().getModel().getData(event.getColumn(), event.getRow()));
}
});*/
UserTableModel model = new UserTableModel(userList, getMessages(), request.getLocale());
if (user.checkAuthorisation(UserModule.AUTH_USER_EDIT)) {
model.setSelectable(true);
DefaultTableModelColumn editColumn = new DefaultTableModelColumn("", "");
editColumn.setRenderer(new TableColumnRenderer() {
public String getTemplate() {
return "v2js_widgets_tablelink";
}
public Object getData(Object obj) {
if (obj instanceof User) {
JSONObject jLink = new JSONObject();
jLink.element("url", "user/userEdit.do?selected=" + ((ZeroUser) obj).getId());
jLink.element("text", "Edit");
return jLink;
}
return "";
}
});
model.addColumn(editColumn);
}
if (user.checkAuthorisation(UserModule.AUTH_LOGIN_AS)) {
model.setSelectable(true);
DefaultTableModelColumn loginColumn = new DefaultTableModelColumn("", "");
loginColumn.setRenderer(new TableColumnRenderer() {
public String getTemplate() {
return null;
}
public Object getData(Object obj) {
if (obj instanceof User) {
return new HtmlSnippet("<a href=\"user/loginAsUser.do?selected=" + ((ZeroUser) obj).getId() + "\">Login</a>");
}
return "";
}
});
model.addColumn(loginColumn);
}
model.addColumn(usernameColumn);
model.addColumn(new DefaultTableModelColumn("base.user.table.firstname", "person.firstname"));
model.addColumn(new DefaultTableModelColumn("base.user.table.lastname", "person.lastname"));
model.addColumn(new DefaultTableModelColumn("base.user.table.email", "person.email"));
model.addColumn(new DefaultTableModelColumn("base.user.table.phone", "person.phone"));
model.addColumn(new DefaultTableModelColumn("base.user.label.usergroupkey", "userGroup.groupKey"));
model.addColumn(new DefaultTableModelColumn("base.user.label.locked", "locked"));
if (user.checkAuthorisation(UserModule.AUTH_USER_EDIT)) {
DefaultTableModelColumn sendPwdColumn = new DefaultTableModelColumn("", "");
sendPwdColumn.setRenderer(new TableColumnRenderer() {
public String getTemplate() {
return "v2js_widgets_tablelink";
}
public Object getData(Object obj) {
if (obj instanceof User) {
JSONObject jLink = new JSONObject();
jLink.element("url", "user/userSendPwd.do?selected=" + ((ZeroUser) obj).getId());
jLink.element("text", "Send Password");
return jLink;
}
return "";
}
});
model.addColumn(sendPwdColumn);
}
model.setSort(1);
userListComponent = new HtmlTableWidget("USERLIST", model, request.getLocale());
userListComponent.setRowsPerPage(20);
getWidgetManager(session).register(userListComponent);
} else {
((DefaultTableModel<ZeroUser>) userListComponent.getModel()).setCollection(userList);
}
view.addWidget(userListComponent);
if (user.checkAuthorisation(UserModule.AUTH_USER_EDIT)) {