tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1017261 [7/41] - in /websites/production/tapestry/content: ./ cache/
Date Fri, 25 Aug 2017 08:23:01 GMT
Modified: websites/production/tapestry/content/component-mixins.html
==============================================================================
--- websites/production/tapestry/content/component-mixins.html (original)
+++ websites/production/tapestry/content/component-mixins.html Fri Aug 25 08:22:59 2017
@@ -27,15 +27,6 @@
       </title>
   <link type="text/css" rel="stylesheet" href="/resources/space.css" />
 
-          <link href='/resources/highlighter/styles/shCoreCXF.css' rel='stylesheet' type='text/css'
/>
-    <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css'
/>
-    <script src='/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-        <script>
-      SyntaxHighlighter.defaults['toolbar'] = false;
-      SyntaxHighlighter.all();
-    </script>
   
   <link href="/styles/style.css" rel="stylesheet" type="text/css"/>
 
@@ -76,111 +67,34 @@
       </div>
 
       <div id="content">
-                <div id="ConfluenceContent"><p>A <strong>Component Mixin</strong>
is a way to supplement an existing Tapestry component with additional behavior.</p><div
class="aui-label" style="float:right" title="Related Articles">
-
-
-
-
-
-
-
-
-<h3>Related Articles</h3>
-
-<ul class="content-by-label"><li>
-        <div>
-                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>
       </div>
-
-        <div class="details">
-                        <a  href="page-and-component-classes-faq.html">Page And Component
Classes FAQ</a>
-                
-                        
-                    </div>
-    </li><li>
-        <div>
-                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>
       </div>
-
-        <div class="details">
-                        <a  href="legacy-javascript.html">Legacy JavaScript</a>
-                
-                        
-                    </div>
-    </li><li>
-        <div>
-                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>
       </div>
-
-        <div class="details">
-                        <a  href="component-templates.html">Component Templates</a>
-                
-                        
-                    </div>
-    </li><li>
-        <div>
-                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>
       </div>
-
-        <div class="details">
-                        <a  href="component-cheat-sheet.html">Component Cheat Sheet</a>
-                
-                        
-                    </div>
-    </li><li>
-        <div>
-                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>
       </div>
-
-        <div class="details">
-                        <a  href="component-parameters.html">Component Parameters</a>
-                
-                        
-                    </div>
-    </li></ul>
-</div>
-
-
-<p>You can think of a mixin as a kind of mashup for a component; it combines the new
behavior of the mixin with the existing behavior of the component, and bundles it all in one
place. Mixins may be used to add specialized validation to user input fields, dynamically
modify the HTML output of a component, or to add Ajax effects and behaviors of all sorts to
components.</p><p>Tapestry comes with several mixins, such as the <a  class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/Autocomplete.html">Autocomplete
mixin</a> which adds autocomplete behavior to an ordinary TextField Component. In addition,
you can easily create your own.</p><h2 id="ComponentMixins-MixinClasses">Mixin
Classes</h2><p>Mixin classes are stored in the <code>mixins</code>
sub-package of your application, below the application (or library) root package. This parallels
where your component and page classes are stored.</p><p>Other than that, mixin
classes are th
 e same as any other component class.</p><h2 id="ComponentMixins-MixinLimitations">Mixin
Limitations</h2><p>Currently, mixins are allowed to do anything a component can
do, including having parameters and render phase methods.</p><p>Mixins may not
have a template. They integrate with the component strictly in terms of invoking render phase
methods.</p><p>Mixins may have persistent fields, but currently, this is not implemented
perfectly (there is a potential for a name clash between a mixin and the component or another
mixin). Use persistent fields with mixins with care ... or better yet, delegate persistence
to the container using parameters.</p><p>Mixins may not, themselves, have mixins.</p><h2
id="ComponentMixins-UsingMixins">Using Mixins</h2><p>Mixins are used in two
different scenarios: <em>Instance mixins</em> and <em>Implementation mixins</em>.</p><h3
id="ComponentMixins-InstanceMixins">Instance Mixins</h3><p>An instance mixin
is a mixin applied to a specific <em>instance</em>
  of a component. This can be done in the <a  href="component-templates.html">component
