in plugins/tiles/src/main/java/org/apache/tiles/api/BasicAttributeContext.java [170:211]
public void inherit(AttributeContext parent) {
if (parent instanceof BasicAttributeContext) {
inherit((BasicAttributeContext) parent);
} else {
// Inheriting template, roles and preparer.
Attribute parentTemplateAttribute = parent.getTemplateAttribute();
inheritParentTemplateAttribute(parentTemplateAttribute);
if (preparer == null) {
preparer = parent.getPreparer();
}
// Inheriting attributes.
Set<String> names = parent.getCascadedAttributeNames();
if (names != null && !names.isEmpty()) {
for (String name : names) {
Attribute attribute = parent.getCascadedAttribute(name);
Attribute destAttribute = getCascadedAttribute(name);
if (destAttribute == null) {
putAttribute(name, attribute, true);
} else if (attribute instanceof ListAttribute
&& destAttribute instanceof ListAttribute
&& ((ListAttribute) destAttribute).isInherit()) {
((ListAttribute) destAttribute).inherit((ListAttribute) attribute);
}
}
}
names = parent.getLocalAttributeNames();
if (names != null && !names.isEmpty()) {
for (String name : names) {
Attribute attribute = parent.getLocalAttribute(name);
Attribute destAttribute = getLocalAttribute(name);
if (destAttribute == null) {
putAttribute(name, attribute, false);
} else if (attribute instanceof ListAttribute
&& destAttribute instanceof ListAttribute
&& ((ListAttribute) destAttribute).isInherit()) {
((ListAttribute) destAttribute).inherit((ListAttribute) attribute);
}
}
}
}
}