portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r414477 - in /portals/jetspeed-2/trunk: components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPortletPreferenceSet.java src/webapp/WEB-INF/pages/default-page.psml
Date Thu, 15 Jun 2006 05:52:13 GMT
Author: rwatler
Date: Wed Jun 14 22:52:13 2006
New Revision: 414477

URL: http://svn.apache.org/viewvc?rev=414477&view=rev
Log:
by popular demand, allow default preference values in PSML Fragments to override default preference
values specified in portlet.xml

Modified:
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPortletPreferenceSet.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/default-page.psml

Modified: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPortletPreferenceSet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPortletPreferenceSet.java?rev=414477&r1=414476&r2=414477&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPortletPreferenceSet.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPortletPreferenceSet.java
Wed Jun 14 22:52:13 2006
@@ -43,29 +43,39 @@
     
     public FragmentPortletPreferenceSet(PreferenceSetComposite preferenceSet, Fragment fragment)
     {
+        // save mutable preference set and read only fragment
         this.preferenceSet = preferenceSet;
         this.fragment = fragment;
+
+        // construct merged portlet definition prefs map;
+        // note that user specific preferences accessed via
+        // the portlet entity should override these defaults
+        int prefsSize = preferenceSet.size() + 1;
         if (fragment.getPreferences() != null)
         {
-            this.prefs = new HashMap(fragment.getPreferences().size());
-            Iterator itr = fragment.getPreferences().iterator();        
-            while(itr.hasNext())
-            {
-                Preference pref = (Preference) itr.next();
-                prefs.put(pref.getName(), pref);
-            }
-        }
-        else
-        {
-            this.prefs = new HashMap();
+            prefsSize += fragment.getPreferences().size();
         }
-        
+        this.prefs = new HashMap(prefsSize);
+
+        // add global portlet definition defaults to prefs
         Iterator iterator = preferenceSet.iterator();
         while(iterator.hasNext())
         {
             Preference pref = (Preference) iterator.next();
             prefs.put(pref.getName(), pref);
         }        
+
+        // add/override global portlet definition defaults
+        // using more specific fragment preferences
+        if (fragment.getPreferences() != null)
+        {
+            Iterator itr = fragment.getPreferences().iterator();        
+            while(itr.hasNext())
+            {
+                Preference pref = (Preference) itr.next();
+                prefs.put(pref.getName(), pref);
+            }
+        }
     }
 
     public Preference add(String arg0, List arg1)

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/default-page.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/default-page.psml?rev=414477&r1=414476&r2=414477&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/default-page.psml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/pages/default-page.psml Wed Jun 14 22:52:13
2006
@@ -57,12 +57,19 @@
       <property layout="TwoColumns" name="row" value="3" />
       <property layout="TwoColumns" name="column" value="0" />
     </fragment>
-    <fragment id="dp-17" type="portlet" name="demo::UserInfoTest">
+    <fragment id="dp-10" type="portlet" name="demo::IFramePortlet" decorator="gray-gradient-noborder">
       <property layout="TwoColumns" name="row" value="4" />
       <property layout="TwoColumns" name="column" value="0" />
+      <preference name="SRC">
+        <value>http://www.apache.org</value>
+      </preference>
     </fragment>
-    <fragment id="dp-18" type="portlet" name="demo::BookmarkPortlet">
+    <fragment id="dp-17" type="portlet" name="demo::UserInfoTest">
       <property layout="TwoColumns" name="row" value="5" />
+      <property layout="TwoColumns" name="column" value="0" />
+    </fragment>
+    <fragment id="dp-18" type="portlet" name="demo::BookmarkPortlet">
+      <property layout="TwoColumns" name="row" value="6" />
       <property layout="TwoColumns" name="column" value="0" />
     </fragment>
   </fragment>



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


Mime
View raw message