You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/11/06 21:32:25 UTC

svn commit: r471871 - /myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java

Author: bommel
Date: Mon Nov  6 12:32:24 2006
New Revision: 471871

URL: http://svn.apache.org/viewvc?view=rev&rev=471871
Log:
[TOBAGO-173] Menu should support subforms for partial validation and partial model update

Modified:
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java?view=diff&rev=471871&r1=471870&r2=471871
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java Mon Nov  6 12:32:24 2006
@@ -59,6 +59,7 @@
 import javax.faces.component.UIPanel;
 import javax.faces.component.UISelectOne;
 import javax.faces.component.UISelectBoolean;
+import javax.faces.component.UIForm;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 import javax.faces.model.SelectItem;
@@ -324,11 +325,13 @@
     writer.writeAttribute(HtmlAttributes.SRC, image, null);
     writer.endElement(HtmlConstants.IMG);
   }
-
-  private void addMenuEntrys(StringBuffer sb, String var,
-                             FacesContext facesContext, UIComponent component, boolean warn)
+  private int addMenuEntrys(StringBuffer sb, String var,
+                            FacesContext facesContext, UIComponent component, boolean warn) throws IOException {
+    return addMenuEntrys(sb, var, facesContext, component, warn, 0);
+  }
+  private int addMenuEntrys(StringBuffer sb, String var,
+                             FacesContext facesContext, UIComponent component, boolean warn, int index)
       throws IOException {
-    int i = 0;
     for (Object o : component.getChildren()) {
       UIComponent entry = (UIComponent) o;
       if (entry instanceof UICommand) {
@@ -336,12 +339,15 @@
       } else if (entry instanceof UIMenuSeparator) {
         addMenuSeparator(sb, var);
       } else if (entry instanceof UIMenu) {
-        i = addMenu(sb, var, facesContext, (UIPanel) entry, i);
+        index = addMenu(sb, var, facesContext, (UIPanel) entry, index);
+      } else if (entry instanceof UIForm) {
+        index = addMenuEntrys(sb, var, facesContext, entry, warn, index);
       } else if (warn) {
         LOG.error("Illegal UIComponent class in menuBar: "
             + entry.getClass().getName());
       }
     }
+    return index;
   }
 
   private void addMenuEntry(StringBuffer sb, String var, FacesContext facesContext,