/** * Return a time instant representing the current time. */ public static TimeInstant now() { return new TimeInstant(); }
/** * Return a time instant representing the current time. */ public static TimeInstant now() { return new TimeInstant(); }
public TimeInstant cloneInstance() { TimeInstant clone = new TimeInstant(); clone.timeMode = timeMode; clone.intervalType = intervalType; clone.firstMonthOfYear = firstMonthOfYear; if (timeAmount != null) clone.timeAmount = timeAmount.cloneInstance(); return clone; }
@Inject public TimeInstantEditor(View view, TimeAmountEditor timeAmountEditor) { this.timeAmountEditor = timeAmountEditor; this.timeInstant = new TimeInstant(); this.view = view; this.view.init(this); }
public TimeInstant cloneInstance() { TimeInstant clone = new TimeInstant(); clone.timeMode = timeMode; clone.intervalType = intervalType; clone.firstMonthOfYear = firstMonthOfYear; if (timeAmount != null) clone.timeAmount = timeAmount.cloneInstance(); return clone; }
@Inject public TimeInstantEditor(View view, TimeAmountEditor timeAmountEditor) { this.timeAmountEditor = timeAmountEditor; this.timeInstant = new TimeInstant(); this.view = view; this.view.init(this); }
public void init(final TimeInstant ti, final Command onChangeCommand) { this.timeInstant = ti != null ? ti : new TimeInstant(); this.onChangeCommand = onChangeCommand; this.timeAmountEditor.init(timeInstant.getTimeAmount(), new Command() { public void execute() { timeInstant.setTimeAmount(timeAmountEditor.getTimeAmount()); onChangeCommand.execute(); } }); initTimeModeSelector(); initIntervalTypeSelector(); }
public void init(final TimeInstant ti, final Command onChangeCommand) { this.timeInstant = ti != null ? ti : new TimeInstant(); this.onChangeCommand = onChangeCommand; this.timeAmountEditor.init(timeInstant.getTimeAmount(), new Command() { public void execute() { timeInstant.setTimeAmount(timeAmountEditor.getTimeAmount()); onChangeCommand.execute(); } }); initTimeModeSelector(); initIntervalTypeSelector(); }
throw new IllegalArgumentException("Empty time instant expression"); TimeInstant instant = new TimeInstant(); String expr = timeInstantExpr.toLowerCase().trim();
throw new IllegalArgumentException("Empty time instant expression"); TimeInstant instant = new TimeInstant(); String expr = timeInstantExpr.toLowerCase().trim();
@Test public void testViewInitialization() { TimeInstant beginMonth = new TimeInstant(TimeInstant.TimeMode.BEGIN, DateIntervalType.MONTH, Month.JANUARY, new TimeAmount(10, DateIntervalType.DAY)); TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor); timeInstantEditor.init(beginMonth, changeCommand); assertEquals(timeInstantView, timeInstantEditor.view); verify(timeInstantView).init(timeInstantEditor); verify(timeInstantView).clearTimeModeSelector(); verify(timeInstantView, times(TimeInstant.TimeMode.values().length)).addTimeModeItem(any(TimeInstant.TimeMode.class)); verify(timeInstantView).setSelectedTimeModeIndex(TimeInstant.TimeMode.BEGIN.getIndex()); verify(timeInstantView).enableIntervalTypeSelector(); verify(timeInstantView).clearIntervalTypeSelector(); verify(timeInstantView, times(TimeInstantEditor.INTERVAL_TYPES.size())).addIntervalTypeItem(any(DateIntervalType.class)); verify(timeInstantView).setSelectedIntervalTypeIndex(3); }
@Test public void testViewInitialization() { TimeInstant beginMonth = new TimeInstant(TimeInstant.TimeMode.BEGIN, DateIntervalType.MONTH, Month.JANUARY, new TimeAmount(10, DateIntervalType.DAY)); TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor); timeInstantEditor.init(beginMonth, changeCommand); assertEquals(timeInstantView, timeInstantEditor.view); verify(timeInstantView).init(timeInstantEditor); verify(timeInstantView).clearTimeModeSelector(); verify(timeInstantView, times(TimeInstant.TimeMode.values().length)).addTimeModeItem(any(TimeInstant.TimeMode.class)); verify(timeInstantView).setSelectedTimeModeIndex(TimeInstant.TimeMode.BEGIN.getIndex()); verify(timeInstantView).enableIntervalTypeSelector(); verify(timeInstantView).clearIntervalTypeSelector(); verify(timeInstantView, times(TimeInstantEditor.INTERVAL_TYPES.size())).addIntervalTypeItem(any(DateIntervalType.class)); verify(timeInstantView).setSelectedIntervalTypeIndex(3); }