Search in sources :

Example 6 with Recurrence

use of org.jaffa.modules.scheduler.services.Recurrence in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceForm method getWeeklyDay.

/**
 * Getter for property weeklyDay.
 * @return Value of property weeklyDay.
 */
public String getWeeklyDay() {
    Recurrence r = ((TaskMaintenanceComponent) getComponent()).getRecurrence();
    Recurrence.WeekDay weeklyDay = r != null && r instanceof Recurrence.Weekly ? ((Recurrence.Weekly) r).getDay() : null;
    return weeklyDay != null ? weeklyDay.toString() : null;
}
Also used : Recurrence(org.jaffa.modules.scheduler.services.Recurrence)

Example 7 with Recurrence

use of org.jaffa.modules.scheduler.services.Recurrence in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceForm method populateMonthlyMonths.

private void populateMonthlyMonths(GridModel model) {
    model.clearRows();
    // Get current list of months
    Recurrence r = ((TaskMaintenanceComponent) getComponent()).getRecurrence();
    Recurrence.Month[] months = r != null && r instanceof Recurrence.Monthly ? ((Recurrence.Monthly) r).getMonths() : null;
    if (months != null)
        Arrays.sort(months);
    // Get all possible months
    Recurrence.Month[] allMonths = Recurrence.Month.values();
    // Create rows, such that the labels appear vertically-sorted.. like a newspaper !!
    // To begin with, select all the months
    int noOfRows = allMonths.length % MONTHS_GRID_COLUMNS == 0 ? allMonths.length / MONTHS_GRID_COLUMNS : (allMonths.length / MONTHS_GRID_COLUMNS) + 1;
    for (int i = 0; i < MONTHS_GRID_COLUMNS; i++) {
        for (int j = 0; j < noOfRows; j++) {
            int index = (i * noOfRows) + j;
            if (index >= allMonths.length)
                break;
            Recurrence.Month month = allMonths[index];
            Boolean selected = months == null ? Boolean.TRUE : Arrays.binarySearch(months, month) >= 0;
            GridModelRow row = (i == 0) ? model.newRow() : model.getRow(j);
            row.addElement("label" + i, "label.Jaffa.Scheduler.ScheduledTask.Recurrence.MONTHLY.Month." + month);
            row.addElement("value" + i, month);
            row.addElement("selected" + i, new SimpleWidgetModel(selected));
        }
    }
}
Also used : Recurrence(org.jaffa.modules.scheduler.services.Recurrence) GridModelRow(org.jaffa.presentation.portlet.widgets.model.GridModelRow) SimpleWidgetModel(org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)

Example 8 with Recurrence

use of org.jaffa.modules.scheduler.services.Recurrence in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceForm method getOftenMinutes.

/**
 * Getter for property oftenMinutes.
 * @return Value of property oftenMinutes.
 */
public Long getOftenMinutes() {
    Recurrence r = ((TaskMaintenanceComponent) getComponent()).getRecurrence();
    Integer oftenMinutes = r != null && r instanceof Recurrence.Often ? ((Recurrence.Often) r).getMinutes() : null;
    return oftenMinutes != null ? new Long(oftenMinutes) : null;
}
Also used : Recurrence(org.jaffa.modules.scheduler.services.Recurrence)

Example 9 with Recurrence

use of org.jaffa.modules.scheduler.services.Recurrence in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceForm method getMonthlyDay.

/**
 * Getter for property monthlyDay.
 * @return Value of property monthlyDay.
 */
public Long getMonthlyDay() {
    Recurrence r = ((TaskMaintenanceComponent) getComponent()).getRecurrence();
    Integer monthlyDay = r != null && r instanceof Recurrence.Monthly ? ((Recurrence.Monthly) r).getDay() : null;
    return monthlyDay != null ? new Long(monthlyDay) : null;
}
Also used : Recurrence(org.jaffa.modules.scheduler.services.Recurrence)

Example 10 with Recurrence

use of org.jaffa.modules.scheduler.services.Recurrence in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceForm method getDailyWeekDaysOnly.

/**
 * Getter for property dailyWeekDaysOnly.
 * @return Value of property dailyWeekDaysOnly.
 */
public Boolean getDailyWeekDaysOnly() {
    Recurrence r = ((TaskMaintenanceComponent) getComponent()).getRecurrence();
    Boolean weekDaysOnly = r != null && r instanceof Recurrence.Daily ? ((Recurrence.Daily) r).getWeekDaysOnly() : null;
    return weekDaysOnly != null ? weekDaysOnly : Boolean.FALSE;
}
Also used : Recurrence(org.jaffa.modules.scheduler.services.Recurrence)

Aggregations

Recurrence (org.jaffa.modules.scheduler.services.Recurrence)13 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)1 SimpleWidgetModel (org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)1