protected FunctionParameterEditor createTimeFrameWidget(final List paramList, final int paramIndex) { TimeFrame timeFrame = TimeFrame.parse((String) paramList.get(paramIndex)); final TimeFrameEditor input = beanManager.lookupBean(TimeFrameEditor.class).newInstance(); input.init(timeFrame, new Command() { public void execute() { paramList.set(paramIndex, input.getTimeFrame().toString()); updateSelectedFilter(); } }); return input; }
protected void changeFirstMonthAvailability() { view.hideFirstMonthSelector(); if (isFirstMonthAvailable()) { view.showFirstMonthSelector(); } }
@UiHandler(value = "firstMonthList") public void onFirstMonthSelected(ChangeEvent changeEvent) { presenter.changeFirstMonth(); } }
@Override public void init(TimeFrameEditor presenter) { this.presenter = presenter; fromEditor = presenter.getFromEditor(); toEditor = presenter.getToEditor(); initWidget(uiBinder.createAndBindUi(this)); }
public void changeFirstMonth() { int selectedIdx = view.getSelectedFirstMonthIndex(); Month month = Month.getByIndex(selectedIdx + 1); setFirstMonthOfYear(month); fireChanges(); }
public void execute() { fromEditor.getTimeInstant().setFirstMonthOfYear(getFirstMonthOfYear()); timeFrame.setFrom(fromEditor.getTimeInstant()); changeFirstMonthAvailability(); fireChanges(); } });
@Test public void testFirstMonthAvailable() { timeFrameEditor.init(CURRENT_YEAR, changeCommand); assertEquals(timeFrameEditor.isFirstMonthAvailable(), true); }
public void init(TimeFrame tf, Command onChangeCommand) { this.onChangeCommand = onChangeCommand; this.timeFrame = tf != null ? tf : TimeFrame.parse("begin[year] till end[year]"); this.fromEditor = beanManager.lookupBean(TimeInstantEditor.class).newInstance(); this.fromEditor.init(timeFrame.getFrom(), new Command() { public void execute() { fromEditor.getTimeInstant().setFirstMonthOfYear(getFirstMonthOfYear()); timeFrame.setFrom(fromEditor.getTimeInstant()); changeFirstMonthAvailability(); fireChanges(); } }); this.toEditor = beanManager.lookupBean(TimeInstantEditor.class).newInstance(); this.toEditor.init(timeFrame.getTo(), new Command() { public void execute() { toEditor.getTimeInstant().setFirstMonthOfYear(getFirstMonthOfYear()); timeFrame.setTo(toEditor.getTimeInstant()); changeFirstMonthAvailability(); fireChanges(); } }); view.init(this); initFirstMonthSelector(); changeFirstMonthAvailability(); }
protected void initFirstMonthSelector() { view.clearFirstMonthSelector(); Month current = getFirstMonthOfYear(); Month[] entries = Month.values(); for (int i = 0; i < entries.length; i++) { Month entry = entries[i]; view.addFirstMonthItem(entry); if (current != null && current.equals(entry)) { view.setSelectedFirstMonthIndex(i); } } }
@Before public void init() { fromAmountEditor = new TimeAmountEditor(timeAmountView); toAmountEditor = new TimeAmountEditor(timeAmountView); fromInstantEditor = new TimeInstantEditor(timeInstantView, fromAmountEditor); toInstantEditor = new TimeInstantEditor(timeInstantView, toAmountEditor); timeFrameEditor = new TimeFrameEditor(timeFrameView, beanManager); SyncBeanDef tieBeanDef = mock(SyncBeanDef.class); when(beanManager.lookupBean(TimeInstantEditor.class)).thenReturn(tieBeanDef); when(tieBeanDef.newInstance()).thenReturn(fromInstantEditor, toInstantEditor); }
public void execute() { paramList.set(paramIndex, input.getTimeFrame().toString()); updateSelectedFilter(); } });
@Test public void testFirstMonthAvailable() { timeFrameEditor.init(CURRENT_YEAR, changeCommand); assertEquals(timeFrameEditor.isFirstMonthAvailable(), true); }
public void execute() { toEditor.getTimeInstant().setFirstMonthOfYear(getFirstMonthOfYear()); timeFrame.setTo(toEditor.getTimeInstant()); changeFirstMonthAvailability(); fireChanges(); } });
@Override public void init(TimeFrameEditor presenter) { this.presenter = presenter; fromEditor = presenter.getFromEditor(); toEditor = presenter.getToEditor(); initWidget(uiBinder.createAndBindUi(this)); }
public void changeFirstMonth() { int selectedIdx = view.getSelectedFirstMonthIndex(); Month month = Month.getByIndex(selectedIdx + 1); setFirstMonthOfYear(month); fireChanges(); }
public void init(TimeFrame tf, Command onChangeCommand) { this.onChangeCommand = onChangeCommand; this.timeFrame = tf != null ? tf : TimeFrame.parse("begin[year] till end[year]"); this.fromEditor = beanManager.lookupBean(TimeInstantEditor.class).newInstance(); this.fromEditor.init(timeFrame.getFrom(), new Command() { public void execute() { fromEditor.getTimeInstant().setFirstMonthOfYear(getFirstMonthOfYear()); timeFrame.setFrom(fromEditor.getTimeInstant()); changeFirstMonthAvailability(); fireChanges(); } }); this.toEditor = beanManager.lookupBean(TimeInstantEditor.class).newInstance(); this.toEditor.init(timeFrame.getTo(), new Command() { public void execute() { toEditor.getTimeInstant().setFirstMonthOfYear(getFirstMonthOfYear()); timeFrame.setTo(toEditor.getTimeInstant()); changeFirstMonthAvailability(); fireChanges(); } }); view.init(this); initFirstMonthSelector(); changeFirstMonthAvailability(); }
protected void initFirstMonthSelector() { view.clearFirstMonthSelector(); Month current = getFirstMonthOfYear(); Month[] entries = Month.values(); for (int i = 0; i < entries.length; i++) { Month entry = entries[i]; view.addFirstMonthItem(entry); if (current != null && current.equals(entry)) { view.setSelectedFirstMonthIndex(i); } } }
@Before public void init() { fromAmountEditor = new TimeAmountEditor(timeAmountView); toAmountEditor = new TimeAmountEditor(timeAmountView); fromInstantEditor = new TimeInstantEditor(timeInstantView, fromAmountEditor); toInstantEditor = new TimeInstantEditor(timeInstantView, toAmountEditor); timeFrameEditor = new TimeFrameEditor(timeFrameView, beanManager); SyncBeanDef tieBeanDef = mock(SyncBeanDef.class); when(beanManager.lookupBean(TimeInstantEditor.class)).thenReturn(tieBeanDef); when(tieBeanDef.newInstance()).thenReturn(fromInstantEditor, toInstantEditor); }
public void execute() { paramList.set(paramIndex, input.getTimeFrame().toString()); updateSelectedFilter(); } });
@Test public void testFirstMonthUnavailable() { timeFrameEditor.init(LAST_DAY, changeCommand); assertEquals(timeFrameEditor.isFirstMonthAvailable(), false); } }