use of org.olat.core.gui.components.table.TableGuiConfiguration in project OpenOLAT by OpenOLAT.
the class UsermanagerUserSearchForm method initUserListCtr.
/**
* Initialize the table controller using the list of identities
*
* @param ureq
* @param identitiesList
*/
private void initUserListCtr(UserRequest ureq, List<Identity> myIdentities, Integer searchStatusField) {
removeAsListenerAndDispose(tableCtr);
boolean actionEnabled = true;
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("error.no.user.found"));
if ((searchStatusField != null) && (searchStatusField.equals(Identity.STATUS_DELETED))) {
actionEnabled = false;
}
tableConfig.setDownloadOffered(true);
tableConfig.setPreferencesOffered(true, "ExtendedIdentitiesTable");
tableConfig.setTableEmptyMessage(translate("error.no.user.found"));
tdm = new ExtendedIdentitiesTableDataModel(ureq, myIdentities, actionEnabled);
OLATResourceable ores = OresHelper.createOLATResourceableInstance("table", 0l);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = addToHistory(ureq, ores, null);
tableCtr = new TableController(tableConfig, ureq, bwControl, getTranslator());
tdm.addColumnDescriptors(tableCtr, getTranslator());
tableCtr.setTableDataModel(tdm);
listenTo(tableCtr);
if (showEmailButton) {
tableCtr.addMultiSelectAction("command.mail", CMD_MAIL);
}
if (actionEnabled) {
tableCtr.addMultiSelectAction("action.bulkedit", CMD_BULKEDIT);
}
if (showEmailButton || actionEnabled) {
tableCtr.setMultiSelect(true);
}
}
use of org.olat.core.gui.components.table.TableGuiConfiguration in project OpenOLAT by OpenOLAT.
the class StatisticDisplayController method createTableController.
private TableController createTableController(UserRequest ureq, StatisticResult result) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setDisplayTableHeader(true);
tableConfig.setDisplayRowCount(true);
tableConfig.setPageingEnabled(true);
tableConfig.setDownloadOffered(true);
tableConfig.setSortingEnabled(true);
removeAsListenerAndDispose(tableController);
tableController = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(tableController);
// tableCtr.addColumnDescriptor(statisticManager.createColumnDescriptor(ureq, 0, null));
IndentedStatisticNodeRenderer indentedNodeRenderer = new IndentedStatisticNodeRenderer(Util.createPackageTranslator(statisticManager.getClass(), ureq.getLocale()));
indentedNodeRenderer.setSimpleRenderingOnExport(true);
CustomRenderColumnDescriptor nodeCD = new CustomRenderColumnDescriptor("stat.table.header.node", 0, CLICK_NODE_ACTION, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, indentedNodeRenderer) {
@Override
public int compareTo(int rowa, int rowb) {
// order by original row order
return new Integer(rowa).compareTo(rowb);
}
};
tableController.addColumnDescriptor(nodeCD);
int column = 1;
List<String> headers = result.getHeaders();
for (Iterator<String> it = headers.iterator(); it.hasNext(); ) {
final String aHeader = it.next();
final int aColumnId = column++;
tableController.addColumnDescriptor(statisticManager.createColumnDescriptor(ureq, aColumnId, aHeader));
}
tableController.addColumnDescriptor(new CustomRenderColumnDescriptor("stat.table.header.total", column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT, new TotalColumnRenderer()) {
@Override
public String getAction(int row) {
if (row == table.getTableDataModel().getRowCount() - 1) {
return super.getAction(row);
} else {
return null;
}
}
});
tableController.setTableDataModel(result);
return tableController;
}
use of org.olat.core.gui.components.table.TableGuiConfiguration 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.TableGuiConfiguration in project OpenOLAT by OpenOLAT.
the class QTI12ResultDetailsController method init.
private void init(UserRequest ureq) {
main = createVelocityContainer("qtires");
boolean hasEssay = checkEssay();
main.contextPut("warningEssay", Boolean.valueOf(hasEssay));
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("column.header.date", 0, null, ureq.getLocale()));
DefaultColumnDescriptor durationCol = new DefaultColumnDescriptor("column.header.duration", 1, null, ureq.getLocale());
durationCol.setEscapeHtml(EscapeMode.none);
tableCtr.addColumnDescriptor(durationCol);
DefaultColumnDescriptor pointCol = new DefaultColumnDescriptor("column.header.assesspoints", 2, null, ureq.getLocale());
pointCol.setEscapeHtml(EscapeMode.none);
tableCtr.addColumnDescriptor(pointCol);
tableCtr.addColumnDescriptor(new QTISelectColumnDescriptor("column.header.action", 3, coachCourseEnv.isCourseReadOnly(), getLocale(), getTranslator()));
List<QTIResultSet> resultSets = qrm.getResultSets(courseResourceableId, nodeIdent, repositoryEntry.getKey(), assessedIdentity);
tableModel = new QTIResultTableModel(resultSets, qtiPersister, getTranslator());
tableCtr.setTableDataModel(tableModel);
listenTo(tableCtr);
main.put("qtirestable", tableCtr.getInitialComponent());
putInitialPanel(main);
}
use of org.olat.core.gui.components.table.TableGuiConfiguration in project OpenOLAT by OpenOLAT.
the class LTIResultDetailsController method init.
protected void init(UserRequest ureq) {
TableGuiConfiguration summaryTableConfig = new TableGuiConfiguration();
summaryTableConfig.setDownloadOffered(true);
summaryTableCtr = new TableController(summaryTableConfig, ureq, getWindowControl(), getTranslator());
summaryTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.date", 0, null, ureq.getLocale()));
summaryTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.action", 1, null, ureq.getLocale()));
summaryTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.key", 2, null, ureq.getLocale()));
summaryTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.value", 3, null, ureq.getLocale()));
List<LTIOutcome> outcomes = ltiManager.loadOutcomes(assessedIdentity, resource, resSubPath);
summaryTableCtr.setTableDataModel(new OutcomeTableDataModel(outcomes));
listenTo(summaryTableCtr);
putInitialPanel(summaryTableCtr.getInitialComponent());
}
Aggregations