Search in sources :

Example 56 with DefaultColumnDescriptor

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

the class GroupChoiceForm method initManageTable.

private void initManageTable(UserRequest ureq) {
    // reload data
    loadData();
    // load participants
    List<Identity> lstIdents = new ArrayList<Identity>();
    if (groupForm.getSelection().equals(GroupChoiceForm.CHOICE_ALL)) {
        lstIdents.addAll(allIdentities);
    } else if (groupForm.getSelection().equals(GroupChoiceForm.CHOICE_OTHERS)) {
        lstIdents.addAll(notInGroupIdentities);
    } else if (StringHelper.isLong(groupForm.getSelection())) {
        Long groupKey = new Long(groupForm.getSelection());
        BusinessGroup group = businessGroupService.loadBusinessGroup(groupKey);
        lstIdents.addAll(businessGroupService.getMembers(group, GroupRoles.participant.name()));
    }
    boolean isAdministrativeUser = securityModule.isUserAllowedAdminProps(ureq.getUserSession().getRoles());
    List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(USER_PROPS_ID, isAdministrativeUser);
    // prepare table for run view
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("cl.table.empty"));
    tableConfig.setDownloadOffered(true);
    tableConfig.setPreferencesOffered(true, "ExtendedManageTable");
    removeAsListenerAndDispose(manageChecklistTable);
    manageChecklistTable = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
    listenTo(manageChecklistTable);
    int cols = 0;
    if (isAdministrativeUser) {
        manageChecklistTable.addColumnDescriptor(new DefaultColumnDescriptor("username", 1000, null, getLocale()));
        cols++;
    }
    int i = 0;
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        if (userPropertyHandler == null)
            continue;
        boolean visible = UserManager.getInstance().isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
        manageChecklistTable.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(i++, DETAILS_ACTION, getLocale()));
        cols++;
    }
    int j = 500;
    List<Checkpoint> checkpointList = checklist.getCheckpointsSorted(ChecklistUIFactory.comparatorTitleAsc);
    for (Checkpoint checkpoint : checkpointList) {
        String pointTitle = checkpoint.getTitle() == null ? "" : checkpoint.getTitle();
        manageChecklistTable.addColumnDescriptor(new ChecklistMultiSelectColumnDescriptor(pointTitle, j++));
        cols++;
    }
    if (!readOnly) {
        manageChecklistTable.addColumnDescriptor(new StaticColumnDescriptor(EDIT_ACTION, "cl.edit.title", translate(EDIT_ACTION)));
        cols++;
    }
    manageChecklistTable.setMultiSelect(false);
    manageTableData = new ChecklistManageTableDataModel(checkpointList, lstIdents, userPropertyHandlers, cols);
    manageChecklistTable.setTableDataModel(manageTableData);
    panel.setContent(manageChecklistTable.getInitialComponent());
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) TableController(org.olat.core.gui.components.table.TableController) ArrayList(java.util.ArrayList) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) Identity(org.olat.core.id.Identity) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 57 with DefaultColumnDescriptor

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

the class GroupChoiceForm method initEditTable.

private void initEditTable(UserRequest ureq, Identity identity) {
    List<Checkpoint> checkpoints = checklist.getCheckpoints();
    editTableData = new ChecklistRunTableDataModel(checkpoints, getTranslator());
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("cl.table.empty"));
    tableConfig.setDownloadOffered(true);
    tableConfig.setPreferencesOffered(true, "ExtendedEditTable");
    removeAsListenerAndDispose(editChecklistTable);
    editChecklistTable = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
    listenTo(editChecklistTable);
    editChecklistTable.addColumnDescriptor(new DefaultColumnDescriptor("cl.table.title", 0, null, ureq.getLocale()));
    editChecklistTable.addColumnDescriptor(new DefaultColumnDescriptor("cl.table.description", 1, null, ureq.getLocale()));
    editChecklistTable.addColumnDescriptor(new DefaultColumnDescriptor("cl.table.mode", 2, null, ureq.getLocale()));
    editChecklistTable.setMultiSelect(true);
    editChecklistTable.addMultiSelectAction("cl.close", "close");
    editChecklistTable.addMultiSelectAction("cl.save.close", "save");
    editChecklistTable.setTableDataModel(editTableData);
    for (int i = 0; i < checkpoints.size(); i++) {
        Checkpoint checkpoint = editTableData.getObject(i);
        boolean selected = checkpoint.getSelectionFor(identity).booleanValue();
        editChecklistTable.setMultiSelectSelectedAt(i, selected);
    }
}
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 58 with DefaultColumnDescriptor

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

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

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

DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)68 TableController (org.olat.core.gui.components.table.TableController)38 TableGuiConfiguration (org.olat.core.gui.components.table.TableGuiConfiguration)38 CustomRenderColumnDescriptor (org.olat.core.gui.components.table.CustomRenderColumnDescriptor)18 StaticColumnDescriptor (org.olat.core.gui.components.table.StaticColumnDescriptor)18 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)13 BooleanColumnDescriptor (org.olat.core.gui.components.table.BooleanColumnDescriptor)10 TotalAwareColumnDescriptor (org.olat.course.statistic.TotalAwareColumnDescriptor)10 Date (java.util.Date)8 ColumnDescriptor (org.olat.core.gui.components.table.ColumnDescriptor)8 Translator (org.olat.core.gui.translator.Translator)6 OnlineIconRenderer (org.olat.group.ui.main.OnlineIconRenderer)6 ArrayList (java.util.ArrayList)4 Locale (java.util.Locale)4 Renderer (org.olat.core.gui.render.Renderer)4 StringOutput (org.olat.core.gui.render.StringOutput)4 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)4 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)4 BigDecimal (java.math.BigDecimal)2 DateFormat (java.text.DateFormat)2