myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r501571 - /myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java
Date Tue, 30 Jan 2007 21:30:24 GMT
Author: werpu
Date: Tue Jan 30 13:30:24 2007
New Revision: 501571

URL: http://svn.apache.org/viewvc?view=rev&rev=501571
Log:
fix for a minor issue in the visible window attribute
a non set value now expands the fisheye a set one
displays the scroller

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java?view=diff&rev=501571&r1=501570&r2=501571
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/fisheye/HtmlFishEyeNavigationMenuRenderer.java
Tue Jan 30 13:30:24 2007
@@ -147,7 +147,12 @@
 
             if (fisheye.getVisibleWindow() != null) {
                 paramMap.put("visibleWindow", fisheye.getVisibleWindow());
+            } else {
+            	 HtmlFishEyeNavigationMenu menu = (HtmlFishEyeNavigationMenu) component;
+            	 int visibleWindow = calculateVisbleWindow(component, menu);
+                 paramMap.put("visibleWindow",new Integer( visibleWindow)); //lets expand,
the fisheye will shrink it as needed
             }
+            	
 
             paramMap.put(ITEM_WIDTH_ATTR, fisheye.getItemWidth());
             paramMap.put(ITEM_HEIGHT_ATTR, fisheye.getItemHeight());
@@ -176,6 +181,25 @@
         }
 
     }
+
+	private int calculateVisbleWindow(UIComponent component, HtmlFishEyeNavigationMenu menu)
{
+		int visibleWindow = 0;
+		 if (menu.getChildCount() == 1 && menu.getChildren().get(0) instanceof FishEyeCommandLink)
{
+		     visibleWindow = menu.getRowCount();
+		 } else {
+			 List children = component.getChildren();
+			 
+			 for (Iterator cit = children.iterator(); cit.hasNext();) {
+		         UIComponent child = (UIComponent) cit.next();
+		         if (!child.isRendered())
+		             continue;
+		         if (child instanceof UINavigationMenuItem) {
+		        	 visibleWindow += 1;
+		         }
+			 }     
+		 }
+		return visibleWindow;
+	}
 
     private Stack getChildsMenuStack(FacesContext context, UIComponent component) {
         Stack menuStack = (Stack) ((HttpServletRequest) context.getExternalContext().getRequest()).getAttribute(component.getClientId(context)



Mime
View raw message