Search in sources :

Example 1 with DateWrapper

use of com.extjs.gxt.ui.client.util.DateWrapper in project activityinfo by bedatadriven.

the class DateFilterMenu method addYearRange.

private void addYearRange(int yearsAgo) {
    int year = new DateWrapper().getFullYear() - yearsAgo;
    DateWrapper from = new DateWrapper(year, 0, 1);
    DateWrapper to = new DateWrapper(year, 11, 31);
    addFixedRange(Integer.toString(year), new DateRange(from.asDate(), to.asDate()));
}
Also used : DateRange(org.activityinfo.legacy.shared.reports.model.DateRange) DateWrapper(com.extjs.gxt.ui.client.util.DateWrapper)

Example 2 with DateWrapper

use of com.extjs.gxt.ui.client.util.DateWrapper in project activityinfo by bedatadriven.

the class DateUtilGWTImpl method yearRange.

@Override
public DateRange yearRange(int year) {
    DateRange range = new DateRange();
    DateWrapper date = new DateWrapper(year, 0, 1);
    range.setMinDate(date.asDate());
    date = new DateWrapper(year, 11, 31);
    range.setMaxDate(date.asDate());
    return range;
}
Also used : DateRange(org.activityinfo.legacy.shared.reports.model.DateRange) DateWrapper(com.extjs.gxt.ui.client.util.DateWrapper)

Example 3 with DateWrapper

use of com.extjs.gxt.ui.client.util.DateWrapper in project activityinfo by bedatadriven.

the class MonthlyReportsPanel method addToolBar.

private void addToolBar() {
    toolBar = new ActionToolBar();
    toolBar.setListener(this);
    toolBar.addSaveSplitButton();
    toolBar.add(new LabelToolItem(I18N.CONSTANTS.month() + ": "));
    monthCombo = new MappingComboBox<>();
    monthCombo.setEditable(false);
    monthCombo.addListener(Events.Select, new Listener<FieldEvent>() {

        @Override
        public void handleEvent(FieldEvent be) {
            selectStartMonth(monthCombo.getMappedValue());
        }
    });
    DateWrapper today = new DateWrapper();
    DateTimeFormat monthFormat = DateTimeFormat.getFormat("MMM yyyy");
    for (int year = today.getFullYear() + 2; year != today.getFullYear() - 3; --year) {
        for (int month = 12; month != 0; --month) {
            DateWrapper d = new DateWrapper(year, month, 1);
            Month m = new Month(year, month);
            monthCombo.add(m, monthFormat.format(d.asDate()));
        }
    }
    toolBar.add(monthCombo);
    toolBar.setDirty(false);
    setTopComponent(toolBar);
}
Also used : LabelToolItem(com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem) Month(org.activityinfo.model.type.time.Month) FieldEvent(com.extjs.gxt.ui.client.event.FieldEvent) DateWrapper(com.extjs.gxt.ui.client.util.DateWrapper) ActionToolBar(org.activityinfo.ui.client.page.common.toolbar.ActionToolBar) DateTimeFormat(com.google.gwt.i18n.client.DateTimeFormat)

Example 4 with DateWrapper

use of com.extjs.gxt.ui.client.util.DateWrapper in project activityinfo by bedatadriven.

the class DateUtilGWTImpl method monthRange.

@Override
public DateRange monthRange(int year, int month) {
    DateRange range = new DateRange();
    DateWrapper date = new DateWrapper(year, month - 1, 1);
    range.setMinDate(date.asDate());
    date = date.addMonths(1);
    date = date.addDays(-1);
    range.setMaxDate(date.asDate());
    return range;
}
Also used : DateRange(org.activityinfo.legacy.shared.reports.model.DateRange) DateWrapper(com.extjs.gxt.ui.client.util.DateWrapper)

Example 5 with DateWrapper

use of com.extjs.gxt.ui.client.util.DateWrapper 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()));
}
Also used : DateRange(org.activityinfo.legacy.shared.reports.model.DateRange) DateWrapper(com.extjs.gxt.ui.client.util.DateWrapper)

Aggregations

DateWrapper (com.extjs.gxt.ui.client.util.DateWrapper)8 DateRange (org.activityinfo.legacy.shared.reports.model.DateRange)4 Month (org.activityinfo.model.type.time.Month)2 FieldEvent (com.extjs.gxt.ui.client.event.FieldEvent)1 LabelToolItem (com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem)1 DateTimeFormat (com.google.gwt.i18n.client.DateTimeFormat)1 ActionToolBar (org.activityinfo.ui.client.page.common.toolbar.ActionToolBar)1