[ http://issues.apache.org/jira/browse/TAPESTRY-556?page=all ]
Howard M. Lewis Ship reassigned TAPESTRY-556:
---------------------------------------------
Assign To: Howard M. Lewis Ship
> a binding in template overrides another binding in specification for the same
> informal parameter
> ------------------------------------------------------------------------------------------------
>
> Key: TAPESTRY-556
> URL: http://issues.apache.org/jira/browse/TAPESTRY-556
> Project: Tapestry
> Type: Bug
> Versions: 4.0
> Environment: WinXP
> Reporter: Kent Tong
> Assignee: Howard M. Lewis Ship
>
> If there is a (literal) binding in the template (for WYSIWYG purpose) for an
> informal parameter, then even if another (ognl) binding is specified in the
> specification for the same parameter, the literal binding will win. For
> example:
> Test.html:
> <span jwcid="sample" style="color: red">foo</span> <!-- this binding will
> win -->
> Test.page:
> <page-specification class="Test">
> <component id="sample" type="Any">
> <binding name="style" value="ognl:color"/> <!-- this binding will be
> overridden -->
> </component>
> </page-specification>
> Test.java
> class Test {
> public String getColor() { //this method is never called.
> ...
> }
> }
> The bug is in the validate() method in ComponentTemplateLoaderLogic. This
> method only checks for: 1) formal parameter; 2) reserved parameter; 3)
> allow-informal-parameter is no. It doesn't check if a binding has been
> provided for an informal parameter in the specification.
> public class ComponentTemplateLoaderLogic
> {
> private boolean validate(IComponent component, IComponentSpecification
> spec, String name,
> IBinding binding)
> {
> boolean literal = binding instanceof LiteralBinding;
> boolean isFormal = (spec.getParameter(name) != null);
> if (isFormal)
> {
> if (component.getBinding(name) != null)
> {
> if (literal)
> return false;
> throw new
> ApplicationRuntimeException(ImplMessages.dupeTemplateBinding(
> name,
> component,
> _loadComponent), component, binding.getLocation(),
> null);
> }
> return true;
> }
> if (!spec.getAllowInformalParameters())
> {
> if (literal)
> return false;
> throw new
> ApplicationRuntimeException(ImplMessages.templateBindingForInformalParameter(
> _loadComponent,
> name,
> component), component, binding.getLocation(), null);
> }
> if (spec.isReservedParameterName(name))
> {
> if (literal)
> return false;
> throw new
> ApplicationRuntimeException(ImplMessages.templateBindingForReservedParameter(
> _loadComponent,
> name,
> component), component, binding.getLocation(), null);
> }
> return true;
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]