Modified: wicket/common/site/trunk/_site/learn/examples/navomatic.html URL: http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/learn/examples/navomatic.html?rev=1085437&r1=1085436&r2=1085437&view=diff ============================================================================== --- wicket/common/site/trunk/_site/learn/examples/navomatic.html (original) +++ wicket/common/site/trunk/_site/learn/examples/navomatic.html Fri Mar 25 16:00:25 2011 @@ -171,148 +171,37 @@ <p>For example, here is markup for a simple Border subclass, a usage of that border, and the markup which would be output on rendering:</p> <h3 id='border_markup'>Border markup</h3> -<div class='highlight'><pre><code class='html'><span class='nt'><html></span> -<span class='nt'><body></span> - <span class='nt'><wicket:border></span> - First <span class='nt'><wicket:body/></span> Last - <span class='nt'></wicket:border></span> -<span class='nt'></body></span> -<span class='nt'></html></span> -</code></pre> -</div> + <h3 id='border_usage'>Border usage</h3> -<div class='highlight'><pre><code class='html'><span class='nt'><html></span> -<span class='nt'><body></span> - <span class='nt'><span</span> <span class='na'>wicket:id =</span><span class='err'> </span><span class='s'>"myBorder"</span><span class='nt'>></span> - Middle - <span class='nt'></span></span> -<span class='nt'></body></span> -<span class='nt'></html></span> -</code></pre> -</div> + <h3 id='rendered_markup'>Rendered markup</h3> -<div class='highlight'><pre><code class='html'><span class='nt'><html></span> -<span class='nt'><body></span> - First Middle Last -<span class='nt'></body></span> -<span class='nt'></html></span> -</code></pre> -</div> + <p>In other words, the markup around the <code><wicket:body/></code> tag in the border component is sort of “wrapped around” the body of the <code><span></code> tag where the border is used. This seems simple in this example, but keep in mind that nested components and even nested borders can appear anywhere in either markup file. This can be used to create quite complex effects with relatively little code.</p> <h3 id='navomaticapplicationjava'>NavomaticApplication.java</h3> <p>Just as in the Hello World! example, we need to define our application. In this case, we set Page1 to be our home page.</p> -<div class='highlight'><pre><code class='java'><span class='kn'>package</span> <span class='n'>org</span><span class='o'>.</span><span class='na'>apache</span><span class='o'>.</span><span class='na'>wicket</span><span class='o'>.</span><span class='na'>examples</span><span class='o'>.</span><span class='na'>navomatic</span><span class='o'>;</span> -<span class='kn'>import</span> <span class='nn'>org.apache.wicket.protocol.http.WebApplication</span><span class='o'>;</span> - -<span class='kd'>public</span> <span class='kd'>class</span> <span class='nc'>NavomaticApplication</span> <span class='kd'>extends</span> <span class='n'>WebApplication</span> <span class='o'>{</span> - <span class='kd'>public</span> <span class='nf'>NavomaticApplication</span><span class='o'>()</span> <span class='o'>{</span> - <span class='o'>}</span> - - <span class='kd'>public</span> <span class='n'>Class</span> <span class='nf'>getHomePage</span><span class='o'>()</span> <span class='o'>{</span> - <span class='k'>return</span> <span class='n'>Page1</span><span class='o'>.</span><span class='na'>class</span><span class='o'>;</span> - <span class='o'>}</span> -<span class='o'>}</span> -</code></pre> -</div> <h3 id='page1java'>Page1.java</h3> <p>The Page1 Java and HTML files look like this:</p> -<div class='highlight'><pre><code class='java'><span class='kn'>package</span> <span class='n'>wicket</span><span class='o'>.</span><span class='na'>examples</span><span class='o'>.</span><span class='na'>navomatic</span><span class='o'>;</span> - -<span class='kn'>import</span> <span class='nn'>org.apache.wicket.markup.html.WebPage</span><span class='o'>;</span> -<span class='kd'>public</span> <span class='kd'>class</span> <span class='nc'>Page1</span> <span class='kd'>extends</span> <span class='n'>WebPage</span> <span class='o'>{</span> - <span class='kd'>public</span> <span class='nf'>Page1</span><span class='o'>()</span> <span class='o'>{</span> - <span class='n'>add</span><span class='o'>(</span><span class='k'>new</span> <span class='n'>NavomaticBorder</span><span class='o'>(</span><span class='s'>"navomaticBorder"</span><span class='o'>));</span> - <span class='o'>}</span> -<span class='o'>}</span> -</code></pre> -</div> <h3 id='page1html'>Page1.html</h3> -<div class='highlight'><pre><code class='html'><span class='nt'><html></span> -<span class='nt'><body></span> - <span class='nt'><span</span> <span class='na'>wicket:id =</span><span class='err'> </span><span class='s'>"navomaticBorder"</span><span class='nt'>></span> - You are viewing Page1 - <span class='nt'></span></span> -<span class='nt'></body></span> -<span class='nt'></html></span> -</code></pre> -</div> + <p>Notice that the NavomaticBorder component is attached to the <code><span></code> tag because the name of the component in the Java code is “navomaticBorder” and the <code><span></code> tag’s wicket:id attribute is set to “navomaticBorder”. Because the two names match, Wicket associates the NavomaticBorder Java component with the <code><span></code> tag.</p> <h3 id='page2java'>Page2.java</h3> <p>The Page2 Java and HTML files look almost identical (and we’ll omit the sources for Page3 altogether because it follows the same pattern):</p> -<div class='highlight'><pre><code class='java'><span class='kd'>public</span> <span class='kd'>class</span> <span class='nc'>Page2</span> <span class='kd'>extends</span> <span class='n'>WebPage</span> <span class='o'>{</span> - <span class='kd'>public</span> <span class='nf'>Page2</span><span class='o'>()</span> <span class='o'>{</span> - <span class='n'>add</span><span class='o'>(</span><span class='k'>new</span> <span class='n'>NavomaticBorder</span><span class='o'>(</span><span class='s'>"navomaticBorder"</span><span class='o'>));</span> - <span class='o'>}</span> -<span class='o'>}</span> -</code></pre> -</div> + <h3 id='page2html'>Page2.html</h3> -<div class='highlight'><pre><code class='html'><span class='nt'><html></span> -<span class='nt'><body></span> - <span class='nt'><span</span> <span class='na'>wicket:id =</span><span class='err'> </span><span class='s'>"navomaticBorder"</span><span class='nt'>></span> - You are viewing Page2 - <span class='nt'></span></span> -<span class='nt'></body></span> -<span class='nt'></html></span> -</code></pre> -</div> + <h3 id='navomaticborderjava'>NavomaticBorder.java</h3> <p>So how does NavomaticBorder work? Glad you asked. The Java code below simply adds the two BoxBorder components you see. These components are nested borders which each draw a thin black line around their contents. The rest of the magic is in the NavomaticBorder markup.</p> -<div class='highlight'><pre><code class='java'><span class='kn'>package</span> <span class='n'>wicket</span><span class='o'>.</span><span class='na'>examples</span><span class='o'>.</span><span class='na'>navomatic</span><span class='o'>;</span> -<span class='kn'>import</span> <span class='nn'>org.apache.wicket.markup.html.border.Border</span><span class='o'>;</span> -<span class='kn'>import</span> <span class='nn'>org.apache.wicket.markup.html.border.BoxBorder</span><span class='o'>;</span> - -<span class='kd'>public</span> <span class='kd'>class</span> <span class='nc'>NavomaticBorder</span> <span class='kd'>extends</span> <span class='n'>Border</span> <span class='o'>{</span> - <span class='kd'>public</span> <span class='nf'>NavomaticBorder</span><span class='o'>(</span><span class='kd'>final</span> <span class='n'>String</span> <span class='n'>componentName</span><span class='o'>)</span> <span class='o'>{</span> - <span class='kd'>super</span><span class='o'>(</span><span class='n'>componentName</span><span class='o'>);</span> - - <span class='n'>add</span><span class='o'>(</span><span class='k'>new</span> <span class='n'>BoxBorder</span><span class='o'>(</span><span class='s'>"navigationBorder"</span><span class='o'>));</span> - <span class='n'>add</span><span class='o'>(</span><span class='k'>new</span> <span class='n'>BoxBorder</span><span class='o'>(</span><span class='s'>"bodyBorder"</span><span class='o'>));</span> - <span class='o'>}</span> -<span class='o'>}</span> -</code></pre> -</div> <h3 id='navomaticborderhtml'>NavomaticBorder.html</h3> -<div class='highlight'><pre><code class='html'><span class='nt'><html></span> -<span class='nt'><body></span> - <span class='nt'><wicket:border></span> - <span class='nt'><p></span> - <span class='nt'><table></span> - <span class='nt'><tr></span> - <span class='nt'><td></span> - <span class='nt'><span</span> <span class='na'>wicket:id =</span><span class='err'> </span><span class='s'>"navigationBorder"</span><span class='nt'>></span> - <span class='nt'><b></span>Navigation Links<span class='nt'></b></span> - <span class='nt'><p></span> - <span class='nt'><wicket:link></span> - <span class='nt'><a</span> <span class='na'>href =</span><span class='err'> </span><span class='s'>"Page1.html"</span><span class='nt'>></span>Page1<span class='nt'></a><br/></span> - <span class='nt'><a</span> <span class='na'>href =</span><span class='err'> </span><span class='s'>"Page2.html"</span><span class='nt'>></span>Page2<span class='nt'></a><br/></span> - <span class='nt'><a</span> <span class='na'>href =</span><span class='err'> </span><span class='s'>"Page3.html"</span><span class='nt'>></span>Page3<span class='nt'></a></span> - <span class='nt'></wicket:link></span> - <span class='nt'></p></span> - <span class='nt'></span></span> - <span class='nt'></td></span> - <span class='nt'><td></span> - <span class='nt'><span</span> <span class='na'>wicket:id =</span><span class='err'> </span><span class='s'>"bodyBorder"</span><span class='nt'>></span> - <span class='nt'><wicket:body/></span> - <span class='nt'></span></span> - <span class='nt'></td></span> - <span class='nt'></tr></span> - <span class='nt'></table></span> - <span class='nt'></p></span> - <span class='nt'></wicket:border></span> - <span class='nt'></body></span> -<span class='nt'></html></span> -</code></pre> -</div> + <p>Notice that the markup above encloses the entire contents of the markup file’s <code><body></code> with a <code><wicket:border></code> tag, as we described earlier. This lets the NavomaticBorder know how much of its markup to use when it wraps itself around the markup it finds in the context where it is used. Notice also the <code><wicket:body/></code> marker which designates where to put whatever is found inside the tag at the use context.</p> <p>Next, notice that the navigation links and the border’s <code><wicket:body/></code> are both enclosed in <code><span></code> tags which have wicket:id attributes that associate those tags with the BoxBorder components added in the NavomaticBorder constructor. These nested border components will each draw a thin black line around their contents.</p> @@ -322,21 +211,6 @@ <h3 id='webxml'>web.xml</h3> <p>In order to get this application up and running, we need to register the application with the Wicket servlet in the web.xml file. The following sections need to be added to the web.xml in the WEB-INF folder.</p> -<div class='highlight'><pre><code class='xml'><span class='nt'><servlet></span> - <span class='nt'><servlet-name></span>NavomaticApplication<span class='nt'></servlet-name></span> - <span class='nt'><servlet-class></span>org.apache.wicket.protocol.http.WicketServlet<span class='nt'></servlet-class></span> - <span class='nt'><init-param></span> - <span class='nt'><param-name></span>applicationClassName<span class='nt'></param-name></span> - <span class='nt'><param-value></span>wicket.examples.navomatic.NavomaticApplication<span class='nt'></param-value></span> - <span class='nt'></init-param></span> - <span class='nt'><load-on-startup></span>1<span class='nt'></load-on-startup></span> -<span class='nt'></servlet></span> -<span class='nt'><servlet-mapping></span> - <span class='nt'><servlet-name></span>NavomaticApplication<span class='nt'></servlet-name></span> - <span class='nt'><url-pattern></span>/app/*<span class='nt'></url-pattern></span> -<span class='nt'></servlet-mapping></span> -</code></pre> -</div> </div> <div id="clearer"></div> <div id="footer"><span>
Modified: wicket/common/site/trunk/_site/learn/examples/usingfragments.html URL: http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/learn/examples/usingfragments.html?rev=1085437&r1=1085436&r2=1085437&view=diff ============================================================================== --- wicket/common/site/trunk/_site/learn/examples/usingfragments.html (original) +++ wicket/common/site/trunk/_site/learn/examples/usingfragments.html Fri Mar 25 16:00:25 2011 @@ -153,86 +153,17 @@ <h2 id='creating_a_fragment'>Creating a Fragment</h2> <p>First things first, let’s create a page that we can add our fragments to. We will add a Loop that will repeat markup and choose a different Fragment for each item in the loop.</p> -<div class='highlight'><pre><code class='html'><span class='nt'><html></span> -<span class='nt'><head></head></span> -<span class='nt'><body></span> -<span class='nt'><ul></span> -<span class='nt'><li</span> <span class='na'>wicket:id=</span><span class='s'>"list"</span><span class='nt'>><span</span> <span class='na'>wicket:id=</span><span class='s'>"panel"</span><span class='nt'>></span></li></span> -<span class='nt'></ul></span> -<span class='nt'><wicket:fragment</span> <span class='na'>wicket:id=</span><span class='s'>"fragment1"</span><span class='nt'>></span>panel 1<span class='nt'></wicket:fragment></span> -<span class='nt'><wicket:fragment</span> <span class='na'>wicket:id=</span><span class='s'>"fragment2"</span><span class='nt'>></span>panel 2<span class='nt'></wicket:fragment></span> -<span class='nt'></body></span> -<span class='nt'></html></span> -</code></pre> -</div> -<p>As you can see in this markup file, we already took care of adding the fragment markup to the page in the <code><wicket:fragment></code> tags. Each fragment can contain its own markup and components. Those components need to be added to the Fragment instance in the Java file, just as you would do with a panel and web markup container.</p> -<div class='highlight'><pre><code class='java'><span class='kn'>package</span> <span class='n'>wicket</span><span class='o'>.</span><span class='na'>quickstart</span><span class='o'>;</span> -<span class='kn'>import</span> <span class='nn'>wicket.markup.html.list.Loop</span><span class='o'>;</span> -<span class='kn'>import</span> <span class='nn'>wicket.markup.html.panel.Fragment</span><span class='o'>;</span> +<p>As you can see in this markup file, we already took care of adding the fragment markup to the page in the <code><wicket:fragment></code> tags. Each fragment can contain its own markup and components. Those components need to be added to the Fragment instance in the Java file, just as you would do with a panel and web markup container.</p> -<span class='kd'>public</span> <span class='kd'>class</span> <span class='nc'>Index</span> <span class='kd'>extends</span> <span class='n'>QuickStartPage</span> <span class='o'>{</span> - <span class='kd'>public</span> <span class='nf'>Index</span><span class='o'>()</span> <span class='o'>{</span> - <span class='n'>Loop</span> <span class='n'>loop</span> <span class='o'>=</span> <span class='k'>new</span> <span class='n'>Loop</span><span class='o'>(</span><span class='s'>"list"</span><span class='o'>,</span> <span class='mi'>5</span><span class='o'>)</span> <span class='o'>{</span> - <span class='kd'>protected</span> <span class='kt'>void</span> <span class='nf'>populateItem</span><span class='o'>(</span><span class='n'>LoopItem</span> <span class='n'>item</span><span class='o'>)</span> <span class='o'>{</span> - <span class='n'>String</span> <span class='n'>fragmentId</span> <span class='o'>=</span> <span class='s'>"fragment"</span> <span class='o'>+</span> <span class='o'>(</span><span class='n'>item</span><span class='o'>.</span><span class='na'>getIteration</span><span class='o'>()</span> <span class='o'>%</span> <span class='mi'>2</span> <span class='o'>+</span> <span class='mi'>1</span><span class='o'>);</span> - <span class='n'>item</span><span class='o'>.</span><span class='na'>add</span><span class='o'>(</span><span class='k'>new</span> <span class='n'>Fragment</span><span class='o'>(</span><span class='s'>"panel"</span><span class='o'>,</span> <span class='n'>fragmentId</span><span class='o'>));</span> - <span class='o'>}</span> - <span class='o'>};</span> - <span class='n'>add</span><span class='o'>(</span><span class='n'>loop</span><span class='o'>);</span> - <span class='o'>}</span> -<span class='o'>}</span> -</code></pre> -</div> <p>The Loop will render 5 items, and the <code>populateItem</code> method will be called for each item. In each item we construct a fragment identifier that corresponds to the identifier in the <code><wicket:fragment></code>. The Fragment constructor takes the identifier of the markup it needs to attach to, and the fragment identifier telling it where to find the specific markup in the file.</p> <h2 id='adding_components_to_fragments'>Adding components to fragments</h2> <p>In the previous example we just showed different markup for each fragment, but you can add components to the fragments as well. Let’s add a label to fragment 1.</p> -<div class='highlight'><pre><code class='html'><span class='nt'><html></span> -<span class='nt'><head></head></span> -<span class='nt'><body></span> -<span class='nt'><ul></span> -<span class='nt'><li</span> <span class='na'>wicket:id=</span><span class='s'>"list"</span><span class='nt'>><span</span> <span class='na'>wicket:id=</span><span class='s'>"panel"</span><span class='nt'>></span></li></span> -<span class='nt'></ul></span> -<span class='nt'><wicket:fragment</span> <span class='na'>wicket:id=</span><span class='s'>"fragment1"</span><span class='nt'>></span>panel 1 <span class='nt'><span</span> <span class='na'>wicket:id=</span><span class='s'>"label"</span><span class='nt'>></span></wicket:fragment></span> -<span class='nt'><wicket:fragment</span> <span class='na'>wicket:id=</span><span class='s'>"fragment2"</span><span class='nt'>></span>panel 2<span class='nt'></wicket:fragment></span> -<span class='nt'></body></span> -<span class='nt'></html></span> -</code></pre> -</div> + <p>In order to add the component to the first fragment we’ll introduce a subclass for fragment one to encapsulate the component.</p> -<div class='highlight'><pre><code class='java'><span class='kn'>package</span> <span class='n'>wicket</span><span class='o'>.</span><span class='na'>quickstart</span><span class='o'>;</span> -<span class='kn'>import</span> <span class='nn'>wicket.markup.html.basic.Label</span><span class='o'>;</span> -<span class='kn'>import</span> <span class='nn'>wicket.markup.html.list.Loop</span><span class='o'>;</span> -<span class='kn'>import</span> <span class='nn'>wicket.markup.html.panel.Fragment</span><span class='o'>;</span> - -<span class='kd'>public</span> <span class='kd'>class</span> <span class='nc'>Index</span> <span class='kd'>extends</span> <span class='n'>QuickStartPage</span> <span class='o'>{</span> - <span class='kd'>public</span> <span class='kd'>class</span> <span class='nc'>Fragment1</span> <span class='kd'>extends</span> <span class='n'>Fragment</span> <span class='o'>{</span> - <span class='kd'>public</span> <span class='nf'>Fragment1</span><span class='o'>(</span><span class='n'>String</span> <span class='n'>id</span><span class='o'>,</span> <span class='n'>String</span> <span class='n'>markupId</span><span class='o'>)</span> <span class='o'>{</span> - <span class='kd'>super</span><span class='o'>(</span><span class='n'>id</span><span class='o'>,</span> <span class='n'>markupId</span><span class='o'>);</span> - <span class='n'>add</span><span class='o'>(</span><span class='k'>new</span> <span class='n'>Label</span><span class='o'>(</span><span class='s'>"label"</span><span class='o'>,</span> <span class='s'>"Hello, World!"</span><span class='o'>));</span> - <span class='o'>}</span> - <span class='o'>}</span> - - <span class='kd'>public</span> <span class='nf'>Index</span><span class='o'>()</span> <span class='o'>{</span> - <span class='n'>Loop</span> <span class='n'>loop</span> <span class='o'>=</span> <span class='k'>new</span> <span class='n'>Loop</span><span class='o'>(</span><span class='s'>"list"</span><span class='o'>,</span> <span class='mi'>5</span><span class='o'>)</span> <span class='o'>{</span> - <span class='kd'>protected</span> <span class='kt'>void</span> <span class='nf'>populateItem</span><span class='o'>(</span><span class='n'>LoopItem</span> <span class='n'>item</span><span class='o'>)</span> <span class='o'>{</span> - <span class='kt'>int</span> <span class='n'>index</span> <span class='o'>=</span> <span class='o'>(</span><span class='n'>item</span><span class='o'>.</span><span class='na'>getIteration</span><span class='o'>()</span> <span class='o'>%</span> <span class='mi'>2</span> <span class='o'>+</span> <span class='mi'>1</span><span class='o'>);</span> - <span class='n'>String</span> <span class='n'>fragmentId</span> <span class='o'>=</span> <span class='s'>"fragment"</span> <span class='o'>+</span> <span class='n'>index</span><span class='o'>;</span> - <span class='k'>if</span> <span class='o'>(</span><span class='n'>index</span> <span class='o'>==</span> <span class='mi'>1</span><span class='o'>)</span> <span class='o'>{</span> - <span class='n'>item</span><span class='o'>.</span><span class='na'>add</span><span class='o'>(</span><span class='k'>new</span> <span class='n'>Fragment1</span><span class='o'>(</span><span class='s'>"panel"</span><span class='o'>,</span> <span class='n'>fragmentId</span><span class='o'>));</span> - <span class='o'>}</span> <span class='k'>else</span> <span class='o'>{</span> - <span class='n'>item</span><span class='o'>.</span><span class='na'>add</span><span class='o'>(</span><span class='k'>new</span> <span class='n'>Fragment</span><span class='o'>(</span><span class='s'>"panel"</span><span class='o'>,</span> <span class='n'>fragmentId</span><span class='o'>));</span> - <span class='o'>}</span> - <span class='o'>}</span> - <span class='o'>};</span> - <span class='n'>add</span><span class='o'>(</span><span class='n'>loop</span><span class='o'>);</span> - <span class='o'>}</span> -<span class='o'>}</span> -</code></pre> -</div> <p>The class <code>Fragment1</code> adds the label to itself. In the loop’s <code>populateItem</code> we alternate the fragments type between <code>Fragment</code> and <code>Fragment1</code>. This means that in the final page on one line you’ll see <code>"panel 1 Hello, World!"</code> and on the other line just <code>"panel 2"</code>.</p> <h2 id='summary'>Summary</h2> Modified: wicket/common/site/trunk/_site/learn/projects/authroles.html URL: http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/learn/projects/authroles.html?rev=1085437&r1=1085436&r2=1085437&view=diff ============================================================================== --- wicket/common/site/trunk/_site/learn/projects/authroles.html (original) +++ wicket/common/site/trunk/_site/learn/projects/authroles.html Fri Mar 25 16:00:25 2011 @@ -195,12 +195,7 @@ <h3 id='authorization'>Authorization</h3> <p>Annotation for configuring what roles are allowed for instantiation the annotated component or package. This annotation can be used for classes and packages, and can be used like this:</p> -<div class='highlight'><pre><code class='java'><span class='c1'>// only users with role ADMIN are allowed to create instances of this page, whether it is</span> -<span class='c1'>// either bookmarkable or not</span> -<span class='nd'>@AuthorizeInstantiation</span><span class='o'>(</span><span class='s'>"ADMIN"</span><span class='o'>)</span> -<span class='kd'>public</span> <span class='kd'>class</span> <span class='nc'>AdminAnnotationsBookmarkablePage</span> <span class='kd'>extends</span> <span class='n'>WebPage</span> -</code></pre> -</div> + <p>When someone who doesn’t have the role ADMIN, Wicket will not allow the page to be fully constructed and throw an authorization exception during the construction of the page. This will result in an access denied page for the user.</p> <p>Enablng the annotations for role based authorization is done by setting the <code>WebApplication#getSecuritySettings</code> value to <code>AnnotationsRoleAuthorizationStrategy</code>. Then you can use the auth/roles provided authorization annotations.</p> @@ -230,13 +225,7 @@ <h3 id='using_maven'>Using Maven</h3> <p>Add the following dependency to your pom:</p> -<div class='highlight'><pre><code class='xml'><span class='nt'><dependency></span> - <span class='nt'><groupId></span>org.apache.wicket<span class='nt'></groupId></span> - <span class='nt'><artifactId></span>wicket-auth-roles<span class='nt'></artifactId></span> - <span class='nt'><version></span>1.4.16<span class='nt'></version></span> -<span class='nt'></dependency></span> -</code></pre> -</div> + <h3 id='required_dependencies'>Required dependencies</h3> <p>Wicket Auth/Roles requires the following jar files to be on your classpath:</p> Modified: wicket/common/site/trunk/_site/learn/projects/velocity.html URL: http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/learn/projects/velocity.html?rev=1085437&r1=1085436&r2=1085437&view=diff ============================================================================== --- wicket/common/site/trunk/_site/learn/projects/velocity.html (original) +++ wicket/common/site/trunk/_site/learn/projects/velocity.html Fri Mar 25 16:00:25 2011 @@ -161,16 +161,7 @@ <p>Velocity brings a templating language to your users. You can let them create conditional markup, use loops and do all other things made possible by Velocity.</p> <p>Velocity templates look like the following:</p> -<div class='highlight'><pre><code class='html'>#set ($foo = "deoxyribonucleic acid") -#set ($bar = "ribonucleic acid") -#if ($foo == $bar) - In this case it's clear they aren't equivalent. So... -#else - They are not equivalent and this will be the output. -#end -</code></pre> -</div> <p>Read <a href='http://velocity.apache.org/engine/releases/velocity-1.4/user-guide.html'>more</a> about the Velocity template language.</p> <p>This project allows you to use Velocity templates as a component within your Wicket pages, and let them live next to Wicket components. A typical usecase would be to enable your users to embed Velocity templates in your application and using that as a type of portlet.</p> @@ -180,32 +171,15 @@ <h2 id='example'>Example</h2> <p>Showing Hello, World using Velocity in a Wicket application, embedded in a Wicket page.</p> -<div class='highlight'><pre><code class='html'><span class='nt'><h2></span>This is a Velocity template<span class='nt'></h2></span> -<span class='nt'><p></span>The secret message is: $message<span class='nt'></p></span> -</code></pre> -</div> <p>In this template we want to replace the string <code>$message</code> with the text “Hello, World!”. <code>$message</code> is Velocity markup denoting a variable that is taken from the context that is provided to the Velocity rendering engine.</p> <p>To use Velocity in your Wicket pages we provide a <code>VelocityPanel</code> which enables you to generate parts of your page using Velocity markup. Adding the panel to your Wicket page is shown in the following example:</p> -<div class='highlight'><pre><code class='java'><span class='kd'>public</span> <span class='nf'>VelocityPage</span><span class='o'>()</span> <span class='o'>{</span> - <span class='n'>HashMap</span><span class='o'><</span><span class='n'>String</span><span class='o'>,</span> <span class='n'>String</span><span class='o'>></span> <span class='n'>values</span> <span class='o'>=</span> <span class='k'>new</span> <span class='n'>HashMap</span><span class='o'><</span><span class='n'>String</span><span class='o'>,</span> <span class='n'>String</span><span class='o'>>();</span> - <span class='n'>values</span><span class='o'>.</span><span class='na'>put</span><span class='o'>(</span><span class='s'>"message"</span><span class='o'>,</span> <span class='s'>"Hello, World!"</span><span class='o'>);</span> - <span class='n'>Model</span><span class='o'><</span><span class='n'>HashMap</span><span class='o'><</span><span class='n'>String</span><span class='o'>,</span> <span class='n'>String</span><span class='o'>>></span> <span class='n'>context</span> <span class='o'>=</span> <span class='n'>Model</span><span class='o'>.</span><span class='na'>of</span><span class='o'>(</span><span class='n'>values</span><span class='o'>);</span> - - <span class='n'>UrlResourceStream</span> <span class='n'>template</span> <span class='o'>=</span> <span class='k'>new</span> <span class='n'>UrlResourceStream</span><span class='o'>(</span><span class='n'>getClass</span><span class='o'>().</span><span class='na'>getResource</span><span class='o'>(</span><span class='s'>"test.html"</span><span class='o'>));</span> - <span class='n'>add</span><span class='o'>(</span><span class='n'>VelocityPanel</span><span class='o'>.</span><span class='na'>forTemplateResource</span><span class='o'>(</span><span class='s'>"velocityPanel"</span><span class='o'>,</span> <span class='n'>context</span><span class='o'>,</span> <span class='n'>template</span><span class='o'>));</span> -<span class='o'>}</span> -</code></pre> -</div> + <p><code>VelocityPanel.forTemplateResource</code> creates a <code>VelocityPanel</code> and sets up the engine such that the context is merged with the template with each render.</p> <p>The markup of the page is quite simple: adding a VelocityPanel is as simple as using a <code>div</code> and attaching a <code>wicket:identifier</code> to it. The following example shows this.</p> -<div class='highlight'><pre><code class='html'><span class='cp'><!DOCTYPE html></span> -<span class='nt'><h1></span>This is a test page for Velocity<span class='nt'></h1></span> -<span class='nt'><div</span> <span class='na'>wicket:id=</span><span class='s'>"velocityPanel"</span><span class='nt'>></div></span> -</code></pre> -</div> + <h2 id='installing'>Installing</h2> <p>Installing Wicket Velocity can be done through adding a dependency in your project’s Maven pom, or by putting the wicket-velocity.jar and the required dependencies in your projects classpath.</p> @@ -213,13 +187,7 @@ <h3 id='using_maven'>Using Maven</h3> <p>Add the following dependency to your pom:</p> -<div class='highlight'><pre><code class='xml'><span class='nt'><dependency></span> - <span class='nt'><groupId></span>org.apache.wicket<span class='nt'></groupId></span> - <span class='nt'><artifactId></span>wicket-velocity<span class='nt'></artifactId></span> - <span class='nt'><version></span>1.4.16<span class='nt'></version></span> -<span class='nt'></dependency></span> -</code></pre> -</div> + <h3 id='required_dependencies'>Required dependencies</h3> <p>Wicket Velocity requires the following jar files to be on your classpath:</p> Modified: wicket/common/site/trunk/_site/start/download.html URL: http://svn.apache.org/viewvc/wicket/common/site/trunk/_site/start/download.html?rev=1085437&r1=1085436&r2=1085437&view=diff ============================================================================== --- wicket/common/site/trunk/_site/start/download.html (original) +++ wicket/common/site/trunk/_site/start/download.html Fri Mar 25 16:00:25 2011 @@ -173,21 +173,9 @@ <h2 id='maven_2'>Maven 2</h2> <p>Add the following snippet to your Maven project descriptor (<code>pom.xml</code>):</p> -<div class='highlight'><pre><code class='xml'><span class='nt'><dependency></span> - <span class='nt'><groupId></span>org.apache.wicket<span class='nt'></groupId></span> - <span class='nt'><artifactId></span>wicket<span class='nt'></artifactId></span> - <span class='nt'><version></span>1.4.16<span class='nt'></version></span> -<span class='nt'></dependency></span> -</code></pre> -</div> + <p>For the SLF4J log4j binding:</p> -<div class='highlight'><pre><code class='xml'><span class='nt'><dependency></span> - <span class='nt'><groupId></span>org.slf4j<span class='nt'></groupId></span> - <span class='nt'><artifactId></span>slf4j-log4j12<span class='nt'></artifactId></span> - <span class='nt'><version></span>1.5.6<span class='nt'></version></span> -<span class='nt'></dependency></span> -</code></pre> -</div> + <h2 id='snapshots_and_latest_bleedingedge_code'>SNAPSHOTs and latest bleeding-edge code</h2> <p>If you wish to build the latest code from scratch, the two branches live in the following places in Subversion:</p> @@ -203,15 +191,6 @@ </ul> <p>There’s also a Maven 2 repository providing SNAPSHOTs available here:</p> -<div class='highlight'><pre><code class='xml'><span class='nt'><repositories></span> - <span class='nt'><repository></span> - <span class='nt'><id></span>org.wicketstuff<span class='nt'></id></span> - <span class='nt'><name></span>Wicket Stuff Repository<span class='nt'></name></span> - <span class='nt'><url></span>http://wicketstuff.org/maven/repository<span class='nt'></url></span> - <span class='nt'></repository></span> -<span class='nt'></repositories></span> -</code></pre> -</div> </div> <div id="clearer"></div> <div id="footer"><span> Added: wicket/common/site/trunk/learn/books/awc.jpg URL: http://svn.apache.org/viewvc/wicket/common/site/trunk/learn/books/awc.jpg?rev=1085437&view=auto ============================================================================== Binary file - no diff available. Propchange: wicket/common/site/trunk/learn/books/awc.jpg ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: wicket/common/site/trunk/learn/books/awc.md URL: http://svn.apache.org/viewvc/wicket/common/site/trunk/learn/books/awc.md?rev=1085437&view=auto ============================================================================== --- wicket/common/site/trunk/learn/books/awc.md (added) +++ wicket/common/site/trunk/learn/books/awc.md Fri Mar 25 16:00:25 2011 @@ -0,0 +1,87 @@ +--- +layout: default +title: Books â Apache Wicket Cookbook +--- + +## Description ## + +Apache Wicket is one of the most famous Java web application frameworks. Wicket simplifies web development and makes it fun. Are you bored of going through countless pages of theory to find out how to get your web development done? With this book in hand, you don't need to go through hundreds of pages to figure out how you will actually build a web application. You will get practical solutions to your common everyday development tasks to pace up your development activities. + +Apache Wicket Cookbook provides you with information that gets your problems solved quickly without beating around the bush. This book is perfect for you if you are ready to take the next step from tutorials and step into the practical world. It will take you beyond the basics of using Apache Wicket and show you how to leverage Wicket's advanced features to create simpler and more maintainable solutions to what at first may seem complex problems. + +You will learn how to integrate with client-side technologies such as JavaScript libraries or Flash components, which will help you to build your application faster. You will discover how to use Wicket paradigms to factor out commonly used code into custom Components, which will reduce the maintenance cost of your application, and how to leverage the existing Wicket Components to make your own code simpler. + +A straightforward Cookbook with over 75 highly focused practical recipes to make your web application development easier with the Wicket web framework + +## What you will learn from this book ## + +* Leverage Wicket to implement a wide variety of both simple and advanced use cases in a narrative that gets straight to the point +* Make forms work in the crazy world of the Web by learning the ways of Wicket's form processing +* Simplify localizing your Wicket applications +* Take the boring out of your forms by discovering how to improve the user experience while simplifying your code at the same time +* Leverage the built-in Table component to make displaying tabular data a snap +* Think Wicket's Borders are not very useful? Learn to use them in unexpected places to simplify things +* See how to integrate with Flash components and create interactive charts at the same time +* Web 1.0 too boring? Learn how to tame Wicket's AJAX support and bring your application into Web 2.0 +* Simplify your security code by learning various security techniques +* An application cannot be built with Wicket alone; see how to make it play nice with other frameworks + +## Approach ## + +This is a hands-on practical guide to a large variety of topics and use cases. This book tries to use real-world examples when possible, but is not afraid to come up with a contrived pretext if it makes explaining the problem simpler. Unlike a lot of other books, this one does not try to maintain a continuous theme from chapter to chapter, such as demonstrating solutions on the same fictional application; doing so would be almost impossible given the wide variety of recipes presented here. Instead, this book concentrates on focused problems users are likely to encounter and shows clear solutions in a step-by-step manner. This book tries to teach by example and is not afraid to show a lot of code because, after all, it is for coders. + +## Who this book is written for ## + +This book is for current users of the Apache Wicket framework; it is not an introduction to Wicket that will bore you with tons of theory. You are expected to have built or maintained a simple Wicket application in the past and to be looking to learn new and better ways of using Wicket. If you are ready to take your Wicket skills to the next level this book is for you. + +## About the author ## + +Igor Vaynberg is a software architect with more than ten years of experience in the software field. His liking for computers was sparked when his parents got him a Sinclair Z80 when he was but ten years old. Since then he has worked with companies both large and small building modular and scalable web applications. Igor's main interest is finding ways to simply the development of complex user interfaces required by modern web applications. Igor is a committer for the Apache Wicket framework, the aim of which is to simply the programming model as well as reintroduce OOP to the web UI tier. In his AFK time he enjoys snowboarding with his beautiful wife and playing with his amazing children. + + +## Book details ## + +<table> + <tr> + <th>Title</th> + <td>Apache Wicket Cookbook</td> + </tr> + <tr> + <th>Author</th> + <td>Igor Vaynberg</td> + </tr> + <tr> + <th>Version covered</th> + <td>Wicket 1.4, but most material is applicable to Wicket 1.5</td> + </tr> + <tr> + <th>Publisher URL</th> + <td><a href="http://www.packtpub.com/apache-wicket-cookbook/book">Apache Wicket Cookbook</a></td> + </tr> + <tr> + <th>Paperback</th> + <td>312 pages</td> + </tr> + <tr> + <th>Date</th> + <td>March, 2011</td> + </tr> + <tr> + <th>Language</th> + <td>English</td> + </tr> + <tr> + <th>ISBN-10</th> + <td>1849511608</td> + </tr> + <tr> + <th>ISBN-13</th> + <td>978-1-84951-160-5</td> + </tr> + <tr> + <th>Buy</th> + <td><a href="http://www.packtpub.com/apache-wicket-cookbook/book">PACKT Publishing</a></td> + </tr> +</table> + + Modified: wicket/common/site/trunk/learn/books/index.md URL: http://svn.apache.org/viewvc/wicket/common/site/trunk/learn/books/index.md?rev=1085437&r1=1085436&r2=1085437&view=diff ============================================================================== --- wicket/common/site/trunk/learn/books/index.md (original) +++ wicket/common/site/trunk/learn/books/index.md Fri Mar 25 16:00:25 2011 @@ -3,9 +3,10 @@ layout: default title: Books about Wicket --- -Several books have been written about Apache Wicket, 3 in English, 2 in German +Several books have been written about Apache Wicket, 4 in English, 2 in German and 1 in Japanese. Click on a cover to learn more about each book. +<a href="awc.html"><img src="awc.jpg" height="300px" alt="Apache Wicket Cookbook cover" title="Apache Wicket Cookbook" /></a> <a href="wia.html"><img src="wia.png" height="300px" alt="Wicket in Action cover" title="Wicket in Action" /></a> <a href="ewdww.html"><img src="ewdww.png" height="300px" alt="Enjoying Web Development with Wicket cover" title="Enjoying Web Development with Wicket" /></a> <a href="prowicket.html"><img src="prowicket.png" height="300px" alt="Pro Wicket cover" title="Pro Wicket" /></a>