@Test public void testNullInitialization() { TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor); timeInstantEditor.init(null, 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.NOW.getIndex()); verify(timeInstantView).disableIntervalTypeSelector(); verify(timeInstantView, never()).clearIntervalTypeSelector(); verify(timeInstantView, never()).enableIntervalTypeSelector(); verify(timeInstantView, never()).addIntervalTypeItem(any(DateIntervalType.class)); verify(timeInstantView, never()).setSelectedIntervalTypeIndex(any(Integer.class)); }
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(); }
TimeInstantEditor implements IsWidget { 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(); } }
TimeInstantEditor implements IsWidget { 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(); } @Inject  TimeInstantEditor(View view, TimeAmountEditor timeAmountEditor); }
TimeInstantEditor implements IsWidget { 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(); } @Inject  TimeInstantEditor(View view, TimeAmountEditor timeAmountEditor); @Override Widget asWidget(); TimeInstant getTimeInstant(); void init(final TimeInstant ti, final Command onChangeCommand); TimeAmountEditor getTimeAmountEditor(); }
TimeInstantEditor implements IsWidget { 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(); } @Inject  TimeInstantEditor(View view, TimeAmountEditor timeAmountEditor); @Override Widget asWidget(); TimeInstant getTimeInstant(); void init(final TimeInstant ti, final Command onChangeCommand); TimeAmountEditor getTimeAmountEditor();  }