public IntervalListMonth(ColumnGroup columnGroup) { super(columnGroup); intervalMap = new HashMap<Integer, Interval>(); Month firstMonth = columnGroup.getFirstMonthOfYear(); int monthIndex = firstMonth.getIndex(); Month[] months = Month.getAll(); for (int i = 0; i < months.length; i++) { Month month = months[monthIndex-1]; Interval interval = new Interval(Integer.toString(month.getIndex()), i); interval.setType(columnGroup.getIntervalSize()); this.add(interval); intervalMap.put(monthIndex-1, interval); monthIndex = Month.nextIndex(monthIndex); } }
int firstMonthYear = columnGroup.getFirstMonthOfYear().getIndex(); int rest = Quarter.getPositionInQuarter(firstMonthYear, currentMonth + 1); c.add(Calendar.MONTH, rest * -1);
public IntervalListQuarter(ColumnGroup columnGroup) { super(columnGroup); intervalMap = new HashMap<Integer, Interval>(); Month firstMonth = columnGroup.getFirstMonthOfYear(); int monthIndex = firstMonth.getIndex(); for (int i = 0; i < 4; i++) { Quarter quarter = Quarter.getByIndex(i+1); Interval interval = new Interval((Integer.toString(quarter.getIndex())), i); interval.setType(columnGroup.getIntervalSize()); this.add(interval); for (int j = 0; j < 3; j++) { intervalMap.put(monthIndex-1, interval); monthIndex = Month.nextIndex(monthIndex); } } }
@Test public void testViewInitialization() { timeFrameEditor.init(TEN_DAYS, changeCommand); assertEquals(timeFrameView, timeFrameEditor.view); verify(timeFrameView).init(timeFrameEditor); verify(timeFrameView).clearFirstMonthSelector(); verify(timeFrameView, times(Month.values().length)).addFirstMonthItem(any(Month.class)); verify(timeFrameView).setSelectedFirstMonthIndex(Month.MARCH.getIndex() - 1); }
@Test public void testNullInitialization() { timeFrameEditor.init(UNDEFINED, changeCommand); assertEquals(timeFrameView, timeFrameEditor.view); verify(timeFrameView).init(timeFrameEditor); verify(timeFrameView).clearFirstMonthSelector(); verify(timeFrameView, times(Month.values().length)).addFirstMonthItem(any(Month.class)); verify(timeFrameView).setSelectedFirstMonthIndex(Month.JANUARY.getIndex() - 1); }
@Test public void testViewInitialization() { timeFrameEditor.init(TEN_DAYS, changeCommand); assertEquals(timeFrameView, timeFrameEditor.view); verify(timeFrameView).init(timeFrameEditor); verify(timeFrameView).clearFirstMonthSelector(); verify(timeFrameView, times(Month.values().length)).addFirstMonthItem(any(Month.class)); verify(timeFrameView).setSelectedFirstMonthIndex(Month.MARCH.getIndex() - 1); }
@Test public void testNullInitialization() { timeFrameEditor.init(UNDEFINED, changeCommand); assertEquals(timeFrameView, timeFrameEditor.view); verify(timeFrameView).init(timeFrameEditor); verify(timeFrameView).clearFirstMonthSelector(); verify(timeFrameView, times(Month.values().length)).addFirstMonthItem(any(Month.class)); verify(timeFrameView).setSelectedFirstMonthIndex(Month.JANUARY.getIndex() - 1); }
int inc = TimeMode.END.equals(timeMode) ? 1 : 0; startDate.setYear((base + inc) * 1000); startDate.setMonth(firstMonthOfYear.getIndex()-1); startDate.setDate(1); startDate.setHours(0); int inc = TimeMode.END.equals(timeMode) ? 1 : 0; startDate.setYear((base + inc) * 100); startDate.setMonth(firstMonthOfYear.getIndex()-1); startDate.setDate(1); startDate.setHours(0); int inc = TimeMode.END.equals(timeMode) ? 1 : 0; startDate.setYear((base + inc) * 10); startDate.setMonth(firstMonthOfYear.getIndex()-1); startDate.setDate(1); startDate.setHours(0); int firstMonth = firstMonthOfYear.getIndex()-1; int yearInc = 0; if (TimeMode.BEGIN.equals(timeMode)) yearInc = month < firstMonth ? -1 : 0; int firstMonth = Quarter.getQuarterFirstMonth(firstMonthOfYear.getIndex(), month + 1)-1; int yearInc = 0; int monthInc = 3;
int inc = TimeMode.END.equals(timeMode) ? 1 : 0; startDate.setYear((base + inc) * 1000); startDate.setMonth(firstMonthOfYear.getIndex()-1); startDate.setDate(1); startDate.setHours(0); int inc = TimeMode.END.equals(timeMode) ? 1 : 0; startDate.setYear((base + inc) * 100); startDate.setMonth(firstMonthOfYear.getIndex()-1); startDate.setDate(1); startDate.setHours(0); int inc = TimeMode.END.equals(timeMode) ? 1 : 0; startDate.setYear((base + inc) * 10); startDate.setMonth(firstMonthOfYear.getIndex()-1); startDate.setDate(1); startDate.setHours(0); int firstMonth = firstMonthOfYear.getIndex()-1; int yearInc = 0; if (TimeMode.BEGIN.equals(timeMode)) yearInc = month < firstMonth ? -1 : 0; int firstMonth = Quarter.getQuarterFirstMonth(firstMonthOfYear.getIndex(), month + 1)-1; int yearInc = 0; int monthInc = 3;
int firstMonthYear = columnGroup.getFirstMonthOfYear().getIndex(); int rest = Quarter.getPositionInQuarter(firstMonthYear, currentMonth + 1); intervalMinDate.setMonth(currentMonth - rest);
int firstMonthYear = columnGroup.getFirstMonthOfYear().getIndex(); int rest = Quarter.getPositionInQuarter(firstMonthYear, currentMonth + 1); intervalMinDate.setMonth(currentMonth - rest);