Package org.apache.tapestry

Examples of org.apache.tapestry.Field


    @SuppressWarnings("unchecked")
    @Test
    public void nonmatching_value_type_skipped() throws Exception
    {
        Field field = newField();
        MessageFormatter formatter = newMessageFormatter();
        Validator validator = newValidator();
        Integer value = 15;

        train_invokeIfBlank(validator, true);
View Full Code Here


    @SuppressWarnings("unchecked")
    @Test
    public void value_type_check_skipped_for_null_values() throws Exception
    {
        Field field = newField();
        MessageFormatter formatter = newMessageFormatter();
        Validator validator = newValidator();

        train_invokeIfBlank(validator, true);
View Full Code Here

        if (!Field.class.isInstance(fieldAsObject))
            throw new TapestryException(BindingsMessages.validateBindingForFieldsOnly(component),
                    location, null);

        Field field = (Field) fieldAsObject;

        // The expression is a validator specification, such as "required,minLength=5".
        // ValidatorBindingFactory is the odd man out becasuse it needs the binding component (the
        // component whose parameter is to be bound) rather than the containing component, the way
        // most factories work.
View Full Code Here

        expect(validator.getMessageKey()).andReturn(messageKey).atLeastOnce();
    }

    protected final Field newFieldWithLabel(String label)
    {
        Field field = newField();

        train_getLabel(field, label);

        return field;
    }
View Full Code Here

    private ComponentResources _resources;

    @BeginRender
    void begin(MarkupWriter writer)
    {
        final Field field = _field;

        final Element element = writer.element("label");

        _resources.renderInformalParameters(writer);

        // Uh oh! Referencing a private field (that happens to get instrumented up the wazoo) from
        // a inner class causes a java.lang.Verify error (Unable to pop operand off an empty stack).
        // Perhaps this is a Javassist error? Shouldn't the inner class be going through a synthetic
        // accessor method of some kind? Resolved by assigning to a local variable and referencing
        // that. Layers on layers, oh my!

        final ValidationDecorator decorator = _decorator;

        // Since we don't know if the field has rendered yet, we need to defer writing the for
        // attribute until we know the field has rendered (and set its clientId property). That's
        // exactly what Heartbeat is for.

        Runnable command = new Runnable()
        {
            public void run()
            {
                String fieldId = field.getClientId();

                element.forceAttributes("for", fieldId, "id", fieldId + ":label");

                decorator.insideLabel(field, element);
            }
View Full Code Here

{
    @SuppressWarnings("unchecked")
    @Test
    public void null_value_skipped() throws Exception
    {
        Field field = mockField();
        MessageFormatter formatter = mockMessageFormatter();
        Validator validator = mockValidator();

        train_invokeIfBlank(validator, false);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void blank_value_skipped() throws Exception
    {
        Field field = mockField();
        MessageFormatter formatter = mockMessageFormatter();
        Validator validator = mockValidator();

        train_invokeIfBlank(validator, false);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void nonmatching_value_type_skipped() throws Exception
    {
        Field field = mockField();
        MessageFormatter formatter = mockMessageFormatter();
        Validator validator = mockValidator();
        Integer value = 15;

        train_invokeIfBlank(validator, true);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void value_type_check_skipped_for_null_values() throws Exception
    {
        Field field = mockField();
        MessageFormatter formatter = mockMessageFormatter();
        Validator validator = mockValidator();

        train_invokeIfBlank(validator, true);
View Full Code Here

    private Element _labelElement;

    @BeginRender
    void begin(MarkupWriter writer)
    {
        final Field field = _field;

        _decorator.beforeLabel(field);

        _labelElement = writer.element("label");

        _resources.renderInformalParameters(writer);

        // Since we don't know if the field has rendered yet, we need to defer writing the for and id
        // attributes until we know the field has rendered (and set its clientId property). That's
        // exactly what Heartbeat is for.

        Runnable command = new Runnable()
        {
            public void run()
            {
                String fieldId = field.getClientId();

                _labelElement.forceAttributes("for", fieldId, "id", fieldId + ":label");

                _decorator.insideLabel(field, _labelElement);
            }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.Field

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.