Package org.apache.tapestry5.internal

Examples of org.apache.tapestry5.internal.InternalComponentResources


        expect(binding.getPropertyName()).andReturn("foo");

        replay();

        InternalComponentResources resources = new InternalComponentResourcesImpl(page, element, null, null, null,
                null, ins, false);

        resources.bindParameter("bar", binding);

        assertEquals(resources.getPropertyName("bar"), "foo");

        verify();
    }
View Full Code Here


        ComputedValue<FieldConduit<Object>> computed = new ComputedValue<FieldConduit<Object>>()
        {
            public FieldConduit<Object> get(InstanceContext context)
            {
                InternalComponentResources resources = context.get(InternalComponentResources.class);
                return new PersistentFieldConduit(resources, logicalFieldName, defaultValue);
            }
        };

        field.setComputedConduit(computed);
View Full Code Here

                                               final String fieldName, final String[] possibleNames)
    {
        if (!resources.isMixin())
            throw new TapestryException(TransformMessages.bindParameterOnlyOnMixin(fieldName, resources), null);

        InternalComponentResources containerResources = (InternalComponentResources) resources.getContainerResources();

        // Evaluate this early so that we get a fast fail.

        String containerParameterName = identifyParameterName(resources, InternalUtils.stripMemberName(fieldName),
                possibleNames);
View Full Code Here

   
    embeddedComponentResourcesList.add(containerResources);
   
    while(!embeddedComponentResourcesList.isEmpty())
    {
      InternalComponentResources resources = embeddedComponentResourcesList.remove(0);
     
      ComponentModel containerComponentModel = resources.getComponentModel();
     
      for(String embeddedComponentId : containerComponentModel.getEmbeddedComponentIds())
      {
        EmbeddedComponentModel embeddedComponentModel = containerComponentModel
            .getEmbeddedComponentModel(embeddedComponentId);
       
        InternalComponentResources embeddedComponentResources = (InternalComponentResources) resources
            .getEmbeddedComponent(embeddedComponentId).getComponentResources();
        /**
           * If the parameter is not a formal parameter, then the parameter must be a published parameter
           * of an embeddedComponent of the component we are currently examining.
           */
        if(embeddedComponentModel.getPublishedParameters().contains(publishedParameterName)
            && embeddedComponentResources.getComponentModel().isFormalParameter(publishedParameterName))
        {
          return embeddedComponentResources;
        }
       
        embeddedComponentResourcesList.add(embeddedComponentResources);
View Full Code Here

        return new ComputedValue<FieldConduit<Object>>()
        {
            public FieldConduit get(InstanceContext context)
            {
                ComponentResources resources = context.get(ComponentResources.class);
                final InternalComponentResources icr = (InternalComponentResources) resources;

                return new ReadOnlyComponentFieldConduit(resources, fieldName)
                {
                    public Object get(Object instance, InstanceContext context)
                    {
                        return icr.getMixinByClassName(mixinClassName);
                    }
                };
            }
        };
    }
View Full Code Here

                            new AvailableValues("Formal parameters", embeddedAssembler.getFormalParameterNames()));
                }

                final String defaultBindingPrefix = binder.getDefaultBindingPrefix(metaDefaultBindingPrefix);

                InternalComponentResources containerResources = pageAssembly.activeElement.peek()
                        .getComponentResources();

                ComponentPageElement embeddedElement = pageAssembly.createdElement.peek();
                InternalComponentResources embeddedResources = embeddedElement.getComponentResources();

                Binding binding = elementFactory.newBinding(parameterName, containerResources, embeddedResources,
                        defaultBindingPrefix, parameterValue, location);

                binder.bind(embeddedElement, binding);
View Full Code Here

            {
                // A little extra weight for token containing one or more expansions.

                pageAssembly.weight++;

                InternalComponentResources resources = pageAssembly.activeElement.peek().getComponentResources();

                RenderCommand command = elementFactory.newAttributeElement(resources, token);

                pageAssembly.addRenderCommand(command);
            }
View Full Code Here

        return new ComputedValue<FieldConduit<Object>>()
        {
            public FieldConduit<Object> get(InstanceContext context)
            {
                Object fieldDefaultValue = classCache.defaultValueForType(fieldType);
                InternalComponentResources resources = context.get(InternalComponentResources.class);

                return new UnclaimedFieldConduit(resources, perThreadManager.createValue(), fieldDefaultValue);
            }
        };
    }
View Full Code Here

        int dotx = parameterName.lastIndexOf('.');

        if (dotx > 0)
        {
            String mixinName = parameterName.substring(0, dotx);
            InternalComponentResources mixinResources = InternalUtils.get(mixinIdToComponentResources, mixinName);

            if (mixinResources == null) throw new TapestryException(
                    StructureMessages.missingMixinForParameter(completeId, mixinName, parameterName), binding, null);

            String simpleName = parameterName.substring(dotx + 1);

            mixinResources.bindParameter(simpleName, binding);
            return;
        }

        InternalComponentResources informalParameterResources = null;

        // Does it match a formal parameter name of the core component? That takes precedence

        if (coreResources.getComponentModel().getParameterModel(parameterName) != null)
        {
            coreResources.bindParameter(parameterName, binding);
            return;
        }

        for (String mixinName : InternalUtils.sortedKeys(mixinIdToComponentResources))
        {
            InternalComponentResources resources = mixinIdToComponentResources.get(mixinName);
            if (resources.getComponentModel().getParameterModel(parameterName) != null)
            {
                resources.bindParameter(parameterName, binding);
                return;
            }

            if (informalParameterResources == null && resources.getComponentModel().getSupportsInformalParameters())
                informalParameterResources = resources;
        }

        // An informal parameter
View Full Code Here

        int dotx = parameterName.lastIndexOf('.');

        if (dotx > 0)
        {
            String mixinName = parameterName.substring(0, dotx);
            InternalComponentResources mixinResources = InternalUtils.get(mixinIdToComponentResources, mixinName);

            if (mixinResources == null) throw new TapestryException(
                    StructureMessages.missingMixinForParameter(completeId, mixinName, parameterName), null, null);

            String simpleName = parameterName.substring(dotx + 1);

            ParameterModel pm = mixinResources.getComponentModel().getParameterModel(simpleName);

            return pm != null ? pm.getDefaultBindingPrefix() : null;
        }

        // A formal parameter of the core component?

        ParameterModel pm = coreResources.getComponentModel().getParameterModel(parameterName);

        if (pm != null) return pm.getDefaultBindingPrefix();

        // Search for mixin that it is a formal parameter of

        for (String mixinName : InternalUtils.sortedKeys(mixinIdToComponentResources))
        {
            InternalComponentResources resources = mixinIdToComponentResources.get(mixinName);

            pm = resources.getComponentModel().getParameterModel(parameterName);

            if (pm != null) return pm.getDefaultBindingPrefix();
        }

        // Not a formal parameter of the core component or any mixin.
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.internal.InternalComponentResources

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.