Search in sources :

Example 6 with BooleanColumnDescriptor

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

the class DENManager method createRunDatesTable.

/**
 * Create the table for the run view
 * @param ureq
 * @param wControl
 * @param trans
 * @param listener
 * @param tableData DENRunTableDataModel
 * @return TableController
 */
protected TableController createRunDatesTable(UserRequest ureq, WindowControl wControl, Translator trans, DENRunTableDataModel tableData) {
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(trans.translate("dates.table.empty"));
    TableController tableCntrl = new TableController(tableConfig, ureq, wControl, trans);
    tableCntrl.addColumnDescriptor(new StrongColumnDescriptor("dates.table.date", 0, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.begin", 1, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new StrongColumnDescriptor("dates.table.location", 3, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.duration", 2, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.comment", 4, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.reserved", 5, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.status", 6, null, ureq.getLocale()));
    if (tableData.isEnrollmentEnabled()) {
        tableCntrl.addColumnDescriptor(new BooleanColumnDescriptor("dates.table.sign.in", 7, DENRunTableDataModel.CMD_ENROLL_IN_DATE, trans.translate("dates.table.sign.in"), trans.translate("dates.table.run.no_action")));
        tableCntrl.addColumnDescriptor(new BooleanColumnDescriptor("dates.table.sign.out", 8, DENRunTableDataModel.CMD_ENROLLED_CANCEL, trans.translate("dates.table.sign.out"), trans.translate("dates.table.run.no_action")));
    }
    tableCntrl.setTableDataModel(tableData);
    // timeframe
    tableCntrl.setSortColumn(1, true);
    return tableCntrl;
}
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 7 with BooleanColumnDescriptor

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

the class ProjectListController method createTableController.

private TableController createTableController(final UserRequest ureq, WindowControl wControl) {
    numberOfCustomFieldInTable = 0;
    numberOfEventInTable = 0;
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("projectlist.no.projects"));
    tableConfig.setPreferencesOffered(true, "projectbrokerList");
    // Do not allow show all because many entries takes too long to render
    tableConfig.setShowAllLinkEnabled(false);
    removeAsListenerAndDispose(tableController);
    tableController = new TableController(tableConfig, ureq, wControl, this.getTranslator(), true);
    listenTo(tableController);
    int dataColumn = 0;
    tableController.addColumnDescriptor(new DefaultColumnDescriptor("projectlist.tableheader.title", dataColumn++, TABLE_ACTION_SHOW_DETAIL, getLocale()));
    CustomRenderColumnDescriptor projectManagerDescriptor = new CustomRenderColumnDescriptor("projectlist.tableheader.account.manager", dataColumn++, TABLE_ACTION_ACCOUNT_MANAGER, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new ProjectManagerColumnRenderer()) {

        /**
         * @see org.olat.core.gui.components.table.DefaultColumnDescriptor#compareTo(int, int)
         */
        @Override
        public int compareTo(int rowa, int rowb) {
            return super.compareTo(rowa, rowb);
        }

        /**
         * @see org.olat.core.gui.components.table.CustomRenderColumnDescriptor#renderValue(org.olat.core.gui.render.StringOutput, int, org.olat.core.gui.render.Renderer)
         */
        @Override
        public void renderValue(StringOutput sb, int row, Renderer renderer) {
            Object val = getModelData(row);
            // to get info about row in Renderer!
            String rowSt = Integer.toString(row);
            getCustomCellRenderer().render(sb, renderer, val, getLocale(), getAlignment(), rowSt);
        }
    };
    tableController.addColumnDescriptor(projectManagerDescriptor);
    // Custom-Fields
    List<CustomField> customFieldList = moduleConfig.getCustomFields();
    for (Iterator<CustomField> iterator = customFieldList.iterator(); iterator.hasNext(); ) {
        CustomField customField = iterator.next();
        if (customField.isTableViewEnabled()) {
            numberOfCustomFieldInTable++;
            DefaultColumnDescriptor columnDescriptor = new DefaultColumnDescriptor(customField.getName(), dataColumn++, null, getLocale());
            columnDescriptor.setTranslateHeaderKey(false);
            tableController.addColumnDescriptor(columnDescriptor);
        }
    }
    // Project Events
    for (Project.EventType eventType : Project.EventType.values()) {
        if (moduleConfig.isProjectEventEnabled(eventType) && moduleConfig.isProjectEventTableViewEnabled(eventType)) {
            numberOfEventInTable++;
            tableController.addColumnDescriptor(new CustomRenderColumnDescriptor("projectlist.tableheader.event." + eventType.getI18nKey(), dataColumn++, null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new ProjectEventColumnRenderer()));
        }
    }
    tableController.addColumnDescriptor(new CustomRenderColumnDescriptor("projectlist.tableheader.state", dataColumn++, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new ProjectStateColumnRenderer()));
    tableController.addColumnDescriptor(new DefaultColumnDescriptor("projectlist.tableheader.numbers", dataColumn++, 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 {
                Long la = new Long((String) a);
                Long lb = new Long((String) b);
                return la.compareTo(lb);
            } catch (NumberFormatException e) {
                return super.compareTo(rowa, rowb);
            }
        }
    });
    String selectCmd = userCourseEnv.isCourseReadOnly() ? null : TABLE_ACTION_SELECT;
    tableController.addColumnDescriptor(new BooleanColumnDescriptor("projectlist.tableheader.select", dataColumn++, selectCmd, translate("table.action.select"), "-"));
    String cancelCmd = userCourseEnv.isCourseReadOnly() ? null : TABLE_ACTION_CANCEL_SELECT;
    tableController.addColumnDescriptor(new BooleanColumnDescriptor("projectlist.tableheader.cancel.select", dataColumn++, cancelCmd, translate("projectlist.tableheader.cancel.select"), "-"));
    return tableController;
}
Also used : CustomRenderColumnDescriptor(org.olat.core.gui.components.table.CustomRenderColumnDescriptor) TableController(org.olat.core.gui.components.table.TableController) StringOutput(org.olat.core.gui.render.StringOutput) BooleanColumnDescriptor(org.olat.core.gui.components.table.BooleanColumnDescriptor) Project(org.olat.course.nodes.projectbroker.datamodel.Project) Renderer(org.olat.core.gui.render.Renderer) CustomField(org.olat.course.nodes.projectbroker.datamodel.CustomField) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 8 with BooleanColumnDescriptor