template</a> with the <code>mixins</code> attribute of the component tag.
This is a comma-separated list of mixin names.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;t:textfield
t:id="accountName" t:mixins="Autocomplete,DefaultFromCookie" /&gt;
-</pre>
-</div></div><p>Alternately, when the @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Component.html">Component</a>
annotation is used to define the component type, you may specify the mixins in two ways:</p><ul><li>The
@<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Mixins.html">Mixins</a>
annotation allows a list of mixin names to be specified.</li><li>The @<a  class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/MixinClasses.html">MixinClasses</a>
annotation allows a set of mixin classes to be specified directly.</li></ul><p>The
former is often less verbose, and allows core mixins to be overridden with application-specific
mixins. The later format is more specific and more refactor-safe (renaming a mixin class will
rename the entry in the MixinClasses annotation as well).</p><p>Example:</p><div
class="code pane
 l pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  @Component(parameters=.
. .) @Mixins({"Autocomplete", "DefaultFromCookie"})
+                <div id="ConfluenceContent"><p>A <strong>Component Mixin</strong>
is a way to supplement an existing Tapestry component with additional behavior.</p><parameter
ac:name="style">float:right</parameter><parameter ac:name="title">Related Articles</parameter><parameter
ac:name="class">aui-label</parameter><rich-text-body><parameter ac:name="showLabels">false</parameter><parameter
ac:name="showSpace">false</parameter><parameter ac:name="title">Related Articles</parameter><parameter
ac:name="cql">label in ("component-classes","mixins") and space = currentSpace()</parameter></rich-text-body><p>You
can think of a mixin as a kind of mashup for a component; it combines the new behavior of
the mixin with the existing behavior of the component, and bundles it all in one place. Mixins
may be used to add specialized validation to user input fields, dynamically modify the HTML
output of a component, or to add Ajax effects and behaviors of all sorts to components.</p><p>Tapestry
come
 s with several mixins, such as the <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/Autocomplete.html">Autocomplete
mixin</a> which adds autocomplete behavior to an ordinary TextField Component. In addition,
you can easily create your own.</p><h2 id="ComponentMixins-MixinClasses">Mixin
Classes</h2><p>Mixin classes are stored in the <code>mixins</code>
sub-package of your application, below the application (or library) root package. This parallels
where your component and page classes are stored.</p><p>Other than that, mixin
classes are the same as any other component class.</p><h2 id="ComponentMixins-MixinLimitations">Mixin
Limitations</h2><p>Currently, mixins are allowed to do anything a component can
do, including having parameters and render phase methods.</p><p>Mixins may not
have a template. They integrate with the component strictly in terms of invoking render phase
methods.</p><p>Mixins may have persistent fields, 
 but currently, this is not implemented perfectly (there is a potential for a name clash between
a mixin and the component or another mixin). Use persistent fields with mixins with care ...
or better yet, delegate persistence to the container using parameters.</p><p>Mixins
may not, themselves, have mixins.</p><h2 id="ComponentMixins-UsingMixins">Using
Mixins</h2><p>Mixins are used in two different scenarios: <em>Instance mixins</em>
and <em>Implementation mixins</em>.</p><h3 id="ComponentMixins-InstanceMixins">Instance
Mixins</h3><p>An instance mixin is a mixin applied to a specific <em>instance</em>
of a component. This can be done in the <a  href="component-templates.html">component
template</a> with the <code>mixins</code> attribute of the component tag.
This is a comma-separated list of mixin names.</p><parameter ac:name="language">xml</parameter><plain-text-body>&lt;t:textfield
t:id="accountName" t:mixins="Autocomplete,DefaultFromCookie" /&gt;
+</plain-text-body><p>Alternately, when the @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Component.html">Component</a>
annotation is used to define the component type, you may specify the mixins in two ways:</p><ul><li>The
@<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Mixins.html">Mixins</a>
annotation allows a list of mixin names to be specified.</li><li>The @<a  class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/MixinClasses.html">MixinClasses</a>
annotation allows a set of mixin classes to be specified directly.</li></ul><p>The
former is often less verbose, and allows core mixins to be overridden with application-specific
mixins. The later format is more specific and more refactor-safe (renaming a mixin class will
rename the entry in the MixinClasses annotation as well).</p><p>Example:</p><parameter
ac:n
 ame="language">java</parameter><plain-text-body>  @Component(parameters=.
. .) @Mixins({"Autocomplete", "DefaultFromCookie"})
   private TextField userId;
