public DateTimeWidget() { // create the Date and Time widgets dateWidget = new DateWidget(); timeWidget = new TimeWidget(); }
@Test public void testHidden() throws Exception { Date date = new SimpleDateFormat("HH:mm:ss").parse("18:09:35"); TimeWidget widget = new TimeWidget(); widget.setHidden(true); widget.setInitialValue(date); FormEntryContext formEntryContext = mock(FormEntryContext.class); when(formEntryContext.getFieldName(widget)).thenReturn("w1"); String html = widget.generateHtml(formEntryContext); assertTrue(html.contains("<input type=\"hidden\" class=\"hfe-hours\" name=\"w1hours\" value=\"18\"/>")); assertTrue(html.contains("<input type=\"hidden\" class=\"hfe-minutes\" name=\"w1minutes\" value=\"09\"/>")); assertTrue(html.contains("<input type=\"hidden\" class=\"hfe-seconds\" name=\"w1seconds\" value=\"35\"/>")); }
valueWidget = new DateWidget(); } else if (ConceptDatatype.TIME.equals(concept.getDatatype().getHl7Abbreviation())) { valueWidget = new TimeWidget(); if(hideSeconds){ ((TimeWidget) valueWidget).setHideSeconds(true); timeWidget = new TimeWidget(); if(hideSeconds){ timeWidget.setHideSeconds(true);
timeWidget = new TimeWidget(); timeErrorWidget = new ErrorWidget(); if (context.getExistingEncounter() != null) {
@Test public void testTimeFormat() throws Exception { Date date = new SimpleDateFormat("HH:mm:ss").parse("18:09:35"); TimeWidget widget = new TimeWidget(); widget.setInitialValue(date); // Test default if GP is missing setGlobalProperty(""); testTimeFormat(widget, "18:09"); // Test specific GP value setGlobalProperty("h:mm a"); testTimeFormat(widget, "6:09 PM"); // Test specific widget value widget.setTimeFormat("mm.ss"); testTimeFormat(widget, "09.35"); }