Search in sources :

Example 61 with DefaultColumnDescriptor

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

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 62 with DefaultColumnDescriptor

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

the class NotificationSubscriptionTableDataModel method addTableColumns.

/**
 * Add the column descriptors to the given table controller that matches with
 * this data model
 *
 * @param subscriptionsTableCtr
 */
void addTableColumns(TableController subscriptionsTableCtr, boolean admin) {
    subscriptionsTableCtr.addColumnDescriptor(false, new DefaultColumnDescriptor("overview.column.key", 0, "launch", getLocale()));
    subscriptionsTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("overview.column.type", 1, "launch", getLocale()));
    subscriptionsTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("overview.column.resname", 2, null, getLocale()));
    subscriptionsTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("overview.column.subidentifier", 3, null, getLocale()));
    subscriptionsTableCtr.addColumnDescriptor(admin, new DefaultColumnDescriptor("overview.column.creationDate", 4, null, getLocale()));
    subscriptionsTableCtr.addColumnDescriptor(admin, new DefaultColumnDescriptor("overview.column.lastEmail", 5, null, getLocale()));
    subscriptionsTableCtr.addColumnDescriptor(new StaticColumnDescriptor("del", "overview.column.action", trans.translate("overview.column.action.cellvalue")));
}
Also used : StaticColumnDescriptor(org.olat.core.gui.components.table.StaticColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 63 with DefaultColumnDescriptor

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

the class GenericArchiveController method doNodeChoose.

/**
 * @param ureq
 */
private void doNodeChoose(UserRequest ureq, VelocityContainer nodeChoose) {
    // table configuraton
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("nodesoverview.nonodes"));
    tableConfig.setDownloadOffered(false);
    tableConfig.setSortingEnabled(false);
    tableConfig.setDisplayTableHeader(true);
    tableConfig.setDisplayRowCount(false);
    tableConfig.setPageingEnabled(false);
    removeAsListenerAndDispose(nodeListCtr);
    nodeListCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
    listenTo(nodeListCtr);
    // table columns
    nodeListCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("table.header.node", 0, null, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new IndentedNodeRenderer()));
    nodeListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.action.select", 1, CMD_SELECT_NODE, getLocale()));
    // get list of course node data and populate table data model
    ICourse course = CourseFactory.loadCourse(ores);
    CourseNode rootNode = course.getRunStructure().getRootNode();
    List<AssessmentNodeData> nodesTableObjectArrayList = addNodesAndParentsToList(0, rootNode);
    // only populate data model if data available
    if (nodesTableObjectArrayList == null) {
        nodeChoose.contextPut("hasNodes", Boolean.FALSE);
    } else {
        nodeChoose.contextPut("hasNodes", Boolean.TRUE);
        nodeTableModel = new NodeTableDataModel(nodesTableObjectArrayList, getTranslator());
        nodeListCtr.setTableDataModel(nodeTableModel);
        nodeChoose.put("nodeTable", nodeListCtr.getInitialComponent());
    }
    // set main content to nodechoose, do not use wrapper
    main.setContent(nodeChoose);
}
Also used : CustomRenderColumnDescriptor(org.olat.core.gui.components.table.CustomRenderColumnDescriptor) TableController(org.olat.core.gui.components.table.TableController) ICourse(org.olat.course.ICourse) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) IndentedNodeRenderer(org.olat.course.assessment.IndentedNodeRenderer) CourseNode(org.olat.course.nodes.CourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) AssessmentNodeData(org.olat.course.assessment.model.AssessmentNodeData)

Example 64 with DefaultColumnDescriptor

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

the class CourseCalendarPeekViewController method init.

private void init(UserRequest ureq, CalCourseNode courseNode, UserCourseEnvironment courseEnv, NodeEvaluation ne) {
    CourseCalendars myCal = CourseCalendars.createCourseCalendarsWrapper(ureq, getWindowControl(), courseEnv, ne);
    Date refDate;
    ModuleConfiguration config = courseNode.getModuleConfiguration();
    if (CalEditController.getAutoDate(config)) {
        refDate = new Date();
    } else {
        refDate = CalEditController.getStartDate(config);
        if (refDate == null)
            refDate = new Date();
    }
    List<KalendarEvent> nextEvents = new ArrayList<KalendarEvent>();
    for (KalendarRenderWrapper calendar : myCal.getCalendars()) {
        Kalendar cal = calendar.getKalendar();
        Collection<KalendarEvent> events = cal.getEvents();
        for (KalendarEvent event : events) {
            if (refDate.compareTo(event.getBegin()) <= 0) {
                nextEvents.add(event);
            }
        }
    }
    Collections.sort(nextEvents, new KalendarEventComparator());
    List<KalendarEvent> nextThreeEvents = nextEvents.subList(0, Math.min(3, nextEvents.size()));
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("calendar.noEvents"));
    tableConfig.setDisplayTableHeader(false);
    tableConfig.setCustomCssClass("o_portlet_table");
    tableConfig.setDisplayRowCount(false);
    tableConfig.setPageingEnabled(false);
    tableConfig.setDownloadOffered(false);
    tableConfig.setSortingEnabled(false);
    removeAsListenerAndDispose(tableController);
    tableController = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
    listenTo(tableController);
    // dummy header key, won't be used since setDisplayTableHeader is set to
    // false
    tableController.addColumnDescriptor(new DefaultColumnDescriptor("calendar.date", 0, null, ureq.getLocale()));
    tableController.addColumnDescriptor(new DefaultColumnDescriptor("calendar.subject", 1, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT));
    tableController.setTableDataModel(new CourseCalendarPeekViewModel(nextThreeEvents, getTranslator()));
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) TableController(org.olat.core.gui.components.table.TableController) ArrayList(java.util.ArrayList) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper) Date(java.util.Date) Kalendar(org.olat.commons.calendar.model.Kalendar) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 65 with DefaultColumnDescriptor

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

the class HourOfDayStatisticManager method createColumnDescriptor.

@Override
public ColumnDescriptor createColumnDescriptor(UserRequest ureq, int column, String headerId) {
    if (column == 0) {
        return new DefaultColumnDescriptor("stat.table.header.node", 0, null, ureq.getLocale());
    }
    String hourOfDayLocaled = headerId;
    try {
        Calendar c = Calendar.getInstance(ureq.getLocale());
        c.setTime(new Date());
        c.set(Calendar.HOUR_OF_DAY, Integer.parseInt(headerId));
        c.set(Calendar.MINUTE, 0);
        DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT, ureq.getLocale());
        hourOfDayLocaled = df.format(c.getTime());
    } catch (RuntimeException re) {
        re.printStackTrace(System.out);
    }
    TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(hourOfDayLocaled, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
    cd.setTranslateHeaderKey(false);
    return cd;
}
Also used : Calendar(java.util.Calendar) DateFormat(java.text.DateFormat) TotalAwareColumnDescriptor(org.olat.course.statistic.TotalAwareColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor) Date(java.util.Date)

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