Package org.apache.tapestry5.model

Examples of org.apache.tapestry5.model.ComponentModel


        return parser.parseTemplate(r);
    }

    private Resource locateTemplateResource(ComponentModel initialModel, ComponentResourceSelector selector)
    {
        ComponentModel model = initialModel;
        while (model != null)
        {
            Resource localized = locator.locateTemplate(model, selector);

            if (localized != null)
                return localized;

            // Otherwise, this component doesn't have its own template ... lets work up to its
            // base class and check there.

            model = model.getParentModel();
        }

        // This will be a Resource whose URL is null, which will be picked up later and force the
        // return of the empty template.
View Full Code Here


    }

    @Test
    public void simple_component()
    {
        ComponentModel model = mockComponentModel();

        train_getComponentClassName(model, SIMPLE_COMPONENT_CLASS_NAME);

        train_getBaseResource(model, simpleComponentResource);
View Full Code Here

    }

    @Test
    public void per_language_messages_override()
    {
        ComponentModel model = mockComponentModel();

        train_getComponentClassName(model, SIMPLE_COMPONENT_CLASS_NAME);

        train_getBaseResource(model, simpleComponentResource);
View Full Code Here

    }

    @Test
    public void messages_keys_are_case_insensitive()
    {
        ComponentModel model = mockComponentModel();

        train_getComponentClassName(model, SIMPLE_COMPONENT_CLASS_NAME);

        train_getBaseResource(model, simpleComponentResource);
View Full Code Here

    }

    @Test
    public void subclass_inherits_base_class_messages()
    {
        ComponentModel model = mockComponentModel();
        ComponentModel parent = mockComponentModel();

        train_getComponentClassName(model, "org.apache.tapestry5.internal.services.SubclassComponent");

        train_getBaseResource(model, new ClasspathResource(
                "org/apache/tapestry5/internal/services/SubclassComponent.class"));
View Full Code Here

    }

    @Test
    public void no_app_catalog()
    {
        ComponentModel model = mockComponentModel();
        ComponentModel parent = mockComponentModel();

        train_getComponentClassName(model, "org.apache.tapestry5.internal.services.SubclassComponent");

        train_getBaseResource(model, new ClasspathResource(
                "org/apache/tapestry5/internal/services/SubclassComponent.class"));
View Full Code Here

        String supportsInformals = null;

        for (Map.Entry<String, Instantiator> entry : mixinIdToInstantiator.entrySet())
        {
            String mixinId = entry.getKey();
            ComponentModel mixinModel = entry.getValue().getModel();

            updateParameterNameToQualified(mixinId, mixinModel);

            if (supportsInformals == null && mixinModel.getSupportsInformalParameters())
                supportsInformals = mixinId;
        }

        // The component comes last and overwrites simple names from the others.
View Full Code Here

        return new BoundParameterFieldValueConduit(containerParameterName, containerResources, fieldType);
    }

    private String identifyParameterName(ComponentResources resources, String firstGuess, String... otherGuesses)
    {
        ComponentModel model = resources.getContainerResources().getComponentModel();

        List<String> guesses = CollectionFactory.newList();
        guesses.add(firstGuess);

        for (String name : otherGuesses)
        {
            guesses.add(name);
        }

        for (String name : guesses)
        {
            if (model.isFormalParameter(name))
                return name;
           
            if(isPublishedParameter(model, name))
              return name;
        }
       
        String message = String.format("Containing component %s does not contain a formal parameter or a published parameter %s %s.",

                model.getComponentClassName(),

                guesses.size() == 1 ? "matching" : "matching any of",

                InternalUtils.joinSorted(guesses));

        List<String> formalAndPublishedParameters = CollectionFactory.newList(model.getParameterNames());
        formalAndPublishedParameters.addAll(getPublishedParameters(model));

        throw new UnknownValueException(message, new AvailableValues("Formal and published parameters", formalAndPublishedParameters));
    }
View Full Code Here

   
    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();
        /**
 
View Full Code Here

        strategy.postChange(pageName, resources.getNestedId(), fieldName, newValue);
    }

    private String findStrategy(ComponentResources resources, String fieldName)
    {
        ComponentModel model = resources.getComponentModel();

        String strategy = model.getFieldPersistenceStrategy(fieldName);

        if (InternalUtils.isNonBlank(strategy))
            return strategy;

        return metaDataLocator.findMeta(SymbolConstants.PERSISTENCE_STRATEGY, resources, String.class);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.model.ComponentModel

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.