use of org.olat.core.gui.components.table.BooleanColumnDescriptor in project OpenOLAT by OpenOLAT.
the class DENManager method createListParticipantsTable.
/**
* Create the table for the list of participants view
* @param ureq
* @param wControl
* @param trans
* @param listener
* @param tableData DENListTableDataModel
* @return TableController
*/
protected TableController createListParticipantsTable(UserRequest ureq, WindowControl wControl, Translator trans, DENListTableDataModel tableData) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(trans.translate("dates.table.empty"));
TableController tableCntrl = new TableController(tableConfig, ureq, wControl, trans);
tableCntrl.addColumnDescriptor(new StrongColumnDescriptor("dates.table.date", 0, null, ureq.getLocale()));
tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.begin", 1, null, ureq.getLocale()));
tableCntrl.addColumnDescriptor(new StrongColumnDescriptor("dates.table.location", 3, null, ureq.getLocale()));
tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.duration", 2, null, ureq.getLocale()));
tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.comment", 4, null, ureq.getLocale()));
DefaultColumnDescriptor dcd = new DefaultColumnDescriptor("dates.table.participant.name", 5, null, ureq.getLocale());
dcd.setEscapeHtml(EscapeMode.none);
tableCntrl.addColumnDescriptor(dcd);
boolean isAdministrativeUser = CoreSpringFactory.getImpl(BaseSecurityModule.class).isUserAllowedAdminProps(ureq.getUserSession().getRoles());
if (isAdministrativeUser) {
DefaultColumnDescriptor ucd = new DefaultColumnDescriptor("dates.table.participant.username", 6, null, ureq.getLocale());
ucd.setEscapeHtml(EscapeMode.none);
tableCntrl.addColumnDescriptor(ucd);
}
if (!tableData.isReadOnly()) {
tableCntrl.addColumnDescriptor(new BooleanColumnDescriptor("participants", 7, DENListTableDataModel.CHANGE_ACTION, trans.translate("dates.table.participant.manage"), ""));
tableCntrl.addMultiSelectAction("dates.table.list.email", DENListTableDataModel.MAIL_ACTION);
tableCntrl.addMultiSelectAction("dates.table.list.delete", DENListTableDataModel.DELETE_ACTION);
tableCntrl.setMultiSelect(true);
}
tableCntrl.setTableDataModel(tableData);
// timeframe + multi select column
tableCntrl.setSortColumn(2, true);
return tableCntrl;
}
use of org.olat.core.gui.components.table.BooleanColumnDescriptor in project OpenOLAT by OpenOLAT.
the class DENManager method createParticipantsTable.
/**
* Create the table for the participants management view
* @param ureq
* @param wControl
* @param trans
* @param listener
* @param tableData DENParticipantsTableDataModel
* @return TableController
*/
protected TableController createParticipantsTable(UserRequest ureq, WindowControl wControl, Translator trans, DENParticipantsTableDataModel tableData) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(trans.translate("dates.table.empty"));
TableController tableCntrl = new TableController(tableConfig, ureq, wControl, trans);
tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.participant.firstname", 0, null, ureq.getLocale()));
tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.participant.lastname", 1, null, ureq.getLocale()));
tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.participant.email", 2, null, ureq.getLocale()));
tableCntrl.addColumnDescriptor(new BooleanColumnDescriptor("dates.table.participant.email.send", 3, DENParticipantsTableDataModel.MAIL_ACTION, trans.translate("dates.table.participant.email.send"), ""));
tableCntrl.addColumnDescriptor(new BooleanColumnDescriptor("dates.table.list.delete", 3, DENParticipantsTableDataModel.REMOVE_ACTION, trans.translate("dates.table.list.delete"), ""));
tableCntrl.setTableDataModel(tableData);
return tableCntrl;
}
use of org.olat.core.gui.components.table.BooleanColumnDescriptor in project OpenOLAT by OpenOLAT.
the class ENRunController method createTableController.
private TableController createTableController(UserRequest ureq, boolean hasAnyWaitingList) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("grouplist.no.groups"));
removeAsListenerAndDispose(tableCtr);
tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(tableCtr);
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("grouplist.table.name", 0, CMD_VISIT_CARD, getLocale()));
DefaultColumnDescriptor descCd = new DefaultColumnDescriptor("grouplist.table.desc", 1, null, getLocale());
descCd.setEscapeHtml(EscapeMode.antisamy);
tableCtr.addColumnDescriptor(descCd);
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("grouplist.table.partipiciant", 2, null, getLocale()) {
@Override
public int compareTo(int rowa, int rowb) {
Object a = table.getTableDataModel().getValueAt(rowa, dataColumn);
Object b = table.getTableDataModel().getValueAt(rowb, dataColumn);
if (a == null || b == null) {
boolean bb = (b == null);
return (a == null) ? (bb ? 0 : -1) : (bb ? 1 : 0);
}
try {
Integer la, lb;
if (a instanceof String) {
String sa = (String) a;
la = Integer.parseInt(sa.substring(0, sa.indexOf("/")));
} else {
la = (Integer) a;
}
if (b instanceof String) {
String sb = (String) b;
lb = Integer.parseInt(sb.substring(0, sb.indexOf("/")));
} else {
lb = (Integer) b;
}
return la.compareTo(lb);
} catch (NumberFormatException e) {
return super.compareTo(rowa, rowb);
}
}
});
tableCtr.addColumnDescriptor(hasAnyWaitingList, new DefaultColumnDescriptor("grouplist.table.waitingList", 3, null, getLocale()));
DefaultColumnDescriptor stateColdEsc = new DefaultColumnDescriptor("grouplist.table.state", 4, null, getLocale());
stateColdEsc.setEscapeHtml(EscapeMode.none);
tableCtr.addColumnDescriptor(stateColdEsc);
String enrollCmd = userCourseEnv.isCourseReadOnly() ? null : CMD_ENROLL_IN_GROUP;
BooleanColumnDescriptor columnDesc = new BooleanColumnDescriptor("grouplist.table.enroll", 5, enrollCmd, translate(CMD_ENROLL_IN_GROUP), translate("grouplist.table.no_action"));
columnDesc.setSortingAllowed(false);
tableCtr.addColumnDescriptor(columnDesc);
String cancelCmd = userCourseEnv.isCourseReadOnly() ? null : CMD_ENROLLED_CANCEL;
tableCtr.addColumnDescriptor(new BooleanColumnDescriptor("grouplist.table.cancel_enroll", 6, cancelCmd, translate(CMD_ENROLLED_CANCEL), translate("grouplist.table.no_action")));
return tableCtr;
}
use of org.olat.core.gui.components.table.BooleanColumnDescriptor in project openolat by klemens.
the class ProjectListController method createTableController.
private TableController createTableController(final UserRequest ureq, WindowControl wControl) {
numberOfCustomFieldInTable = 0;
numberOfEventInTable = 0;
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("projectlist.no.projects"));
tableConfig.setPreferencesOffered(true, "projectbrokerList");
// Do not allow show all because many entries takes too long to render
tableConfig.setShowAllLinkEnabled(false);
removeAsListenerAndDispose(tableController);
tableController = new TableController(tableConfig, ureq, wControl, this.getTranslator(), true);
listenTo(tableController);
int dataColumn = 0;
tableController.addColumnDescriptor(new DefaultColumnDescriptor("projectlist.tableheader.title", dataColumn++, TABLE_ACTION_SHOW_DETAIL, getLocale()));
CustomRenderColumnDescriptor projectManagerDescriptor = new CustomRenderColumnDescriptor("projectlist.tableheader.account.manager", dataColumn++, TABLE_ACTION_ACCOUNT_MANAGER, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new ProjectManagerColumnRenderer()) {
/**
* @see org.olat.core.gui.components.table.DefaultColumnDescriptor#compareTo(int, int)
*/
@Override
public int compareTo(int rowa, int rowb) {
return super.compareTo(rowa, rowb);
}
/**
* @see org.olat.core.gui.components.table.CustomRenderColumnDescriptor#renderValue(org.olat.core.gui.render.StringOutput, int, org.olat.core.gui.render.Renderer)
*/
@Override
public void renderValue(StringOutput sb, int row, Renderer renderer) {
Object val = getModelData(row);
// to get info about row in Renderer!
String rowSt = Integer.toString(row);
getCustomCellRenderer().render(sb, renderer, val, getLocale(), getAlignment(), rowSt);
}
};
tableController.addColumnDescriptor(projectManagerDescriptor);
// Custom-Fields
List<CustomField> customFieldList = moduleConfig.getCustomFields();
for (Iterator<CustomField> iterator = customFieldList.iterator(); iterator.hasNext(); ) {
CustomField customField = iterator.next();
if (customField.isTableViewEnabled()) {
numberOfCustomFieldInTable++;
DefaultColumnDescriptor columnDescriptor = new DefaultColumnDescriptor(customField.getName(), dataColumn++, null, getLocale());
columnDescriptor.setTranslateHeaderKey(false);
tableController.addColumnDescriptor(columnDescriptor);
}
}
// Project Events
for (Project.EventType eventType : Project.EventType.values()) {
if (moduleConfig.isProjectEventEnabled(eventType) && moduleConfig.isProjectEventTableViewEnabled(eventType)) {
numberOfEventInTable++;
tableController.addColumnDescriptor(new CustomRenderColumnDescriptor("projectlist.tableheader.event." + eventType.getI18nKey(), dataColumn++, null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new ProjectEventColumnRenderer()));
}
}
tableController.addColumnDescriptor(new CustomRenderColumnDescriptor("projectlist.tableheader.state", dataColumn++, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new ProjectStateColumnRenderer()));
tableController.addColumnDescriptor(new DefaultColumnDescriptor("projectlist.tableheader.numbers", dataColumn++, null, getLocale()) {
@Override
public int compareTo(int rowa, int rowb) {
Object a = table.getTableDataModel().getValueAt(rowa, dataColumn);
Object b = table.getTableDataModel().getValueAt(rowb, dataColumn);
if (a == null || b == null) {
boolean bb = (b == null);
return (a == null) ? (bb ? 0 : -1) : (bb ? 1 : 0);
}
try {
Long la = new Long((String) a);
Long lb = new Long((String) b);
return la.compareTo(lb);
} catch (NumberFormatException e) {
return super.compareTo(rowa, rowb);
}
}
});
String selectCmd = userCourseEnv.isCourseReadOnly() ? null : TABLE_ACTION_SELECT;
tableController.addColumnDescriptor(new BooleanColumnDescriptor("projectlist.tableheader.select", dataColumn++, selectCmd, translate("table.action.select"), "-"));
String cancelCmd = userCourseEnv.isCourseReadOnly() ? null : TABLE_ACTION_CANCEL_SELECT;
tableController.addColumnDescriptor(new BooleanColumnDescriptor("projectlist.tableheader.cancel.select", dataColumn++, cancelCmd, translate("projectlist.tableheader.cancel.select"), "-"));
return tableController;
}
use of org.olat.core.gui.components.table.BooleanColumnDescriptor in project openolat by klemens.
the class ENRunController method createTableController.
private TableController createTableController(UserRequest ureq, boolean hasAnyWaitingList) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("grouplist.no.groups"));
removeAsListenerAndDispose(tableCtr);
tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(tableCtr);
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("grouplist.table.name", 0, CMD_VISIT_CARD, getLocale()));
DefaultColumnDescriptor descCd = new DefaultColumnDescriptor("grouplist.table.desc", 1, null, getLocale());
descCd.setEscapeHtml(EscapeMode.antisamy);
tableCtr.addColumnDescriptor(descCd);
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("grouplist.table.partipiciant", 2, null, getLocale()) {
@Override
public int compareTo(int rowa, int rowb) {
Object a = table.getTableDataModel().getValueAt(rowa, dataColumn);
Object b = table.getTableDataModel().getValueAt(rowb, dataColumn);
if (a == null || b == null) {
boolean bb = (b == null);
return (a == null) ? (bb ? 0 : -1) : (bb ? 1 : 0);
}
try {
Integer la, lb;
if (a instanceof String) {
String sa = (String) a;
la = Integer.parseInt(sa.substring(0, sa.indexOf("/")));
} else {
la = (Integer) a;
}
if (b instanceof String) {
String sb = (String) b;
lb = Integer.parseInt(sb.substring(0, sb.indexOf("/")));
} else {
lb = (Integer) b;
}
return la.compareTo(lb);
} catch (NumberFormatException e) {
return super.compareTo(rowa, rowb);
}
}
});
tableCtr.addColumnDescriptor(hasAnyWaitingList, new DefaultColumnDescriptor("grouplist.table.waitingList", 3, null, getLocale()));
DefaultColumnDescriptor stateColdEsc = new DefaultColumnDescriptor("grouplist.table.state", 4, null, getLocale());
stateColdEsc.setEscapeHtml(EscapeMode.none);
tableCtr.addColumnDescriptor(stateColdEsc);
String enrollCmd = userCourseEnv.isCourseReadOnly() ? null : CMD_ENROLL_IN_GROUP;
BooleanColumnDescriptor columnDesc = new BooleanColumnDescriptor("grouplist.table.enroll", 5, enrollCmd, translate(CMD_ENROLL_IN_GROUP), translate("grouplist.table.no_action"));
columnDesc.setSortingAllowed(false);
tableCtr.addColumnDescriptor(columnDesc);
String cancelCmd = userCourseEnv.isCourseReadOnly() ? null : CMD_ENROLLED_CANCEL;
tableCtr.addColumnDescriptor(new BooleanColumnDescriptor("grouplist.table.cancel_enroll", 6, cancelCmd, translate(CMD_ENROLLED_CANCEL), translate("grouplist.table.no_action")));
return tableCtr;
}
Aggregations