Search in sources :

Example 56 with TableController

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

Example 57 with TableController

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

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 58 with TableController

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

the class SelectionForm 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(), propertyHandlerTranslator);
    listenTo(tableCtr);
    List<Identity> l = UserDeletionManager.getInstance().getDeletableIdentities(UserDeletionManager.getInstance().getLastLoginDuration());
    tdm = new UserDeleteTableModel(l, ureq.getLocale(), isAdministrativeUser);
    tdm.addColumnDescriptors(tableCtr, null);
    tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", translate("action.activate")));
    tableCtr.addMultiSelectAction("action.delete.selection", ACTION_MULTISELECT_CHOOSE);
    tableCtr.setMultiSelect(true);
    tableCtr.setTableDataModel(tdm);
}
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 59 with TableController

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

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 60 with TableController

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

the class UserSearchController method doSearch.

private void doSearch(UserRequest ureq) {
    String login = searchform.login.getValue();
    // build user fields search map
    Map<String, String> userPropertiesSearch = new HashMap<>();
    for (UserPropertyHandler userPropertyHandler : searchform.userPropertyHandlers) {
        if (userPropertyHandler == null)
            continue;
        FormItem ui = searchform.propFormItems.get(userPropertyHandler.getName());
        String uiValue = userPropertyHandler.getStringValue(ui);
        if (userPropertyHandler.getName().startsWith("genericCheckboxProperty")) {
            if (!"false".equals(uiValue)) {
                userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
            }
        } else if (StringHelper.containsNonWhitespace(uiValue)) {
            userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
        }
    }
    if (userPropertiesSearch.isEmpty()) {
        userPropertiesSearch = null;
    }
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), myContent.getTranslator());
    listenTo(tableCtr);
    List<Identity> users = searchUsers(login, userPropertiesSearch, true);
    int maxResults = securityModule.getUserSearchMaxResultsValue();
    if (maxResults > 0 && users.size() > maxResults) {
        users = users.subList(0, maxResults);
        showWarning("error.search.maxResults", Integer.toString(maxResults));
    }
    if (!users.isEmpty()) {
        tdm = new UserTableDataModel(users, getLocale(), isAdministrativeUser);
        // add the data column descriptors
        tdm.addColumnDescriptors(tableCtr, null);
        // add the action columns
        if (useMultiSelect) {
            // add multiselect action
            tableCtr.addMultiSelectAction(this.actionKeyChoose, ACTION_MULTISELECT_CHOOSE);
        } else {
            // add single column selec action
            tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", myContent.getTranslator().translate("action.choose")));
        }
        tableCtr.setTableDataModel(tdm);
        tableCtr.setMultiSelect(useMultiSelect);
        searchPanel.pushContent(tableCtr.getInitialComponent());
        myContent.contextPut("showButton", "true");
    } else {
        getWindowControl().setInfo(translate("error.no.user.found"));
    }
}
Also used : HashMap(java.util.HashMap) FormItem(org.olat.core.gui.components.form.flexible.FormItem) TableController(org.olat.core.gui.components.table.TableController) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) Identity(org.olat.core.id.Identity) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

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