Examples of IValidationDelegate


Examples of org.apache.tapestry.valid.IValidationDelegate

    @InjectPage("MyLibrary")
    public abstract MyLibrary getMyLibrary();

    public void addBook()
    {
        IValidationDelegate delegate = getValidationDelegate();

        Map attributes = getAttributes();

        Integer publisherId = (Integer) attributes.get("publisherId");
        String publisherName = getPublisherName();

        if (publisherId == null && HiveMind.isBlank(publisherName))
        {
            delegate.record(getPublisherNameField(), needPublisherName());
            return;
        }

        if (publisherId != null && HiveMind.isNonBlank(publisherName))
        {
            delegate.record(getPublisherNameField(), leavePublisherNameEmpty());
            return;
        }

        if (isInError())
            return;
View Full Code Here

Examples of org.apache.tapestry.valid.IValidationDelegate

    @InjectPage("Login")
    public abstract Login getLogin();

    private void clear(IFormComponent field)
    {
        IValidationDelegate delegate = getValidationDelegate();

        delegate.setFormComponent(field);
        delegate.recordFieldInputValue(null);
    }
View Full Code Here

Examples of org.apache.tapestry.valid.IValidationDelegate

        delegate.recordFieldInputValue(null);
    }

    public void attemptRegister()
    {
        IValidationDelegate delegate = getValidationDelegate();

        String password1 = getPassword1();
        String password2 = getPassword2();

        setPassword1(null);
        setPassword2(null);

        clear(getPassword1Field());
        clear(getPassword1Field());

        if (delegate.getHasErrors())
            return;

        // Note: we know password1 and password2 are not null
        // because they are required fields.

        if (!password1.equals(password2))
        {
            delegate.record(getPassword1Field(), passwordMustMatch());
            return;
        }

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        Login login = getLogin();
View Full Code Here

Examples of org.apache.tapestry.valid.IValidationDelegate

        String password = getPassword();

        // Do a little extra work to clear out the password.

        setPassword(null);
        IValidationDelegate delegate = getValidationDelegate();

        delegate.setFormComponent(getPasswordField());
        delegate.recordFieldInputValue(null);

        // An error, from a validation field, may already have occured.

        if (delegate.getHasErrors())
            return;

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

        int i = 0;
View Full Code Here

Examples of org.apache.tapestry.valid.IValidationDelegate

        setForm(form);

        if (form.wasPrerendered(writer, this))
            return;

        IValidationDelegate delegate = form.getDelegate();

        delegate.setFormComponent(this);

        form.getElementId(this);

        if (form.isRewinding())
        {
            if (!isDisabled())
            {
                rewindFormComponent(writer, cycle);
            }
        }
        else if (!cycle.isRewinding())
        {
            if (!isDisabled())
                delegate.registerForFocus(this, ValidationConstants.NORMAL_FIELD);

            renderFormComponent(writer, cycle);

            if (delegate.isInError())
                delegate.registerForFocus(this, ValidationConstants.ERROR_FIELD);
        }

        super.renderComponent(writer, cycle);
    }
View Full Code Here

Examples of org.apache.tapestry.valid.IValidationDelegate

        String password2 = getPassword2();

        setPassword1(null);
        setPassword2(null);

        IValidationDelegate delegate = getValidationDelegate();

        delegate.setFormComponent(getPassword1Field());
        delegate.recordFieldInputValue(null);

        delegate.setFormComponent(getPassword2Field());
        delegate.recordFieldInputValue(null);

        if (delegate.getHasErrors())
            return;

        Map attributes = getAttributes();

        if (HiveMind.isBlank(password1) != HiveMind.isBlank(password2))
        {
            delegate.record(getPassword1Field(), enterPasswordTwice());

            return;
        }

        if (HiveMind.isNonBlank(password1))
        {
            if (!password1.equals(password2))
            {
                delegate.record(getPassword1Field(), passwordMustMatch());
                return;
            }

            attributes.put("password", password1);
        }
View Full Code Here

Examples of org.apache.tapestry.valid.IValidationDelegate

        cycle.removeAttribute(ATTRIBUTE_NAME);

        _encodingType = null;

        IValidationDelegate delegate = getDelegate();

        if (delegate != null)
            delegate.setFormComponent(null);

        super.cleanupAfterRender(cycle);
    }
View Full Code Here

Examples of org.apache.tapestry.valid.IValidationDelegate

                null,
                null);

        setForm(result);

        IValidationDelegate delegate = result.getDelegate();

        if (delegate != null)
            delegate.setFormComponent(this);

        return result;
    }
View Full Code Here

Examples of org.apache.tapestry.valid.IValidationDelegate

    {
        _formSupport = null;

        TapestryUtils.removeForm(cycle);

        IValidationDelegate delegate = getDelegate();

        if (delegate != null)
            delegate.setFormComponent(null);

        super.cleanupAfterRender(cycle);
    }
View Full Code Here

Examples of org.apache.tapestry.valid.IValidationDelegate

        _threadLocale = threadLocale;
    }

    public String format(TranslatedField field, Object object)
    {
        IValidationDelegate delegate = field.getForm().getDelegate();

        return delegate.isInError() ? delegate.getFieldInputValue() : field.getTranslator().format(
                field,
                _threadLocale.getLocale(),
                object);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.