List<UserGroup> userGroupList = userGroupDao.findAll();
ZeroView view = new ZeroView(getMessages(), request.getLocale());
view.addWidget(new SimpleWidget(ZeroView.DIV_CONTENT, "user_usergrouplist"));
HtmlTableWidget userGroupListComponent = (HtmlTableWidget) getWidgetManager(session).getWidget("USERGROUPLIST");
if (userGroupListComponent == null) {
DefaultTableModelColumn usernameColumn = new DefaultTableModelColumn("base.user.label.usergroupkey", "groupKey");
usernameColumn.setStyleClass("emphasize");
/* usernameColumn.addClickListener(new TableClickListener() {
public void fireClicked(TableClickEvent event) {
log.debug("fireClicked: " + event.getWidget().getModel().getData(event.getColumn(), event.getRow()));
}
});*/
DefaultTableModel<UserGroup> model = new DefaultTableModel<UserGroup>(userGroupList, 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 UserGroup) {
JSONObject jLink = new JSONObject();
jLink.element("url", "user/userGroupEdit.do?selected="+((UserGroup)obj).getGroupKey());
jLink.element("text", "Edit");
return jLink;
}
return "";
}
});
model.addColumn(editColumn);
}
model.addColumn(usernameColumn);
model.addColumn(new DefaultTableModelColumn("base.user.label.description", "description"));
model.setSort(1);
userGroupListComponent = new HtmlTableWidget("USERGROUPLIST", model, request.getLocale());
getWidgetManager(session).register(userGroupListComponent);
} else {
((DefaultTableModel<UserGroup>) userGroupListComponent.getModel()).setCollection(userGroupList);
}
view.addWidget(userGroupListComponent);
if (user.checkAuthorisation(UserModule.AUTH_USER_EDIT)) {