Search in sources :

Example 6 with TotalAwareColumnDescriptor

use of org.olat.course.statistic.TotalAwareColumnDescriptor in project openolat by klemens.

the class OrgTypeStatisticManager 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());
    }
    if (headerId != null) {
        Translator translator = Util.createPackageTranslator(ShibbolethModule.class, ureq.getLocale());
        if (translator != null) {
            String newHeaderId = translator.translate("swissEduPersonHomeOrganizationType." + headerId);
            if (newHeaderId != null && !newHeaderId.startsWith(Translator.NO_TRANSLATION_ERROR_PREFIX)) {
                headerId = newHeaderId;
            }
        }
    }
    TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(headerId, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
    cd.setTranslateHeaderKey(false);
    return cd;
}
Also used : Translator(org.olat.core.gui.translator.Translator) TotalAwareColumnDescriptor(org.olat.course.statistic.TotalAwareColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 7 with TotalAwareColumnDescriptor

use of org.olat.course.statistic.TotalAwareColumnDescriptor in project openolat by klemens.

the class StudyLevelStatisticManager 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());
    }
    if (headerId != null) {
        Translator translator = Util.createPackageTranslator(ShibbolethModule.class, ureq.getLocale());
        if (translator != null) {
            String newHeaderId = translator.translate("swissEduPersonStudyLevel." + headerId);
            if (newHeaderId != null && !newHeaderId.startsWith(Translator.NO_TRANSLATION_ERROR_PREFIX)) {
                headerId = newHeaderId;
            }
        }
    }
    TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(headerId, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
    cd.setTranslateHeaderKey(false);
    return cd;
}
Also used : Translator(org.olat.core.gui.translator.Translator) TotalAwareColumnDescriptor(org.olat.course.statistic.TotalAwareColumnDescriptor) DefaultColumnDescriptor(org.olat.core.gui.components.table.DefaultColumnDescriptor)

Example 8 with TotalAwareColumnDescriptor

use of org.olat.course.statistic.TotalAwareColumnDescriptor in project OpenOLAT by OpenOLAT.

the class WeeklyStatisticManager method createColumnDescriptor.

@Override
public ColumnDescriptor createColumnDescriptor(UserRequest ureq, int column, String headerId) {
    if (column == 0) {
        throw new IllegalStateException("column must never be 0 here");
    }
    TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(headerId, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
    cd.setTranslateHeaderKey(false);
    return cd;
}
Also used : TotalAwareColumnDescriptor(org.olat.course.statistic.TotalAwareColumnDescriptor)

Example 9 with TotalAwareColumnDescriptor

use of org.olat.course.statistic.TotalAwareColumnDescriptor in project OpenOLAT by OpenOLAT.

the class DailyStatisticManager method createColumnDescriptor.

@Override
public ColumnDescriptor createColumnDescriptor(UserRequest ureq, int column, String headerId) {
    if (column == 0) {
        throw new IllegalStateException("column must never be 0 here");
    }
    String header = headerId;
    try {
        Date d = columnHeaderFormat_.parse(headerId);
        Calendar c = Calendar.getInstance(ureq.getLocale());
        c.setTime(d);
        DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, ureq.getLocale());
        header = df.format(c.getTime());
    } catch (ParseException pe) {
        log.warn("createColumnDescriptor: ParseException while parsing " + headerId + ".", pe);
    }
    TotalAwareColumnDescriptor cd = new TotalAwareColumnDescriptor(header, column, StatisticDisplayController.CLICK_TOTAL_ACTION + column, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT);
    cd.setTranslateHeaderKey(false);
    return cd;
}
Also used : Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) TotalAwareColumnDescriptor(org.olat.course.statistic.TotalAwareColumnDescriptor) ParseException(java.text.ParseException) Date(java.util.Date)

Example 10 with TotalAwareColumnDescriptor

use of org.olat.course.statistic.TotalAwareColumnDescriptor in project OpenOLAT by OpenOLAT.

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

TotalAwareColumnDescriptor (org.olat.course.statistic.TotalAwareColumnDescriptor)14 DefaultColumnDescriptor (org.olat.core.gui.components.table.DefaultColumnDescriptor)10 Translator (org.olat.core.gui.translator.Translator)6 DateFormat (java.text.DateFormat)4 Calendar (java.util.Calendar)4 Date (java.util.Date)4 ParseException (java.text.ParseException)2 SimpleDateFormat (java.text.SimpleDateFormat)2