deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r863176 - in /websites/staging/deltaspike/trunk/content: ./ deltaspike/jsf.html
Date Sun, 26 May 2013 16:14:15 GMT
Author: buildbot
Date: Sun May 26 16:14:15 2013
New Revision: 863176

Log:
Staging update by buildbot for deltaspike

Modified:
    websites/staging/deltaspike/trunk/content/   (props changed)
    websites/staging/deltaspike/trunk/content/deltaspike/jsf.html

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun May 26 16:14:15 2013
@@ -1 +1 @@
-1479762
+1486424

Modified: websites/staging/deltaspike/trunk/content/deltaspike/jsf.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/deltaspike/jsf.html (original)
+++ websites/staging/deltaspike/trunk/content/deltaspike/jsf.html Sun May 26 16:14:15 2013
@@ -103,12 +103,7 @@
 <li><a href="#using-viewconfigresolver">Using ViewConfigResolver</a></li>
 </ul>
 </li>
-<li><a href="#advanced-api-usages">Advanced API usages</a><ul>
-<li><a href="#creating-custom-meta-data-via-viewmetadata">Creating Custom Meta-Data
via @ViewMetaData</a></li>
-<li><a href="#creating-custom-callbacks-via-viewmetadata">Creating Custom Callbacks
via @ViewMetaData</a></li>
-<li><a href="#creating-custom-inline-meta-data-via-inlineviewmetadata">Creating
Custom inline Meta-Data via @InlineViewMetaData</a></li>
-</ul>
-</li>
+<li><a href="#advanced-api-usages">Advanced API usages</a></li>
 <li><a href="#view-config-spi">View-Config SPI</a></li>
 <li><a href="#activation-of-custom-naming-conventions">Activation of custom naming
conventions</a></li>
 </ul>
@@ -668,12 +663,76 @@ Furthermore, it's also possible to use i
 <p><strong>Besides</strong> translating a config class to the final path
of the folder or page, it's possible to get the implicitly as well as explicitly configured
(view-)meta-data and get and/or execute configured callbacks.</p>
 <h2 id="advanced-api-usages">Advanced API usages</h2>
 <p>[TODO]</p>