use of org.olat.core.gui.components.table.BooleanColumnDescriptor in project openolat by klemens.

the class DENManager method createListParticipantsTable.

/**
 * Create the table for the list of participants view
 * @param ureq
 * @param wControl
 * @param trans
 * @param listener
 * @param tableData DENListTableDataModel
 * @return TableController
 */
protected TableController createListParticipantsTable(UserRequest ureq, WindowControl wControl, Translator trans, DENListTableDataModel tableData) {
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(trans.translate("dates.table.empty"));
    TableController tableCntrl = new TableController(tableConfig, ureq, wControl, trans);
    tableCntrl.addColumnDescriptor(new StrongColumnDescriptor("dates.table.date", 0, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.begin", 1, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new StrongColumnDescriptor("dates.table.location", 3, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.duration", 2, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.comment", 4, null, ureq.getLocale()));
    DefaultColumnDescriptor dcd = new DefaultColumnDescriptor("dates.table.participant.name", 5, null, ureq.getLocale());
    dcd.setEscapeHtml(EscapeMode.none);
    tableCntrl.addColumnDescriptor(dcd);
    boolean isAdministrativeUser = CoreSpringFactory.getImpl(BaseSecurityModule.class).isUserAllowedAdminProps(ureq.getUserSession().getRoles());
    if (isAdministrativeUser) {
        DefaultColumnDescriptor ucd = new DefaultColumnDescriptor("dates.table.participant.username", 6, null, ureq.getLocale());
        ucd.setEscapeHtml(EscapeMode.none);
        tableCntrl.addColumnDescriptor(ucd);
    }
    if (!tableData.isReadOnly()) {
        tableCntrl.addColumnDescriptor(new BooleanColumnDescriptor("participants", 7, DENListTableDataModel.CHANGE_ACTION, trans.translate("dates.table.participant.manage"), ""));
        tableCntrl.addMultiSelectAction("dates.table.list.email", DENListTableDataModel.MAIL_ACTION);
        tableCntrl.addMultiSelectAction("dates.table.list.delete", DENListTableDataModel.DELETE_ACTION);
        tableCntrl.setMultiSelect(true);
    }
    tableCntrl.setTableDataModel(tableData);
    // timeframe + multi select column
    tableCntrl.setSortColumn(2, true);
    return tableCntrl;
}
Also used : BooleanColumnDescriptor(org.olat.core.gui.components.table.BooleanColumnDescriptor) TableController(org.olat.core.gui.components.table.TableController) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 9 with BooleanColumnDescriptor

use of org.olat.core.gui.components.table.BooleanColumnDescriptor in project openolat by klemens.

the class DENManager method createRunDatesTable.

/**
 * Create the table for the run view
 * @param ureq
 * @param wControl
 * @param trans
 * @param listener
 * @param tableData DENRunTableDataModel
 * @return TableController
 */
protected TableController createRunDatesTable(UserRequest ureq, WindowControl wControl, Translator trans, DENRunTableDataModel tableData) {
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(trans.translate("dates.table.empty"));
    TableController tableCntrl = new TableController(tableConfig, ureq, wControl, trans);
    tableCntrl.addColumnDescriptor(new StrongColumnDescriptor("dates.table.date", 0, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.begin", 1, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new StrongColumnDescriptor("dates.table.location", 3, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.duration", 2, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.comment", 4, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.reserved", 5, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.status", 6, null, ureq.getLocale()));
    if (tableData.isEnrollmentEnabled()) {
        tableCntrl.addColumnDescriptor(new BooleanColumnDescriptor("dates.table.sign.in", 7, DENRunTableDataModel.CMD_ENROLL_IN_DATE, trans.translate("dates.table.sign.in"), trans.translate("dates.table.run.no_action")));
        tableCntrl.addColumnDescriptor(new BooleanColumnDescriptor("dates.table.sign.out", 8, DENRunTableDataModel.CMD_ENROLLED_CANCEL, trans.translate("dates.table.sign.out"), trans.translate("dates.table.run.no_action")));
    }
    tableCntrl.setTableDataModel(tableData);
    // timeframe
    tableCntrl.setSortColumn(1, true);
    return tableCntrl;
}
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 BooleanColumnDescriptor

use of org.olat.core.gui.components.table.BooleanColumnDescriptor in project openolat by klemens.

the class DENManager method createParticipantsTable.

/**
 * Create the table for the participants management view
 * @param ureq
 * @param wControl
 * @param trans
 * @param listener
 * @param tableData DENParticipantsTableDataModel
 * @return TableController
 */
protected TableController createParticipantsTable(UserRequest ureq, WindowControl wControl, Translator trans, DENParticipantsTableDataModel tableData) {
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(trans.translate("dates.table.empty"));
    TableController tableCntrl = new TableController(tableConfig, ureq, wControl, trans);
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.participant.firstname", 0, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.participant.lastname", 1, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new DefaultColumnDescriptor("dates.table.participant.email", 2, null, ureq.getLocale()));
    tableCntrl.addColumnDescriptor(new BooleanColumnDescriptor("dates.table.participant.email.send", 3, DENParticipantsTableDataModel.MAIL_ACTION, trans.translate("dates.table.participant.email.send"), ""));
    tableCntrl.addColumnDescriptor(new BooleanColumnDescriptor("dates.table.list.delete", 3, DENParticipantsTableDataModel.REMOVE_ACTION, trans.translate("dates.table.list.delete"), ""));
    tableCntrl.setTableDataModel(tableData);
    return tableCntrl;
}
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)

Aggregations

BooleanColumnDescriptor (org.olat.core.gui.components.table.BooleanColumnDescriptor)10 DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)10 TableController (org.olat.core.gui.components.table.TableController)10 TableGuiConfiguration (org.olat.core.gui.components.table.TableGuiConfiguration)10 BaseSecurityModule (org.olat.basesecurity.BaseSecurityModule)2 CustomRenderColumnDescriptor (org.olat.core.gui.components.table.CustomRenderColumnDescriptor)2 Renderer (org.olat.core.gui.render.Renderer)2 StringOutput (org.olat.core.gui.render.StringOutput)2 CustomField (org.olat.course.nodes.projectbroker.datamodel.CustomField)2 Project (org.olat.course.nodes.projectbroker.datamodel.Project)2