You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by bo...@apache.org on 2014/03/10 02:49:29 UTC

svn commit: r900807 - /websites/production/tapestry/content/5.3.7/apidocs/org/apache/tapestry5/corelib/components/Any.html

Author: bobharner
Date: Mon Mar 10 01:49:29 2014
New Revision: 900807

Log:
Live update to Any component docs for 5.3, via SVN (per TAP5-2298)

Modified:
    websites/production/tapestry/content/5.3.7/apidocs/org/apache/tapestry5/corelib/components/Any.html

Modified: websites/production/tapestry/content/5.3.7/apidocs/org/apache/tapestry5/corelib/components/Any.html
==============================================================================
--- websites/production/tapestry/content/5.3.7/apidocs/org/apache/tapestry5/corelib/components/Any.html (original)
+++ websites/production/tapestry/content/5.3.7/apidocs/org/apache/tapestry5/corelib/components/Any.html Mon Mar 10 01:49:29 2014
@@ -105,12 +105,64 @@ Class Any</H2>
 </PRE>
 
 <P>
-Renders an arbitrary element including informal parameters.
-<P>
+Turns any arbitrary (X)HTML element into a component. The element's start and end
+ tags are rendered, including any informal parameters and possibly an id
+ attribute.  The id is provided by <a href="../../../../../org/apache/tapestry5/services/javascript/JavaScriptSupport.html#allocateClientId(java.lang.String)"><code>JavaScriptSupport.allocateClientId(String)</code></a>
+ (so it will be unique on the client side) and is available after the component
+ renders using <a href="../../../../../org/apache/tapestry5/corelib/components/Any.html#getClientId()"><code>getClientId()</code></a>. The Any component has no template of its
+ own but does render its body, if any.
+ <p>
+ Some common uses are:
+ <ul>
+ 
+ <li>Applying a mixin to an ordinary HTML element. For example,
+ the following turns an <i>img</i> element into a component that, via the
+ <a href="../../../../../org/apache/tapestry5/corelib/mixins/RenderNotification.html" title="class in org.apache.tapestry5.corelib.mixins"><code>RenderNotification</code></a> mixin, triggers event
+ notifications when it enters the BeginRender and EndRender phases:
+ 
+ <pre>&lt;img t:type="any" t:mixins="renderNotification"&gt;</pre>
+ 
+ And the following renders a <i>td</i> element with the
+ <a href="../../../../../org/apache/tapestry5/corelib/mixins/NotEmpty.html" title="class in org.apache.tapestry5.corelib.mixins"><code>NotEmpty</code></a> mixin to ensure
+ that a non-breaking space (&amp;nbsp;) is rendered if the td element would
+ otherwise be empty:
+ 
+ <pre>&lt;td t:type="any" t:mixins="NotEmpty"&gt;</pre>
+ </li>
+ 
+ <li>Providing a dynamically-generated client ID for an HTML element
+ in a component rendered in a loop or zone (or more than once in a page), for
+ use from JavaScript. (The component class will typically use
+ <a href="../../../../../org/apache/tapestry5/annotations/InjectComponent.html" title="annotation in org.apache.tapestry5.annotations"><code>InjectComponent</code></a>
+ to get the component, then call <a href="../../../../../org/apache/tapestry5/corelib/components/Any.html#getClientId()"><code>getClientId()</code></a> to retrieve the ID.)
+ 
+ <pre>&lt;table t:type="any" id="clientId"&gt;</pre>
+ 
+ As an alternative to calling getClientId, you can use the
+ <a href="../../../../../org/apache/tapestry5/corelib/mixins/RenderClientId.html" title="class in org.apache.tapestry5.corelib.mixins"><code>RenderClientId</code></a>
+ mixin to force the id attribute to appear in the HTML:
+ 
+ <pre>&lt;table t:type="any" t:mixins="RenderClientId"&gt;</pre>
+ </li>
+ 
+ <li>Dynamically outputting a different HTML element depending on
+ the string value of a property. For example, the following renders an element
+ identified by the "element" property in the corresponding component class:
+ 
+ <pre>&lt;t:any element="prop:element" ... &gt;</pre>
+ </li>
+ 
+ <li>As the base component for a new custom component, especially convenient
+ when the new component should support informal parameters or needs a dynamically
+ generated client ID:
+ 
+ <pre>public class MyComponent extends Any { ... }
+ </li>
+ </ul>
 
 <P>
 <DL>
-</dl><table width='100%' cellspacing='0' cellpadding='3' border='1' class='parameters'><thead><tr class='TableHeadingColor' bgcolor='#CCCCFF'><th align='left' colspan='7'><font size='+2'><b>Component Parameters</b></font></th></tr><tr class='columnHeaders'><th>Name</th><th>Description</th><th>Type</th><th>Flags</th><th>Default</th><th>Default Prefix</th><th>Since</th></tr></thead><tbody><tr><th>clientId</th><td>The desired client id, which defaults to the components id.</td><td>String</td><td></td><td>prop:<wbr/>componentResources.<wbr/>id</td><td>literal</td><td></td></tr><tr><th>element</th><td></td><td>String</td><td></td><td></td><td>literal</td><td></td></tr></tbody></table></dd></DL>
+</dl><table width='100%' cellspacing='0' cellpadding='3' border='1' class='parameters'><thead><tr class='TableHeadingColor' bgcolor='#CCCCFF'><th align='left' colspan='7'><font size='+2'><b>Component Parameters</b></font></th></tr><tr class='columnHeaders'><th>Name</th><th>Description</th><th>Type</th><th>Flags</th><th>Default</th><th>Default Prefix</th><th>Since</th></tr></thead><tbody><tr><th>clientId</th><td>The desired client id, which defaults to the component's id.</td><td>String</td><td></td><td>prop:<wbr/>componentResources.<wbr/>id</td><td>literal</td><td></td></tr><tr><th>element</th><td>The name of the element to be rendered, typically one of the standard (X)HTML elements, "div", "span", "a", etc., although practically any string will be accepted. The default comes from the template, or is "div" if the template does not specify an element.</td><td>String</td><td></td><td></td><td>literal</td><td></td></tr></tbody></table></dd></DL>
 <HR>
 
 <P>