Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Cleared up confusion (I think) about implementation mixins having parameters, using mostly Howard's words from Feb 27, 2011 mailing list message

...

Code Block
java
java
public class AutocompleteField extendes TextField
{
  @Mixin("Autocomplete")
  private Object autocompleteMixin;
  
  . . .
}

Note that Tapestry currently doesn't support parameters in implementation mixins.

Mixin Parameters

Instance Mixins are allowed to have parameters, just like components.

When binding parameters (either in the template, or using the parameters attribute of the Component annotation), 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 mix 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.

...

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

Note that when you define an implementation mixin, and the mixin has parameters, there's no way to bind those parameters as part of the implementation. They simply become available when the composite component (including the mixin) is introduced into a page.

Render Phase Ordering

All mixins for a component execute their render phase methods before the component's render phase methods for most phases. However, in the later phases (AfterRender, CleanupRender) the order of executing is reversed.

...