You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2008/09/29 17:11:06 UTC

svn commit: r700149 - in /tiles/framework/trunk/src/site: apt/config-reference.apt apt/tutorial/advanced/attribute-rendering.apt apt/tutorial/advanced/index.apt apt/tutorial/index.apt site.xml

Author: apetrelli
Date: Mon Sep 29 08:11:05 2008
New Revision: 700149

URL: http://svn.apache.org/viewvc?rev=700149&view=rev
Log:
TILES-306
Added documentation for attribute renderers.

Added:
    tiles/framework/trunk/src/site/apt/tutorial/advanced/attribute-rendering.apt
Modified:
    tiles/framework/trunk/src/site/apt/config-reference.apt
    tiles/framework/trunk/src/site/apt/tutorial/advanced/index.apt
    tiles/framework/trunk/src/site/apt/tutorial/index.apt
    tiles/framework/trunk/src/site/site.xml

Modified: tiles/framework/trunk/src/site/apt/config-reference.apt
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/config-reference.apt?rev=700149&r1=700148&r2=700149&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/apt/config-reference.apt (original)
+++ tiles/framework/trunk/src/site/apt/config-reference.apt Mon Sep 29 08:11:05 2008
@@ -46,6 +46,12 @@
 *---------------------------------------------+--------------------------------------+
 | {{{config-reference.html#org.apache.tiles.preparer.PreparerFactory}<<<org.apache.tiles.preparer.PreparerFactory>>>}}     | View preparer factory class name     |
 *---------------------------------------------+--------------------------------------+
+| {{{config-reference.html#org.apache.tiles.renderer.RendererFactory}<<<org.apache.tiles.renderer.RendererFactory>>>}}     | Attribute renderer factory class name     |
+*---------------------------------------------+--------------------------------------+
+| {{{config-reference.html#org.apache.tiles.renderer.impl.BasicRendererFactory.TYPE_RENDERERS}<<<org.apache.tiles.renderer.impl.BasicRendererFactory.TYPE_RENDERERS>>>}}     | Attribute renderers class name     |
+*---------------------------------------------+--------------------------------------+
+| {{{config-reference.html#org.apache.tiles.renderer.impl.BasicRendererFactory.DEFAULT_RENDERER}<<<org.apache.tiles.renderer.impl.BasicRendererFactory.DEFAULT_RENDERER>>>}}     | Default attribute renderer class name     |
+*---------------------------------------------+--------------------------------------+
 
   [[2]] {{{config-reference.html#BasicTilesContainer configuration}<<<BasicTilesContainer>>> configuration}}.
 
@@ -160,7 +166,49 @@
     
   * <<Usage>>: when specified, it must contain the name of a class that
   implements the <<<PreparerFactory>>> interface.
+
+** {<<<org.apache.tiles.renderer.RendererFactory>>>}
+
+  Specify the class of the attribute renderer factory to use.
+  
+  * <<Specified in>>:
+  {{{framework/apidocs/org/apache/tiles/factory/TilesContainerFactory.html#RENDERER_FACTORY_INIT_PARAM}<<<org.apache.tiles.factory.TilesContainerFactory>>>}}.
+    
+  * <<Default>>: <<<org.apache.tiles.renderer.impl.BasicRendererFactory>>>
+    
+  * <<Usage>>: when specified, it must contain the class name of the attribute
+  renderer factory to use.
+
+** {<<<org.apache.tiles.renderer.impl.BasicRendererFactory.TYPE_RENDERERS>>>}
+
+  Specifies the named attribute renderers that can be used.
   
+  * <<Specified in>>:
+  {{{framework/apidocs/org/apache/tiles/renderer/impl/BasicRendererFactory.html#TYPE_RENDERERS_INIT_PARAM}<<<org.apache.tiles.renderer.impl.BasicRendererFactory>>>}}.
+    
+  * <<Default>>: <<<string,org.apache.tiles.renderer.impl;
+  definition,org.apache.tiles.renderer.impl.DefinitionAttributeRenderer;
+  template,org.apache.tiles.renderer.impl.TemplateAttributeRenderer>>>.
+    
+  * <<Usage>>: when specified, it must contain a semicolon (;) separated list
+  of comma-separated pairs (,) in which:
+
+  ** the first element is the name of the renderer;
+
+  ** the second element is the class name of the attribute renderer.
+
+** {<<<org.apache.tiles.renderer.impl.BasicRendererFactory.DEFAULT_RENDERER>>>}
+
+  Specifies the named attribute renderers that can be used.
+  
+  * <<Specified in>>:
+  {{{framework/apidocs/org/apache/tiles/renderer/impl/BasicRendererFactory.html#DEFAULT_RENDERER_INIT_PARAM}<<<org.apache.tiles.renderer.impl.BasicRendererFactory>>>}}.
+    
+  * <<Default>>: <<<org.apache.tiles.renderer.impl.UntypedAttributeRenderer>>>
+    
+  * <<Usage>>: when specified, it must contain the class name of the attribute
+  renderer to use in case the type of an attribute is not specified.
+
 * {<<<BasicTilesContainer>>> configuration}
 
 ** {<<<org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG>>>}

Added: tiles/framework/trunk/src/site/apt/tutorial/advanced/attribute-rendering.apt
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/tutorial/advanced/attribute-rendering.apt?rev=700149&view=auto
==============================================================================
--- tiles/framework/trunk/src/site/apt/tutorial/advanced/attribute-rendering.apt (added)
+++ tiles/framework/trunk/src/site/apt/tutorial/advanced/attribute-rendering.apt Mon Sep 29 08:11:05 2008
@@ -0,0 +1,101 @@
+~~ $Id: runtime.apt 700127 2008-09-29 13:32:33Z apetrelli $
+~~
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements.  See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership.  The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License.  You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied.  See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+~~
+         -----------
+         Attribute rendering
+         -----------
+
+Attribute rendering
+
+  With Tiles 2.1, attribute rendering behaviour can be customized. The "type"
+  of an attribute can be still <<<string>>>, <<<definition>>> or <<<template>>>
+  but you can define new types or use a class name directly.
+
+Default behaviour
+
+  The behaviour that Tiles follows is compatible with Tiles 2.0 and it applies
+  both to XML definition files and JSP tags. Tiles follows these steps: 
+
+  * If the type is not specified:
+
+  ** if the value is a valid definition name, the definition is rendered;
+
+  ** if the value starts with a '/', a template will be rendered;
+
+  ** otherwise, a string will be rendered.
+
+  * If the type is specified:
+
+  ** if the type is <<<string>>>, <<<definition>>> or <<<template>>>, it will
+  be rendered like in Tiles 2.0;
+
+  ** otherwise, Tiles tries to instantiate (only once) a class whose name is
+  specified in the "type" of the attribute. If an error occurs, it pops up as
+  a runtime exception.
+
+Customize attribute rendering
+
+  With Tiles 2.1 you can customize rendering in three ways:
+
+  * specifying new renderers;
+
+  * overriding the default renderer for untyped attributes;
+
+  * specifying a new renderer factory.
+
+* Custom attribute renderers
+
+  If you don't want to use class names as attribute types, you can use new
+  "named" custom attribute renderers. You can do it by:
+
+  * using the
+  {{{../../config-reference.html#org.apache.tiles.renderer.impl.BasicRendererFactory.TYPE_RENDERERS}<<<org.apache.tiles.renderer.impl.BasicRendererFactory.TYPE_RENDERERS>>>}}
+  init parameter, if you are using parameter-based initialization;
+
+  * overriding the
+  {{{../../apidocs/org/apache/tiles/factory/BasicTilesContainerFactory.html#registerAttributeRenderers(org.apache.tiles.renderer.impl.BasicRendererFactory,%20java.lang.Object,%20org.apache.tiles.TilesApplicationContext,%20org.apache.tiles.context.TilesContextFactory,%20org.apache.tiles.TilesContainer,%20org.apache.tiles.evaluator.AttributeEvaluator)}registerAttributeRenderers}}
+  of <<<BasicTilesContainerFactory>>> if you are using Java-based configuration.
+
+* Custom default attribute renderer
+
+  The behaviour of Tiles when the type of an attribute is not specified can be
+  also customized. You can do it by:
+
+  * using the
+  {{{../../config-reference.html#org.apache.tiles.renderer.impl.BasicRendererFactory.DEFAULT_RENDERER}<<<org.apache.tiles.renderer.impl.BasicRendererFactory.DEFAULT_RENDERER>>>}}
+  init parameter, if you are using parameter-based initialization;
+
+  * overriding the
+  {{{../../apidocs/org/apache/tiles/factory/BasicTilesContainerFactory.html#createDefaultAttributeRenderer(java.lang.Object,%20org.apache.tiles.TilesApplicationContext,%20org.apache.tiles.context.TilesContextFactory,%20org.apache.tiles.TilesContainer,%20org.apache.tiles.evaluator.AttributeEvaluator)}createDefaultAttributeRenderer}}
+  of <<<BasicTilesContainerFactory>>> if you are using Java-based configuration.
+
+* Custom attribute renderer factory
+
+  The attribute renderer factory can be completely customized, leaving to you
+  the maximum freedom of choice in the attribute renderer creation. You can
+  specify the factory's implementation by:
+
+  * using the
+  {{{../../config-reference.html#org.apache.tiles.renderer.RendererFactory}<<<org.apache.tiles.renderer.RendererFactory>>>}}
+  init parameter, if you are using parameter-based initialization;
+
+  * overriding the
+  {{{../../apidocs/org/apache/tiles/factory/BasicTilesContainerFactory.html#createRendererFactory(java.lang.Object,%20org.apache.tiles.TilesApplicationContext,%20org.apache.tiles.context.TilesContextFactory,%20org.apache.tiles.TilesContainer,%20org.apache.tiles.evaluator.AttributeEvaluator)}createRendererFactory}}
+  of <<<BasicTilesContainerFactory>>> if you are using Java-based configuration.
+    
\ No newline at end of file

Modified: tiles/framework/trunk/src/site/apt/tutorial/advanced/index.apt
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/tutorial/advanced/index.apt?rev=700149&r1=700148&r2=700149&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/apt/tutorial/advanced/index.apt (original)
+++ tiles/framework/trunk/src/site/apt/tutorial/advanced/index.apt Mon Sep 29 08:11:05 2008
@@ -46,4 +46,5 @@
   [[9]] {{{wildcard.html}Wildcard support}}
   
   [[10]] {{{el-support.html}EL support}}
-  
\ No newline at end of file
+
+  [[11]] {{{attribute-rendering.html}Attribute rendering}}

Modified: tiles/framework/trunk/src/site/apt/tutorial/index.apt
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/tutorial/index.apt?rev=700149&r1=700148&r2=700149&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/apt/tutorial/index.apt (original)
+++ tiles/framework/trunk/src/site/apt/tutorial/index.apt Mon Sep 29 08:11:05 2008
@@ -60,7 +60,9 @@
         [[9]] {{{advanced/wildcard.html}Wildcard support}}
   
         [[10]] {{{advanced/el-support.html}EL support}}
-  
+
+        [[11]] {{{advanced/attribute-rendering.html}Attribute rendering}}
+
   [[6]] {{{integration/index.html}Integration with other technologies}}
   
         [[1]] {{{integration/frameworks.html}Integration with other frameworks}}

Modified: tiles/framework/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/site.xml?rev=700149&r1=700148&r2=700149&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/site.xml (original)
+++ tiles/framework/trunk/src/site/site.xml Mon Sep 29 08:11:05 2008
@@ -110,6 +110,9 @@
                     <item   
                             name="EL support"
                             href="tutorial/advanced/el-support.html"/>
+                    <item   
+                            name="Attribute rendering"
+                            href="tutorial/advanced/attribute-rendering.html"/>
                 </item>
                 <item   
                         name="Integrations"