-</pre>
-</div></div><p>This example defines a component of type TextField and mixes
in the <em>hypothetical</em> Autocomplete and DefaultFromCookie mixins.</p><h3
id="ComponentMixins-OrderingtheMixins">Ordering the Mixins</h3><p>With @Mixins
and @MixinClasses annotations, we can order the list of mixins, by adding a constraint.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  @Component(parameters=.
. .) @Mixins({"Autocomplete", "DefaultFromCookie::before:Autocomplete"})
+</plain-text-body><p>This example defines a component of type TextField and mixes
in the <em>hypothetical</em> Autocomplete and DefaultFromCookie mixins.</p><h3
id="ComponentMixins-OrderingtheMixins">Ordering the Mixins</h3><p>With @Mixins
and @MixinClasses annotations, we can order the list of mixins, by adding a constraint.</p><parameter
ac:name="language">java</parameter><plain-text-body>  @Component(parameters=.
. .) @Mixins({"Autocomplete", "DefaultFromCookie::before:Autocomplete"})
   private TextField userId;
-</pre>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  @Component(parameters=.
. .) 
+</plain-text-body><parameter ac:name="language">java</parameter><plain-text-body>
 @Component(parameters=. . .) 
   @MixinClasses(value={Autocomplete.class, DefaultFromCookie.class}, order={"","before:AutoComplete"})
   private TextField userId;
-</pre>
-</div></div><p>You can specify many contraints for a mixin. You just need
to separate them with a ";".</p><h3 id="ComponentMixins-ImplementationMixins">Implementation
Mixins</h3><p>Implementation mixins, mixins which apply to all instances of a
component, are added using the @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Mixin.html">Mixin</a>
annotation. This annotation defines a field that will contain the mixin instance.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">public
class AutocompleteField extends TextField
+</plain-text-body><p>You can specify many contraints for a mixin. You just need
to separate them with a ";".</p><h3 id="ComponentMixins-ImplementationMixins">Implementation
Mixins</h3><p>Implementation mixins, mixins which apply to all instances of a
component, are added using the @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Mixin.html">Mixin</a>
annotation. This annotation defines a field that will contain the mixin instance.</p><parameter
ac:name="language">java</parameter><plain-text-body>public class AutocompleteField
extends TextField
 {
   @Mixin
   private Autocomplete autocompleteMixin;
   
   . . .
 }
-</pre>
-</div></div><p>Often, the type of the field is the exact mixin class to
be instantiated.</p><p>In other cases, such as when the field's type is an interface
or a base class, the value attribute of the annotation will be used to determine the mixin
class name:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">public
class AutocompleteField extends TextField
+</plain-text-body><p>Often, the type of the field is the exact mixin class to
be instantiated.</p><p>In other cases, such as when the field's type is an interface
or a base class, the value attribute of the annotation will be used to determine the mixin
class name:</p><parameter ac:name="language">java</parameter><plain-text-body>public
class AutocompleteField extends TextField
 {
   @Mixin("Autocomplete")
   private Object autocompleteMixin;
   
   . . .
 }
-</pre>
-</div></div><h2 id="ComponentMixins-MixinParameters">Mixin Parameters</h2><p>Mixins
are allowed to have parameters, just like components.</p><p>Here we provide a
value of ".5" seconds for the Autocomplete mixin's "frequency" parameter:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;t:container
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"&gt;
+</plain-text-body><h2 id="ComponentMixins-MixinParameters">Mixin Parameters</h2><p>Mixins
are allowed to have parameters, just like components.</p><p>Here we provide a
value of ".5" seconds for the Autocomplete mixin's "frequency" parameter:</p><parameter
ac:name="language">xml</parameter><plain-text-body>&lt;t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"&gt;
 ...
-&lt;t:textfield t:id="accountName" t:mixins="Autocomplete" t:Autocomplete.frequency=".5"
/&gt;</pre>
-</div></div><p>The parameter name should be prefixed with the name of the
mixin class ("Autocomplete." above).</p><p>You can do the same thing with the
@Component annotation:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@Component(parameters={"Autocomplete.frequency=.5",
. . . })
+&lt;t:textfield t:id="accountName" t:mixins="Autocomplete" t:Autocomplete.frequency=".5"
/&gt;</plain-text-body><p>The parameter name should be prefixed with the name
of the mixin class ("Autocomplete." above).</p><p>You can do the same thing with
the @Component annotation:</p><parameter ac:name="language">java</parameter><plain-text-body>@Component(parameters={"Autocomplete.frequency=.5",
. . . })
 @Mixins("Autocomplete", "DefaultFromCookie"})
 private TextField userId;
