|
Found a NPE bug in the initial patch when selecting the customize html.
Here are the corrected patches.
Scott
-----Original Message-----
Adds the ability to set a PortletInstance's title. This allows users to override the parent Portlet's title for display purposes.
PortletInstance.getTitle() will now first look at Entry.getTitle() first to retrieve a PortletInstance's title. If no title is defined, it defaults to the parent's title.
Modifications had to be made to Jetspeed.vm so that we were looking at the PortletInstance instead of the Portlet itself when retrieving the title.
Scott |
Index: src/java/org/apache/jetspeed/portal/JetspeedPortletInstance.java
===================================================================
RCS file:
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/JetspeedPortletInstance.java,v
retrieving revision 1.2
diff -u -r1.2 JetspeedPortletInstance.java
--- src/java/org/apache/jetspeed/portal/JetspeedPortletInstance.java 1 Jul 2002
06:15:52 -0000 1.2
+++ src/java/org/apache/jetspeed/portal/JetspeedPortletInstance.java 9 Jul 2002
+17:31:37 -0000
@@ -62,7 +62,6 @@
import org.apache.jetspeed.om.profile.Parameter;
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.om.profile.psml.PsmlParameter;
-import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
import org.apache.turbine.util.RunData;
@@ -301,15 +300,33 @@
*/
public String getTitle()
{
- return portlet.getTitle();
+ String title = null;
+
+ if(entry != null)
+ {
+ title = entry.getTitle();
+ }
+ if(title == null)
+ {
+ title = portlet.getTitle();
+ }
+ return title;
}
/**
* @see PortletInstance#getPortlet()
*/
public Portlet getPortlet()
- {
+ {
return this.portlet;
+ }
+
+ /**
+ * @see PortletInstance#setTitle()
+ */
+ public void setTitle(String title)
+ {
+ entry.setTitle(title);
}
}
Index: src/java/org/apache/jetspeed/portal/PortletInstance.java
===================================================================
RCS file:
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletInstance.java,v
retrieving revision 1.1
diff -u -r1.1 PortletInstance.java
--- src/java/org/apache/jetspeed/portal/PortletInstance.java 1 Jul 2002 04:30:24
-0000 1.1
+++ src/java/org/apache/jetspeed/portal/PortletInstance.java 9 Jul 2002 17:31:38
+-0000
@@ -173,12 +173,21 @@
String getName();
/**
- * Retrieves the title (if it is defined) of the parent portlet as it is defined
- * within the portlet registry.
+ * Retrieves the title (if it is defined) from the current PSML Document
+ * . If this is not defined it will use the title (if it is defined) of the
+parent portlet
+ * as it is defined within the portlet registry.
*
* @return String The title of the portlet.
*/
String getTitle();
+
+ /**
+ * Sets the title of this PortletInstance. This overrides the
+ * title (if it is defined) of the parnet.
+ *
+ * @return String The title of the portlet.
+ */
+ void setTitle(String title);
/**
* Retrieves the description (if it is defined) of the parent portlet as it
Index: webapp/WEB-INF/templates/vm/controls/html/jetspeed.vm
===================================================================
RCS file:
/home/cvspublic/jakarta-jetspeed/webapp/WEB-INF/templates/vm/controls/html/jetspeed.vm,v
retrieving revision 1.9
diff -u -r1.9 jetspeed.vm
--- webapp/WEB-INF/templates/vm/controls/html/jetspeed.vm 15 Mar 2002 09:21:13
-0000 1.9
+++ webapp/WEB-INF/templates/vm/controls/html/jetspeed.vm 9 Jul 2002 16:19:42
+-0000
@@ -46,7 +46,8 @@
#if( $portlet.isShowTitleBar($data) )
<tr #if (${skin.TitleStyleClass}) class="${skin.TitleStyleClass}" #end #if
(${titlestyle}) style="${titlestyle}" #end >
<td align="left" nowrap="true" valign="middle" width="100%" #if
(${skin.TitleStyleClass}) class="${skin.TitleStyleClass}" #end #if (${titlestyle})
style="${titlestyle}" #end>
- $portlet.Title
+ ## $portlet.Title
+ $portlet.getInstance($data).Title
</td>
<td align="right" nowrap="true" valign="middle" #if (${skin.TitleStyleClass})
class="${skin.TitleStyleClass}" #end #if (${titlestyle}) style="${titlestyle}" #end>
#foreach ( $action in $actions )-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
