Search in sources :

Example 21 with Month

use of org.activityinfo.model.type.time.Month in project activityinfo by bedatadriven.

the class MonthlyReportsTest method testGetReports.

@Test
public void testGetReports() throws Exception {
    GetMonthlyReports cmd = new GetMonthlyReports(6);
    cmd.setStartMonth(new Month(2009, 1));
    cmd.setEndMonth(new Month(2009, 2));
    MonthlyReportResult result = execute(cmd);
    Assert.assertEquals(1, result.getData().size());
    Assert.assertEquals(35, result.getData().get(0).getValue(2009, 1).intValue());
    Assert.assertEquals(70, result.getData().get(0).getValue(2009, 2).intValue());
}
Also used : Month(org.activityinfo.model.type.time.Month) GetMonthlyReports(org.activityinfo.legacy.shared.command.GetMonthlyReports) MonthlyReportResult(org.activityinfo.legacy.shared.command.result.MonthlyReportResult) Test(org.junit.Test)

Example 22 with Month

use of org.activityinfo.model.type.time.Month in project activityinfo by bedatadriven.

the class MonthlyGrid method updateMonthColumns.

/**
 * Updates the month headers based on the given start month
 */
public void updateMonthColumns(Month startMonth) {
    Month month = startMonth;
    for (int i = 0; i != MONTHS_TO_SHOW; ++i) {
        getColumnModel().setColumnHeader(i + 1, formatHeader(month));
        getColumnModel().setDataIndex(i + 1, IndicatorRowDTO.propertyName(month));
        month = month.next();
    }
}
Also used : Month(org.activityinfo.model.type.time.Month)

Example 23 with Month

use of org.activityinfo.model.type.time.Month in project activityinfo by bedatadriven.

the class MonthlyReportsPanel method getInitialStartMonth.

private Month getInitialStartMonth(SiteDTO site) {
    String stateKey = "monthlyView" + site.getActivityId() + "startMonth";
    if (StateManager.get().getString(stateKey) != null) {
        try {
            return Month.parseMonth(StateManager.get().getString(stateKey));
        } catch (NumberFormatException e) {
        }
    }
    DateWrapper today = new DateWrapper();
    return new Month(today.getFullYear(), today.getMonth());
}
Also used : Month(org.activityinfo.model.type.time.Month) DateWrapper(com.extjs.gxt.ui.client.util.DateWrapper)

Aggregations

Month (org.activityinfo.model.type.time.Month)23 Test (org.junit.Test)9 MonthlyReportResult (org.activityinfo.legacy.shared.command.result.MonthlyReportResult)7 ArrayList (java.util.ArrayList)5 UpdateMonthlyReports (org.activityinfo.legacy.shared.command.UpdateMonthlyReports)5 GetMonthlyReports (org.activityinfo.legacy.shared.command.GetMonthlyReports)3 IndicatorRowDTO (org.activityinfo.legacy.shared.model.IndicatorRowDTO)3 SqlResultSet (com.bedatadriven.rebar.sql.client.SqlResultSet)2 SqlResultSetRow (com.bedatadriven.rebar.sql.client.SqlResultSetRow)2 DateWrapper (com.extjs.gxt.ui.client.util.DateWrapper)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 Change (org.activityinfo.legacy.shared.command.UpdateMonthlyReports.Change)2 IllegalAccessCommandException (org.activityinfo.legacy.shared.exception.IllegalAccessCommandException)2 OnDataSet (org.activityinfo.server.database.OnDataSet)2 Timed (org.activityinfo.server.util.monitoring.Timed)2 SqlResultCallback (com.bedatadriven.rebar.sql.client.SqlResultCallback)1 SqlTransaction (com.bedatadriven.rebar.sql.client.SqlTransaction)1 FieldEvent (com.extjs.gxt.ui.client.event.FieldEvent)1 LabelToolItem (com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem)1