Examples of InjectComponent


Examples of org.apache.tapestry.annotations.InjectComponent

    @Test
    public void default_id_from_field_name()
    {
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        InjectComponent annotation = newMock(InjectComponent.class);
        ComponentClassTransformWorker worker = new InjectComponentWorker();

        train_findFieldsWithAnnotation(ct, InjectComponent.class, "myfield");
        train_getFieldAnnotation(ct, "myfield", InjectComponent.class, annotation);
        train_getFieldType(ct, "myfield", CLASS_NAME);
        train_getResourcesFieldName(ct, "resources");
        expect(annotation.value()).andReturn("");
        ct.makeReadOnly("myfield");

        train_extendMethod(ct, TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE,
                           "myfield = (" + CLASS_NAME + ") resources.getEmbeddedComponent(\"myfield\");");
View Full Code Here

Examples of org.apache.tapestry.annotations.InjectComponent

    @Test
    public void explicit_component_id_provided_as_annotation()
    {
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        InjectComponent annotation = newMock(InjectComponent.class);
        ComponentClassTransformWorker worker = new InjectComponentWorker();

        train_findFieldsWithAnnotation(ct, InjectComponent.class, "myfield");
        train_getFieldAnnotation(ct, "myfield", InjectComponent.class, annotation);
        train_getFieldType(ct, "myfield", CLASS_NAME);
        train_getResourcesFieldName(ct, "resources");
        expect(annotation.value()).andReturn("id_provided_as_annotation").atLeastOnce();
        ct.makeReadOnly("myfield");
        train_extendMethod(ct, TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE,
                           "myfield = (" + CLASS_NAME + ") resources.getEmbeddedComponent(\"id_provided_as_annotation\");");

        replay();
View Full Code Here

Examples of org.apache.tapestry.annotations.InjectComponent

        builder.addln("%s core = %s.getCoreComponent();", Component.class.getName(), transformation
                .getResourcesFieldName());

        for (String fieldName : names)
        {
            InjectComponent annotation = transformation.getFieldAnnotation(
                    fieldName,
                    InjectComponent.class);

            String fieldType = transformation.getFieldType(fieldName);
View Full Code Here

Examples of org.apache.tapestry.annotations.InjectComponent

    public void transform(ClassTransformation transformation,
                          MutableComponentModel model)
    {
        for (String fieldName : transformation.findFieldsWithAnnotation(InjectComponent.class))
        {
            InjectComponent annotation = transformation.getFieldAnnotation(fieldName, InjectComponent.class);

            String type = transformation.getFieldType(fieldName);

            String resourcesFieldName = transformation.getResourcesFieldName();

            String componentId = annotation.value();
            if (InternalUtils.isBlank(componentId))
                componentId = InternalUtils.stripMemberPrefix(fieldName);

            transformation.makeReadOnly(fieldName);
View Full Code Here

Examples of org.apache.tapestry5.annotations.InjectComponent

    public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model)
    {
        for (PlasticField field : plasticClass.getFieldsWithAnnotation(InjectComponent.class))
        {
            InjectComponent annotation = field.getAnnotation(InjectComponent.class);

            field.claim(annotation);

            final String type = field.getTypeName();
View Full Code Here

Examples of org.apache.tapestry5.annotations.InjectComponent

    public void transform(ClassTransformation transformation, MutableComponentModel model)
    {
        for (TransformField field : transformation.matchFieldsWithAnnotation(InjectComponent.class))
        {
            InjectComponent annotation = field.getAnnotation(InjectComponent.class);

            field.claim(annotation);

            final String type = field.getType();
View Full Code Here

Examples of org.apache.tapestry5.annotations.InjectComponent

    public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model)
    {
        for (PlasticField field : plasticClass.getFieldsWithAnnotation(InjectComponent.class))
        {
            InjectComponent annotation = field.getAnnotation(InjectComponent.class);

            field.claim(annotation);

            final String type = field.getTypeName();
View Full Code Here

Examples of org.apache.tapestry5.annotations.InjectComponent

    public void transform(ClassTransformation transformation,
                          MutableComponentModel model)
    {
        for (String fieldName : transformation.findFieldsWithAnnotation(InjectComponent.class))
        {
            InjectComponent annotation = transformation.getFieldAnnotation(fieldName, InjectComponent.class);

            String type = transformation.getFieldType(fieldName);

            String resourcesFieldName = transformation.getResourcesFieldName();

            String componentId = annotation.value();
            if (InternalUtils.isBlank(componentId))
                componentId = InternalUtils.stripMemberPrefix(fieldName);

            transformation.makeReadOnly(fieldName);
View Full Code Here

Examples of org.apache.tapestry5.annotations.InjectComponent

    @Test
    public void default_id_from_field_name()
    {
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        InjectComponent annotation = newMock(InjectComponent.class);
        ComponentClassTransformWorker worker = new InjectComponentWorker();

        train_findFieldsWithAnnotation(ct, InjectComponent.class, "myfield");
        train_getFieldAnnotation(ct, "myfield", InjectComponent.class, annotation);
        train_getFieldType(ct, "myfield", CLASS_NAME);
        train_getResourcesFieldName(ct, "resources");
        expect(annotation.value()).andReturn("");
        ct.makeReadOnly("myfield");

        ct.extendMethod(same(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE),
                        contains(
                                "myfield = (" + CLASS_NAME + ") resources.getEmbeddedComponent(\"myfield\");"));
View Full Code Here

Examples of org.apache.tapestry5.annotations.InjectComponent

    @Test
    public void explicit_component_id_provided_as_annotation()
    {
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        InjectComponent annotation = newMock(InjectComponent.class);
        ComponentClassTransformWorker worker = new InjectComponentWorker();

        train_findFieldsWithAnnotation(ct, InjectComponent.class, "myfield");
        train_getFieldAnnotation(ct, "myfield", InjectComponent.class, annotation);
        train_getFieldType(ct, "myfield", CLASS_NAME);
        train_getResourcesFieldName(ct, "resources");
        expect(annotation.value()).andReturn("id_provided_as_annotation").atLeastOnce();
        ct.makeReadOnly("myfield");

        ct.extendMethod(same(TransformConstants.CONTAINING_PAGE_DID_LOAD_SIGNATURE),
                        contains(
                                "myfield = (" + CLASS_NAME + ") resources.getEmbeddedComponent(\"id_provided_as_annotation\");"));
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.