use of org.olat.core.gui.components.table.TableGuiConfiguration in project openolat by klemens.
the class CourseCalendarPeekViewController method init.
private void init(UserRequest ureq, CalCourseNode courseNode, UserCourseEnvironment courseEnv, NodeEvaluation ne) {
CourseCalendars myCal = CourseCalendars.createCourseCalendarsWrapper(ureq, getWindowControl(), courseEnv, ne);
Date refDate;
ModuleConfiguration config = courseNode.getModuleConfiguration();
if (CalEditController.getAutoDate(config)) {
refDate = new Date();
} else {
refDate = CalEditController.getStartDate(config);
if (refDate == null)
refDate = new Date();
}
List<KalendarEvent> nextEvents = new ArrayList<KalendarEvent>();
for (KalendarRenderWrapper calendar : myCal.getCalendars()) {
Kalendar cal = calendar.getKalendar();
Collection<KalendarEvent> events = cal.getEvents();
for (KalendarEvent event : events) {
if (refDate.compareTo(event.getBegin()) <= 0) {
nextEvents.add(event);
}
}
}
Collections.sort(nextEvents, new KalendarEventComparator());
List<KalendarEvent> nextThreeEvents = nextEvents.subList(0, Math.min(3, nextEvents.size()));
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("calendar.noEvents"));
tableConfig.setDisplayTableHeader(false);
tableConfig.setCustomCssClass("o_portlet_table");
tableConfig.setDisplayRowCount(false);
tableConfig.setPageingEnabled(false);
tableConfig.setDownloadOffered(false);
tableConfig.setSortingEnabled(false);
removeAsListenerAndDispose(tableController);
tableController = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
listenTo(tableController);
// dummy header key, won't be used since setDisplayTableHeader is set to
// false
tableController.addColumnDescriptor(new DefaultColumnDescriptor("calendar.date", 0, null, ureq.getLocale()));
tableController.addColumnDescriptor(new DefaultColumnDescriptor("calendar.subject", 1, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
tableController.setTableDataModel(new CourseCalendarPeekViewModel(nextThreeEvents, getTranslator()));
}
use of org.olat.core.gui.components.table.TableGuiConfiguration in project openolat by klemens.
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 klemens.
the class BGConfigResourcesStepController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
addResource = uifactory.addFormLink("cmd.addresource", formLayout, Link.BUTTON);
Translator resourceTrans = Util.createPackageTranslator(RepositoryTableModel.class, getLocale(), getTranslator());
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("config.resources.noresources"));
resourcesCtr = new TableController(tableConfig, ureq, getWindowControl(), resourceTrans);
listenTo(resourcesCtr);
repoTableModel = new RepositoryTableModel(getLocale());
repoTableModel.addColumnDescriptors(resourcesCtr, false, false, true, true);
resourcesCtr.setTableDataModel(repoTableModel);
((FormLayoutContainer) formLayout).put("resources", resourcesCtr.getInitialComponent());
}
use of org.olat.core.gui.components.table.TableGuiConfiguration in project openolat by klemens.
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 klemens.
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