portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r891283 - in /portals/jetspeed-2/applications/j2-admin/trunk/src/main: java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java webapp/WEB-INF/view/toolbox/toolbox.jsp
Date Wed, 16 Dec 2009 16:00:46 GMT
Author: woonsan
Date: Wed Dec 16 16:00:46 2009
New Revision: 891283

URL: http://svn.apache.org/viewvc?rev=891283&view=rev
Log:
JS2-1057: Removing unused codes and changes on accessing the portal singleton instance.

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java?rev=891283&r1=891282&r2=891283&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/toolbox/JetspeedToolbox.java
Wed Dec 16 16:00:46 2009
@@ -31,14 +31,12 @@
 import javax.portlet.RenderResponse;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.math.NumberUtils;
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.decoration.DecorationFactory;
 import org.apache.jetspeed.layout.PageLayoutComponent;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.ContentPage;
-import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.portlet.HeaderPhaseSupportConstants;
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.portals.bridges.common.GenericServletPortlet;
@@ -187,77 +185,5 @@
         
         return categories;
     }
- 
-    protected ContentFragment findFirstUnlockedFragment(ContentFragment fragment)
-    {
-        if (fragment.isLocked())
-        {
-            List<ContentFragment> fragments = (List<ContentFragment>) fragment.getFragments();
-            
-            for (ContentFragment f : fragments)
-            {
-                if (f.getType().equals(Fragment.LAYOUT))
-                {
-                    fragment = findFirstUnlockedFragment(f);
-                    if (fragment != null)
-                        return fragment;
-                }
-            }
-            
-            return null;
-        }
-        return fragment;
-    }
-    
-    // BOZO: this only works with flat collections of 1,2,3,4 column layouts. Not meant to
work with nested layouts
-    // TODO: move code to an AJAX API
-    protected void addPortletToLeastUsedColumn(ContentPage page, String portletName)
-    {
-        ContentFragment layoutFragment = findFirstUnlockedFragment(page.getRootFragment());
-        
-        if (layoutFragment != null)
-        {
-            String layoutType = layoutFragment.getName();
-            List<ContentFragment> fragments = (List<ContentFragment>)layoutFragment.getFragments();
-            int columnCounts[] = new int[getLayoutSize(layoutType)];
-            
-            for (ContentFragment fragment : fragments)
-            {
-                int column = fragment.getLayoutColumn();
-                int row = fragment.getLayoutRow();
-                if (column == -1)
-                    column = NumberUtils.min(columnCounts);
-                if (row == -1)
-                    row = columnCounts[column];            
-                if (column > fragments.size() -1)
-                {
-                    fragment.updateRowColumn(-1, 0);
-                    column = 0;
-                }
-                columnCounts[column]++;
-            }
-            
-            int placedColumn = 0;
-            
-            for (int ix = 1; ix < columnCounts.length; ix++)
-            {
-                if (columnCounts[ix] < columnCounts[placedColumn])
-                    placedColumn = ix;
-            }
-            
-            layoutFragment.addPortlet(ContentFragment.PORTLET, portletName, columnCounts[placedColumn],
placedColumn);
-        }
-    }
     
-    public static int getLayoutSize(String layoutType)
-    {
-        if (layoutType.indexOf("TwoColumns") > -1)
-            return 2;
-        if (layoutType.indexOf("ThreeColumns") > -1)
-            return 3;
-        if (layoutType.indexOf("FourColumns") > -1)
-            return 4;
-        else
-            return 1;
-    }
 }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp?rev=891283&r1=891282&r2=891283&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
Wed Dec 16 16:00:46 2009
@@ -171,7 +171,7 @@
 
 <script language="javascript">
 YUI().use('io', 'json', 'node-base', 'cookie', 'jetui-portal', function(Y) {
-
+    
     function switchTab(e) {
         var tabId = null;
         if ('string' == typeof(e)) {
@@ -308,8 +308,8 @@
             return;
         }
 
-        if (JETUI_YUI && JETUI_YUI.portalInstance) {
-	        var portal = JETUI_YUI.portalInstance;
+        var portal = JETUI_YUI.getPortalInstance();
+        if (portal) {
 	        portal.addPortlet(dataOut);
         } else {
             location.href = location.href;



---------------------------------------------------------------------
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