Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.TransformField


        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
        Integer five = 5;
        FormSupport fs = mockFormSupport();

        Map<String, Validator> map = singletonMap("minLength", validator);

        train_getConstraintType(validator, Integer.class);
View Full Code Here


                annotation.cache());

        ComponentValueProvider<ParameterConduit> provider = createParameterConduitProvider(parameterName, fieldType,
                annotation);

        TransformField conduitField = transformation.addIndirectInjectedField(ParameterConduit.class, parameterName
                + "$conduit", provider);

        FieldAccess conduitAccess = conduitField.getAccess();

        addCodeForParameterDefaultMethod(transformation, parameterName, conduitAccess);

        field.replaceAccess(conduitField);
View Full Code Here

    ObjectLocator locator = mockObjectLocator();
    InjectionProvider ip = newMock(InjectionProvider.class);
    Inject annotation = newInject();
    ClassTransformation ct = mockClassTransformation();
    MutableComponentModel model = mockMutableComponentModel();
    TransformField field = newMock(TransformField.class);

    train_matchFields(ct, field);

    train_getName(field, "myfield");

    train_getAnnotation(field, Inject.class, annotation);

    train_getType(field, REQUEST_CLASS_NAME);
    train_toClass(ct, REQUEST_CLASS_NAME, Request.class);

    train_provideInjection(ip, "myfield", Request.class, locator, ct,
        model, true);

    field.claim(annotation);

    replay();

    ComponentClassTransformWorker worker = new InjectWorker(locator, ip,
        new QuietOperationTracker());
View Full Code Here

    ObjectLocator locator = mockObjectLocator();
    InjectionProvider ip = newMock(InjectionProvider.class);
    Inject annotation = newInject();
    ClassTransformation ct = mockClassTransformation();
    MutableComponentModel model = mockMutableComponentModel();
    TransformField field = newMock(TransformField.class);

    train_matchFields(ct, field);

    train_getName(field, "myfield");
View Full Code Here

    ObjectLocator locator = mockObjectLocator();
    InjectionProvider ip = newMock(InjectionProvider.class);
    Inject annotation = newInject();
    ClassTransformation ct = mockClassTransformation();
    MutableComponentModel model = mockMutableComponentModel();
    TransformField field = newMock(TransformField.class);
    RuntimeException failure = new RuntimeException("Oops.");

    train_matchFields(ct, field);

    train_getName(field, "myfield");
View Full Code Here

        // make a special check here.

        if (fieldType.equals(Messages.class))
            return false;

        TransformField field = transformation.getField(fieldName);

        Object injectionValue = masterObjectProvider.provide(fieldType, field, this.locator, false);

        // Null means that no ObjectProvider could provide the value. We have set up the chain of
        // command so that InjectResources can give it a try next. Later, we'll try to match against
        // a service.

        if (injectionValue != null)
        {
            field.inject(injectionValue);
            return true;
        }

        return false;
    }
View Full Code Here

        handleAssetsDuringSetupRenderPhase(transformation, model, access);
    }

    private FieldAccess createFieldForAssets(ClassTransformation transformation)
    {
        TransformField field = transformation.createField(Modifier.PROTECTED, List.class.getName(), "includedAssets");

        return field.getAccess();
    }
View Full Code Here

            ClassTransformation transformation, MutableComponentModel componentModel)
    {
        if (!fieldType.equals(ComponentResources.class))
            return false;

        TransformField field = transformation.getField(fieldName);

        ComponentValueProvider<FieldValueConduit> provider = createResourcesFieldConduitProvider(fieldName);

        field.replaceAccess(provider);

        return true;
    }
View Full Code Here

            ClassTransformation transformation, MutableComponentModel componentModel)
    {
        if (!fieldType.equals(Block.class))
            return false;

        TransformField field = transformation.getField(fieldName);

        Id annotation = field.getAnnotation(Id.class);

        String blockId = getBlockId(fieldName, annotation);

        ComponentValueProvider<FieldValueConduit> provider = cxreateProvider(fieldName, blockId);

        field.replaceAccess(provider);

        return true; // claim the field
    }
View Full Code Here

    }

    public boolean provideInjection(String fieldName, Class fieldType, ObjectLocator locator,
            ClassTransformation transformation, MutableComponentModel componentModel)
    {
        TransformField field = transformation.getField(fieldName);

        Path path = field.getAnnotation(Path.class);

        if (path == null)
            return false;

        final String expanded = symbolSource.expandSymbols(path.value());

        final Resource baseResource = componentModel.getBaseResource();

        ComponentValueProvider<Asset> provider = new ComponentValueProvider<Asset>()
        {

            public Asset get(ComponentResources resources)
            {
                Locale locale = resources.getLocale();

                return assetSource.getAsset(baseResource, expanded, locale);
            }
        };

        field.injectIndirect(provider);

        return true;
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.TransformField

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.