Search in sources :

Example 6 with TableGuiConfiguration

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

Example 7 with TableGuiConfiguration

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;
}
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 8 with TableGuiConfiguration

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

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);
}
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 10 with TableGuiConfiguration

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());
}
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