-</pre>
-</div></div><p>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.</p><p>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.</p><p>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 <em>implementation</em>. They simply become available
when the composite component (including the mixin) is introduced into a page.</p><h2
id="ComponentMixins-Bindingtheparameterofthecorecomponent">Binding the parameter of the
core component</h2><p>It is so
 metimes desirable to access the current value of a parameter defined in the component associated
with the mixin. For example: normally, when the textfield component is marked disabled, it
renders a text field with a disabled attribute, but you want it to output the (plaintext)
value when disabled. A mixin for this purpose would need access to at least the disabled,
and value parameters, and possibly the translate parameter (for a client-side representation).
You can access the disabled parameter via @InjectContainer and checking isDisabled on the
field, but textfield currently provides no access to value or translate. In this case, you
can bind the core-component parameter using the @BindParameter annotation:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  public
class MyMixin
+</plain-text-body><p>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.</p><p>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.</p><p>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 <em>implementation</em>. They simply become available
when the composite component (including the mixin) is introduced into a page.</p><h2
id="ComponentMixins-Bindingtheparameterofthecorecomponent">Binding the parameter of the
core component</h2><p>It
  is sometimes desirable to access the current value of a parameter defined in the component
associated with the mixin. For example: normally, when the textfield component is marked disabled,
it renders a text field with a disabled attribute, but you want it to output the (plaintext)
value when disabled. A mixin for this purpose would need access to at least the disabled,
and value parameters, and possibly the translate parameter (for a client-side representation).
You can access the disabled parameter via @InjectContainer and checking isDisabled on the
field, but textfield currently provides no access to value or translate. In this case, you
can bind the core-component parameter using the @BindParameter annotation:</p><parameter
ac:name="language">java</parameter><plain-text-body>  public class MyMixin
   {
     @BindParameter
     private boolean disabled;
@@ -203,39 +117,26 @@ private TextField userId;
         ...
     }
     ....
-</pre>
-</div></div><p>Tapestry will "link" the disabled, translate, and value
fields above to parameters of the same name on the associated component. The fields are not
parameters to the mixin, but local copies of the component parameter. They are cached only
if the associated component parameter is cached. They are read-write, and Tapestry handles
synchronizing the value between mixins and the associated component such that even with a
cached parameter, components and mixins will share the same value for a given parameter/bound-parameter
during render. Only declared parameters of the associated components may be bound.</p><p>By
default, Tapestry will bind the parameter with the same name as the field. You can explicitly
declare the parameter to bind via the value attribute:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  @BindParameter("translate")
+</plain-text-body><p>Tapestry will "link" the disabled, translate, and value
fields above to parameters of the same name on the associated component. The fields are not
parameters to the mixin, but local copies of the component parameter. They are cached only
if the associated component parameter is cached. They are read-write, and Tapestry handles
synchronizing the value between mixins and the associated component such that even with a
cached parameter, components and mixins will share the same value for a given parameter/bound-parameter
during render. Only declared parameters of the associated components may be bound.</p><p>By
default, Tapestry will bind the parameter with the same name as the field. You can explicitly
declare the parameter to bind via the value attribute:</p><parameter ac:name="language">java</parameter><plain-text-body>
 @BindParameter("translate")
   private FieldTranslator translator;
-</pre>
-</div></div><p>In some cases, a mixin will be used on different components
using different names for a similar parameter type. For instance, BeanEditor has an "object"
parameter; most form fields have a "value" parameter, and Grid has a "source" parameter. These
parameters have different names, but each is the "principle" parameter on which the components
are acting. A mixin useable by all three components can specify multiple potential parameter
values to bind. The first value that matches a declared parameter of the associated component
will be used:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">public
class MyMixin
+</plain-text-body><p>In some cases, a mixin will be used on different components
using different names for a similar parameter type. For instance, BeanEditor has an "object"
parameter; most form fields have a "value" parameter, and Grid has a "source" parameter. These
parameters have different names, but each is the "principle" parameter on which the components
are acting. A mixin useable by all three components can specify multiple potential parameter
values to bind. The first value that matches a declared parameter of the associated component
will be used:</p><parameter ac:name="language">java</parameter><plain-text-body>public
class MyMixin
 {
   ...
   @BindParameter({"value","object","source"})
   private Object principalObject;
   ...
 }
