@Test public void testStartEditing() { final Cell.Context context = mock(Cell.Context.class); final Element parent = mock(Element.class); final Date expectedDate = makeDate("04-01-2018"); cell.startEditing(context, parent, expectedDate); verify(datePicker).setValue(dateCaptor.capture()); final Date actualDate = dateCaptor.getValue(); assertEquals(expectedDate, actualDate); }
@Override @SuppressWarnings("deprecation") protected void startEditing(final Context context, final Element parent, final Date value) { Date date = value; if (value == null) { Date d = new Date(); int year = d.getYear(); int month = d.getMonth(); int dom = d.getDate(); date = new Date(year, month, dom); } getDatePicker().setValue(date); panel.setPopupPositionAndShow(new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { panel.setPopupPosition(parent.getAbsoluteLeft() + offsetX, parent.getAbsoluteTop() + offsetY); } }); }
PopupDateEditCell extends AbstractPopupEditCell<Date, Date> { @Override @SuppressWarnings("deprecation") protected void startEditing(final Context context, final Element parent, final Date value) { Date date = value; if (value == null) { Date d = new Date(); int year = d.getYear(); int month = d.getMonth(); int dom = d.getDate(); date = new Date(year, month, dom); } getDatePicker().setValue(date); panel.setPopupPositionAndShow(new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { panel.setPopupPosition(parent.getAbsoluteLeft() + offsetX, parent.getAbsoluteTop() + offsetY); } }); } }
PopupDateEditCell extends AbstractPopupEditCell<Date, Date> { @Override @SuppressWarnings("deprecation") protected void startEditing(final Context context, final Element parent, final Date value) { Date date = value; if (value == null) { Date d = new Date(); int year = d.getYear(); int month = d.getMonth(); int dom = d.getDate(); date = new Date(year, month, dom); } getDatePicker().setValue(date); panel.setPopupPositionAndShow(new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { panel.setPopupPosition(parent.getAbsoluteLeft() + offsetX, parent.getAbsoluteTop() + offsetY); } }); } PopupDateEditCell(final boolean isReadOnly); }
PopupDateEditCell extends AbstractPopupEditCell<Date, Date> { @Override @SuppressWarnings("deprecation") protected void startEditing(final Context context, final Element parent, final Date value) { Date date = value; if (value == null) { Date d = new Date(); int year = d.getYear(); int month = d.getMonth(); int dom = d.getDate(); date = new Date(year, month, dom); } getDatePicker().setValue(date); panel.setPopupPositionAndShow(new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { panel.setPopupPosition(parent.getAbsoluteLeft() + offsetX, parent.getAbsoluteTop() + offsetY); } }); } PopupDateEditCell(final boolean isReadOnly); @Override void render(Context context,
                       Date value,
                       SafeHtmlBuilder sb); }
PopupDateEditCell extends AbstractPopupEditCell<Date, Date> { @Override @SuppressWarnings("deprecation") protected void startEditing(final Context context, final Element parent, final Date value) { Date date = value; if (value == null) { Date d = new Date(); int year = d.getYear(); int month = d.getMonth(); int dom = d.getDate(); date = new Date(year, month, dom); } getDatePicker().setValue(date); panel.setPopupPositionAndShow(new PositionCallback() { public void setPosition(int offsetWidth, int offsetHeight) { panel.setPopupPosition(parent.getAbsoluteLeft() + offsetX, parent.getAbsoluteTop() + offsetY); } }); } PopupDateEditCell(final boolean isReadOnly); @Override void render(Context context,
                       Date value,
                       SafeHtmlBuilder sb);  }