Search in sources :

Example 21 with SimpleWidgetModel

use of org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel 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 22 with SimpleWidgetModel

use of org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceForm method getDescriptionWM.

/**
 * Getter for property description. This is invoked by the custom tag, when the jsp is rendered, to get the current value.
 * @return Value of property description.
 */
public SimpleWidgetModel getDescriptionWM() {
    SimpleWidgetModel w_description = (SimpleWidgetModel) getWidgetCache().getModel("description");
    if (w_description == null) {
        w_description = new SimpleWidgetModel(getDescription());
        getWidgetCache().addModel("description", w_description);
    }
    return w_description;
}
Also used : SimpleWidgetModel(org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)

Example 23 with SimpleWidgetModel

use of org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceForm method getMonthlyWeekFrequencyWM.

/**
 * Getter for property monthlyWeekFrequency. This is invoked by the custom tag, when the jsp is rendered, to get the current value.
 * @return Value of property monthlyWeekFrequency.
 */
public SimpleWidgetModel getMonthlyWeekFrequencyWM() {
    SimpleWidgetModel w_monthlyWeekFrequency = (SimpleWidgetModel) getWidgetCache().getModel("monthlyWeekFrequency");
    if (w_monthlyWeekFrequency == null) {
        w_monthlyWeekFrequency = new SimpleWidgetModel(getMonthlyWeekFrequency());
        addWeekFrequencyOptions(w_monthlyWeekFrequency);
        getWidgetCache().addModel("monthlyWeekFrequency", w_monthlyWeekFrequency);
    }
    return w_monthlyWeekFrequency;
}
Also used : SimpleWidgetModel(org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)

Example 24 with SimpleWidgetModel

use of org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceForm method getStartOnWM.

/**
 * Getter for property startOn. This is invoked by the custom tag, when the jsp is rendered, to get the current value.
 * @return Value of property startOn.
 */
public SimpleWidgetModel getStartOnWM() {
    SimpleWidgetModel w_startOn = (SimpleWidgetModel) getWidgetCache().getModel("startOn");
    if (w_startOn == null) {
        w_startOn = new SimpleWidgetModel(getStartOn());
        getWidgetCache().addModel("startOn", w_startOn);
    }
    return w_startOn;
}
Also used : SimpleWidgetModel(org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)

Example 25 with SimpleWidgetModel

use of org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel in project jaffa-framework by jaffa-projects.

the class TaskMaintenanceForm method getCreatedOnWM.

/**
 * Getter for property createdOn. This is invoked by the custom tag, when the jsp is rendered, to get the current value.
 * @return Value of property createdOn.
 */
public SimpleWidgetModel getCreatedOnWM() {
    SimpleWidgetModel w_createdOn = (SimpleWidgetModel) getWidgetCache().getModel("createdOn");
    if (w_createdOn == null) {
        w_createdOn = new SimpleWidgetModel(getCreatedOn());
        getWidgetCache().addModel("createdOn", w_createdOn);
    }
    return w_createdOn;
}
Also used : SimpleWidgetModel(org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)

Aggregations

SimpleWidgetModel (org.jaffa.presentation.portlet.widgets.model.SimpleWidgetModel)40 GridModelRow (org.jaffa.presentation.portlet.widgets.model.GridModelRow)5 JspWriteRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.JspWriteRuntimeException)5 IOException (java.io.IOException)4 JspException (javax.servlet.jsp.JspException)4 JspWriter (javax.servlet.jsp.JspWriter)4 MissingParametersRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.MissingParametersRuntimeException)4 OuterFormTagMissingRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.OuterFormTagMissingRuntimeException)4 IPropertyRuleIntrospector (org.jaffa.rules.IPropertyRuleIntrospector)4 Iterator (java.util.Iterator)2 IntegerFieldMetaData (org.jaffa.metadata.IntegerFieldMetaData)2 Recurrence (org.jaffa.modules.scheduler.services.Recurrence)2 FormBase (org.jaffa.presentation.portlet.FormBase)2 File (java.io.File)1 TreeSet (java.util.TreeSet)1 FrameworkException (org.jaffa.exceptions.FrameworkException)1 TaskMaintenanceDto (org.jaffa.modules.scheduler.components.taskmaintenance.dto.TaskMaintenanceDto)1 GridModel (org.jaffa.presentation.portlet.widgets.model.GridModel)1 WidgetModelAccessMethodNotFoundRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.WidgetModelAccessMethodNotFoundRuntimeException)1