-<h3 id="creating-custom-meta-data-via-viewmetadata">Creating Custom Meta-Data via @ViewMetaData</h3>
-<p>[TODO]</p>
-<h3 id="creating-custom-callbacks-via-viewmetadata">Creating Custom Callbacks via @ViewMetaData</h3>
-<p>[TODO]</p>
-<h3 id="creating-custom-inline-meta-data-via-inlineviewmetadata">Creating Custom inline
Meta-Data via @InlineViewMetaData</h3>
-<p>[TODO]</p>
+<p>Creating Custom Meta-Data via @ViewMetaData
+This meta-annotation allows to create custom view-meta-data which can be used for view-configs.
Per default meta-data of a lower level overrides meta-data on a higher level which has the
same type. That can be customized via annotating the final annotation as a whole via <code>@Aggregated(true)</code>.</p>
+<div class="codehilite"><pre><span class="nd">@ViewMetaData</span>
+<span class="nd">@interface</span> <span class="n">InfoPage</span>
+<span class="o">{</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>By just using <code>@InfoPage</code> in view-configs, it can be queried
via:</p>
+<div class="codehilite"><pre><span class="nd">@Inject</span>
+<span class="kd">private</span> <span class="n">ViewConfigResolver</span>
<span class="n">viewConfigResolver</span><span class="o">;</span>
+<span class="c1">//...</span>
+
+<span class="n">ViewConfigDescriptor</span> <span class="n">viewConfigDescriptor</span>
<span class="o">=</span> <span class="n">viewConfigResolver</span><span
class="o">.</span><span class="na">getViewConfigDescriptor</span><span
class="o">(</span><span class="n">Pages</span><span class="o">.</span><span
class="na">Index</span><span class="o">.</span><span class="na">class</span><span
class="o">);</span>
+<span class="n">List</span><span class="o">&lt;</span><span
class="n">InfoPage</span><span class="o">&gt;</span> <span class="n">metaDataList</span>
<span class="o">=</span> <span class="n">viewConfigDescriptor</span><span
class="o">.</span><span class="na">getMetaData</span><span class="o">(</span><span
class="n">InfoPage</span><span class="o">.</span><span class="na">class</span><span
class="o">)</span>
+</pre></div>
+
+
+<p>Creating Custom Callbacks via @ViewMetaData</p>
+<p>Via a custom ConfigPreProcessor it's possible to register custom callbacks dynamically.
+The following listing shows a view-config which adds a simple callback including the corresponding
<code>ConfigPreProcessor</code> and <code>ExecutableCallbackDescriptor</code>.</p>
+<div class="codehilite"><pre><span class="nd">@ViewMetaData</span><span
class="o">(</span><span class="n">preProcessor</span> <span class="o">=</span>
<span class="n">MySecured</span><span class="o">.</span><span class="na">AnnotationPreProcessor</span><span
class="o">.</span><span class="na">class</span><span class="o">)</span>
+<span class="kd">public</span> <span class="nd">@interface</span>
<span class="n">MySecured</span>
+<span class="o">{</span>
+    <span class="n">Class</span><span class="o">&lt;?</span>
<span class="kd">extends</span> <span class="n">TestAccessDecisionVoter</span><span
class="o">&gt;[]</span> <span class="n">value</span><span class="o">();</span>
+
+    <span class="kd">class</span> <span class="nc">AnnotationPreProcessor</span>
<span class="kd">implements</span> <span class="n">ConfigPreProcessor</span><span
class="o">&lt;</span><span class="n">MySecured</span><span class="o">&gt;</span>
+    <span class="o">{</span>
+        <span class="nd">@Override</span>
+        <span class="kd">public</span> <span class="n">MySecured</span>
<span class="nf">beforeAddToConfig</span><span class="o">(</span><span
class="n">MySecured</span> <span class="n">metaData</span><span class="o">,</span>
<span class="n">ViewConfigNode</span> <span class="n">viewConfigNode</span><span
class="o">)</span>
+        <span class="o">{</span>
+            <span class="n">List</span><span class="o">&lt;</span><span
class="n">CallbackDescriptor</span><span class="o">&gt;</span> <span
class="n">descriptors</span> <span class="o">=</span> <span class="n">viewConfigNode</span><span
class="o">.</span><span class="na">getCallbackDescriptors</span><span
class="o">(</span><span class="n">MySecured</span><span class="o">.</span><span
class="na">class</span><span class="o">);</span>
+            <span class="n">descriptors</span><span class="o">.</span><span
class="na">add</span><span class="o">(</span><span class="k">new</span>
<span class="n">Descriptor</span><span class="o">(</span><span
class="n">metaData</span><span class="o">.</span><span class="na">value</span><span
class="o">(),</span> <span class="n">DefaultCallback</span><span class="o">.</span><span
class="na">class</span><span class="o">));</span>
+            <span class="k">return</span> <span class="n">metaData</span><span
class="o">;</span>
+        <span class="o">}</span>
+    <span class="o">}</span>
+
+    <span class="kd">static</span> <span class="kd">class</span>
<span class="nc">Descriptor</span> <span class="kd">extends</span>
<span class="n">ExecutableCallbackDescriptor</span><span class="o">&lt;</span><span
class="n">Set</span><span class="o">&lt;</span><span class="n">String</span><span
class="o">&gt;&gt;</span>
+    <span class="o">{</span>
+        <span class="kd">public</span> <span class="nf">Descriptor</span><span
class="o">(</span><span class="n">Class</span><span class="o">[]</span>
<span class="n">beanClasses</span><span class="o">,</span> <span
class="n">Class</span><span class="o">&lt;?</span> <span class="kd">extends</span>
<span class="n">Annotation</span><span class="o">&gt;</span> <span
class="n">callbackMarker</span><span class="o">)</span>
+        <span class="o">{</span>
+            <span class="kd">super</span><span class="o">(</span><span
class="n">beanClasses</span><span class="o">,</span> <span class="n">callbackMarker</span><span
class="o">);</span>
+        <span class="o">}</span>
+
+        <span class="kd">public</span> <span class="n">List</span><span
class="o">&lt;</span><span class="n">Set</span><span class="o">&lt;</span><span
class="n">String</span><span class="o">&gt;&gt;</span> <span
class="n">execute</span><span class="o">(</span><span class="n">String</span>
<span class="n">param1</span><span class="o">,</span> <span class="n">String</span>
<span class="n">param2</span><span class="o">)</span>
+        <span class="o">{</span>
+            <span class="k">return</span> <span class="kd">super</span><span
class="o">.</span><span class="na">execute</span><span class="o">(</span><span
class="n">param1</span><span class="o">,</span> <span class="n">param2</span><span
class="o">);</span>
+        <span class="o">}</span>
+    <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>By just using <code>@MySecured</code> in view-configs, it can be queried
and executed via:</p>
+<div class="codehilite"><pre><span class="nd">@Inject</span>
+<span class="kd">private</span> <span class="n">ViewConfigResolver</span>
<span class="n">viewConfigResolver</span><span class="o">;</span>
+<span class="c1">//...</span>
+<span class="n">ViewConfigDescriptor</span> <span class="n">viewConfigDescriptor</span>
<span class="o">=</span> <span class="n">viewConfigResolver</span><span
class="o">.</span><span class="na">getViewConfigDescriptor</span><span
class="o">(</span><span class="n">Pages</span><span class="o">.</span><span
class="na">Secured</span><span class="o">.</span><span class="na">Index</span><span
class="o">.</span><span class="na">class</span><span class="o">);</span>
+
+<span class="n">List</span><span class="o">&lt;</span><span
class="n">Set</span><span class="o">&lt;</span><span class="n">String</span><span
class="o">&gt;</span> <span class="cm">/*return type of one callback*/</span><span
class="o">&gt;</span> <span class="n">callbackResult</span> <span
class="o">=</span>
+    <span class="n">viewConfigDescriptor</span><span class="o">.</span><span
class="na">getExecutableCallbackDescriptor</span><span class="o">(</span><span
class="n">MySecured</span><span class="o">.</span><span class="na">class</span><span
class="o">,</span> <span class="n">MySecured</span><span class="o">.</span><span
class="na">Descriptor</span><span class="o">.</span><span class="na">class</span><span
class="o">)</span>
+        <span class="o">.</span><span class="na">execute</span><span
class="o">(</span><span class="s">&quot;param1&quot;</span><span
class="o">,</span> <span class="s">&quot;param2&quot;</span><span
class="o">);</span>
+</pre></div>
+
+
+<p>It's also possible do register different callback-types per view-meta-data. An example
can be found at <code>ViewControllerRef</code> which registers different callback-types
for <code>InitView</code>, <code>PreViewAction</code>, <code>PreRenderView</code>
and <code>PostRenderView</code>. In this case it's needed to use the type of the
callback (= class of the annotation) as additional parameter for <code>#getExecutableCallbackDescriptor</code>.</p>
+<p>Creating Custom inline Meta-Data via @InlineViewMetaData
+This annotation can be used for view-meta-data which can be placed on other classes than
view-config-classes. It's used e.g. for <code>@ViewRef</code>.
+Via a <code>TargetViewConfigProvider</code> it's possible to point to the view-config
the meta-data should get applied to and via <code>InlineMetaDataTransformer</code>
it's possible to convert it to a different meta-data-representation (which allows that at
runtime you only have to support one side since the inline-meta-data was converted to the
same meta-data representation which is used for the normal view-meta-data).</p>
 <h2 id="view-config-spi">View-Config SPI</h2>
 <p>[TODO]</p>
 <h2 id="activation-of-custom-naming-conventions">Activation of custom naming conventions</h2>



Mime
View raw message