You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2005/05/24 23:39:24 UTC

cvs commit: jakarta-jetspeed/xdocs titles.xml faq.xml viewprocessors.xml

taylor      2005/05/24 14:39:24

  Modified:    xdocs    faq.xml viewprocessors.xml
  Added:       xdocs    titles.xml
  Log:
  setting portlet titles documentation
  
  Revision  Changes    Path
  1.22      +17 -0     jakarta-jetspeed/xdocs/faq.xml
  
  Index: faq.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/faq.xml,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- faq.xml	3 May 2004 17:31:35 -0000	1.21
  +++ faq.xml	24 May 2005 21:39:23 -0000	1.22
  @@ -323,5 +323,22 @@
   				</tr>
   			</table>
   		</section>
  +		<section name="Setting Title at Runtime">
  +			<table>
  +				<tr>
  +					<th>Question</th>
  +					<th>Answer</th>
  +				</tr>
  +				<tr>
  +					<td>
  +How do I set the title at runtime?
  +</td>
  +					<td>
  +<a href="titles.html">Setting Portlet Titles at Runtime</a>
  +                    </td>
  +				</tr>
  +			</table>
  +		</section>
  +        
   	</body>
   </document>
  
  
  
  1.2       +2 -0      jakarta-jetspeed/xdocs/viewprocessors.xml
  
  Index: viewprocessors.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/viewprocessors.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- viewprocessors.xml	3 Apr 2005 22:39:09 -0000	1.1
  +++ viewprocessors.xml	24 May 2005 21:39:23 -0000	1.2
  @@ -57,6 +57,7 @@
                   Since the Velocity and JSP view processors write their content directly to the servlet output stream, 
                   it is possible that the content could be rendered before the title is rendered.
       		</p>
  +            <p><a href="titles.html">Setting Portlet Titles at Runtime</a></p>
       	</subsection>
       	<subsection name="BufferedJSP">
       		<p>
  @@ -71,6 +72,7 @@
                   Since the Velocity and JSP view processors write their content directly to the servlet output stream, 
                   it is possible that the content could be rendered before the title is rendered.
       		</p>
  +            <p><a href="titles.html">Setting Portlet Titles at Runtime</a></p>            
       	</subsection>
       	<subsection name="XSL">
       		<p>
  
  
  
  1.1                  jakarta-jetspeed/xdocs/titles.xml
  
  Index: titles.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>
  		<title>Portlet Titles</title>
  		<subtitle>Setting Portlet Titles at Runtime</subtitle>
  		<authors>
  			<person name="Jeremy Ford" email="jford@apache.org"/>
  			<person name="David Sean Taylor" email="taylor@apache.org"/>            
  		</authors>
  	</properties>
  	<body>
  <section name="Setting Portlet Titles at Runtime">
  <p>
  This document shows how to set the title of your portlet at runtime.
  Jetspeed has some special requirements for setting the portlet title at runtime. 
  We demonstrate the configuration requirements, and then how to set the title in your Java portlet code.
  </p>
  <subsection name='Registry'>
  <p>
  In the portlet registry, declare your portlet:
  </p>
  <source><![CDATA[
  <registry>
  	<portlet-entry name="HelloTitle" hidden="false" type="ref" parent="GenericMVCPortlet" application="false">
  		<meta-info>
  			<title>HelloTitle</title>
  			<description>Simple JSP and Title Portlet Example</description>
  		</meta-info>
  		<parameter name="template" value="title.jsp" hidden="true"/>
  	    <parameter name="viewtype" value="BufferedJSP" hidden="true"/>		
  		<parameter name="action" value="portlets.HelloTitleAction" hidden="true"/>		 
  		<media-type ref="html"/>
  		<category>demo</category>
  		<category>jsp.demo</category>
  	</portlet-entry>
  ]]></source>
  <p>
  You must make sure that the parent portlet is <b>GenericMVCPortlet</b>
  or a derivitive portlet. 
  </p>
  <source><![CDATA[
  parent="GenericMVCPortlet"
  ]]></source>
  <p>
  The view type must be set to <b>BufferedJSP</b>:
  </p>
  <source><![CDATA[
     <parameter name="viewtype" value="BufferedJSP" hidden="true"/>		
  ]]></source>
  </subsection>
  <subsection name='Portlet'>   
  <p>
  Setting the portlet title at runtime is done in your portlet code, from an MVC action,
  buildNormalContext, or the portlet's getContent() methods.
  Here is an example of setting the title in a portlet actions <b>buildNormalContextGeneric</b> method.
  </p>
  <source><![CDATA[
  public class HelloTitleAction extends GenericMVCAction
  {
      protected void buildNormalContext(Portlet portlet, Context context, RunData data)
          throws Exception
      {
          portlet.setTitle("Here we go " + new Date(), data);        
          super.buildNormalContext(portlet, context, data);
      }
  }
  ]]></source>    
  <p>
  Note again, we must derive from the MVC portlet framework. 
  Here we extend <b>GenericMVCAction</b>:
  </p>
  <source><![CDATA[
  public class HelloTitleAction extends GenericMVCAction
  ]]></source>    
  <p>
  Remember to use the new signature, as the single parameter signature of setTitle does not work!
  </p>
  <source><![CDATA[
          portlet.setTitle("Here we go " + new Date(), data);
  ]]></source>    
  </subsection>
  <subsection name='PSML'>
  <p>
  Make sure to have a PSML entry that uses the <b>BufferredTitlePortletControl</b>
  as this is a requirement.
  (This control can also be selected in the portlet customizer)
  </p>
  <source ><![CDATA[
          <entry id="P-103f31759e9-10001" parent="HelloTitle">
              <metainfo>
                  <title>Here we go Wed May 18 20:55:45 PDT 2005</title>
              </metainfo>
              <layout position="-1" size="-1">
                  <property name="column" value="0"/>
                  <property name="row" value="0"/>
              </layout>
              <control name="BufferredTitlePortletControl"/>
          </entry>    
  ]]></source>        
  </subsection>
  <subsection name='Configuration'>
  <p>
  To make the the buffered title control the default for all portlets, set the following property in your
  JetspeedResources.properties.merge (or my.properties):
  </p>
  <source><![CDATA[
  services.PortalToolkit.default.control=BufferredTitlePortletControl
  ]]></source>        
  </subsection>
  </section>
  </body>
  </document>
  
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org