use of org.apache.tapestry5.model.ComponentModel in project tapestry-5 by apache.
the class EmbeddedComponentAssemblerImpl method prescanMixins.
private String prescanMixins(boolean strictMixinParameters) {
// Mixin id found to support informal parameters
String supportsInformals = null;
for (Map.Entry<String, Instantiator> entry : mixinIdToInstantiator.entrySet()) {
String mixinId = entry.getKey();
ComponentModel mixinModel = entry.getValue().getModel();
updateParameterNameToQualified(mixinId, mixinModel, strictMixinParameters);
if (supportsInformals == null && mixinModel.getSupportsInformalParameters())
supportsInformals = mixinId;
}
// The component comes last and overwrites simple names from the others.
updateParameterNameToQualified(null, componentModel, false);
return supportsInformals;
}
use of org.apache.tapestry5.model.ComponentModel in project tapestry-5 by apache.
the class PageLoaderImpl method copyInformalParameters.
private void copyInformalParameters(ComponentPageElement container, ComponentPageElement embedded) {
// TODO: Much more, this is an area where we can make things a bit more efficient by tracking
// what has and hasn't been bound in the EmbeddedComponentAssembler (and identifying what is
// and isn't informal).
ComponentModel model = embedded.getComponentResources().getComponentModel();
Map<String, Binding> informals = container.getInformalParameterBindings();
for (String name : informals.keySet()) {
if (model.getParameterModel(name) != null)
continue;
Binding binding = informals.get(name);
embedded.bindParameter(name, binding);
}
}
use of org.apache.tapestry5.model.ComponentModel in project tapestry-5 by apache.
the class PageLoaderImpl method buildOverrideSearch.
private List<ComponentTemplate> buildOverrideSearch(ComponentAssembler assembler, ComponentTemplate template) {
List<ComponentTemplate> result = CollectionFactory.newList();
result.add(template);
ComponentModel model = assembler.getModel();
ComponentTemplate lastTemplate = template;
while (lastTemplate.isExtension()) {
ComponentModel parentModel = model.getParentModel();
if (parentModel == null) {
throw new RuntimeException(String.format("Component %s uses an extension template, but does not have a parent component.", model.getComponentClassName()));
}
ComponentTemplate parentTemplate = templateSource.getTemplate(parentModel, assembler.getSelector());
result.add(parentTemplate);
lastTemplate = parentTemplate;
model = parentModel;
}
return result;
}
use of org.apache.tapestry5.model.ComponentModel in project tapestry-5 by apache.
the class BlockInjectionProvider method provideInjection.
public boolean provideInjection(PlasticField field, ObjectLocator locator, MutableComponentModel componentModel) {
if (!field.getTypeName().equals(BLOCK_TYPE_NAME)) {
return false;
}
Id annotation = field.getAnnotation(Id.class);
String blockId = getBlockId(field.getName(), annotation);
FieldConduit<Object> conduit = createConduit(field, blockId);
field.setConduit(conduit);
// claim the field
return true;
}
use of org.apache.tapestry5.model.ComponentModel in project tapestry-5 by apache.
the class ComponentTemplateSourceImpl method locateTemplateResource.
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();
}
return initialModel.getBaseResource().withExtension(TapestryConstants.TEMPLATE_EXTENSION);
}
Aggregations