portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r209714 - in /portals/jetspeed-2/branches/MENUS_BRANCH: components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/ components/portal-site/src/java/org/apache/jetspeed/portalsite/menu/ components/portal-site/src/java/org/apache/jet...
Date Fri, 08 Jul 2005 07:15:40 GMT
Author: rwatler
Date: Fri Jul  8 00:15:37 2005
New Revision: 209714

URL: http://svn.apache.org/viewcvs?rev=209714&view=rev
Log:
Minor bug fixes:

- add Menu.isEmpty()
- fix path evaluation corner case involving single folder regexp matches
- define standard navigations menu root links as '/*.link', not '*.link'


Modified:
    portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/MenuImpl.java
    portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/menu/StandardNavigationsMenuDefinition.java
    portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java
    portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/test/org/apache/jetspeed/portalsite/TestPortalSite.java
    portals/jetspeed-2/branches/MENUS_BRANCH/jetspeed-api/src/java/org/apache/jetspeed/portalsite/Menu.java
    portals/jetspeed-2/branches/MENUS_BRANCH/portal/src/webapp/WEB-INF/decorations/layout/html/tigris/decorator-top.vm

Modified: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/MenuImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/MenuImpl.java?rev=209714&r1=209713&r2=209714&view=diff
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/MenuImpl.java
(original)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/MenuImpl.java
Fri Jul  8 00:15:37 2005
@@ -302,7 +302,7 @@
                                 else
                                 {
                                     // include menu elements
-                                    if ((includeMenu.getElements() != null) && !includeMenu.getElements().isEmpty())
+                                    if (!includeMenu.isEmpty())
                                     {
                                         Iterator elementsIter = includeMenu.getElements().iterator();
                                         while (elementsIter.hasNext())
@@ -972,6 +972,16 @@
     public List getElements()
     {
         return elements;
+    }
+
+    /**
+     * isEmpty - get empty state of list of menu elements
+     *
+     * @return menu elements list empty state
+     */
+    public boolean isEmpty()
+    {
+        return ((elements == null) || elements.isEmpty());
     }
 
     /**

Modified: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/menu/StandardNavigationsMenuDefinition.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/menu/StandardNavigationsMenuDefinition.java?rev=209714&r1=209713&r2=209714&view=diff
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/menu/StandardNavigationsMenuDefinition.java
(original)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/menu/StandardNavigationsMenuDefinition.java
Fri Jul  8 00:15:37 2005
@@ -139,7 +139,7 @@
                      */
                     public String getOptions()
                     {
-                        return "*" + Link.DOCUMENT_TYPE;
+                        return Folder.PATH_SEPARATOR + "*" + Link.DOCUMENT_TYPE;
                     }
 
                     /**

Modified: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java?rev=209714&r1=209713&r2=209714&view=diff
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java
(original)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java
Fri Jul  8 00:15:37 2005
@@ -883,6 +883,7 @@
                                     // null if nonexistent
                                     if (subfolders.size() > 1)
                                     {
+                                        // recursively process matching sub-folders
                                         List proxies = null;
                                         Iterator subfoldersIter = subfolders.iterator();
                                         while (subfoldersIter.hasNext())
@@ -902,18 +903,31 @@
                                     }
                                     else if (subfolders.size() == 1)
                                     {
+                                        // access single sub-folder
                                         currentFolder = (Folder)subfolders.iterator().next();
                                     }
                                     else
                                     {
+                                        // no matching sub-folders
                                         return null;
                                     }
                                 }
+                                else
+                                {
+                                    // no matching sub-folders
+                                    return null;
+                                }
+                            }
+                            else
+                            {
+                                // no sub-folders
+                                return null;
                             }
                         }
                         else
                         {
-                            // access sub-folder or return null if nonexistent
+                            // access single sub-folder or return null if
+                            // nonexistent by throwing exception
                             currentFolder = currentFolder.getFolder(subfolder);
                         }
                     }

Modified: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/test/org/apache/jetspeed/portalsite/TestPortalSite.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/test/org/apache/jetspeed/portalsite/TestPortalSite.java?rev=209714&r1=209713&r2=209714&view=diff
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/test/org/apache/jetspeed/portalsite/TestPortalSite.java
(original)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/test/org/apache/jetspeed/portalsite/TestPortalSite.java
Fri Jul  8 00:15:37 2005
@@ -480,6 +480,7 @@
         assertEquals("dhtml-pull-down", topMenu.getSkin());
         assertEquals("top", topMenu.getName());
         assertEquals("/", topMenu.getUrl());
+        assertFalse(topMenu.isEmpty());
         List topMenuElements = topMenu.getElements();
         assertNotNull(topMenuElements);
         assertEquals(7, topMenuElements.size());
@@ -492,6 +493,7 @@
                 assertTrue(element instanceof Menu);
                 assertEquals("/folder0", ((Menu)element).getUrl());
                 assertTrue(((Menu)element).getParentMenu() == topMenu);
+                assertFalse(((Menu)element).isEmpty());
                 List elements = ((Menu)element).getElements();
                 assertNotNull(elements);
                 assertEquals(1, elements.size());
@@ -504,6 +506,7 @@
                 assertTrue(element instanceof Menu);
                 assertEquals("/folder1", ((Menu)element).getUrl());
                 assertTrue(((Menu)element).getParentMenu() == topMenu);
+                assertFalse(((Menu)element).isEmpty());
                 List elements = ((Menu)element).getElements();
                 assertNotNull(elements);
                 assertEquals(2, elements.size());
@@ -560,6 +563,7 @@
         assertNotNull(breadCrumbsMenu);
         assertEquals("bread-crumbs", breadCrumbsMenu.getName());
         assertEquals("/", breadCrumbsMenu.getUrl());
+        assertFalse(breadCrumbsMenu.isEmpty());
         List breadCrumbsElements = breadCrumbsMenu.getElements();
         assertNotNull(breadCrumbsElements);
         assertEquals(1, breadCrumbsElements.size());
@@ -594,6 +598,7 @@
         assertNotNull(breadCrumbsMenu2);
         assertEquals("bread-crumbs", breadCrumbsMenu2.getName());
         assertEquals("/folder0", breadCrumbsMenu2.getUrl());
+        assertFalse(breadCrumbsMenu2.isEmpty());
         breadCrumbsElements = breadCrumbsMenu2.getElements();
         assertNotNull(breadCrumbsElements);
         assertEquals(2, breadCrumbsElements.size());
@@ -626,10 +631,12 @@
         assertNotNull(topMenu3);
         assertTrue(topMenu == topMenu3);
         Menu backMenu = requestContext.getMenu("back");
+        assertTrue(backMenu.isEmpty());
         assertNull(backMenu.getElements());
         assertTrue(((MenuImpl)backMenu).isElementRelative());
         Menu navigationsMenu = requestContext.getMenu("navigations");
         assertNotNull(navigationsMenu);
+        assertFalse(navigationsMenu.isEmpty());
         List navigationsElements = navigationsMenu.getElements();
         assertNotNull(navigationsElements);
         assertEquals(6, navigationsElements.size());
@@ -677,6 +684,7 @@
         assertTrue(((MenuImpl)navigationsMenu).isElementRelative());
         Menu pagesMenu = requestContext.getMenu("pages");
         assertNotNull(pagesMenu);
+        assertFalse(pagesMenu.isEmpty());
         List pagesElements = pagesMenu.getElements();
         assertNotNull(pagesElements);
         assertEquals(3, pagesElements.size());
@@ -727,6 +735,7 @@
         assertTrue(topMenu != topMenu4);
         Menu customMenu = requestContext.getMenu("custom");
         assertNotNull(customMenu);
+        assertFalse(customMenu.isEmpty());
         List customElements = customMenu.getElements();
         assertNotNull(customElements);
         assertEquals(12, customElements.size());
@@ -759,6 +768,7 @@
             MenuElement element = (MenuElement)menuElementsIter.next();
             if (element.getElementType().equals(MenuElement.MENU_ELEMENT_TYPE) &&
element.getTitle().equals("user root"))
             {
+                assertFalse(((Menu)element).isEmpty());
                 List nestedElements = ((Menu)element).getElements();
                 assertEquals(6, nestedElements.size());
                 Iterator nestedElementsIter = nestedElements.iterator();

Modified: portals/jetspeed-2/branches/MENUS_BRANCH/jetspeed-api/src/java/org/apache/jetspeed/portalsite/Menu.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/jetspeed-api/src/java/org/apache/jetspeed/portalsite/Menu.java?rev=209714&r1=209713&r2=209714&view=diff
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/jetspeed-api/src/java/org/apache/jetspeed/portalsite/Menu.java
(original)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/jetspeed-api/src/java/org/apache/jetspeed/portalsite/Menu.java
Fri Jul  8 00:15:37 2005
@@ -73,6 +73,13 @@
     List getElements();
 
     /**
+     * isEmpty - get empty state of list of menu elements
+     *
+     * @return menu elements list empty state
+     */
+    boolean isEmpty();
+
+    /**
      * getSelectedElement - return selected option or nested
      *                      menu within this menu selected by
      *                      the specified request context

Modified: portals/jetspeed-2/branches/MENUS_BRANCH/portal/src/webapp/WEB-INF/decorations/layout/html/tigris/decorator-top.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/portal/src/webapp/WEB-INF/decorations/layout/html/tigris/decorator-top.vm?rev=209714&r1=209713&r2=209714&view=diff
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/portal/src/webapp/WEB-INF/decorations/layout/html/tigris/decorator-top.vm
(original)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/portal/src/webapp/WEB-INF/decorations/layout/html/tigris/decorator-top.vm
Fri Jul  8 00:15:37 2005
@@ -60,13 +60,13 @@
 <!-- Top Tabs -->
       <div class="tabs">
 #set($pagesStandardMenu = $site.getMenu("pages"))
-#if($pagesStandardMenu.elements)
+#if(!$pagesStandardMenu.empty)
 #includeTabsNavigation($pagesStandardMenu $LEFT_TO_RIGHT)
 #end
       </div>
       <div id="breadcrumbs">
 #set($backStandardMenu = $site.getMenu("back"))
-#if($backStandardMenu.elements)
+#if(!$backStandardMenu.empty)
 #includeLinksNavigation($backStandardMenu $LEFT_TO_RIGHT)
 #else
         &nbsp;
@@ -75,7 +75,7 @@
       <table cellpadding="0" cellspacing="0" border="0" width="100%" id="main">
         <tr>
 #set($navigationsStandardMenu = $site.getMenu("navigations"))
-#if($navigationsStandardMenu.elements)
+#if(!$navigationsStandardMenu.empty)
           <td valign="top" id="leftcol" width="20%">
             <div id="navcolumn">
 



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