Package org.apache.tapestry5

Examples of org.apache.tapestry5.ValidationTrackerImpl$FieldTracker


     * @return a tracker ready to receive data (possibly a previously stored tracker with field
     *         input and errors)
     */
    private ValidationTracker getWrappedTracker()
    {
        ValidationTracker innerTracker = tracker == null ? new ValidationTrackerImpl() : tracker;

        ValidationTracker wrapper = new ValidationTrackerWrapper(innerTracker)
        {
            private boolean saved = false;

View Full Code Here


public class ValidationTrackerImplTest extends TapestryTestCase
{
    @Test
    public void empty_tracker_has_no_errors()
    {
        ValidationTracker tracker = new ValidationTrackerImpl();

        assertTrue(tracker.getErrors().isEmpty());
        assertFalse(tracker.getHasErrors());
    }
View Full Code Here

        Field fielda = newFieldWithControlName("fieldA");
        Field fieldb = newFieldWithControlName("fieldB");

        replay();

        ValidationTracker tracker = new ValidationTrackerImpl();

        tracker.recordError("one");
        tracker.recordError(fieldb, "fieldb: two");
        tracker.recordError("three");
        tracker.recordError(fielda, "fielda: four");

        assertEquals(tracker.getErrors(), Arrays.asList(
                "one",
                "three",
                "fieldb: two",
                "fielda: four"));
View Full Code Here

    {
        Field field = newFieldWithControlName("field");

        replay();

        ValidationTracker tracker = new ValidationTrackerImpl();

        assertNull(tracker.getInput(field));

        tracker.recordInput(field, "one");

        assertEquals(tracker.getInput(field), "one");

        tracker.recordInput(field, "two");

        assertEquals(tracker.getInput(field), "two");

        verify();
    }
View Full Code Here

    {
        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();
    }
View Full Code Here

    }

    @Test
    public void record_error_for_form()
    {
        ValidationTracker tracker = new ValidationTrackerImpl();

        assertFalse(tracker.getHasErrors());

        assertTrue(tracker.getErrors().isEmpty());

        tracker.recordError("one");

        assertEquals(tracker.getErrors(), Arrays.asList("one"));

        tracker.recordError("two");

        assertEquals(tracker.getErrors(), Arrays.asList("one", "two"));
    }
View Full Code Here

        Field fieldb = newFieldWithControlName("fieldB");
        Field fieldc = newFieldWithControlName("fieldC");

        replay();

        ValidationTracker tracker = new ValidationTrackerImpl();

        tracker.recordError("one");
        tracker.recordError(fieldb, "fieldb: two");
        tracker.recordError("three");
        tracker.recordError(fielda, "fielda: four");

        ValidationTracker copy = cloneBySerialiation(tracker);

        copy.recordError(fieldc, "fieldc: five");
View Full Code Here

        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();
    }
View Full Code Here

        actionSink = new ComponentActionSink(logger, clientDataEncoder);

        formSupport = createInternalFormSupport(formClientId, formComponentId, actionSink);

        environment.push(FormSupport.class, formSupport);
        environment.push(ValidationTracker.class, new ValidationTrackerImpl());

        heartbeat.begin();
    }
View Full Code Here

        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();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ValidationTrackerImpl$FieldTracker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.