use of org.activityinfo.legacy.shared.reports.model.DateRange in project activityinfo by bedatadriven.
the class DateUtilCalendarImpl method monthRange.
@Override
public DateRange monthRange(int year, int month) {
DateRange range = new DateRange();
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month - 1);
calendar.set(Calendar.DATE, 1);
range.setMinDate(calendar.getTime());
calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE));
range.setMaxDate(calendar.getTime());
return range;
}
use of org.activityinfo.legacy.shared.reports.model.DateRange in project activityinfo by bedatadriven.
the class RenderElementHandler method execute.
@Override
public CommandResult execute(RenderElement cmd, User user) throws CommandException {
try {
Renderer renderer = rendererFactory.get(cmd.getFormat());
GeneratedResource storage = storageProvider.create(renderer.getMimeType(), cmd.getFilename() + renderer.getFileSuffix());
LOGGER.fine("Rendering element: " + cmd + "\nURL: " + storage.getDownloadUri());
try (OutputStream out = storage.openOutputStream()) {
generator.generateElement(user, cmd.getElement(), new Filter(), new DateRange());
renderer.render(cmd.getElement(), out);
}
return new UrlResult(storage.getDownloadUri());
} catch (Exception e) {
throw new RuntimeException("Exception generating export", e);
}
}
use of org.activityinfo.legacy.shared.reports.model.DateRange in project activityinfo by bedatadriven.
the class DateFilterMenu method addQuarterRange.
private void addQuarterRange(int year, int quarter) {
DateWrapper from = new DateWrapper(year, quarter * 3, 1);
DateWrapper to = from.addMonths(3).addDays(-1);
addFixedRange(I18N.MESSAGES.quarter(year, (quarter + 1)), new DateRange(from.asDate(), to.asDate()));
}
use of org.activityinfo.legacy.shared.reports.model.DateRange in project activityinfo by bedatadriven.
the class DateRangeDialog method onButtonPressed.
@Override
protected void onButtonPressed(Button button) {
if (button.getItemId().equals("ok")) {
if (callback != null) {
callback.onSelected(new DateRange(date1.getValue(), date2.getValue()));
}
}
this.callback = null;
hide();
}
use of org.activityinfo.legacy.shared.reports.model.DateRange in project activityinfo by bedatadriven.
the class EmptyChartsTest method generate.
@Test
public void generate() {
PivotChartReportElement element = new PivotChartReportElement(Type.StackedBar);
element.setIndicator(1);
element.addCategoryDimension(new Dimension(DimensionType.Partner));
element.addSeriesDimension(new Dimension(DimensionType.Database));
DispatcherSync dispatcher = createMock(DispatcherSync.class);
expect(dispatcher.execute(isA(PivotSites.class))).andReturn(new PivotSites.PivotResult(Collections.EMPTY_LIST));
expect(dispatcher.execute(isA(GetDimensionLabels.class))).andReturn(new GetDimensionLabels.DimensionLabels(Collections.EMPTY_MAP));
replay(dispatcher);
IndicatorDAO indicatorDAO = createMock(IndicatorDAO.class);
expect(indicatorDAO.findById(eq(1))).andReturn(new Indicator());
replay(indicatorDAO);
PivotChartGenerator generator = new PivotChartGenerator(dispatcher, indicatorDAO);
generator.generate(new User(), element, new Filter(), new DateRange());
}
Aggregations