cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: rev 57115 - in cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal: coplet layout/renderer/aspect/impl
Date Wed, 10 Nov 2004 00:11:33 GMT
Author: rgoers
Date: Tue Nov  9 16:11:33 2004
New Revision: 57115

Modified:
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplet/copletinstancedata.xml
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/PortletWindowAspect.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java
Log:
Allow title in coplet instance to override coplet data.


Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplet/CopletInstanceData.java
Tue Nov  9 16:11:33 2004
@@ -38,7 +38,9 @@
 
     /** Temporary attributes are not persisted */
     protected Map temporaryAttributes = new HashMap();
-    
+
+    private String title = null;
+
 	/**
 	 * Constructor
 	 */
@@ -92,7 +94,22 @@
     public Map getTemporaryAttributes() {
         return this.temporaryAttributes;
     }
-    
+
+    public String getTitle() {
+        if (this.title != null) {
+            return this.title;
+        }
+        return this.getCopletData().getTitle();
+    }
+
+    public String getInstanceTitle() {
+        return this.title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
     /* (non-Javadoc)
      * @see java.lang.Object#clone()
      */
@@ -114,5 +131,4 @@
             return null;
         }
     }
-    
 }

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplet/copletinstancedata.xml
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplet/copletinstancedata.xml
(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplet/copletinstancedata.xml
Tue Nov  9 16:11:33 2004
@@ -50,6 +50,10 @@
 		<field name="attributes" type="org.exolab.castor.mapping.MapItem" collection="map" handler="org.apache.cocoon.portal.util.AttributesFieldHandler">
 			<bind-xml name="attribute"/>
 		</field>
+
+    <field name="title" type="java.lang.String" get-method="getInstanceTitle">
+      <bind-xml name="title"/>
+    </field>
 	</class>
 
 	<class name="org.exolab.castor.mapping.MapItem">

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/PortletWindowAspect.java
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/PortletWindowAspect.java
(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/PortletWindowAspect.java
Tue Nov  9 16:11:33 2004
@@ -121,7 +121,7 @@
         final PortletWindow window = (PortletWindow)copletInstanceData.getTemporaryAttribute("window");
         if ( window == null ) {
             // no portlet window, so use a default behaviour
-            XMLUtils.createElement(contenthandler, "title", copletInstanceData.getCopletData().getTitle());
+            XMLUtils.createElement(contenthandler, "title", copletInstanceData.getTitle());
         } else {
             if ( ((PortletWindowImpl)window).getLayout() == null ) {
                 ((PortletWindowImpl)window).setLayout((CopletLayout)layout);
@@ -133,7 +133,7 @@
                 try {
                     title = def.getDisplayName(def.getLanguageSet().getDefaultLocale()).getDisplayName();
                 } catch (Exception ignore)  {
-                    title = copletInstanceData.getCopletData().getTitle();
+                    title = copletInstanceData.getTitle();
                 }
             }
             XMLUtils.createElement(contenthandler, "title", title);            

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java
(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java
Tue Nov  9 16:11:33 2004
@@ -53,7 +53,7 @@
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  * 
- * @version CVS $Id: WindowAspect.java,v 1.8 2004/04/25 20:09:34 haul Exp $
+ * @version CVS $Id$
  */
 public final class WindowAspect extends AbstractAspect {
 
@@ -71,7 +71,7 @@
         if ( config.rootTag ) {
             XMLUtils.startElement(contenthandler, config.tagName);
         }
-        XMLUtils.createElement(contenthandler, "title", copletInstanceData.getCopletData().getTitle());
+        XMLUtils.createElement(contenthandler, "title", copletInstanceData.getTitle());
 
         context.invokeNext( layout, service, contenthandler );
 

Mime
View raw message