use of org.apache.tapestry5.ValidationTrackerImpl in project tapestry-5 by apache.
the class AjaxFormUpdateControllerImpl method setupBeforePartialZoneRender.
public void setupBeforePartialZoneRender(MarkupWriter writer) {
if (formComponentId == null)
return;
hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);
actionSink = new ComponentActionSink(logger, clientDataEncoder);
formSupport = createInternalFormSupport(formClientId, formComponentId, actionSink);
environment.push(FormSupport.class, formSupport);
environment.push(ValidationTracker.class, new ValidationTrackerImpl());
heartbeat.begin();
}
use of org.apache.tapestry5.ValidationTrackerImpl in project tapestry-5 by apache.
the class ValidationTrackerImplTest method record_error_for_field.
@Test
public void record_error_for_field() {
Field field = newFieldWithControlName("field");
replay();
ValidationTracker tracker = new ValidationTrackerImpl();
assertFalse(tracker.getHasErrors());
assertFalse(tracker.inError(field));
assertNull(tracker.getError(field));
tracker.recordError(field, "one");
assertTrue(tracker.getHasErrors());
assertTrue(tracker.inError(field));
assertEquals(tracker.getError(field), "one");
tracker.recordError(field, "two");
assertEquals(tracker.getError(field), "two");
verify();
}
use of org.apache.tapestry5.ValidationTrackerImpl in project tapestry-5 by apache.
the class ValidationTrackerImplTest method clear_removes_all.
@Test
public void clear_removes_all() {
Field fielda = newFieldWithControlName("fieldA");
Field fieldb = newFieldWithControlName("fieldB");
replay();
ValidationTracker tracker = new ValidationTrackerImpl();
tracker.recordError("one");
tracker.recordInput(fieldb, "input b");
tracker.recordError(fieldb, "fieldb: two");
tracker.recordError("three");
tracker.recordInput(fielda, "input a");
tracker.recordError(fielda, "fielda: four");
tracker.clear();
assertFalse(tracker.getHasErrors());
assertTrue(tracker.getErrors().isEmpty());
assertNull(tracker.getInput(fielda));
assertNull(tracker.getInput(fieldb));
verify();
}
use of org.apache.tapestry5.ValidationTrackerImpl in project tapestry-5 by apache.
the class ValidationTrackerImplTest method empty_tracker_has_no_errors.
@Test
public void empty_tracker_has_no_errors() {
ValidationTracker tracker = new ValidationTrackerImpl();
assertTrue(tracker.getErrors().isEmpty());
assertFalse(tracker.getHasErrors());
}
use of org.apache.tapestry5.ValidationTrackerImpl in project tapestry-5 by apache.
the class ValidationTrackerImplTest method unsassoicated_errors_listed_first.
@Test
public void unsassoicated_errors_listed_first() {
ValidationTracker tracker = new ValidationTrackerImpl();
Field field = newFieldWithControlName("field");
replay();
tracker.recordError(field, "one");
tracker.recordError("two");
assertEquals(tracker.getErrors(), Arrays.asList("two", "one"));
assertEquals(tracker.getUnassociatedErrors(), Arrays.asList("two"));
verify();
}
Aggregations