You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2009/12/04 17:04:44 UTC

svn commit: r887243 [1/2] - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/renderkit/css/ core/src/main/java/org/apache/myfaces/tobago/taglib/component/ example/demo/src/ma...

Author: lofwyr
Date: Fri Dec  4 16:04:42 2009
New Revision: 887243

URL: http://svn.apache.org/viewvc?rev=887243&view=rev
Log:
TOBAGO-832: Reimplementation of the menu

Added:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIMenuBar.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuItemTagDeclaration.java
      - copied, changed from r883294, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTagDeclaration.java
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/menuBar/
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/menuBar/menuBar.xhtml
      - copied, changed from r883294, myfaces/tobago/trunk/example/test/src/main/webapp/tc/in/in.xhtml
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/page/
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/page/page.xhtml
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuSeparatorRenderer.java
      - copied, changed from r883294, myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.java
    myfaces/tobago/trunk/theme/standard/src/test/
    myfaces/tobago/trunk/theme/standard/src/test/java/
    myfaces/tobago/trunk/theme/standard/src/test/java/org/
    myfaces/tobago/trunk/theme/standard/src/test/java/org/apache/
    myfaces/tobago/trunk/theme/standard/src/test/java/org/apache/myfaces/
    myfaces/tobago/trunk/theme/standard/src/test/java/org/apache/myfaces/tobago/
    myfaces/tobago/trunk/theme/standard/src/test/java/org/apache/myfaces/tobago/renderkit/
    myfaces/tobago/trunk/theme/standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/
Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/CreateComponentUtils.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Position.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCheckboxTagDeclaration.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTagDeclaration.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSeparatorTagDeclaration.java
    myfaces/tobago/trunk/example/demo/src/main/webapp/menu.xhtml
    myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/MenuCheckboxExtensionHandler.java
    myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/MenuRadioExtensionHandler.java
    myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoMenuExtensionHandler.java
    myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.1/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java
    myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.1/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java
    myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java
    myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java
    myfaces/tobago/trunk/theme/charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/style.css
    myfaces/tobago/trunk/theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
    myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/mozilla/style/style.css
    myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/msie/property/tobago-theme-config.properties
    myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/msie/style/style.css
    myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
    myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIMenuBar.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIMenuBar.java?rev=887243&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIMenuBar.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIMenuBar.java Fri Dec  4 16:04:42 2009
@@ -0,0 +1,39 @@
+package org.apache.myfaces.tobago.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.config.Configurable;
+import org.apache.myfaces.tobago.renderkit.RendererBase;
+
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+
+public class AbstractUIMenuBar extends javax.faces.component.UIPanel implements Configurable, OnComponentCreated {
+
+  // todo: may have a markup for menubar, also may be a LayoutComponent/Container
+  public String[] getMarkup() {
+    return new String[0];
+  }
+
+  public void onComponentCreated(FacesContext context) {
+    Renderer renderer = getRenderer(getFacesContext());
+    if (renderer instanceof RendererBase) {
+      ((RendererBase) renderer).onComponentCreated(context, this);
+    }
+  }
+}

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/CreateComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/CreateComponentUtils.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/CreateComponentUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/CreateComponentUtils.java Fri Dec  4 16:04:42 2009
@@ -106,7 +106,7 @@
       radio = (UIMenuSelectOne) createComponent(facesContext, UIMenuSelectOne.COMPONENT_TYPE,
           RendererTypes.SELECT_ONE_RADIO, clientId);
       //noinspection unchecked
-      command.getFacets().put(Facets.ITEMS, radio);
+      command.getFacets().put(Facets.RADIO, radio);
       radio.setValueBinding(Attributes.VALUE, valueBinding);
     }
     return radio;
@@ -125,7 +125,7 @@
     AbstractUISelectBooleanCheckbox checkbox = (AbstractUISelectBooleanCheckbox) createComponent(
         facesContext, ComponentTypes.SELECT_BOOLEAN_CHECKBOX, RendererTypes.SELECT_BOOLEAN_CHECKBOX, clientId);
     //noinspection unchecked
-    command.getFacets().put(Facets.ITEMS, checkbox);
+    command.getFacets().put(Facets.CHECKBOX, checkbox);
     ValueBinding valueBinding = command.getValueBinding(Attributes.VALUE);
     if (valueBinding != null) {
       checkbox.setValueBinding(Attributes.VALUE, valueBinding);

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Facets.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Facets.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Facets.java Fri Dec  4 16:04:42 2009
@@ -22,11 +22,11 @@
   public static final String ACTION = "action";
   public static final String ADDENDUM = "addendum";
   public static final String CHANGE = "change";
+  public static final String CHECKBOX = "checkbox";
   public static final String CLICK = "click";
   public static final String COMPLETE = "complete";
   public static final String CONFIRMATION = "confirmation";
   public static final String CONSTRAINTS = "constraints";
-  public static final String ITEMS = "items";
   public static final String LABEL = "label";
   public static final String LAYOUT = "layout";
   public static final String LAYOUT_DEFAULT = "layoutDefault";
@@ -36,6 +36,7 @@
   public static final String PAGER_ROW = "pagerRow";
   public static final String PICKER_POPUP = "pickerPopup";
   public static final String POPUP = "popup";
+  public static final String RADIO = "radio";
   public static final String RELOAD = "reload";
   public static final String RESIZE_ACTION = "resizeAction";
   public static final String SORTER = "sorter";

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java Fri Dec  4 16:04:42 2009
@@ -45,6 +45,7 @@
   public static final String MENU = "Menu";
   public static final String MENU_BAR = "MenuBar";
   public static final String MENU_COMMAND = "MenuCommand";
+  public static final String MENU_SEPARATOR = "MenuSeparator";
   public static final String OBJECT = "Object";
   public static final String OUT = "Out";
   public static final String PAGE = "Page";

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Position.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Position.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Position.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Position.java Fri Dec  4 16:04:42 2009
@@ -20,7 +20,9 @@
 public enum Position {
 
   ABSOLUTE("absolute"),
-  RELATIVE("relative");
+  RELATIVE("relative"),
+  FIXED("fixed"), // not supported in IE 6
+  STATIC("static");
 
   private String value;
 

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java Fri Dec  4 16:04:42 2009
@@ -19,6 +19,7 @@
 
 import org.apache.myfaces.tobago.config.ThemeConfig;
 import org.apache.myfaces.tobago.layout.Display;
+import org.apache.myfaces.tobago.layout.LayoutBase;
 import org.apache.myfaces.tobago.layout.LayoutComponent;
 import org.apache.myfaces.tobago.layout.Measure;
 
@@ -27,7 +28,7 @@
 
 public class Style implements Serializable {
 
-  private static final long serialVersionUID = 2L;
+  private static final long serialVersionUID = 3L;
 
   private Measure width;
   private Measure height;
@@ -36,8 +37,10 @@
   private Display display;
   private Position position;
   private Overflow overflow;
+  private Measure marginTop;
   private Measure paddingTop;
   private Measure paddingBottom;
+  private String backgroundImage;
 
   public Style() {
   }
@@ -50,11 +53,13 @@
     this.display = map.display;
     this.position = map.position;
     this.overflow = map.overflow;
+    this.marginTop = map.marginTop;
     this.paddingTop = map.paddingTop;
     this.paddingBottom = map.paddingBottom;
+    this.backgroundImage = map.backgroundImage;
   }
 
-  public Style(FacesContext facesContext, LayoutComponent layout) {
+  public Style(FacesContext facesContext, LayoutBase layout) {
 
     String rendererType = layout.getRendererType();
     
@@ -83,7 +88,9 @@
       position = Position.ABSOLUTE;
     }
 
-    display = layout.getDisplay();
+    if (layout instanceof LayoutComponent) { // fixme
+      display = ((LayoutComponent)layout).getDisplay();
+    }
   }
 
   public String encode() {
@@ -123,6 +130,11 @@
       buf.append(overflow.getValue());
       buf.append(';');
     }
+    if (marginTop != null) {
+      buf.append("margin-top:");
+      buf.append(marginTop);
+      buf.append(';');
+    }
     if (paddingTop != null) {
       buf.append("padding-top:");
       buf.append(paddingTop);
@@ -133,6 +145,11 @@
       buf.append(paddingBottom);
       buf.append(';');
     }
+    if (backgroundImage != null) {
+      buf.append("background-image:");
+      buf.append(backgroundImage);
+      buf.append(';');
+    }
 
     return buf.toString();
   }
@@ -193,6 +210,14 @@
     this.overflow = overflow;
   }
 
+  public Measure getMarginTop() {
+    return marginTop;
+  }
+
+  public void setMarginTop(Measure marginTop) {
+    this.marginTop = marginTop;
+  }
+
   public Measure getPaddingTop() {
     return paddingTop;
   }
