Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reorganizing Mixin Parameters section

...

Code Block
languagexml
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
...
<t:textfield t:id="accountName" t:mixins="Autocomplete" t:Autocomplete.frequency=".5" />

When using the Tapestry 5.4 or later XSD, mixin parameters must The parameter name should be prefixed with the name of the mixin class name ("Autocomplete." above)  (either in the template, or using the parameters attribute of the Component annotation). Earlier versions didn't require the class name prefix, but then

When binding parameters , Tapestry will match each parameter name against the parameters defined by each class (which is to say, the component and each mixin).

If the component and a mixin both define a parameter with the same name, then the component wins: the component's parameter will be bound, and the mixin's parameter will be unbound.

You can do the same thing with the @Component annotationAlternately, you may prefix the name of the parameter with the unqualified name of the Mixin class; this eliminates the ambiguity. Example:

Code Block
languagejava
  @Component(parameters={"Autocomplete.idfrequency=auto.5", . . . }) 
@Mixins("Autocomplete", "DefaultFromCookie"})
  private TextField userId;

When using the Tapestry 5.3 and earlier XSDs, you may omit the class name prefix (e.g. t:frequency=".5" instead of t:Autocomplete.frequency=".5"), but then Tapestry has to resolve conflicts. If a component and a mixin both define a parameter with the same name, the component wins; the component's parameter will be bound, and the mixin's parameter will be unbound.

If the component and a mixin both supports informal parameters, the mixin will receive the all the unqualified informal parameters. If more than one Mixin supports informal parameters the results are undefined.

...