@Test public void testSetOnChangeFunction() throws Exception { Date date = new SimpleDateFormat("yyyy-MM-dd").parse("2014-10-01"); DateWidget widget = new DateWidget(); widget.setHidden(true); widget.setInitialValue(date); widget.setDateFormat("yyyy-MM-dd"); widget.setOnChangeFunction("changeFunc"); FormEntryContext formEntryContext = mock(FormEntryContext.class); when(formEntryContext.getFieldName(widget)).thenReturn("w1"); String html = widget.generateHtml(formEntryContext); assertThat(html, is("<input type=\"hidden\" name=\"w1\" id=\"w1\" onChange=\"changeFunc\" value=\"2014-10-01\" />")); }
public void setOnChangeFunction(String onChangeFunction) { this.onChangeFunction = onChangeFunction; }
DateWidget implements Widget { public void setOnChangeFunction(String onChangeFunction) { this.onChangeFunction = onChangeFunction; } }
DateWidget implements Widget { public void setOnChangeFunction(String onChangeFunction) { this.onChangeFunction = onChangeFunction; } DateWidget(); }
DateWidget implements Widget { public void setOnChangeFunction(String onChangeFunction) { this.onChangeFunction = onChangeFunction; } DateWidget(); String getYearsRange(); @Override String generateHtml(FormEntryContext context); @Override Date getValue(FormEntryContext context, HttpServletRequest request); @Override void setInitialValue(Object value); Object getInitialValue(); void setOnChangeFunction(String onChangeFunction); void setDateFormat(String dateFormat); void setHidden(boolean hidden); boolean isHidden(); String getOnChangeFunction(); String getDateFormat(); DateWidget clone(); }
DateWidget implements Widget { public void setOnChangeFunction(String onChangeFunction) { this.onChangeFunction = onChangeFunction; } DateWidget(); String getYearsRange(); @Override String generateHtml(FormEntryContext context); @Override Date getValue(FormEntryContext context, HttpServletRequest request); @Override void setInitialValue(Object value); Object getInitialValue(); void setOnChangeFunction(String onChangeFunction); void setDateFormat(String dateFormat); void setHidden(boolean hidden); boolean isHidden(); String getOnChangeFunction(); String getDateFormat(); DateWidget clone();  }