Search in sources :

Example 6 with TableController

use of org.olat.core.gui.components.table.TableController in project OpenOLAT by OpenOLAT.

the class StatusController method initializeTableController.

private void initializeTableController(UserRequest ureq) {
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("error.no.user.found"));
    removeAsListenerAndDispose(tableCtr);
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), this.propertyHandlerTranslator);
    listenTo(tableCtr);
    List<Identity> l = UserDeletionManager.getInstance().getIdentitiesInDeletionProcess(UserDeletionManager.getInstance().getDeleteEmailDuration());
    tdm = new UserDeleteTableModel(l, ureq.getLocale(), isAdministrativeUser);
    tdm.addColumnDescriptors(tableCtr, null, "table.identity.deleteEmail");
    tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", translate("action.activate")));
    tableCtr.setMultiSelect(false);
    tableCtr.setTableDataModel(tdm);
    userDeleteStatusPanel.setContent(tableCtr.getInitialComponent());
}
Also used : TableController(org.olat.core.gui.components.table.TableController) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) Identity(org.olat.core.id.Identity)

Example 7 with TableController

use of org.olat.core.gui.components.table.TableController 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 8 with TableController

use of org.olat.core.gui.components.table.TableController 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 9 with TableController

use of org.olat.core.gui.components.table.TableController 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 10 with TableController

use of org.olat.core.gui.components.table.TableController 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)

Aggregations

TableController (org.olat.core.gui.components.table.TableController)66 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)16 CustomRenderColumnDescriptor (org.olat.core.gui.components.table.CustomRenderColumnDescriptor)12 BooleanColumnDescriptor (org.olat.core.gui.components.table.BooleanColumnDescriptor)10 Identity (org.olat.core.id.Identity)10 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 BaseSecurityModule (org.olat.basesecurity.BaseSecurityModule)6 Roles (org.olat.core.id.Roles)6 HashMap (java.util.HashMap)4 WindowControl (org.olat.core.gui.control.WindowControl)4 Translator (org.olat.core.gui.translator.Translator)4 OLATResourceable (org.olat.core.id.OLATResourceable)4 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)4 RepositoryTableModel (org.olat.repository.ui.RepositoryTableModel)4 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)3 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)3