jford 2004/04/08 14:06:48
Modified: tutorial/xdocs/13 index.xml mvcintro.xml
Added: tutorial/xdocs/13 mvcportlets.xml mvctemplate.xml
Log:
Coverted Chapter 13 tutorial to xdoc format
Revision Changes Path
1.2 +5 -5 jakarta-jetspeed/tutorial/xdocs/13/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/tutorial/xdocs/13/index.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.xml 8 Apr 2004 20:00:47 -0000 1.1
+++ index.xml 8 Apr 2004 21:06:47 -0000 1.2
@@ -32,11 +32,11 @@
<p>
<ul>
<li>1. <a href='mvcintro.html'>Introduction to MVC Portlet</a></li>
-<li>2. <a href='topnav.html'>MVC Portlets in the Registry</a></li>
-<li>3. <a href='leftnav.html'>The Template</a></li>
-<li>4. <a href='bottomnav.html'>MVC Actions and the Context</a></li>
-<li>5. <a href='title.html'>Action Events</a></li>
-<li>6. <a href='skins.html'>Deploy</a></li>
+<li>2. <a href='mvcportlets.html'>MVC Portlets in the Registry</a></li>
+<li>3. <a href='mvctemplate.html'>The Template</a></li>
+<li>4. <a href='mvcactioncontext.html'>MVC Actions and the Context</a></li>
+<li>5. <a href='mvcactionevents.html'>Action Events</a></li>
+<li>6. <a href='deploy.html'>Deploy</a></li>
</ul>
</p>
1.2 +2 -2 jakarta-jetspeed/tutorial/xdocs/13/mvcintro.xml
Index: mvcintro.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/tutorial/xdocs/13/mvcintro.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mvcintro.xml 8 Apr 2004 20:02:52 -0000 1.1
+++ mvcintro.xml 8 Apr 2004 21:06:47 -0000 1.2
@@ -170,7 +170,7 @@
<hr />
-<code>
+<source>
<![CDATA[
<HTML>
<BODY>
@@ -191,7 +191,7 @@
</BODY>
</HTML>
]]>
-</code>
+</source>
<p>This example is not included with the examples source code distribution.</p>
<p>
1.1 jakarta-jetspeed/tutorial/xdocs/13/mvcportlets.xml
Index: mvcportlets.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed 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.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>Change the Portal Logo</title>
</properties>
<body>
<section name="Velocity Portlets in the Registry">
<p>
There is no need to extend this portlet class, just define your porlet entry in the
registry as a child of this class and provide your template and action class (extended
from GenericMVCAction) and you are good to go.
</p>
<p>
Velocity Portlets are defined like any other portlet: in the portlet registry. In
tutorial 7 we define two new portlets:
</p>
<hr />
<source>
<portlet-entry name="TutorialStockQuote1" hidden="false" type="ref"
parent="Velocity" application="false">
...
<parameter name="template" hidden="true"
value="tutorial-stock-quote1"/>
<parameter name="action" hidden="true"
value="portlets.TutorialStockQuoteAction1" />
...
</portlet-entry>
<portlet-entry name="TutorialStockQuote2" hidden="false" type="ref"
parent="Velocity" application="false">
...
<parameter name="template" hidden="true"
value="tutorial-stock-quote2" />
<parameter name="action" hidden="true"
value="portlets.TutorialStockQuoteAction2" />
...
</portlet-entry>
</source>
<p>
When defining a Velocity portlet, there are two required parameters: the template
and the action. The template defines the Velocity template which will generate the
portlet content.
It is your MVC View component. The action is the controller, and it has several
responsibilities including handling action events and populating the context.
The templates should be placed in the portlets subdirectory of one of your Velocity
template paths. The action is placed in the module path, conventionally under the
portlets directory of the root actions directory.
</p>
<p>
Also note that a Velocity portlet can derive from one of two Velocity portlets: <a
href="http://jakarta.apache.org/jetspeed/api/org/apache/jetspeed/portal/portlets/VelocityPortlet.html">Velocity</a>
or <a
href="http://jakarta.apache.org/jetspeed/api/org/apache/jetspeed/portal/portlets/CustomizerVelocityPortlet.html">CustomizerVelocity</a>.
The only difference being that the Velocity portlet uses the default Jetspeed
portlet customizer, where as the CustomizerVelocity portlet is expected to provide its
own customization. Look at the Weather Portlet as an example of a CustomizerVelocity
portlet providing its own customization.
</p>
<hr />
<code>
<portlet-entry name="TutorialStockQuote1" hidden="false" type="ref"
parent="Velocity" application="false">
...
</portlet-entry>
<portlet-entry name="WeatherPortlet" hidden="false" type="ref"
parent="CustomizerVelocity" application="false" >
...
</portlet-entry>
</code>
</section>
</body>
</document>
1.1 jakarta-jetspeed/tutorial/xdocs/13/mvctemplate.xml
Index: mvctemplate.xml
===================================================================
<?xml version="1.0"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed 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.
-->
<document>
<properties>
<author email="[EMAIL PROTECTED]">David Sean Taylor</author>
<title>Change the Portal Logo</title>
</properties>
<body>
<section name="The Velocity Template">
<p>
Let"s have a look at the Velocity template for our first example:
<b>tutorial-stock-quote1.vm</b>
It"s a very simple example of displaying live stock quotes from a web service.
The stock quotes are returned in a collection of quote records, called $quotes.
Also, the column headers are in a collection of strings called $columns.
</p>
<hr />
<source>
<table>
<tr>
<td>
<table border="true" cellspacing="1" cellpadding="3">
<tr>
#foreach ($column in $columns)
#headerCell ($column)
#end
</tr>
#foreach ($quote in $quotes)
<tr>
#entryCell ($quote.Symbol)
#entryCell ($quote.Price)
#entryCell ($quote.Change)
#entryCell ($quote.Volume)
</tr>
#end
</table>
</td>
</tr>
</table>
</source>
<p>
Accessors get the attributes: symbol, price, change and volume.
Also notice that there are some macros: #headerCell and #entryCell.
The macros are defined in a common <a
href="http://jakarta.apache.org/velocity/user-guide.html#Velocimacros">Velocimacro</a>
file that is shared across Jetspeed.
<a
href="http://jakarta.apache.org/velocity/user-guide.html#Velocimacros">Velocimacro</a>
are great for defining little snippets of templates that can be included into other
templates.
</p>
<hr />
<code>
services.VelocityService.velocimacro.library = GlobalMacros.vm
</code>
<p>
The macros in question are defined in the <b>GlobalMacros.vm</b> file. A macro
definition takes parameters. Macros can include macros:
</p>
<hr />
<code>
#macro (formCell $label $name $value)
#formLabel("$label")
#formTextField("$name" "$value")
#end
</code>
<p>
Similarly, common snippets can simple be parsed into the template directly:
</p>
<hr />
<code>
#parse ("/portlets/html/tree-row-browser.vm")
</code>
</section>
</body>
</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]