* Adds bindings based on attributes in the template.
*/
private void addTemplateBindings(IComponent component, OpenToken token)
{
IComponentSpecification spec = component.getSpecification();
Map attributes = token.getAttributesMap();
if (attributes != null)
{
Iterator i = attributes.entrySet().iterator();
while (i.hasNext())
{
Map.Entry entry = (Map.Entry) i.next();
String name = (String) entry.getKey();
TemplateAttribute attribute = (TemplateAttribute) entry.getValue();
AttributeType type = attribute.getType();
if (type == AttributeType.OGNL_EXPRESSION)
{
addExpressionBinding(
component,
spec,
name,
attribute.getValue(),
token.getLocation());
continue;
}
if (type == AttributeType.LOCALIZATION_KEY)
{
addStringBinding(
component,
spec,
name,
attribute.getValue(),
token.getLocation());
continue;
}
if (type == AttributeType.LITERAL)
addStaticBinding(
component,
spec,
name,
attribute.getValue(),
token.getLocation());
}
}
// if the component defines a templateTag parameter and
// there is no established binding for that parameter,
// add a static binding carrying the template tag
if (spec.getParameter(ITemplateSource.TEMPLATE_TAG_PARAMETER_NAME) != null
&& component.getBinding(ITemplateSource.TEMPLATE_TAG_PARAMETER_NAME) == null)
{
addStaticBinding(
component,
spec,