Search in sources :

Example 56 with TableGuiConfiguration

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()));
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) TableController(org.olat.core.gui.components.table.TableController) ArrayList(java.util.ArrayList) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) Date(java.util.Date) Kalendar(org.olat.commons.calendar.model.Kalendar) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 57 with TableGuiConfiguration

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;
}
Also used : CustomRenderColumnDescriptor(org.olat.core.gui.components.table.CustomRenderColumnDescriptor) TableController(org.olat.core.gui.components.table.TableController) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration)

Example 58 with TableGuiConfiguration

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());
}
Also used : RepositoryTableModel(org.olat.repository.ui.RepositoryTableModel) Translator(org.olat.core.gui.translator.Translator) TableController(org.olat.core.gui.components.table.TableController) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration)

Example 59 with TableGuiConfiguration

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);
}
Also used : TableController(org.olat.core.gui.components.table.TableController) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 60 with TableGuiConfiguration

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());
}
Also used : TableController(org.olat.core.gui.components.table.TableController) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) LTIOutcome(org.olat.ims.lti.LTIOutcome) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Aggregations

TableController (org.olat.core.gui.components.table.TableController)60 TableGuiConfiguration (org.olat.core.gui.components.table.TableGuiConfiguration)60 DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)38 StaticColumnDescriptor (org.olat.core.gui.components.table.StaticColumnDescriptor)14 CustomRenderColumnDescriptor (org.olat.core.gui.components.table.CustomRenderColumnDescriptor)12 BooleanColumnDescriptor (org.olat.core.gui.components.table.BooleanColumnDescriptor)10 Identity (org.olat.core.id.Identity)8 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 BaseSecurityModule (org.olat.basesecurity.BaseSecurityModule)6 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 Roles (org.olat.core.id.Roles)4 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)4 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)4 RepositoryTableModel (org.olat.repository.ui.RepositoryTableModel)4 IOException (java.io.IOException)2 BigDecimal (java.math.BigDecimal)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Properties (java.util.Properties)2