-</pre>
-</div></div><p>"MyMixin" can be used on a textfield (principalObject is
bound to "value"), on BeanEditor or BeanDisplay (principalObject is bound to "object"), or
on Grid or Loop (principalObject is bound to "source").</p><h2 id="ComponentMixins-RenderPhaseOrdering">Render
Phase Ordering</h2><p>All mixins for a component execute their render phase methods
<em>before</em> the component's render phase methods for most phases. However,
in the later phases (AfterRender, CleanupRender) the order of executing is reversed.</p><p>Exception:
A mixins whose class is annotated with @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/MixinAfter.html">MixinAfter</a>
is ordered <em>after</em> the component, not before.</p><p>Withing
a given phase and class (@MixinAfter vs. mixin before), mixin ordering is determined by the
ordering constraints specified in the mixin definitions. The constraint definitions follow
the same conventions as <a  
 href="ordering-by-constraints.html">ordered service configurations</a>. How you
specify the constraints depends on how the mixin is specified.</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>As an Implementation Mixin</b></div><div class="codeContent
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  @Mixin("Autocomplete",order={"before:DiscardBody","after:RenderDisabled"}
+</plain-text-body><p>"MyMixin" can be used on a textfield (principalObject is
bound to "value"), on BeanEditor or BeanDisplay (principalObject is bound to "object"), or
on Grid or Loop (principalObject is bound to "source").</p><h2 id="ComponentMixins-RenderPhaseOrdering">Render
Phase Ordering</h2><p>All mixins for a component execute their render phase methods
<em>before</em> the component's render phase methods for most phases. However,
in the later phases (AfterRender, CleanupRender) the order of executing is reversed.</p><p>Exception:
A mixins whose class is annotated with @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/MixinAfter.html">MixinAfter</a>
is ordered <em>after</em> the component, not before.</p><p>Withing
a given phase and class (@MixinAfter vs. mixin before), mixin ordering is determined by the
ordering constraints specified in the mixin definitions. The constraint definitions follow
the same conventions a
 s <a  href="ordering-by-constraints.html">ordered service configurations</a>.
How you specify the constraints depends on how the mixin is specified.</p><parameter
ac:name="language">java</parameter><parameter ac:name="title">As an Implementation
Mixin</parameter><plain-text-body>  @Mixin("Autocomplete",order={"before:DiscardBody","after:RenderDisabled"}
   private TextField userId;
-</pre>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>As a Template-specifed
Instance Mixin</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">  &lt;input
t:id="myfield" t:mixins="autocomplete::before:discardbody;after:renderdisabled,
+</plain-text-body><parameter ac:name="language">xml</parameter><parameter
ac:name="title">As a Template-specifed Instance Mixin</parameter><plain-text-body>
 &lt;input t:id="myfield" t:mixins="autocomplete::before:discardbody;after:renderdisabled,
           defaultfromcookie::before:autocomplete"/&gt;
-</pre>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>As a @Mixins-specified
Instance Mixin</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  @Component(...)
+</plain-text-body><parameter ac:name="language">java</parameter><parameter
ac:name="title">As a @Mixins-specified Instance Mixin</parameter><plain-text-body>
 @Component(...)
   @Mixins("Autocomplete::before:discardbody;after:renderdisabled","DefaultFromCookie::before:autocomplete"))
   private TextField userId;
-</pre>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>As a @MixinClasses-specified
Instance Mixins</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  @Component(...)
+</plain-text-body><parameter ac:name="language">java</parameter><parameter
ac:name="title">As a @MixinClasses-specified Instance Mixins</parameter><plain-text-body>
 @Component(...)
   @MixinClasses(value={Autocomplete.class,DefaultFromCookie.class},
                 order={"before:discardbody;after:renderdisabled","before:autocomplete")
-</pre>
-</div></div><p>The ordering is always specified in terms of the order of
the "forward" rendering process (setupRender, beginRender, etc.). When the "reverse" rendering
phases (afterRender, etc.) occur, the mixin order is exactly reversed. Mixins which have no
associated ordering constraints will be ordered in a manner which is consistent with the specified
constraints for all other mixins, but is otherwise unspecified.</p><h2 id="ComponentMixins-AvailableMixins">Available
Mixins</h2><p>Tapestry includes the following mixins out-of-the-box.</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/Autocomplete.html">Autocomplete</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>modifies a text field to provide
for auto-completion of text using values retrieved from the server as the user types. <a
 
 href="ajax-and-zones.html">See instructions</a>.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><a  class="external-link" href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/corelib/mixins/Confirm.html">Confirm</a></td><td
colspan="1" rowspan="1" class="confluenceTd">attached to a Form or link component, runs
a modal-dialog to force the user to confirm the behavior. New for Tapestry 5.4.</td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/DiscardBody.html">DiscardBody</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>discards a component's body. Returns
false from the BeforeRenderBody phase, which prevents the rendering of the body.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/FormF
 ieldFocus.html">FormFieldFocus</a></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>instruments the outer Form on which component the focus should
be activated. Replaced by OverrideFieldFocus starting in Tapestry 5.4.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><a  class="external-link" href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/corelib/mixins/FormGroup.html">FormGroup</a></td><td
colspan="1" rowspan="1" class="confluenceTd">attaches to a field to render an enclosing
&lt;div&gt; element and label for proper Bootstrap markup of text fields, selects,
and textareas</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a
 class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/NotEmpty.html">NotEmpty</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>attaches to any component that renders
an element. At the end of the render, if the element is empty, then a
  non-breaking space (&amp;nbsp;) is injected into the element.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/OverrideFieldFocus.html">OverrideFieldFocus</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>when attached to a form field, causes
that field to gain focus. Starting in Tapestry 5.4, this supersedes FormFieldFocus.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/RenderClientId.html">RenderClientId</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>forces a client element to render
its client id by ensuring that "getClientId" is called.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache
 /tapestry5/corelib/mixins/RenderDisabled.html">RenderDisabled</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>renders a "disabled" attribute if
the containing component is disabled</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/RenderInformals.html">RenderInformals</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>renders out all informal parameters,
at the end of the BeginRender phase. This mixin can be used with components that render a
single tag inside the BeginRender phase.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/RenderNotification.html">RenderNotification</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>triggers component event notifications
when the attached compo
 nent enters its BeginRender and AfterRender render phases.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/TriggerFragment.html">TriggerFragment</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>when applied to a Checkbox or Radio
component, links the input field and a FormFragment, making the field control the client-side
visibility of the FormFragment</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/ZoneRefresh.html">ZoneRefresh</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>periodically refreshes a Zone by
triggering an event on the server using ajax requests.</p></td></tr></tbody></table></div><p>In
addition, the following mixins are available from other sources:</p><div class="table-wrap">
 <table class="confluenceTable"><tbody><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><a  class="external-link" href="http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/creatingmixins1"
rel="nofollow">ClickOnce</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From
JumpStart, a mixin to apply to a submit button, ensuring it can't be double-clicked</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained">Confirm</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Adds a JavaScript <em>confirm</em>
prompt to any link</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><a  class="external-link" href="http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/onevent"
rel="nofollow">ZoneUpdater</a></td><td colspan="1" rowspan="1" class="confluenceTd">Updates
a zone when a client-side event occurs</td></tr></tb
 ody></table></div><h2 id="ComponentMixins-AdditionalTools">Additional
Tools</h2><p><a  class="external-link" href="http://tapestryxpath.sourceforge.net/"
rel="nofollow">Tapestry-Xpath</a> is a third-part Tapestry module that allows XPath
traversal of the Tapestry (server-side) DOM, which can be extremely useful in certain mixins.</p></div>
+</plain-text-body><p>The ordering is always specified in terms of the order of
the "forward" rendering process (setupRender, beginRender, etc.). When the "reverse" rendering
phases (afterRender, etc.) occur, the mixin order is exactly reversed. Mixins which have no
associated ordering constraints will be ordered in a manner which is consistent with the specified
constraints for all other mixins, but is otherwise unspecified.</p><h2 id="ComponentMixins-AvailableMixins">Available
Mixins</h2><p><parameter ac:name=""><a  href="built-in-mixins.html">Built-in
Mixins</a></parameter></p><p>In addition, the following mixins are
available from other sources:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/creatingmixins1"
rel="nofollow">ClickOnce</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>From
JumpSta
 rt, a mixin to apply to a submit button, ensuring it can't be double-clicked</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><a  class="external-link" href="http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained">Confirm</a></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>Adds a JavaScript <em>confirm</em>
prompt to any link</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><a  class="external-link" href="http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/onevent"
rel="nofollow">ZoneUpdater</a></td><td colspan="1" rowspan="1" class="confluenceTd">Updates
a zone when a client-side event occurs</td></tr></tbody></table></div><h2
id="ComponentMixins-AdditionalTools">Additional Tools</h2><p><a  class="external-link"
href="http://tapestryxpath.sourceforge.net/" rel="nofollow">Tapestry-Xpath</a> is
a third-part Tapestry module that allows XPath traversal of the Tapestry (server-side) DOM,
which can be extremely useful 
 in certain mixins.</p></div>
       </div>
 
       <div class="clearer"></div>



Mime
View raw message