Package org.apache.tapestry.form

Examples of org.apache.tapestry.form.IFormComponent


                + ".", e.getMessage());
    }

    private void negativeTest(String input)
    {
        IFormComponent field = newField("PatternField");

        replayControls();

        try
        {
View Full Code Here


    public void testMalformedPattern() throws ValidatorException
    {
        Location l = fabricateLocation(11);

        MockControl control = newControl(IFormComponent.class);
        IFormComponent field = (IFormComponent) control.getMock();

        field.getDisplayName();
        control.setReturnValue("badPattern");

        field.getLocation();
        control.setReturnValue(l);

        replayControls();

        pv.setPatternString("^(\\d{5}(-\\d{4})?$");
View Full Code Here

        verifyControls();
    }

    public void testOverridePatternNotMatchedMessage()
    {
        IFormComponent field = newField("PatternField");
        replayControls();

        pv.setPatternNotMatchedMessage("Field: {0}, Pattern: {1}, you figure!");
        pv.setPatternString("^(\\d{5}(-\\d{4})?)$");
View Full Code Here

    protected IFormComponent newField(String displayName, Locale locale, int count)
    {
        IPage page = newPage(locale, count);

        MockControl control = newControl(IFormComponent.class);
        IFormComponent component = (IFormComponent) control.getMock();

        for (int i = 0; i < count; i++)
        {
            component.getPage();
            control.setReturnValue(page);

            component.getDisplayName();
            control.setReturnValue(displayName);
        }

        return component;
    }
View Full Code Here

{
    private StringValidator v = new StringValidator();

    public void testToString()
    {
        IFormComponent field = newField();

        replayControls();

        String in = "Foo";
        String out = v.toString(field, in);
View Full Code Here

        verifyControls();
    }

    public void testToStringNull()
    {
        IFormComponent field = newField();

        replayControls();

        String out = v.toString(field, null);
View Full Code Here

        verifyControls();
    }

    public void testToObjectRequiredFail()
    {
        IFormComponent field = newField("requiredField");

        replayControls();

        v.setRequired(true);
View Full Code Here

        verifyControls();
    }

    public void testOverrideRequiredMessage()
    {
        IFormComponent field = newField("overrideMessage");

        replayControls();

        v.setRequired(true);
        v.setRequiredMessage("Gimme a value for {0} you bastard.");
View Full Code Here

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        if (cycle.isRewinding())
            return;

        IFormComponent field = getField();
        String displayName = getDisplayName();

        if (displayName == null)
        {
            if (field == null)
                throw Tapestry.createRequiredParameterException(this, "field");

            displayName = field.getDisplayName();

            if (displayName == null)
            {
                String msg = Tapestry.format("FieldLabel.no-display-name", field.getExtendedId());

                throw new BindingException(msg, this, null, getBinding("field"), null);
            }
        }
View Full Code Here

        expect(form.getDelegate()).andReturn(delegate);
    }
   
    private IFormComponent newField(String displayName, String clientId)
    {
        IFormComponent field = newMock(IFormComponent.class);
        checkOrder(field, false);
       
        trainGetDisplayName(field, displayName);

        trainGetClientId(clientId, field);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.form.IFormComponent

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.