@@ -208,4 +233,12 @@
   public void setPaddingBottom(Measure paddingBottom) {
     this.paddingBottom = paddingBottom;
   }
+
+  public String getBackgroundImage() {
+    return backgroundImage;
+  }
+
+  public void setBackgroundImage(String backgroundImage) {
+    this.backgroundImage = backgroundImage;
+  }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.java Fri Dec  4 16:04:42 2009
@@ -37,7 +37,7 @@
         "org.apache.myfaces.tobago.internal.taglib.MenuSeparatorTag"})
 @UIComponentTag(
     uiComponent = "org.apache.myfaces.tobago.component.UIMenuBar",
-    uiComponentBaseClass = "javax.faces.component.UIPanel",
+    uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUIMenuBar",
     rendererType = RendererTypes.MENU_BAR, isComponentAlreadyDefined = false,
     allowedChildComponenents = {
         "org.apache.myfaces.tobago.Menu",

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCheckboxTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCheckboxTagDeclaration.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCheckboxTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCheckboxTagDeclaration.java Fri Dec  4 16:04:42 2009
@@ -27,14 +27,9 @@
 import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
 import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
 
-/*
- * $Id$
- */
-
 /**
- * Renders a checkable menuitem.
+ * @deprecated Please use tx:menuCheckbox
  */
-
 @Tag(name = "menuCheckbox", tagExtraInfoClassName = "org.apache.myfaces.tobago.taglib.component.CommandTagExtraInfo")
 @UIComponentTag(
     uiComponent = "org.apache.myfaces.tobago.component.UIMenuCheckbox",
@@ -43,6 +38,7 @@
     allowedChildComponenents = {
         "javax.faces.SelectItem",
         "javax.faces.SelectItems"})
+@Deprecated
 public interface MenuCheckboxTagDeclaration extends AbstractCommandTagDeclaration,
     HasIdBindingAndRendered, IsDisabled, HasCommandType, HasBooleanValue,
     HasLabelAndAccessKey {

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTagDeclaration.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTagDeclaration.java Fri Dec  4 16:04:42 2009
@@ -30,7 +30,9 @@
 /**
  * Renders a menu item.
  */
-@Tag(name = "menuItem", tagExtraInfoClassName = "org.apache.myfaces.tobago.taglib.component.CommandTagExtraInfo")
+@Tag(name = "menuCommand", 
+//    deprecatedName = "menuItem", 
+    tagExtraInfoClassName = "org.apache.myfaces.tobago.taglib.component.CommandTagExtraInfo")
 @UIComponentTag(
     uiComponent = "org.apache.myfaces.tobago.component.UIMenuCommand",
     uiComponentBaseClass = "org.apache.myfaces.tobago.component.UICommand",

Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuItemTagDeclaration.java (from r883294, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTagDeclaration.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuItemTagDeclaration.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuItemTagDeclaration.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTagDeclaration.java&r1=883294&r2=887243&rev=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuItemTagDeclaration.java Fri Dec  4 16:04:42 2009
@@ -20,22 +20,20 @@
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
 import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.taglib.decl.AbstractCommandTagDeclaration;
-import org.apache.myfaces.tobago.taglib.decl.HasCommandType;
-import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
-import org.apache.myfaces.tobago.taglib.decl.HasImage;
-import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
-import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
 
 /**
  * Renders a menu item.
+ * <p>
+ * Please use menuCommand instead!
+ * @deprecated
  */
-@Tag(name = "menuItem", tagExtraInfoClassName = "org.apache.myfaces.tobago.taglib.component.CommandTagExtraInfo")
+@Tag(name = "menuItem", 
+    tagExtraInfoClassName = "org.apache.myfaces.tobago.taglib.component.CommandTagExtraInfo")
 @UIComponentTag(
     uiComponent = "org.apache.myfaces.tobago.component.UIMenuCommand",
     uiComponentBaseClass = "org.apache.myfaces.tobago.component.UICommand",
     rendererType = RendererTypes.MENU_COMMAND,
     allowedChildComponenents = "NONE")
-public interface MenuCommandTagDeclaration extends AbstractCommandTagDeclaration,
-    HasIdBindingAndRendered, HasLabelAndAccessKey, IsDisabled, HasCommandType, HasImage {
-}
+@Deprecated
+public interface MenuItemTagDeclaration extends MenuCommandTagDeclaration {
+}
\ No newline at end of file

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSeparatorTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSeparatorTagDeclaration.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSeparatorTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSeparatorTagDeclaration.java Fri Dec  4 16:04:42 2009
@@ -20,6 +20,7 @@
 import org.apache.myfaces.tobago.apt.annotation.BodyContent;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.taglib.decl.HasBinding;
 import org.apache.myfaces.tobago.taglib.decl.IsRendered;
 
@@ -35,6 +36,7 @@
 @UIComponentTag(
     uiComponent = "org.apache.myfaces.tobago.component.UIMenuSeparator",
     uiComponentBaseClass = "javax.faces.component.UIOutput",
+    rendererType = RendererTypes.MENU_SEPARATOR,
     allowedChildComponenents = "NONE")
 
 public interface MenuSeparatorTagDeclaration extends IsRendered, HasBinding {

Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/menu.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/menu.xhtml?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/menu.xhtml (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/menu.xhtml Fri Dec  4 16:04:42 2009
@@ -25,22 +25,17 @@
   <tc:menuBar>
     <tc:menu label="#{overviewBundle.menu_config}">
       <tc:menu label="#{overviewBundle.menu_themes}">
-        <tc:menuItem action="#{clientConfigController.submit}">
-          <f:facet name="items">
-            <tc:selectOneRadio value="#{clientConfigController.theme}">
-              <f:selectItems value="#{clientConfigController.themeItems}"/>
-            </tc:selectOneRadio>
-          </f:facet>
-        </tc:menuItem>
+        <tx:menuRadio action="#{clientConfigController.submit}" value="#{clientConfigController.theme}">
+           <f:selectItems value="#{clientConfigController.themeItems}"/>
+        </tx:menuRadio>
       </tc:menu>
       <tc:menu label="#{overviewBundle.menu_locale}">
-        <tx:menuRadio action="#{clientConfigController.submit}"
-                      value="#{clientConfigController.locale}">
+        <tx:menuRadio action="#{clientConfigController.submit}" value="#{clientConfigController.locale}">
           <f:selectItems value="#{clientConfigController.localeItems}"/>
         </tx:menuRadio>
       </tc:menu>
       <!-- todo: may have something like immediate="true", but in this case, the value will not switched -->
-      <tc:menuCheckbox action="#{clientConfigController.submit}"
+      <tx:menuCheckbox action="#{clientConfigController.submit}"
                        label="#{overviewBundle.menu_debug}"
                        value="#{clientConfigController.debugMode}"/>
       <tc:menuItem action="#{demo.resetSession}" label="Reset"/>
@@ -56,6 +51,229 @@
       <tc:menuItem action="server-info" immediate="true"
                    label="Server Info"
                    disabled="#{! info.enabled}"/>
+      <tc:menu label="Hilfe 1">
+        <tc:menu label="Hilfe 1 1">
+        </tc:menu>
+        <tc:menuSeparator/>
+        <tc:menu label="Hilfe 1 2">
+        </tc:menu>
+        <tc:menu label="Hilfe 1 3">
+        </tc:menu>
+        <tc:menu label="Hilfe 1 4">
+        </tc:menu>
+        <tc:menuSeparator/>
+        <tc:menu label="Hilfe 1 5">
+        </tc:menu>
+        <tc:menu label="Hilfe 1 6">
+        </tc:menu>
+        <tc:menu label="Hilfe 1 7">
+        </tc:menu>
+        <tc:menuSeparator/>
+        <tc:menu label="Hilfe 1 8">
+        </tc:menu>
+        <tc:menu label="Hilfe 1 9">
+        </tc:menu>
+        <tc:menu label="Hilfe 1 10">
+        </tc:menu>
+      </tc:menu>
+      <tc:menu label="Hilfe 2">
+        <tc:menu label="Hilfe 2 1">
+        </tc:menu>
+        <tc:menu label="Hilfe 2 2">
+        </tc:menu>
+        <tc:menu label="Hilfe 2 3">
+        </tc:menu>
+        <tc:menu label="Hilfe 2 4">
+        </tc:menu>
+        <tc:menu label="Hilfe 2 5">
+        </tc:menu>
+        <tc:menu label="Hilfe 2 6">
+        </tc:menu>
+        <tc:menu label="Hilfe 2 7">
+        </tc:menu>
+        <tc:menu label="Hilfe 2 8">
+        </tc:menu>
+        <tc:menu label="Hilfe 2 9">
+        </tc:menu>
+        <tc:menu label="Hilfe 2 10">
+        </tc:menu>
+      </tc:menu>
+      <tc:menu label="Hilfe 3">
+        <tc:menu label="Hilfe 3 1">
+        </tc:menu>
+        <tc:menu label="Hilfe 3 2">
+        </tc:menu>
+        <tc:menu label="Hilfe 3 3">
+        </tc:menu>
+        <tc:menu label="Hilfe 3 4">
+        </tc:menu>
+        <tc:menu label="Hilfe 3 5">
+        </tc:menu>
+        <tc:menu label="Hilfe 3 6">
+        </tc:menu>
+        <tc:menu label="Hilfe 3 7">
+        </tc:menu>
+        <tc:menu label="Hilfe 3 8">
+        </tc:menu>
+        <tc:menu label="Hilfe 3 9">
+        </tc:menu>
+        <tc:menu label="Hilfe 3 10">
+        </tc:menu>
+      </tc:menu>
+      <tc:menu label="Hilfe 4">
+        <tc:menu label="Hilfe 4 1">
+        </tc:menu>
+        <tc:menu label="Hilfe 4 2">
+        </tc:menu>
+        <tc:menu label="Hilfe 4 3">
+        </tc:menu>
+        <tc:menu label="Hilfe 4 4">
+        </tc:menu>
+        <tc:menu label="Hilfe 4 5">
+        </tc:menu>
+        <tc:menu label="Hilfe 4 6">
+        </tc:menu>
+        <tc:menu label="Hilfe 4 7">
+        </tc:menu>
+        <tc:menu label="Hilfe 4 8">
+        </tc:menu>
+        <tc:menu label="Hilfe 4 9">
+        </tc:menu>
+        <tc:menu label="Hilfe 4 10">
+        </tc:menu>
+      </tc:menu>
+      <tc:menu label="Hilfe 5">
+        <tc:menu label="Hilfe 5 1">
+        </tc:menu>
+        <tc:menu label="Hilfe 5 2">
+        </tc:menu>
+        <tc:menu label="Hilfe 5 3">
+        </tc:menu>
+        <tc:menu label="Hilfe 5 4">
+        </tc:menu>
+        <tc:menu label="Hilfe 5 5">
+        </tc:menu>
+        <tc:menu label="Hilfe 5 6">
+        </tc:menu>
+        <tc:menu label="Hilfe 5 7">
+        </tc:menu>
+        <tc:menu label="Hilfe 5 8">
+        </tc:menu>
+        <tc:menu label="Hilfe 5 9">
+        </tc:menu>
+        <tc:menu label="Hilfe 5 10">
+        </tc:menu>
+      </tc:menu>
+      <tc:menu label="Hilfe 6">
+        <tc:menu label="Hilfe 6 1">
+        </tc:menu>
+        <tc:menu label="Hilfe 6 2">
+        </tc:menu>
+        <tc:menu label="Hilfe 6 3">
+        </tc:menu>
+        <tc:menu label="Hilfe 6 4">
+        </tc:menu>
+        <tc:menu label="Hilfe 6 5">
+        </tc:menu>
+        <tc:menu label="Hilfe 6 6">
+        </tc:menu>
+        <tc:menu label="Hilfe 6 7">
+        </tc:menu>
+        <tc:menu label="Hilfe 6 8">
+        </tc:menu>
+        <tc:menu label="Hilfe 6 9">
+        </tc:menu>
+        <tc:menu label="Hilfe 6 10">
+        </tc:menu>
+      </tc:menu>
+      <tc:menu label="Hilfe 7">
+        <tc:menu label="Hilfe 7 1">
+        </tc:menu>
+        <tc:menu label="Hilfe 7 2">
+        </tc:menu>
+        <tc:menu label="Hilfe 7 3">
+        </tc:menu>
+        <tc:menu label="Hilfe 7 4">
+        </tc:menu>
+        <tc:menu label="Hilfe 7 5">
+        </tc:menu>
+        <tc:menu label="Hilfe 7 6">
+        </tc:menu>
+        <tc:menu label="Hilfe 7 7">
+        </tc:menu>
+        <tc:menu label="Hilfe 7 8">
+        </tc:menu>
+        <tc:menu label="Hilfe 7 9">
+        </tc:menu>
+        <tc:menu label="Hilfe 7 10">
+        </tc:menu>
+      </tc:menu>
+      <tc:menu label="Hilfe 8">
+        <tc:menu label="Hilfe 8 1">
+        </tc:menu>
+        <tc:menu label="Hilfe 8 2">
+        </tc:menu>
+        <tc:menu label="Hilfe 8 3">
+        </tc:menu>
+        <tc:menu label="Hilfe 8 4">
+        </tc:menu>
+        <tc:menu label="Hilfe 8 5">
+        </tc:menu>
+        <tc:menu label="Hilfe 8 6">
+        </tc:menu>
+        <tc:menu label="Hilfe 8 7">
+        </tc:menu>
+        <tc:menu label="Hilfe 8 8">
+        </tc:menu>
+        <tc:menu label="Hilfe 8 9">
+        </tc:menu>
+        <tc:menu label="Hilfe 8 10">
+        </tc:menu>
+      </tc:menu>
+      <tc:menu label="Hilfe 9">
+        <tc:menu label="Hilfe 9 1">
+        </tc:menu>
+        <tc:menu label="Hilfe 9 2">
+        </tc:menu>
+        <tc:menu label="Hilfe 9 3">
+        </tc:menu>
+        <tc:menu label="Hilfe 9 4">
+        </tc:menu>
+        <tc:menu label="Hilfe 9 5">
+        </tc:menu>
+        <tc:menu label="Hilfe 9 6">
+        </tc:menu>
+        <tc:menu label="Hilfe 9 7">
+        </tc:menu>
+        <tc:menu label="Hilfe 9 8">
+        </tc:menu>
+        <tc:menu label="Hilfe 9 9">
+        </tc:menu>
+        <tc:menu label="Hilfe 9 10">
+        </tc:menu>
+      </tc:menu>
+      <tc:menu label="Hilfe 10">
+        <tc:menu label="Hilfe 10 1">
+        </tc:menu>
+        <tc:menu label="Hilfe 10 2">
+        </tc:menu>
+        <tc:menu label="Hilfe 10 3">
+        </tc:menu>
+        <tc:menu label="Hilfe 10 4">
+        </tc:menu>
+        <tc:menu label="Hilfe 10 5">
+        </tc:menu>
+        <tc:menu label="Hilfe 10 6">
+        </tc:menu>
+        <tc:menu label="Hilfe 10 7">
+        </tc:menu>
+        <tc:menu label="Hilfe 10 8">
+        </tc:menu>
+        <tc:menu label="Hilfe 10 9">
+        </tc:menu>
+        <tc:menu label="Hilfe 10 10">
+        </tc:menu>
+      </tc:menu>
     </tc:menu>
   </tc:menuBar>
 

Copied: myfaces/tobago/trunk/example/test/src/main/webapp/tc/menuBar/menuBar.xhtml (from r883294, myfaces/tobago/trunk/example/test/src/main/webapp/tc/in/in.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/menuBar/menuBar.xhtml?p2=myfaces/tobago/trunk/example/test/src/main/webapp/tc/menuBar/menuBar.xhtml&p1=myfaces/tobago/trunk/example/test/src/main/webapp/tc/in/in.xhtml&r1=883294&r2=887243&rev=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/in/in.xhtml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/menuBar/menuBar.xhtml Fri Dec  4 16:04:42 2009
@@ -8,12 +8,28 @@
     xmlns:f="http://java.sun.com/jsf/core">
 
   <tc:page>
-    <f:facet name="layout">
-      <tc:gridLayout/>
-    </f:facet>
     <tc:gridLayoutConstraint width="600px" height="300px"/>
+    <f:facet name="menuBar">
+      <tc:menuBar>
+        <tc:menu label="Help">
+            <tc:menuCommand
+                onclick="alert('Help!')"
+                label="Help"/>
+          </tc:menu>
+        <tc:menu label="Help">
+            <tc:menuCommand
+                onclick="alert('Help!')"
+                label="Help"/>
+          </tc:menu>
+        <tc:menu label="Help">
+            <tc:menuCommand
+                onclick="alert('Help!')"
+                label="Help"/>
+          </tc:menu>
+      </tc:menuBar>
 
-    <tc:in value="Some Value"/>
+    </f:facet>
+    <tc:textarea value="this is to test the position of the menuBar and the scrolling when the brower window is small"/>
 
   </tc:page>
 </f:view>

Added: myfaces/tobago/trunk/example/test/src/main/webapp/tc/page/page.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/page/page.xhtml?rev=887243&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/page/page.xhtml (added)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/page/page.xhtml Fri Dec  4 16:04:42 2009
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<f:view
+    xmlns:jsp="http://java.sun.com/JSP/Page"
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:tx="http://myfaces.apache.org/tobago/extension"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core">
+
+  <tc:page>
+    <tc:textarea value="this is to test the size"/>
+
+  </tc:page>
+</f:view>

Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/MenuCheckboxExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/MenuCheckboxExtensionHandler.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/MenuCheckboxExtensionHandler.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/MenuCheckboxExtensionHandler.java Fri Dec  4 16:04:42 2009
@@ -18,11 +18,19 @@
  */
 
 import com.sun.facelets.tag.jsf.ComponentConfig;
+import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UISelectBooleanCheckbox;
 
-/*
- * Date: Aug 10, 2007
- * Time: 10:19:47 PM
+// XXX check if this is correct
+// todo: remove the facet
+/**
+  <pre>
+    &lt;tc:menuCommand label="" action="">
+      &lt;f:facet name="items">
+        &lt;tc:selectBooleanCheckbox value=""/>
+      &lt;/f:facet>
+    &lt;/tc:menuCommand>
+  </pre>
  */
 public class MenuCheckboxExtensionHandler extends TobagoMenuExtensionHandler {
 
@@ -37,4 +45,8 @@
   protected String getSubRendererType() {
     return "SelectBooleanCheckbox";
   }
+
+  protected String getFacetName() {
+    return Facets.CHECKBOX;
+  }
 }

Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/MenuRadioExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/MenuRadioExtensionHandler.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/MenuRadioExtensionHandler.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/MenuRadioExtensionHandler.java Fri Dec  4 16:04:42 2009
@@ -18,6 +18,7 @@
  */
 
 import com.sun.facelets.tag.jsf.ComponentConfig;
+import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UISelectOneRadio;
 
 /*
@@ -38,4 +39,8 @@
     return "SelectOneRadio";
   }
 
+  protected String getFacetName() {
+    return Facets.RADIO;
+  }
+  
 }

Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoMenuExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoMenuExtensionHandler.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoMenuExtensionHandler.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoMenuExtensionHandler.java Fri Dec  4 16:04:42 2009
@@ -24,7 +24,6 @@
 import com.sun.facelets.tag.jsf.ComponentHandler;
 import com.sun.facelets.tag.jsf.ComponentSupport;
 import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UIMenuCommand;
 
 import javax.el.ELException;
@@ -48,14 +47,16 @@
 
   protected abstract String getSubRendererType();
 
+  protected abstract String getFacetName();
+
   protected void applyNextHandler(FaceletContext faceletContext, UIComponent menuCommand)
       throws IOException, FacesException, ELException {
     if (ComponentSupport.isNew(menuCommand)) {
-      UIComponent component = (UIComponent) menuCommand.getFacets().remove(Facets.ITEMS);
+      UIComponent component = (UIComponent) menuCommand.getFacets().remove(getFacetName());
       nextHandler.apply(faceletContext, component);
-      menuCommand.getFacets().put(Facets.ITEMS, component);
+      menuCommand.getFacets().put(getFacetName(), component);
     } else {
-      nextHandler.apply(faceletContext, menuCommand.getFacet(Facets.ITEMS));
+      nextHandler.apply(faceletContext, menuCommand.getFacet(getFacetName()));
     }
   }
 
@@ -67,7 +68,7 @@
     component.setId(root.createUniqueId());
     component.setRendererType(getSubRendererType());
     setAttributes(faceletContext, component);
-    menuCommand.getFacets().put(Facets.ITEMS, component);
+    menuCommand.getFacets().put(getFacetName(), component);
   }
 
   protected MetaRuleset createMetaRuleset(Class aClass) {

Modified: myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.1/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.1/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.1/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java (original)
+++ myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.1/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java Fri Dec  4 16:04:42 2009
@@ -20,10 +20,9 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
-import static org.apache.myfaces.tobago.component.Attributes.RENDERED_PARTIALLY;
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UICommandBase;
-import org.apache.myfaces.tobago.internal.taglib.MenuItemTag;
+import org.apache.myfaces.tobago.internal.taglib.MenuCommandTag;
 import org.apache.myfaces.tobago.internal.taglib.SelectBooleanCheckboxTag;
 import org.apache.myfaces.tobago.taglib.decl.AbstractCommandTagDeclaration;
 import org.apache.myfaces.tobago.taglib.decl.HasBooleanValue;
@@ -37,6 +36,8 @@
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.BodyTagSupport;
 
+import static org.apache.myfaces.tobago.component.Attributes.RENDERED_PARTIALLY;
+
 /*
  * Date: 09.05.2006
  * Time: 00:00:49
@@ -53,7 +54,7 @@
   private String rendered;
   private String value;
 
-  private MenuItemTag menuCommandTag;
+  private MenuCommandTag menuCommandTag;
   private SelectBooleanCheckboxTag selectBooleanCheckbox;
   private FacetTag facetTag;
   private String action;
@@ -73,7 +74,7 @@
   @Override
   public int doStartTag() throws JspException {
 
-    menuCommandTag = new MenuItemTag();
+    menuCommandTag = new MenuCommandTag();
     menuCommandTag.setPageContext(pageContext);
     menuCommandTag.setParent(getParent()); // ???
 
@@ -124,7 +125,7 @@
     facetTag = new FacetTag();
     facetTag.setPageContext(pageContext);
     facetTag.setParent(menuCommandTag);
-    facetTag.setName(Facets.ITEMS);
+    facetTag.setName(Facets.CHECKBOX);
 
     facetTag.doStartTag();
     selectBooleanCheckbox = new SelectBooleanCheckboxTag();

Modified: myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.1/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.1/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.1/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java (original)
+++ myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.1/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java Fri Dec  4 16:04:42 2009
@@ -20,10 +20,9 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
-import static org.apache.myfaces.tobago.component.Attributes.RENDERED_PARTIALLY;
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UICommandBase;
-import org.apache.myfaces.tobago.internal.taglib.MenuItemTag;
+import org.apache.myfaces.tobago.internal.taglib.MenuCommandTag;
 import org.apache.myfaces.tobago.internal.taglib.SelectOneRadioTag;
 import org.apache.myfaces.tobago.taglib.decl.AbstractCommandTagDeclaration;
 import org.apache.myfaces.tobago.taglib.decl.HasConverter;
@@ -38,6 +37,8 @@
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.BodyTagSupport;
 
+import static org.apache.myfaces.tobago.component.Attributes.RENDERED_PARTIALLY;
+
 /*
  * Date: 09.05.2006
  * Time: 17:41:39
@@ -55,7 +56,7 @@
   private String rendered;
   private String value;
 
-  private MenuItemTag menuCommandTag;
+  private MenuCommandTag menuCommandTag;
   private SelectOneRadioTag selectOneRadio;
   private FacetTag facetTag;
   private String action;
@@ -76,7 +77,7 @@
   @Override
   public int doStartTag() throws JspException {
 
-    menuCommandTag = new MenuItemTag();
+    menuCommandTag = new MenuCommandTag();
     menuCommandTag.setPageContext(pageContext);
     menuCommandTag.setParent(getParent()); // ???
 
@@ -127,7 +128,7 @@
     facetTag = new FacetTag();
     facetTag.setPageContext(pageContext);
     facetTag.setParent(menuCommandTag);
-    facetTag.setName(Facets.ITEMS);
+    facetTag.setName(Facets.RADIO);
 
     facetTag.doStartTag();
     selectOneRadio = new SelectOneRadioTag();

Modified: myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java (original)
+++ myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java Fri Dec  4 16:04:42 2009
@@ -26,7 +26,7 @@
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UICommandBase;
-import org.apache.myfaces.tobago.internal.taglib.MenuItemTag;
+import org.apache.myfaces.tobago.internal.taglib.MenuCommandTag;
 import org.apache.myfaces.tobago.internal.taglib.SelectBooleanCheckboxTag;
 
 import javax.faces.component.UIComponent;
@@ -49,7 +49,7 @@
   private javax.el.ValueExpression rendered;
   private javax.el.ValueExpression value;
 
-  private MenuItemTag menuCommandTag;
+  private MenuCommandTag menuCommandTag;
   private SelectBooleanCheckboxTag selectBooleanCheckbox;
   private FacetTag facetTag;
   private javax.el.MethodExpression action;
@@ -66,7 +66,7 @@
   @Override
   public int doStartTag() throws JspException {
 
-    menuCommandTag = new MenuItemTag();
+    menuCommandTag = new MenuCommandTag();
     menuCommandTag.setPageContext(pageContext);
     menuCommandTag.setParent(getParent()); // ???
     if (rendered != null) {
@@ -107,7 +107,7 @@
     facetTag = new FacetTag();
     facetTag.setPageContext(pageContext);
     facetTag.setParent(menuCommandTag);
-    facetTag.setName(Facets.ITEMS);
+    facetTag.setName(Facets.CHECKBOX);
 
     facetTag.doStartTag();
     selectBooleanCheckbox = new SelectBooleanCheckboxTag();

Modified: myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java (original)
+++ myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java Fri Dec  4 16:04:42 2009
@@ -26,7 +26,7 @@
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UICommandBase;
-import org.apache.myfaces.tobago.internal.taglib.MenuItemTag;
+import org.apache.myfaces.tobago.internal.taglib.MenuCommandTag;
 import org.apache.myfaces.tobago.internal.taglib.SelectOneRadioTag;
 
 import javax.faces.component.UIComponent;
@@ -50,7 +50,7 @@
   private javax.el.ValueExpression rendered;
   private javax.el.ValueExpression value;
 
-  private MenuItemTag menuCommandTag;
+  private MenuCommandTag menuCommandTag;
   private SelectOneRadioTag selectOneRadio;
   private FacetTag facetTag;
   private javax.el.MethodExpression action;
@@ -68,7 +68,7 @@
   @Override
   public int doStartTag() throws JspException {
 
-    menuCommandTag = new MenuItemTag();
+    menuCommandTag = new MenuCommandTag();
     menuCommandTag.setPageContext(pageContext);
     menuCommandTag.setParent(getParent());
 
@@ -110,7 +110,7 @@
     facetTag = new FacetTag();
     facetTag.setPageContext(pageContext);
     facetTag.setParent(menuCommandTag);
-    facetTag.setName(Facets.ITEMS);
+    facetTag.setName(Facets.RADIO);
 
     facetTag.doStartTag();
     selectOneRadio = new SelectOneRadioTag();

Modified: myfaces/tobago/trunk/theme/charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/style.css?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/style/style.css Fri Dec  4 16:04:42 2009
@@ -100,40 +100,22 @@
 }
 
 /* Menu ---------------------------------------------------------------------- */
-.tobago-menuBar-default {
-  border: 1px solid #FF9900;
-  background: #FFCC66;
-}
-
-.tobago-menuBar-separator   {
-  margin-top: 0px;
-  margin-bottom: 0px;
-  padding-top: 0px;
-  padding-bottom: 0px;
-  border-top:1px solid #000000;
-  border-right:0px solid #000000;
-  border-bottom:0px solid #000000;
-  border-left:0px solid #000000;
-}
 
-.tobago-menuBar-page-facet {
-  background: #FFCC66;
+.tobago-menuBar-default li {
+  background-color: #FFEECF;
 }
 
-.tobago-menuBar-subitem-container {
-  background: #FFCC66;
+li.tobago-menu-selected {
+  background-color: #FADC9F;
 }
 
-.tobago-menu-item-focus {
-  background: #FF9900;
-}
-
-.tobago-menu-item-hover {
-  background: #FF9900;
+.tobago-menuBar-default {
+  border-bottom-color: #FECB66;
+  background-color: #FFEECF;
 }
 
-.tobago-menuBar-item-span-disabled {
-  color: #888888;
+.tobago-menuBar-default ol {
+  border-color: #FECB66;
 }
 
 /* Sheet ---------------------------------------------------------------------- */

Modified: myfaces/tobago/trunk/theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/style.css Fri Dec  4 16:04:42 2009
@@ -392,40 +392,22 @@
 }
 
 /* menuBar ----------------------------------------------------------------- */
-.tobago-menuBar-default {
-  border: 1px solid #FF9900;
-  background: #FFCC66;
-}
-
-.tobago-menuBar-separator   {
-  margin-top: 0px;
-  margin-bottom: 0px;
-  padding-top: 0px;
-  padding-bottom: 0px;
-  border-top:1px solid #000000;
-  border-right:0px solid #000000;
-  border-bottom:0px solid #000000;
-  border-left:0px solid #000000;
-}
 
-.tobago-menuBar-page-facet {
-  background: #FFCC66;
+.tobago-menuBar-default li {
+  background-color: #FFCC66;
 }
 
-.tobago-menuBar-subitem-container {
-  background: #FFCC66;
+li.tobago-menu-selected {
+  background-color: #FF9900;
 }
 
-.tobago-menu-item-focus {
-  background: #FF9900;
-}
-
-.tobago-menu-item-hover {
-  background: #FF9900;
+.tobago-menuBar-default {
+  border-bottom-color: #FF9900;
+  background-color: #FFCC66;
 }
 
-.tobago-menuBar-item-span-disabled {
-  color: #888888;
+.tobago-menuBar-default ol {
+  border-color: #000000;
 }
 
 /* sheet ----------------------------------------------------------------- */

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?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- 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 Fri Dec  4 16:04:42 2009
@@ -17,52 +17,18 @@
  * limitations under the License.
  */
 
-/*
-  * Created 28.04.2003 at 15:29:36.
-  * $Id$
-  */
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.component.AbstractUIPage;
-import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.CreateComponentUtils;
-import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.UICommandBase;
-import org.apache.myfaces.tobago.component.UIMenu;
-import org.apache.myfaces.tobago.component.UIMenuCommand;
-import org.apache.myfaces.tobago.component.UIMenuSeparator;
-import org.apache.myfaces.tobago.component.UISelectBooleanCommand;
-import org.apache.myfaces.tobago.component.UISelectOneCommand;
-import org.apache.myfaces.tobago.config.TobagoConfig;
-import org.apache.myfaces.tobago.context.ResourceManagerUtil;
+import org.apache.myfaces.tobago.component.UIMenuBar;
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
-import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
-import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
-import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
-import org.apache.myfaces.tobago.renderkit.html.util.CommandRendererHelper;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
-import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
-import org.apache.myfaces.tobago.util.AccessKeyMap;
-import org.apache.myfaces.tobago.util.ComponentUtils;
-import org.apache.myfaces.tobago.util.FastStringWriter;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
 import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-import javax.faces.component.UIPanel;
-import javax.faces.component.UISelectBoolean;
-import javax.faces.component.UISelectOne;
 import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.model.SelectItem;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
 
 import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
 
@@ -73,488 +39,31 @@
   public static final String SEARCH_ID_POSTFIX = SUBCOMPONENT_SEP + "popup";
   private static final String MENU_ACCELERATOR_KEYS = "menuAcceleratorKeys";
 
-  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
-    String clientId;
-
-    Map attributes = component.getAttributes();
-    if (ComponentUtils.getBooleanAttribute(component, Attributes.MENU_POPUP)) {
-      clientId = component.getParent().getClientId(facesContext);
-    } else {
-      clientId = component.getClientId(facesContext);
-      TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
-
-      writer.startElement(HtmlConstants.DIV, component);
-      writer.writeIdAttribute(clientId);
-      HtmlRendererUtils.renderDojoDndItem(component, writer, true);
-      StyleClasses styleClasses = StyleClasses.ensureStyleClasses(component);
-      if (ComponentUtils.getBooleanAttribute(component, Attributes.PAGE_MENU)) {
-        styleClasses.addClass("menuBar", "page-facet"); // XXX not a standard compliant name
-      } else {
-        // todo
-//        Style style = new Style(facesContext, component);
-//        writer.writeStyleAttribute(style);
-      }
-      writer.writeClassAttribute(styleClasses);
-
-/*
-
-      writer.startElement(HtmlConstants.SPAN);
-      writer.writeAttribute(HtmlAttributes.STYLE, "position: relative", null);
-//      writer.writeClassAttribute("tobago-menuBar-container");
-
-      renderTopLevelItems(facesContext, writer, component);
-
-      writer.endElement(HtmlConstants.SPAN);
-
-*/
-      writer.endElement(HtmlConstants.DIV);
-    }
-    attributes.put(MENU_ACCELERATOR_KEYS, new ArrayList<String>());
-
-    addScriptsAndStyles(facesContext, component, clientId);
-    List<String> accKeyFunctions
-        = (List<String>) attributes.remove(MENU_ACCELERATOR_KEYS);
-    if (!accKeyFunctions.isEmpty()) {
-      HtmlRendererUtils.writeScriptLoader(facesContext, null,
-          accKeyFunctions.toArray(new String[accKeyFunctions.size()]));
-    }
-  }
-
-  private void renderTopLevelItems(FacesContext facesContext,
-                                   TobagoResponseWriter writer, UIComponent component) throws IOException {
-    String bac = "green;";
-    for (Object o : component.getChildren()) {
-      if (o instanceof UIMenu) {
-        writer.startElement(HtmlConstants.SPAN, null);
-        writer.writeAttribute(HtmlAttributes.STYLE, "position: relative; background: " + bac + ";", false);
-        writeMenuEntry(facesContext, writer, (UIMenu) o);
-        writer.endElement(HtmlConstants.SPAN);
-        bac = "lime";
-      }
-    }
-  }
-
-  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
-    super.prepareRender(facesContext, component);
+  // XXX check the ajax case
+  @Override
+  public void onComponentCreated(FacesContext facesContext, UIComponent component) {
+    // XXX move to tobago.js or ...
     if (facesContext instanceof TobagoFacesContext) {
-      if (!ComponentUtils.getBooleanAttribute(component, Attributes.MENU_POPUP)) {
-        HtmlRendererUtils.renderDojoDndSource(facesContext, component);
-      }
-
-      final String[] scripts = new String[]{"script/tobago-menu.js"};
-
-      ((TobagoFacesContext) facesContext).getScriptFiles().add(scripts[0]);
-      if (!TobagoConfig.getInstance(facesContext).isAjaxEnabled()) {
-        final AbstractUIPage page = ComponentUtils.findPage(facesContext, component);
-        String clientId = component.getClientId(facesContext);
-        String setupFunction = createSetupFunction(clientId);
-        String function = setupFunction + "('" + clientId + "', '"
-            + page.getClientId(facesContext) + "');";
-        String scriptBlock = createJavascriptFunction(facesContext, component, setupFunction);
-        ((TobagoFacesContext) facesContext).getScriptBlocks().add(scriptBlock);
-        ((TobagoFacesContext) facesContext).getOnloadScripts().add(function);
-      }
-    }
-  }
-
-  protected void addScriptsAndStyles(FacesContext facesContext,
-                                     UIComponent component, final String clientId) throws IOException {
-
-    if (TobagoConfig.getInstance(facesContext).isAjaxEnabled()) {
-      final AbstractUIPage page = ComponentUtils.findPage(facesContext, component);
-      String setupFunction = createSetupFunction(clientId);
-      String function = setupFunction + "('" + clientId + "', '" + page.getClientId(facesContext) + "');";
-      String scriptBlock = createJavascriptFunction(facesContext, component, setupFunction);
-      StringTokenizer st = new StringTokenizer(scriptBlock, "\n");
-      ArrayList<String> lines = new ArrayList<String>();
-      while (st.hasMoreTokens()) {
-        lines.add(st.nextToken());
-      }
-      lines.add(function);
-      HtmlRendererUtils.writeScriptLoader(facesContext,
-          new String[]{"script/tobago-menu.js"},
-          lines.toArray(new String[lines.size()]));
-    }
-  }
+      TobagoFacesContext pageFacesContext = (TobagoFacesContext) facesContext;
 
-  protected String createJavascriptFunction(FacesContext facesContext,
-                                            UIComponent component, String setupFunction)
-      throws IOException {
-    StringBuilder sb = new StringBuilder(256);
+      // todo: move to PageRenderer or ...
+//      pageFacesContext.getScriptFiles().add("script/jquery-1.3.2.min.js");
+      pageFacesContext.getScriptFiles().add("script/tobago-menu.js");
+    }    
+  }
+  
+  @Override
+  public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
 
-    sb.append("function ");
-    sb.append(setupFunction);
-    sb.append("(id, pageId) {\n");
-    sb.append("  var menuStart = new Date();\n");
-    sb.append("  var searchId = id + '" + SEARCH_ID_POSTFIX + "';\n");
-    sb.append("  var menubar = document.getElementById(searchId);\n");
-    sb.append("  if (! menubar) {\n");
-    sb.append("    searchId  = id;\n");
-    sb.append("    menubar = document.getElementById(searchId);\n");
-    sb.append("  }\n");
-    sb.append("  if (menubar) {\n");
-    sb.append("    var menu = createMenuRoot(searchId);\n");
-    sb.append("    menubar.menu = menu;\n");
-
-    sb.append("    menu.setSubitemArrowImage(\"");
-    sb.append(
-        ResourceManagerUtil.getImageWithPath(facesContext, "image/MenuArrow.gif"));
-    sb.append("\");\n");
-
-    if (ComponentUtils.getBooleanAttribute(component, Attributes.MENU_POPUP)) {
-      addMenu(sb, "menu", facesContext, (UIPanel) component, 0);
-      sb.append("    initMenuPopUp(searchId, pageId, \"");
-      sb.append(component.getAttributes().get(Attributes.MENU_POPUP_TYPE));
-      sb.append("\");\n");
-    } else {
-      addMenuEntrys(sb, "menu", facesContext, component, true);
-      sb.append("    initMenuBar(searchId, pageId);\n");
-    }
-
-    sb.append("  }\n");
-    sb.append("  else {\n");
-    sb.append(
-        "    LOG.debug('kein Element mit id: ' + searchId + ' gefunden!');\n");
-    sb.append("  }\n");
-    sb.append("  LOG.debug('Menu Total Time : ' + (new Date().getTime() - menuStart.getTime()));\n");
-    sb.append("}\n");
-    return sb.toString();
-  }
-
-  private String createSetupFunction(String clientId) {
-    return "setupMenu" + clientId.replaceAll(":", "_").replaceAll("\\.", "_").replaceAll("-", "_");
-  }
-
-  private int addMenu(StringBuilder sb, String var, FacesContext facesContext,
-                      UIPanel menu, int i) throws IOException {
-    if (!menu.isRendered()) {
-      return i;
-    }
-
-    String name = var + "_" + i++;
-    sb.append("    var ").append(name).append(" = ").append(createMenuEntry(facesContext, menu)).append(";\n");
-    sb.append("    ").append(var).append(".addMenuItem(").append(name).append(");\n");
-    addMenuEntrys(sb, name, facesContext, menu, false);
-    return i;
-  }
-
-  private String createMenuEntry(FacesContext facesContext, UIPanel uiPanel)
-      throws IOException {
-    ResponseWriter savedWriter = facesContext.getResponseWriter();
-    FastStringWriter stringWriter = new FastStringWriter();
-    ResponseWriter newWriter = savedWriter.cloneWithWriter(stringWriter);
-    facesContext.setResponseWriter(newWriter);
+    UIMenuBar menuBar = (UIMenuBar)component;
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
-
-    writeMenuEntry(facesContext, writer, uiPanel);
-
-    facesContext.setResponseWriter(savedWriter);
-
-
-    return "new Tobago.Menu.Item('" + prepareForScript(stringWriter.toString()) + "', null)";
-  }
-
-  private void writeMenuEntry(FacesContext facesContext, TobagoResponseWriter writer, UIPanel uiPanel)
-      throws IOException {
-    final boolean disabled
-        = ComponentUtils.getBooleanAttribute(uiPanel, Attributes.DISABLED);
-    final boolean topMenu = (uiPanel.getParent().getRendererType() != null)
-        || ComponentUtils.getBooleanAttribute(uiPanel, Attributes.MENU_POPUP);
-    final boolean pageMenu = (uiPanel.getParent().getRendererType() != null)
-        &&
-        ComponentUtils.getBooleanAttribute(uiPanel.getParent(), Attributes.PAGE_MENU);
-    String spanClass
-        = "tobago-menuBar-item-span tobago-menuBar-item-span-"
-        + (disabled ? "disabled" : "enabled")
-        + (topMenu ? " tobago-menuBar-item-span-top" : "")
-        + (pageMenu ? " tobago-menuBar-item-page-top" : "");
-
-    final LabelWithAccessKey label = new LabelWithAccessKey(uiPanel);
-    String image = (String) uiPanel.getAttributes().get(Attributes.IMAGE);
-
-
-    addImage(writer, facesContext, image, disabled);
-
-    writer.startElement(HtmlConstants.A, null);
-    writer.writeClassAttribute(spanClass);
-    writer.writeAttribute(HtmlAttributes.HREF, "#", false);
-    writer.writeAttribute(HtmlAttributes.ONFOCUS, "tobagoMenuFocus(event)", false);
-    writer.writeAttribute(HtmlAttributes.ONBLUR, "tobagoMenuBlur(event)", false);
-    writer.writeAttribute(HtmlAttributes.ONKEYDOWN, "tobagoMenuKeyDown(event)", false);
-    writer.writeAttribute(HtmlAttributes.ONKEYPRESS, "tobagoMenuKeyPress(event)", false);
-    writer.writeIdAttribute(uiPanel.getClientId(facesContext));
-    if (label.getText() != null) {
-      if (label.getAccessKey() != null) {
-        if (LOG.isInfoEnabled()
-            && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
-          LOG.info("dublicated accessKey : " + label.getAccessKey());
-        }
-        if (!disabled) {
-          addAcceleratorKey(facesContext, uiPanel, label.getAccessKey());
-        }
-      }
-      HtmlRendererUtils.writeLabelWithAccessKey(writer, label);
-    }
-    writer.endElement(HtmlConstants.A);
+    
+    writer.startElement(HtmlConstants.OL, menuBar);
+    writer.writeClassAttribute();
   }
 
-  private void addAcceleratorKey(
-      FacesContext facesContext, UIComponent component, Character accessKey) {
-    String clientId = component.getClientId(facesContext);
-    while (component != null && !component.getAttributes().containsKey(MENU_ACCELERATOR_KEYS)) {
-      component = component.getParent();
-    }
-    if (component != null) {
-      List<String> keys
-          = (List<String>) component.getAttributes().get(MENU_ACCELERATOR_KEYS);
-      String jsStatement = HtmlRendererUtils.createOnclickAcceleratorKeyJsStatement(
-          clientId, accessKey, null);
-      keys.add(jsStatement);
-    } else {
-      LOG.warn("Can't find menu root component!");
-    }
-  }
-
-  private void addImage(TobagoResponseWriter writer, FacesContext facesContext,
-                        String image, boolean disabled) throws IOException {
-    if (image != null) {
-      String disabledImage = null;
-      if (disabled) {
-        disabledImage = ResourceManagerUtil.getDisabledImageWithPath(facesContext, image);
-      }
-      if (disabledImage != null) {
-        image = disabledImage;
-      } else {
-        image = ResourceManagerUtil.getImageWithPath(facesContext, image);
-      }
-    } else {
-      image = ResourceManagerUtil.getImageWithPath(facesContext, "image/blank.gif");
-    }
-    writer.startElement(HtmlConstants.IMG, null);
-    writer.writeClassAttribute("tobago-menu-item-image");
-    writer.writeAttribute(HtmlAttributes.SRC, image, false);
-    writer.endElement(HtmlConstants.IMG);
-  }
-
-  private int addMenuEntrys(StringBuilder sb, String var,
-                            FacesContext facesContext, UIComponent component, boolean warn) throws IOException {
-    return addMenuEntrys(sb, var, facesContext, component, warn, 0);
-  }
-
-  private int addMenuEntrys(
-      StringBuilder sb, String var, FacesContext facesContext, UIComponent component, boolean warn, int index)
-      throws IOException {
-    for (Object o : component.getChildren()) {
-      UIComponent entry = (UIComponent) o;
-      if (entry instanceof UICommandBase) {
-        addMenuEntry(sb, var, facesContext, (UICommandBase) entry);
-      } else if (entry instanceof UIMenuSeparator) {
-        addMenuSeparator(sb, var);
-      } else if (entry instanceof UIMenu) {
-        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 (not UICommandBase): " + entry.getClass().getName());
-      }
-    }
-    return index;
-  }
-
-  private void addMenuEntry(StringBuilder sb, String var, FacesContext facesContext, UICommandBase command)
-      throws IOException {
-    CommandRendererHelper helper = new CommandRendererHelper(facesContext, command);
-    String onclick = helper.getOnclick();
-    if (command instanceof UIMenuCommand) {
-      if (command.getFacet(Facets.ITEMS) != null) {
-        UIComponent facet = command.getFacet(Facets.ITEMS);
-        if (facet instanceof UISelectOne) {
-          addSelectOne(sb, var, facesContext, command, onclick);
-        } else if (facet instanceof UISelectBoolean) {
-          addSelectBoolean(sb, var, facesContext, command, onclick);
-        }
-      } else {
-        addCommand(sb, var, facesContext, command, onclick);
-      }
-    } else if (command instanceof UISelectBooleanCommand) {
-      addSelectBoolean(sb, var, facesContext, command, onclick);
-    } else if (command instanceof UISelectOneCommand) {
-      addSelectOne(sb, var, facesContext, command, onclick);
-    }
-  }
-
-  private void addCommand(
-      StringBuilder sb, String var, FacesContext facesContext, UICommandBase command, String onClick) 
-      throws IOException {
-    String image = (String) command.getAttributes().get(Attributes.IMAGE);
-    addMenuItem(sb, var, facesContext, command, image, onClick);
-  }
-
-  private void addSelectBoolean(
-      StringBuilder sb, String var, FacesContext facesContext, UICommandBase command, String onClick)
-      throws IOException {
-
-    UIComponent checkbox = command.getFacet(Facets.ITEMS);
-    if (checkbox == null) {
-      checkbox = CreateComponentUtils.createUISelectBooleanFacetWithId(facesContext, command);
-    }
-
-    final boolean checked = ComponentUtils.getBooleanAttribute(checkbox, Attributes.VALUE);
-
-    String clientId = checkbox.getClientId(facesContext);
-    onClick = RenderUtil.addMenuCheckToggle(clientId, onClick);
-    if (checked) {
-      sb.append("    menuCheckToggle('").append(clientId).append("');\n");
-    }
-    String image = checked ? "image/MenuCheckmark.gif" : null;
-    addMenuItem(sb, var, facesContext, command, image, onClick);
-  }
-
-  private void addMenuItem(
-      StringBuilder sb, String var, FacesContext facesContext, UICommandBase command, String image, String onclick)
-      throws IOException {
-    LabelWithAccessKey label = new LabelWithAccessKey(command);
-    addMenuItem(sb, var, facesContext, command, label, image, onclick);
-  }
-
-  private void addSelectOne(
-      StringBuilder sb, String var, FacesContext facesContext, UICommandBase command, String onclick)
-      throws IOException {
-    List<SelectItem> items;
-    LabelWithAccessKey label = new LabelWithAccessKey(command);
-
-    UISelectOne radio = (UISelectOne) command.getFacet(Facets.ITEMS);
-    if (radio == null) {
-      items = RenderUtil.getSelectItems(command);
-      radio = CreateComponentUtils.createUIMenuSelectOneFacet(facesContext, command);
-      radio.setId(facesContext.getViewRoot().createUniqueId());
-    } else {
-      items = RenderUtil.getSelectItems(radio);
-    }
-
-    Object value = radio.getValue();
-
-    boolean markFirst = !ComponentUtils.hasSelectedValue(items, value);
-    String radioId = radio.getClientId(facesContext);
-    String onClickPrefix = "menuSetRadioValue('" + radioId + "', '";
-    String onClickPostfix = onclick != null ? "') ; " + onclick : "";
-    for (SelectItem item : items) {
-      final String labelText = item.getLabel();
-      label.reset();
-      if (labelText != null) {
-        if (labelText.indexOf(LabelWithAccessKey.INDICATOR) > -1) {
-          label.setup(labelText);
-        } else {
-          label.setText(labelText);
-        }
-      } else {
-        LOG.warn("Menu item has label=null. UICommandBase.getClientId()="
-            + command.getClientId(facesContext));
-      }
-      String formattedValue
-          = RenderUtil.getFormattedValue(facesContext, radio, item.getValue());
-      onclick = onClickPrefix + formattedValue + onClickPostfix;
-      String image;
-      if (item.getValue().equals(value) || markFirst) {
-        image = "image/MenuRadioChecked.gif";
-        markFirst = false;
-        sb.append("    ").append(onClickPrefix).append(formattedValue).append("');");
-      } else {
-        image = "image/MenuRadioUnchecked.gif";
-      }
-      addMenuItem(sb, var, facesContext, command, label, image, onclick);
-    }
-  }
-
-  private void addMenuItem(
-      StringBuilder sb, String var, FacesContext facesContext, UICommandBase command, 
-      LabelWithAccessKey label, String image, String onClick) 
-      throws IOException {
-    if (!command.isRendered()) {
-      return;
-    }
-    final boolean disabled
-        = ComponentUtils.getBooleanAttribute(command, Attributes.DISABLED);
-    String spanClass
-        = "tobago-menuBar-item-span tobago-menuBar-item-span-"
-        + (disabled ? "disabled" : "enabled");
-
-    ResponseWriter savedWriter = facesContext.getResponseWriter();
-    FastStringWriter stringWriter = new FastStringWriter();
-    ResponseWriter newWriter = savedWriter.cloneWithWriter(stringWriter);
-    facesContext.setResponseWriter(newWriter);
+  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
-    addImage(writer, facesContext, image, disabled);
-
-    writer.startElement(HtmlConstants.A, null);
-    writer.writeClassAttribute(spanClass);
-    if (label.getAccessKey() != null) {
-      if (LOG.isInfoEnabled()
-          && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
-        LOG.info("duplicate accessKey : " + label.getAccessKey() + " in " + label.getText());
-      }
-
-      if (!disabled) {
-        writer.writeIdAttribute(command.getClientId(facesContext));
-        addAcceleratorKey(facesContext, command, label.getAccessKey());
-      }
-    }
-    writer.writeAttribute(HtmlAttributes.HREF, "#", false);
-    writer.writeAttribute(HtmlAttributes.ONFOCUS, "tobagoMenuFocus(event)", false);
-    writer.writeAttribute(HtmlAttributes.ONBLUR, "tobagoMenuBlur(event)", false);
-    writer.writeAttribute(HtmlAttributes.ONKEYDOWN, "tobagoMenuKeyDown(event)", false);
-    writer.writeAttribute(HtmlAttributes.ONKEYPRESS, "tobagoMenuKeyPress(event)", false);
-    if (label.getText() != null) {
-      HtmlRendererUtils.writeLabelWithAccessKey(writer, label);
-    }
-    writer.endElement(HtmlConstants.A);
-
-    facesContext.setResponseWriter(savedWriter);
-    final String html = stringWriter.toString();
-
-    sb.append("    ");
-    sb.append(var);
-    sb.append(".addMenuItem(new Tobago.Menu.Item('");
-    sb.append(prepareForScript(html));
-    sb.append("', ");
-    if (!disabled) {
-      sb.append("\"");
-      sb.append(onClick);
-      sb.append("\"");
-    } else {
-      sb.append("null");
-    }
-    sb.append(", ");
-    sb.append(disabled ? "true" : "false");
-    sb.append("));\n");
-  }
-
-  private void addMenuSeparator(StringBuilder sb, String var) {
-    String html = "<div style=\"text-align: center;\">"
-        + "<hr class=\"tobago-menuBar-separator\"></div>";
-
-    sb.append("    ");
-    sb.append(var);
-    sb.append(".addMenuItem(new Tobago.Menu.Item('");
-    sb.append(prepareForScript(html));
-    sb.append("', ");
-    sb.append("null");
-    sb.append(", ");
-    sb.append("true");
-    sb.append(", ");
-    sb.append("true");
-    sb.append("));\n");
-  }
-
-  private String prepareForScript(String s) {
-    return s.replaceAll("\n", " ").replaceAll("'", "\\\\'");
-  }
-
-  public void encodeChildren(FacesContext facesContext, UIComponent component)
-      throws IOException {
-  }
-
-  public boolean getRendersChildren() {
-    return true;
+    writer.endElement(HtmlConstants.OL);
   }
 }

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java?rev=887243&r1=887242&r2=887243&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java Fri Dec  4 16:04:42 2009
@@ -17,33 +17,170 @@
  * limitations under the License.
  */
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.component.Facets;
+import org.apache.myfaces.tobago.component.RendererTypes;
+import org.apache.myfaces.tobago.component.UIMenuCommand;
+import org.apache.myfaces.tobago.component.UISelectBooleanCheckbox;
+import org.apache.myfaces.tobago.context.ResourceManagerUtil;
 import org.apache.myfaces.tobago.renderkit.CommandRendererBase;
+import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
+import org.apache.myfaces.tobago.renderkit.css.Style;
+import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
+import org.apache.myfaces.tobago.renderkit.html.util.CommandRendererHelper;
+import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
+import org.apache.myfaces.tobago.renderkit.util.JQueryUtils;
+import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
+import org.apache.myfaces.tobago.util.AccessKeyMap;
+import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
 import javax.faces.component.UIComponent;
+import javax.faces.component.UISelectOne;
 import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
 import java.io.IOException;
+import java.util.List;
 
 /**
- * Rendering is done by MenuBarRenderer,
- * but we need decoding in CommandRendererBase.
- * @see MenuBarRenderer
+ * Does the decoding with parent class CommandRendererBase.
+ *
  * @see CommandRendererBase
  */
 public class MenuCommandRenderer extends CommandRendererBase {
 
+  private static final Log LOG = LogFactory.getLog(MenuCommandRenderer.class);
+
+  private static final String MENU_ACCELERATOR_KEYS = "menuAcceleratorKeys";
+
   @Override
-  public void encodeBegin(FacesContext facesContext, UIComponent component)
-      throws IOException {
+  public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
+    UIMenuCommand menu = (UIMenuCommand) component;
+    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+
+    boolean disabled = menu.isDisabled();
+    boolean firstLevel = RendererTypes.MENU_BAR.equals(menu.getParent().getRendererType());
+    LabelWithAccessKey label = new LabelWithAccessKey(menu);
+    String clientId = menu.getClientId(facesContext);
+    String submit = "Tobago.submitAction(this, '" + clientId +"');";
+
+    if (menu.getFacet(Facets.CHECKBOX) != null) {
+      // checkbox menu
+      UISelectBooleanCheckbox checkbox = (UISelectBooleanCheckbox) menu.getFacet(Facets.CHECKBOX);
+      boolean checked = ComponentUtils.getBooleanAttribute(checkbox, Attributes.VALUE);
+      String image = checked ? "image/MenuCheckmark.gif" : null;
+      String hiddenId = checkbox.getClientId(facesContext);
+      // the function toggles true <-> false
+      String setValue = JQueryUtils.selectId(hiddenId) 
+          + ".each(function(){$(this).val($(this).val() == 'true' ? 'false' : 'true')}); ";
+      encodeItem(facesContext, writer, menu, label, setValue + submit, disabled, firstLevel, image);
+      encodeHidden(writer, hiddenId, checked);
+    } else if (menu.getFacet(Facets.RADIO) != null) {
+      // radio menu
+      UISelectOne radio = (UISelectOne) menu.getFacet(Facets.RADIO);
+      List<SelectItem> items = RenderUtil.getSelectItems(radio);
+      String hiddenId = radio.getClientId(facesContext);
+      for (SelectItem item : items) {
+        boolean checked = item.getValue().equals(radio.getValue());
+        String image = checked ? "image/MenuRadioChecked.gif" : null;
+        final String labelText = item.getLabel();
+        label.reset();
+        if (labelText != null) {
+          if (labelText.indexOf(LabelWithAccessKey.INDICATOR) > -1) {
+            label.setup(labelText);
+          } else {
+            label.setText(labelText);
+          }
+        } else {
+          LOG.warn("Menu item has label=null where clientId=" + clientId);
+        }
+        String formattedValue = RenderUtil.getFormattedValue(facesContext, radio, item.getValue());
+        String setValue = JQueryUtils.selectId(hiddenId) + ".val('" + JQueryUtils.escapeValue(formattedValue) + "'); ";
+        encodeItem(facesContext, writer, null ,label, setValue + submit, disabled, firstLevel, image);
+      }
+      encodeHidden(writer, hiddenId, radio.getValue());
+    } else {
+      // normal menu command
+      CommandRendererHelper helper = new CommandRendererHelper(facesContext, menu);
+      String onclick = helper.getOnclick();
+      encodeItem(facesContext, writer, menu, label, onclick != null ? onclick : submit, disabled, firstLevel, null);
+    }
   }
 
-  @Override
+  private void encodeHidden(TobagoResponseWriter writer, String hiddenId, Object value) throws IOException {
+    writer.startElement(HtmlConstants.INPUT, null);
+    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
+    writer.writeIdAttribute(hiddenId);
+    writer.writeNameAttribute(hiddenId);
+    if (value != null) {
+      writer.writeAttribute(HtmlAttributes.VALUE, value.toString(), true);
+    }
+    writer.endElement(HtmlConstants.INPUT);
+  }
+
+  private void encodeItem(
+      FacesContext facesContext, TobagoResponseWriter writer, UIComponent component, LabelWithAccessKey label, 
+      String onclick, boolean disabled, boolean firstLevel, String image) throws IOException {
+
+    writer.startElement(HtmlConstants.LI, null);
+    String clazz = (firstLevel ? "tobago-menu-top " : "") + "tobago-menu-parent";
+    writer.writeClassAttribute(clazz);
+    writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, true);
+
+    if (image != null) {
+      Style style = new Style();
+      style.setBackgroundImage("url(" 
+          + ResourceManagerUtil.getImageWithPath(facesContext, image) 
+          + ")");
+      writer.writeStyleAttribute(style);
+    }
+
+    writer.startElement(HtmlConstants.A, null);
+    writer.writeAttribute(HtmlAttributes.HREF, "#", false);
+//    writer.writeIdAttribute(clientId);
+
+    if (label.getText() != null) {
+      if (label.getAccessKey() != null) {
+        if (LOG.isInfoEnabled()
+            && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
+          LOG.info("duplicated accessKey : " + label.getAccessKey());
+        }
+        if (!disabled && component != null) {
+          addAcceleratorKey(facesContext, component, label.getAccessKey());
+        }
+      }
+      HtmlRendererUtils.writeLabelWithAccessKey(writer, label);
+    }
+    writer.endElement(HtmlConstants.A);
+    writer.endElement(HtmlConstants.LI);
+  }
+
+  private void addAcceleratorKey(
+      FacesContext facesContext, UIComponent component, Character accessKey) {
+    String clientId = component.getClientId(facesContext);
+    while (component != null && !component.getAttributes().containsKey(MENU_ACCELERATOR_KEYS)) {
+      component = component.getParent();
+    }
+    if (component != null) {
+      List<String> keys
+          = (List<String>) component.getAttributes().get(MENU_ACCELERATOR_KEYS);
+      String jsStatement = HtmlRendererUtils.createOnclickAcceleratorKeyJsStatement(clientId, accessKey, null);
+      keys.add(jsStatement);
+    } else {
+      LOG.warn("Can't find menu root component!");
+    }
+  }
+  
   public void encodeChildren(FacesContext facesContext, UIComponent component)
       throws IOException {
   }
 
-  @Override
-  public void encodeEnd(FacesContext facesContext, UIComponent component)
-      throws IOException {
+  public boolean getRendersChildren() {
+    return true;
   }
+  
 
 }