@Test public void testMakeOnCreationCallback() { final DatePickerDOMElement datePickerDomElement = mock(DatePickerDOMElement.class); final DatePicker datePickerWidget = mock(DatePicker.class); final String serverDate = "05-01-2018 06:00:00 +0300"; final String dateConvertedFromServerTimezone = "05-01-2018 00:00:00 -0300"; final Consumer<SingleValueDOMElement<Date, DatePicker>> callback = ConsumerFactory.makeOnCreationCallback(makeGridCell(asDate(serverDate))); when(datePickerDomElement.getWidget()).thenReturn(datePickerWidget); callback.accept(datePickerDomElement); verify(datePickerWidget).setValue(asDate(dateConvertedFromServerTimezone)); }
public static <T, W extends TextBox, E extends SingleValueDOMElement<T, W>, F extends SingleValueSingletonDOMElementFactory<T, W, E>> Consumer<E> makeOnCreationCallback(final F factory, final GridCell<T> cell) { return (e) -> { if (hasValue(cell)) { e.getWidget().setValue(factory.convert(cell.getValue().getValue())); } else { e.getWidget().setValue(""); } }; }
ConsumerFactory { public static <T, W extends TextBox, E extends SingleValueDOMElement<T, W>, F extends SingleValueSingletonDOMElementFactory<T, W, E>> Consumer<E> makeOnCreationCallback(final F factory, final GridCell<T> cell) { return (e) -> { if (hasValue(cell)) { e.getWidget().setValue(factory.convert(cell.getValue().getValue())); } else { e.getWidget().setValue(""); } }; } }
ConsumerFactory { public static <T, W extends TextBox, E extends SingleValueDOMElement<T, W>, F extends SingleValueSingletonDOMElementFactory<T, W, E>> Consumer<E> makeOnCreationCallback(final F factory, final GridCell<T> cell) { return (e) -> { if (hasValue(cell)) { e.getWidget().setValue(factory.convert(cell.getValue().getValue())); } else { e.getWidget().setValue(""); } }; }  }
ConsumerFactory { public static <T, W extends TextBox, E extends SingleValueDOMElement<T, W>, F extends SingleValueSingletonDOMElementFactory<T, W, E>> Consumer<E> makeOnCreationCallback(final F factory, final GridCell<T> cell) { return (e) -> { if (hasValue(cell)) { e.getWidget().setValue(factory.convert(cell.getValue().getValue())); } else { e.getWidget().setValue(""); } }; }  static Consumer<E> makeOnCreationCallback(final F factory,
                                                                                                                                                                             final GridCell<T> cell); static Consumer<E> makeOnDisplayTextBoxCallback(); static Consumer<E> makeOnCreationCallback(final F factory,
                                                                                                                                                                           final GridCell<T> cell,
                                                                                                                                                                           final Map<String, String> enumLookups); static Consumer<E> makeOnDisplayListBoxCallback(); static Consumer<E> makeOnCreationCallback(final GridCell<Date> cell); static Consumer<E> makeOnDisplayDatePickerCallback(); }
ConsumerFactory { public static <T, W extends TextBox, E extends SingleValueDOMElement<T, W>, F extends SingleValueSingletonDOMElementFactory<T, W, E>> Consumer<E> makeOnCreationCallback(final F factory, final GridCell<T> cell) { return (e) -> { if (hasValue(cell)) { e.getWidget().setValue(factory.convert(cell.getValue().getValue())); } else { e.getWidget().setValue(""); } }; }  static Consumer<E> makeOnCreationCallback(final F factory,
                                                                                                                                                                             final GridCell<T> cell); static Consumer<E> makeOnDisplayTextBoxCallback(); static Consumer<E> makeOnCreationCallback(final F factory,
                                                                                                                                                                           final GridCell<T> cell,
                                                                                                                                                                           final Map<String, String> enumLookups); static Consumer<E> makeOnDisplayListBoxCallback(); static Consumer<E> makeOnCreationCallback(final GridCell<Date> cell); static Consumer<E> makeOnDisplayDatePickerCallback();  }