Search in sources :

Example 41 with DefaultColumnDescriptor

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

the class WaitingGroupController method initGroupTable.

/**
 * Init WaitingList-table-controller for waitinglist with addional column action=move user to participant-list.
 * Show added-date attribute and sort waiting list per default by added date.
 */
@Override
protected void initGroupTable(TableController tableCtr, UserRequest ureq, boolean enableTablePreferences, boolean enableUserSelection) {
    List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(usageIdentifyer, isAdministrativeUser);
    // first the login name
    if (isAdministrativeUser) {
        // first the login name, but only if administrative user
        DefaultColumnDescriptor cd0 = new DefaultColumnDescriptor("table.user.login", 0, COMMAND_VCARD, ureq.getLocale());
        cd0.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
        tableCtr.addColumnDescriptor(cd0);
    }
    if (chatEnabled) {
        tableCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("table.header.online", 1, COMMAND_IM, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new OnlineIconRenderer()));
    }
    int visibleColId = 0;
    // followed by the users fields
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        boolean visible = userManager.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
        ColumnDescriptor cd = userPropertyHandler.getColumnDescriptor(i + 3, COMMAND_VCARD, ureq.getLocale());
        // make all user attributes clickable to open visiting card
        if (cd instanceof DefaultColumnDescriptor) {
            DefaultColumnDescriptor dcd = (DefaultColumnDescriptor) cd;
            dcd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
        }
        tableCtr.addColumnDescriptor(visible, cd);
        if (visible) {
            visibleColId++;
        }
    }
    // in the end
    if (enableTablePreferences) {
        tableCtr.addColumnDescriptor(true, new DefaultColumnDescriptor("table.subject.addeddate", 2, COMMAND_VCARD, ureq.getLocale()));
        tableCtr.setSortColumn(++visibleColId, true);
    }
    if (mayModifyMembers) {
        tableCtr.addMultiSelectAction("action.waitinglist.move", COMMAND_MOVE_USER_WAITINGLIST);
        tableCtr.addMultiSelectAction("action.remove", COMMAND_REMOVEUSER);
        tableCtr.setMultiSelect(true);
    }
}
Also used : CustomRenderColumnDescriptor(org.olat.core.gui.components.table.CustomRenderColumnDescriptor) OnlineIconRenderer(org.olat.group.ui.main.OnlineIconRenderer) ColumnDescriptor(org.olat.core.gui.components.table.ColumnDescriptor) CustomRenderColumnDescriptor(org.olat.core.gui.components.table.CustomRenderColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 42 with DefaultColumnDescriptor

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

the class AdvancedPropertiesController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == searchForm && event == Event.DONE_EVENT) {
        String resourceTypeName = searchForm.getResourceTypeName();
        String resourceTypeId = searchForm.getResourceTypeId();
        Long resTypeId = null;
        if (resourceTypeId != null && !resourceTypeId.equals(""))
            resTypeId = Long.valueOf(resourceTypeId);
        String category = searchForm.getCategory();
        if (category != null && category.equals(""))
            category = null;
        String propertyName = searchForm.getPropertyName();
        if (propertyName != null && propertyName.equals(""))
            propertyName = null;
        List<Property> entries = PropertyManager.getInstance().listProperties(searchForm.getIdentity(), null, resourceTypeName, resTypeId, category, propertyName);
        PropertiesTableDataModel ptdm = new PropertiesTableDataModel(entries, isAdministrativeUser);
        TableGuiConfiguration tableConfig = new TableGuiConfiguration();
        removeAsListenerAndDispose(tableCtr);
        tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
        // use null as listener argument because we are using listenTo(..) from basiccontroller
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.userName", 0, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.resourceTypeName", 1, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.resourceTypeId", 2, null, getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.category", 3, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.name", 4, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.floatValue", 5, null, getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.stringValue", 6, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.longValue", 10, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.textValue", 7, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.creationdate", 8, null, getLocale()));
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.lastmodified", 9, null, getLocale()));
        tableCtr.setTableDataModel(ptdm);
        listenTo(tableCtr);
        myPanel.setContent(tableCtr.getInitialComponent());
    }
}
Also used : TableController(org.olat.core.gui.components.table.TableController) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) Property(org.olat.properties.Property) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 43 with DefaultColumnDescriptor

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

the class ExtendedIdentitiesTableDataModel method addColumnDescriptors.

/**
 * Add all column descriptors to this table that are available in the table
 * model
 *
 * @param tableCtr
 */
public void addColumnDescriptors(TableController tableCtr, Translator trans) {
    setLocale(trans.getLocale());
    if (isAdministrativeUser) {
        String action = actionEnabled ? COMMAND_SELECTUSER : null;
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.identity.name", colCount++, action, getLocale()));
    }
    UserManager um = UserManager.getInstance();
    // followed by the users fields
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        boolean visible = um.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
        String action = null;
        if (actionEnabled && i < 2) {
            action = COMMAND_SELECTUSER;
        }
        tableCtr.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(colCount++, action, getLocale()));
    }
    // in the end the last login and creation date
    tableCtr.addColumnDescriptor(false, new DefaultColumnDescriptor("table.identity.lastlogin", colCount++, null, getLocale()));
    // creation date at the end, enabled by default
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.identity.creationdate", colCount++, null, getLocale()));
    if (actionEnabled) {
        StaticColumnDescriptor vcd = new StaticColumnDescriptor(COMMAND_VCARD, "table.header.vcard", trans.translate("table.identity.vcard"));
        vcd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
        tableCtr.addColumnDescriptor(vcd);
    }
}
Also used : UserManager(org.olat.user.UserManager) StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 44 with DefaultColumnDescriptor

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

the class UserTableDataModel method addColumnDescriptors.

/**
 * Add all column descriptors to this table that are available in the table
 * model
 *
 * @param tableCtr
 * @param actionCommand command fired when the login name is clicked or NULL when no command is used
 */
public void addColumnDescriptors(TableController tableCtr, String actionCommand) {
    // first column is users login name
    if (isAdministrativeUser) {
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.login", 0, actionCommand, getLocale()));
    }
    // followed by the users fields
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        boolean visible = UserManager.getInstance().isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
        tableCtr.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(i + 1, actionCommand, getLocale()));
    }
}
Also used : DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 45 with DefaultColumnDescriptor

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

the class UserDeleteTableModel method addColumnDescriptors.

/**
 * Add all column descriptors to this table that are available in the table model.
 * The table contains userPropertyHandlers.size() columns plus a column for the
 * username and one for the last login date.
 *
 * @param tableCtr
 * @param actionCommand command fired when the login name is clicked or NULL when no command is used
 */
public void addColumnDescriptors(TableController tableCtr, String actionCommand) {
    // first column is the username
    if (isAdministrativeUser) {
        tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.login", 301, actionCommand, getLocale()));
    }
    // followed by the users fields
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
        boolean visible = UserManager.getInstance().isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
        tableCtr.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(i, null, getLocale()));
    }
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.lastlogin", 302, actionCommand, getLocale()));
}
Also used : DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

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