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 2010/03/02 13:51:05 UTC

svn commit: r918008 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/ example/demo/src/main/webapp/overview/ theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/ theme/sca...

Author: lofwyr
Date: Tue Mar  2 12:51:04 2010
New Revision: 918008

URL: http://svn.apache.org/viewvc?rev=918008&view=rev
Log:
TOBAGO-832: Reimplementation of the menu
 - Menu inside of UIToolBar
 - There where a stuctural change needed to use menu inside the page. The sub menus are collected in a div node near to the body tag in HTML.
 - Naming conventions: rename the CSS classes from *toolbar* to *toolBar*

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
    myfaces/tobago/trunk/example/demo/src/main/webapp/overview/toolbar.xhtml
    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/BoxToolBarRenderer.java
    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/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/SheetRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.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/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/standard/style/style.css

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java Tue Mar  2 12:51:04 2010
@@ -99,8 +99,6 @@
   public static final String MAX_NUMBER = "maxNumber";
   public static final String MAXIMUM_HEIGHT = "maximumHeight";
   public static final String MAXIMUM_WIDTH = "maximumWidth";
-  public static final String MENU_POPUP = "menuPopup";
-  public static final String MENU_POPUP_TYPE = "menuPopupType";
   public static final String METHOD = "method";
   public static final String MIN = "min";
   public static final String MIN_SEVERITY = "minSeverity";

Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/overview/toolbar.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/overview/toolbar.xhtml?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/overview/toolbar.xhtml (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/overview/toolbar.xhtml Tue Mar  2 12:51:04 2010
@@ -24,197 +24,202 @@
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core">
-  <ui:param name="title" value="#{overviewBundle.toolbar}"/>
-  <tc:panel id="pageToolbar">
+<ui:param name="title" value="#{overviewBundle.toolbar}"/>
+<tc:panel id="pageToolbar">
+  <f:facet name="layout">
+    <tc:gridLayout rows="65px;fixed;1px;70px;fixed;50px" id="pageToolbarLayout"/>
+  </f:facet>
+
+  <tc:out escape="false" value="#{overviewBundle.toolbar_text1}"/>
+
+  <tc:box label="#{overviewBundle.toolbar_sampleTitle}" id="boxToolbar">
+
     <f:facet name="layout">
-      <tc:gridLayout rows="65px;fixed;1px;70px;fixed;50px" id="pageToolbarLayout"/>
+      <tc:gridLayout rows="fixed;fixed;fixed" columns="2*;1*;1*" id="boxToolbarLayout"/>
+    </f:facet>
+
+    <f:facet name="toolBar">
+      <tc:toolBar>
+        <tc:toolBarCommand id="button" action="overview/toolbar"
+                           actionListener="#{overviewController.click}"
+                           label="#{overviewBundle.toolbar_buttonAction}"/>
+
+        <tc:toolBarCommand id="imageButton" action="#{overviewController.ping}"
+                           actionListener="#{overviewController.click}"
+                           label="#{overviewBundle.toolbar_imageButtonAction}"
+                           image="image/toolbar_example_button.gif"/>
+
+        <tc:toolBarCommand id="popupButton"
+                           actionListener="#{overviewController.click}"
+                           label="#{overviewBundle.toolbar_popupButtonAction}">
+
+          <f:facet name="popup">
+            <tc:popup width="200" height="100" id="popup" modal="true">
+
+              <f:facet name="layout">
+                <tc:gridLayout rows="35px;1*;fixed"/>
+              </f:facet>
+
+              <tc:out value="#{overviewBundle.toolbar_popupText}"/>
+
+              <tc:cell/>
+              <tc:button id="popupCloseButton" label="#{overviewBundle.toolbar_closePopupAction}">
+                <tc:attribute name="popupClose" value="immediate"/>
+              </tc:button>
+
+            </tc:popup>
+          </f:facet>
+        </tc:toolBarCommand>
+
+        <tc:toolBarCommand id="DropDown"
+                           label="#{overviewBundle.toolbar_dropDownAction}">
+          <f:facet name="menupopup">
+            <tc:menu>
+              <tc:menuCommand onclick="alert('test 1')" label="Alert 1"/>
+              <tc:menuCommand onclick="alert('test 2')" label="Alert 2"/>
+              <tc:menuCommand action="#{overviewController.ping}" id="dropdown3"
+                              actionListener="#{overviewController.click}" label="Action 3"/>
+            </tc:menu>
+          </f:facet>
+        </tc:toolBarCommand>
+
+      </tc:toolBar>
     </f:facet>
 
-    <tc:out escape="false" value="#{overviewBundle.toolbar_text1}"/>
+    <tc:cell spanX="3">
+      <tc:toolBar iconSize="#{overviewController.toolbarIconSize}"
+                  labelPosition="#{overviewController.toolbarTextPosition}"
+                  orientation="left">
+        <tc:toolBarCommand id="button2" action="overview/toolbar"
+                           actionListener="#{overviewController.click}"
+                           label="#{overviewBundle.toolbar_buttonAction}"/>
+
+        <tc:toolBarCommand id="imageButton2" action="overview/toolbar"
+                           actionListener="#{overviewController.click}"
+                           label="#{overviewBundle.toolbar_imageButtonAction}"
+                           image="image/toolbar_example_button.gif"/>
+
+
+        <tc:toolBarCommand id="popupButton2"
+                           actionListener="#{overviewController.click}"
+                           label="#{overviewBundle.toolbar_popupButtonAction}">
+          <tc:popupReference for=":page:popup"/>
+          <!--f:facet name="popup">
+            <tc:popup width="200" height="100" id="popup2" >
+
+              <f:facet name="layout">
+                <tc:gridLayout rows="35px;1*;fixed" />
+              </f:facet>
+
+              <tc:out value="#{overviewBundle.toolbar_popupText}"/>
+
+              <tc:cell/>
+              <tc:button id="popupCloseButton2" label="#{overviewBundle.toolbar_closePopupAction}" >
+                <tc:attribute name="popupClose" value="immediate"/>
+              </tc:button>
+
+            </tc:popup>
+          </f:facet-->
+        </tc:toolBarCommand>
+
+        <tc:toolBarCommand id="DropDown2" action="overview/toolbar"
+                           actionListener="#{overviewController.click}"
+                           label="#{overviewBundle.toolbar_dropDownAction}">
+          <f:facet name="menupopup">
+            <tc:menu>
+              <tc:menuCommand onclick="alert('test 1')" label="Alert 1"/>
+              <tc:menuCommand onclick="alert('test 2')" label="Alert 2"/>
+              <tc:menuCommand id="dropdown3_2" actionListener="#{overviewController.click}" label="Action 3"/>
+            </tc:menu>
+          </f:facet>
+        </tc:toolBarCommand>
 
-    <tc:box label="#{overviewBundle.toolbar_sampleTitle}" id="boxToolbar">
+      </tc:toolBar>
+    </tc:cell>
 
-      <f:facet name="layout">
-        <tc:gridLayout rows="fixed;fixed;fixed" columns="2*;1*;1*" id="boxToolbarLayout"/>
-      </f:facet>
-
-      <f:facet name="toolBar">
-        <tc:toolBar>
-          <tc:toolBarCommand id="button" action="overview/toolbar"
-                             actionListener="#{overviewController.click}"
-                             label="#{overviewBundle.toolbar_buttonAction}"/>
-
-          <tc:toolBarCommand id="imageButton" action="#{overviewController.ping}"
-                             actionListener="#{overviewController.click}"
-                             label="#{overviewBundle.toolbar_imageButtonAction}"
-                             image="image/toolbar_example_button.gif"/>
-
-          <tc:toolBarCommand id="popupButton"
-                             actionListener="#{overviewController.click}"
-                             label="#{overviewBundle.toolbar_popupButtonAction}">
-
-            <f:facet name="popup">
-              <tc:popup width="200" height="100" id="popup" modal="true">
-
-                <f:facet name="layout">
-                  <tc:gridLayout rows="35px;1*;fixed"/>
-                </f:facet>
-
-                <tc:out value="#{overviewBundle.toolbar_popupText}"/>
-
-                <tc:cell/>
-                <tc:button id="popupCloseButton" label="#{overviewBundle.toolbar_closePopupAction}">
-                  <tc:attribute name="popupClose" value="immediate"/>
-                </tc:button>
-
-              </tc:popup>
-            </f:facet>
-          </tc:toolBarCommand>
-
-          <tc:toolBarCommand id="DropDown"
-                             label="#{overviewBundle.toolbar_dropDownAction}">
-            <f:facet name="menupopup">
-              <tc:menu>
-                <tc:menuCommand onclick="alert('test 1')" label="Alert 1"/>
-                <tc:menuCommand onclick="alert('test 2')" label="Alert 2"/>
-                <tc:menuCommand action="#{overviewController.ping}" id="dropdown3"
-                             actionListener="#{overviewController.click}" label="Action 3"/>
-              </tc:menu>
-            </f:facet>
-          </tc:toolBarCommand>
-
-        </tc:toolBar>
-      </f:facet>
-
-      <tc:cell spanX="3">
-        <tc:toolBar iconSize="#{overviewController.toolbarIconSize}"
-                    labelPosition="#{overviewController.toolbarTextPosition}"
-                    orientation="left">
-          <tc:toolBarCommand id="button2" action="overview/toolbar"
-                             actionListener="#{overviewController.click}"
-                             label="#{overviewBundle.toolbar_buttonAction}"/>
-
-          <tc:toolBarCommand id="imageButton2" action="overview/toolbar"
-                             actionListener="#{overviewController.click}"
-                             label="#{overviewBundle.toolbar_imageButtonAction}"
-                             image="image/toolbar_example_button.gif"/>
-
-
-          <tc:toolBarCommand id="popupButton2"
-                             actionListener="#{overviewController.click}"
-                             label="#{overviewBundle.toolbar_popupButtonAction}">
-            <tc:popupReference for=":page:popup"/>
-            <!--f:facet name="popup">
-              <tc:popup width="200" height="100" id="popup2" >
-
-                <f:facet name="layout">
-                  <tc:gridLayout rows="35px;1*;fixed" />
-                </f:facet>
-
-                <tc:out value="#{overviewBundle.toolbar_popupText}"/>
-
-                <tc:cell/>
-                <tc:button id="popupCloseButton2" label="#{overviewBundle.toolbar_closePopupAction}" >
-                  <tc:attribute name="popupClose" value="immediate"/>
-                </tc:button>
-
-              </tc:popup>
-            </f:facet-->
-          </tc:toolBarCommand>
-
-          <tc:toolBarCommand id="DropDown2" action="overview/toolbar"
-                             actionListener="#{overviewController.click}"
-                             label="#{overviewBundle.toolbar_dropDownAction}">
-            <f:facet name="menupopup">
-              <tc:menu>
-                <tc:menuCommand onclick="alert('test 1')" label="Alert 1"/>
-                <tc:menuCommand onclick="alert('test 2')" label="Alert 2"/>
-                <tc:menuCommand id="dropdown3_2" actionListener="#{overviewController.click}" label="Action 3"/>
-              </tc:menu>
-            </f:facet>
-          </tc:toolBarCommand>
-
-        </tc:toolBar>
-      </tc:cell>
-
-      <tx:in value="#{overviewController.lastAction}" readonly="true"
-             label="#{overviewBundle.basic_lastActionLabel}"/>
-
-      <tc:selectOneChoice value="#{overviewController.toolbarTextPosition}">
-        <f:selectItems value="#{overviewController.toolbarTextItems}"/>
-      </tc:selectOneChoice>
-      <tc:selectOneChoice value="#{overviewController.toolbarIconSize}">
-        <f:selectItems value="#{overviewController.toolbarIconItems}"/>
-      </tc:selectOneChoice>
-
-      <tc:cell/>
-      <tc:cell spanX="2">
-        <tc:button label="updateView"/>
-      </tc:cell>
+    <tx:in value="#{overviewController.lastAction}" readonly="true"
+           label="#{overviewBundle.basic_lastActionLabel}"/>
 
-    </tc:box>
+    <tc:selectOneChoice value="#{overviewController.toolbarTextPosition}">
+      <f:selectItems value="#{overviewController.toolbarTextItems}"/>
+    </tc:selectOneChoice>
+    <tc:selectOneChoice value="#{overviewController.toolbarIconSize}">
+      <f:selectItems value="#{overviewController.toolbarIconItems}"/>
+    </tc:selectOneChoice>
 
     <tc:cell/>
+    <tc:cell spanX="2">
+      <tc:button label="updateView"/>
+    </tc:cell>
 
-    <tc:out escape="false" value="#{overviewBundle.toolbar_text2}"/>
+  </tc:box>
 
-    <tc:box label="#{overviewBundle.toolbar_sampleTitle2}" id="boxMenu">
-      <tc:menuBar>
+  <tc:cell/>
 
-        <tc:menu label="Menu 1">
+  <tc:out escape="false" value="#{overviewBundle.toolbar_text2}"/>
 
-          <tc:menuCommand onclick="alert('action 1')" label="alert 1"/>
+  <tc:box label="#{overviewBundle.toolbar_sampleTitle2}" id="boxMenu">
+    <f:facet name="layout">
+      <tc:gridLayout rows="fixed;100px"/>
+    </f:facet>
 
-          <tc:menuCommand action="/" type="navigate" label="#{overviewBundle.toolbar_linkClickme}"
-                       image="image/config.gif">
-            <f:facet name="confirmation"><tc:out value="Do you really want leave this demo?"/></f:facet>
-          </tc:menuCommand>
+    <tc:menuBar>
 
-          <tc:menuCommand link="http://www.atanion.com" disabled="true" label="disabled"/>
+      <tc:menu label="Menu 1">
 
-          <tx:menuCheckbox action="#{demo.clickButton}" label="#{overviewBundle.toolbar_linkClickme}"
-                           value="#{demo.boolTest}"/>
-        </tc:menu>
-        <tc:menu label="Menu 2">
+        <tc:menuCommand onclick="alert('action 1')" label="alert 1"/>
 
-          <tc:menuCommand onclick="alert('action 1')" label="alert 1"/>
+        <tc:menuCommand label="#{overviewBundle.toolbar_linkClickme}" image="image/config.gif">
+          <f:facet name="confirmation"><tc:out value="Do you really want to click this button?"/></f:facet>
+        </tc:menuCommand>
 
-          <tc:menu label="Menu 3">
+        <tc:menuCommand link="http://www.atanion.com" disabled="true" label="disabled"/>
 
-            <tc:menuCommand onclick="alert('action 1')" label="alert 1" image="image/date.gif"/>
+        <tx:menuCheckbox action="#{demo.clickButton}" label="#{overviewBundle.toolbar_linkClickme}"
+                         value="#{demo.boolTest}"/>
+      </tc:menu>
+      <tc:menu label="Menu 2">
 
-            <tc:menuCommand link="/" label="#{overviewBundle.toolbar_linkClickme}" image="image/config.gif">
-              <f:facet name="confirmation"><tc:out value="Do you really want leave this demo?"/></f:facet>
-            </tc:menuCommand>
+        <tc:menuCommand onclick="alert('action 1')" label="alert 1"/>
 
-            <tc:menuCommand link="http://www.atanion.com" disabled="true" label="#{overviewBundle.toolbar_linkClickme}"
-                         image="image/remove.gif"/>
+        <tc:menu label="Menu 3">
 
-            <tc:menu label="#{overviewBundle.toolbar_selectSingleselect}">
+          <tc:menuCommand onclick="alert('action 1')" label="alert 1" image="image/date.gif"/>
 
-              <tx:menuRadio value="#{overviewController.radioValue}" converter="salutationId">
-                <f:selectItems value="#{overviewController.items}"/>
-              </tx:menuRadio>
+          <tc:menuCommand link="/" label="#{overviewBundle.toolbar_linkClickme}" image="image/config.gif">
+            <f:facet name="confirmation"><tc:out value="Do you really want leave this demo?"/></f:facet>
+          </tc:menuCommand>
 
-            </tc:menu>
+          <tc:menuCommand link="http://www.atanion.com" disabled="true" label="#{overviewBundle.toolbar_linkClickme}"
+                          image="image/remove.gif"/>
 
-            <tc:menuCommand action="#{demo.clickButton}" label="#{overviewBundle.toolbar_linkClickme}"/>
-          </tc:menu>
+          <tc:menu label="#{overviewBundle.toolbar_selectSingleselect}">
 
-          <tc:menuSeparator/>
+            <tx:menuRadio value="#{overviewController.radioValue}" converter="salutationId">
+              <f:selectItems value="#{overviewController.items}"/>
+            </tx:menuRadio>
 
-          <tc:menuCommand label="#{overviewBundle.toolbar_linkClickme}">
-            <f:facet name="items">
-              <tc:selectBooleanCheckbox value="#{demo.bool[0]}"/>
-            </f:facet>
-          </tc:menuCommand>
-          <tx:menuCheckbox label="#{overviewBundle.toolbar_linkClickme}" value="#{demo.bool[1]}"/>
-          <tx:menuCheckbox label="#{overviewBundle.toolbar_linkClickme}" value="#{demo.bool[2]}"/>
+          </tc:menu>
 
+          <tc:menuCommand action="#{demo.clickButton}" label="#{overviewBundle.toolbar_linkClickme}"/>
         </tc:menu>
 
-      </tc:menuBar>
-    </tc:box>
+        <tc:menuSeparator/>
+
+        <tc:menuCommand label="#{overviewBundle.toolbar_linkClickme}">
+          <f:facet name="items">
+            <tc:selectBooleanCheckbox value="#{demo.bool[0]}"/>
+          </f:facet>
+        </tc:menuCommand>
+        <tx:menuCheckbox label="#{overviewBundle.toolbar_linkClickme}" value="#{demo.bool[1]}"/>
+        <tx:menuCheckbox label="#{overviewBundle.toolbar_linkClickme}" value="#{demo.bool[2]}"/>
+
+      </tc:menu>
+
+    </tc:menuBar>
+
     <tc:cell/>
-  </tc:panel>
+
+  </tc:box>
+</tc:panel>
 </ui:composition>

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=918008&r1=918007&r2=918008&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 Tue Mar  2 12:51:04 2010
@@ -332,16 +332,16 @@
   border: 0px solid black;
 }
 
-.tobago-toolbar-button-table {
+.tobago-toolBar-button-table {
   font: bold 12px arial, helvetica, sans-serif;
   color: #3366CC;
 }
 
-.tobago-toolbar-button-table-disabled {
+.tobago-toolBar-button-table-disabled {
   color: GrayText;
 }
 
-.tobago-toolbar-button-table-box-facet-disabled {
+.tobago-toolBar-button-table-box-facet-disabled {
   color: GrayText;
 }
 

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxToolBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxToolBarRenderer.java?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxToolBarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxToolBarRenderer.java Tue Mar  2 12:51:04 2010
@@ -54,12 +54,12 @@
 
   protected String getTableClasses(boolean selected, boolean disabled) {
     return
-        "tobago-toolbar-button-table tobago-boxToolbar-button-table-box-facet tobago-toolbar-button-table-box-facet-"
+        "tobago-toolBar-button-table tobago-boxToolbar-button-table-box-facet tobago-toolBar-button-table-box-facet-"
             + (selected ? "selected-" : "") + (disabled ? "disabled" : "enabled");
   }
 
   protected String getDivClasses(boolean selected, boolean disabled) {
-    return "tobago-toolbar-button tobago-toolbar-button-box-facet tobago-toolbar-button-box-facet-"
+    return "tobago-toolBar-button tobago-toolBar-button-box-facet tobago-toolBar-button-box-facet-"
         + (selected ? "selected-" : "") + (disabled ? "disabled" : "enabled");
   }
 }

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=918008&r1=918007&r2=918008&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 Tue Mar  2 12:51:04 2010
@@ -17,10 +17,7 @@
  * limitations under the License.
  */
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.tobago.component.UIMenuBar;
-import org.apache.myfaces.tobago.context.TobagoFacesContext;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
@@ -33,24 +30,9 @@
 
 public class MenuBarRenderer extends LayoutComponentRendererBase {
 
-  private static final Log LOG = LogFactory.getLog(MenuBarRenderer.class);
-
   public static final String SEARCH_ID_POSTFIX = ComponentUtils.SUB_SEPARATOR + "popup";
-  private static final String MENU_ACCELERATOR_KEYS = "menuAcceleratorKeys";
+  public static final String DIVIDER = MenuBarRenderer.class.getName() + "DIVIDER";
 
-  // XXX check the ajax case
-  @Override
-  public void onComponentCreated(FacesContext facesContext, UIComponent component) {
-    // XXX move to tobago.js or ...
-    if (facesContext instanceof TobagoFacesContext) {
-      TobagoFacesContext pageFacesContext = (TobagoFacesContext) facesContext;
-
-      // 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 {
 
@@ -61,6 +43,7 @@
     writer.writeClassAttribute();
   }
 
+  @Override
   public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
     writer.endElement(HtmlConstants.OL);

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.java?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.java Tue Mar  2 12:51:04 2010
@@ -21,6 +21,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.component.UIMenu;
+import org.apache.myfaces.tobago.internal.context.ResponseWriterDivider;
 import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Style;
@@ -28,6 +29,7 @@
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 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;
@@ -48,8 +50,9 @@
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
 
     boolean disabled = menu.isDisabled();
-    boolean firstLevel = RendererTypes.MENU_BAR.equals(menu.getParent().getRendererType());
+    boolean firstLevel = !RendererTypes.MENU.equals(menu.getParent().getRendererType());
     boolean isParentMenu = menu.getChildCount() > 0; // todo: may be not correct
+    String clientId = menu.getClientId(facesContext);
 
     writer.startElement(HtmlConstants.LI, menu);
     String clazz = firstLevel ? "tobago-menu-top" : "tobago-menu-parent"; 
@@ -61,7 +64,7 @@
     }
     writer.startElement(HtmlConstants.A, menu);
     writer.writeAttribute(HtmlAttributes.HREF, "#", false);
-    writer.writeIdAttribute(menu.getClientId(facesContext));
+    writer.writeIdAttribute(clientId);
 
     LabelWithAccessKey label = new LabelWithAccessKey(menu);
     if (label.getText() != null) {
@@ -78,7 +81,13 @@
     }
     writer.endElement(HtmlConstants.A);
     if (isParentMenu) {
+      if (firstLevel) {
+        ResponseWriterDivider divider = ResponseWriterDivider.getInstance(facesContext, MenuBarRenderer.DIVIDER);
+        divider.activateBranch(facesContext);
+        writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+      }
       writer.startElement(HtmlConstants.OL, menu);
+      writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "menu");
     }
   }
 
@@ -87,16 +96,21 @@
 
     UIMenu menu = (UIMenu) component;
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+    boolean firstLevel = !RendererTypes.MENU.equals(menu.getParent().getRendererType());
 
     boolean isParentMenu = menu.getChildCount() > 0; // todo: may be not correct
     if (isParentMenu) {
       writer.endElement(HtmlConstants.OL);
+      if (firstLevel) {
+        ResponseWriterDivider divider = ResponseWriterDivider.getInstance(facesContext, MenuBarRenderer.DIVIDER);
+        divider.passivateBranch(facesContext);
+        writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+      }
     }
     writer.endElement(HtmlConstants.LI);
   }
   
-  private void addAcceleratorKey(
-      FacesContext facesContext, UIComponent component, Character accessKey) {
+  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();

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Tue Mar  2 12:51:04 2010
@@ -30,6 +30,7 @@
 import org.apache.myfaces.tobago.config.Configurable;
 import org.apache.myfaces.tobago.context.ResourceManagerUtil;
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
+import org.apache.myfaces.tobago.internal.context.ResponseWriterDivider;
 import org.apache.myfaces.tobago.internal.layout.LayoutContext;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.PageRendererBase;
@@ -233,7 +234,8 @@
 //    scriptFiles.add(0, debugMode ? "script/jquery/1_4_1/jquery.js" : "script/jquery/1_4_1/jquery.min.js");
     scriptFiles.add(0, debugMode ? "script/jquery/1_3_2/jquery.js" : "script/jquery/1_3_2/jquery.min.js");
     scriptFiles.add(1, "script/tobago.js");
-    scriptFiles.add(2, "script/theme-config.js");
+    scriptFiles.add(2, "script/tobago-menu.js");
+    scriptFiles.add(3, "script/theme-config.js");
     
     int clientLogSeverity = 2;
     if (debugMode) {
@@ -536,13 +538,20 @@
 
     writer.writeJavascript("setTimeout(\"Tobago.init('" + clientId + "')\", 1000)");
 
+    // todo: check if it is empty
+    writer.startElement(HtmlConstants.DIV, page);
+    writer.writeClassAttribute("tobago-page-menuStore");
+    ResponseWriterDivider divider = ResponseWriterDivider.getInstance(facesContext, MenuBarRenderer.DIVIDER);
+    divider.writeOutAndCleanUp(facesContext);
+    writer.endElement(HtmlConstants.DIV);
+    
     writer.endElement(HtmlConstants.BODY);
     writer.endElement(HtmlConstants.HTML);
 
     if (LOG.isDebugEnabled()) {
       LOG.debug("unused AccessKeys    : "
           + AccessKeyMap.getUnusedKeys(facesContext));
-      LOG.debug("dublicated AccessKeys: "
+      LOG.debug("duplicated AccessKeys: "
           + AccessKeyMap.getDublicatedKeys(facesContext));
     }
 

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Tue Mar  2 12:51:04 2010
@@ -882,8 +882,6 @@
       //menu.setTransient(true);
       column.getFacets().put(Facets.MENUPOPUP, menu);
       menu.setRendererType(RendererTypes.MENU_BAR);
-      menu.getAttributes().put(Attributes.MENU_POPUP, Boolean.TRUE);
-      menu.getAttributes().put(Attributes.MENU_POPUP_TYPE, "SheetSelector");
       menu.getAttributes().put(Attributes.IMAGE, "image/sheetSelectorMenu.gif");
 
       String sheetId = column.getParent().getClientId(facesContext);

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java Tue Mar  2 12:51:04 2010
@@ -17,11 +17,6 @@
  * limitations under the License.
  */
 
-/*
- * Created 07.02.2003 16:00:00.
- * $Id$
- */
-
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -72,10 +67,11 @@
 
   private static final Log LOG = LogFactory.getLog(TabGroupRenderer.class);
 
-  private static final String[] SCRIPTS = new String[]{"script/tab.js", "script/tabgroup.js", "script/tobago-menu.js"};
+  private static final String[] SCRIPTS = new String[]{"script/tab.js", "script/tabgroup.js"};
 
   public static final String ACTIVE_INDEX_POSTFIX = "__activeIndex";
 
+  @Override
   public void decode(FacesContext facesContext, UIComponent component) {
     if (ComponentUtils.isOutputOnly(component)) {
       return;
@@ -97,6 +93,7 @@
     }
   }
 
+  @Override
   public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
     super.prepareRender(facesContext, component);
     if (facesContext instanceof TobagoFacesContext) {
@@ -104,6 +101,7 @@
     }
   }
 
+  @Override
   public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
 
     UITabGroup tabGroup = (UITabGroup) uiComponent;

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java Tue Mar  2 12:51:04 2010
@@ -17,14 +17,9 @@
  * 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.UIToolBar;
+import org.apache.myfaces.tobago.config.Configurable;
+import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.css.Style;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
@@ -36,27 +31,24 @@
 
 public class ToolBarRenderer extends ToolBarRendererBase {
 
-  private static final Log LOG = LogFactory.getLog(ToolBarRenderer.class);
-
+  @Override
   public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
 
-    UIToolBar toolbar = (UIToolBar) uiComponent;
+    UIToolBar toolBar = (UIToolBar) uiComponent;
 
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
 
-    writer.startElement(HtmlConstants.DIV, toolbar);
-    writer.writeIdAttribute(toolbar.getClientId(facesContext));
-    HtmlRendererUtils.renderDojoDndItem(toolbar, writer, true);
+    writer.startElement(HtmlConstants.DIV, toolBar);
+    writer.writeIdAttribute(toolBar.getClientId(facesContext));
+    HtmlRendererUtils.renderDojoDndItem(toolBar, writer, true);
     writer.writeClassAttribute();
-    Style style = new Style(facesContext, toolbar);
+    Style style = new Style(facesContext, toolBar);
     writer.writeStyleAttribute(style);
-    writer.startElement(HtmlConstants.DIV, toolbar);
-    boolean right = false;
-    if (toolbar instanceof UIToolBar) {
-      right = UIToolBar.ORIENTATION_RIGHT.equals(((UIToolBar) toolbar).getOrientation());
-    }
+    writer.startElement(HtmlConstants.DIV, toolBar);
+    boolean right = toolBar instanceof UIToolBar && UIToolBar.ORIENTATION_RIGHT.equals(toolBar.getOrientation());
+
     // TODO use StyleClasses
-    writer.writeClassAttribute("tobago-toolbar-div-inner" + (right ? " tobago-toolbar-orientation-right" : ""));
+    writer.writeClassAttribute("tobago-toolBar-div-inner" + (right ? " tobago-toolBar-orientation-right" : ""));
 
     super.encodeEnd(facesContext, uiComponent);
 
@@ -69,13 +61,21 @@
   }
 
   protected String getTableClasses(boolean selected, boolean disabled) {
-    return "tobago-toolbar-button-table tobago-toolbar-button-table-"
+    return "tobago-toolBar-button-table tobago-toolBar-button-table-"
         + (selected ? "selected-" : "") + (disabled ? "disabled" : "enabled");
   }
 
   protected String getDivClasses(boolean selected, boolean disabled) {
-    return "tobago-toolbar-button tobago-toolbar-button-"
+    return "tobago-toolBar-button tobago-toolBar-button-"
         + (selected ? "selected-" : "") + (disabled ? "disabled" : "enabled");
   }
 
+  @Override
+  public Measure getHeight(FacesContext facesContext, Configurable component) {
+    UIToolBar toolBar = (UIToolBar) component;
+    String labelPosition = getLabelPosition(toolBar);
+    String iconSize = getIconSize(toolBar);
+    String key = iconSize + "_" + labelPosition + "_Height";
+    return getResourceManager().getThemeMeasure(facesContext, component, key);
+  }
 }

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java Tue Mar  2 12:51:04 2010
@@ -55,6 +55,7 @@
 
   private static final Log LOG = LogFactory.getLog(ToolBarRendererBase.class);
 
+  @Override
   public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
     super.prepareRender(facesContext, component);
     HtmlRendererUtils.renderDojoDndSource(facesContext, component);
@@ -68,6 +69,7 @@
     return (String) component.getAttributes().get(Attributes.ICON_SIZE);
   }
 
+  @Override
   public void encodeEnd(FacesContext context, UIComponent uiComponent) throws IOException {
     UIPanel toolbar = (UIPanel) uiComponent;
 
@@ -298,7 +300,7 @@
 
     if (!UIToolBar.LABEL_OFF.equals(labelPosition)) {
       writer.startElement(HtmlConstants.TD, null);
-      writer.writeClassAttribute("tobago-toolbar-label-td");
+      writer.writeClassAttribute("tobago-toolBar-label-td");
       writer.writeAttribute(HtmlAttributes.ALIGN, "center", false);
       if (popupMenu != null) {
         writer.writeAttribute(HtmlAttributes.STYLE, "padding-right: 3px;", false);
@@ -429,46 +431,48 @@
     return "tobago-toolBar-button-link" + (disabled ? " tobago-toolBar-button-link-disabled" : "");
   }
 
-  private void renderPopupTd(FacesContext facesContext,
-      TobagoResponseWriter writer, UIComponent command, UIComponent popupMenu,
-      boolean labelBottom)
-      throws IOException {
+  private void renderPopupTd(
+      FacesContext facesContext, TobagoResponseWriter writer, UIComponent command, UIComponent popupMenu,
+      boolean labelBottom) throws IOException {
     writer.startElement(HtmlConstants.TD, null);
     if (labelBottom) {
       writer.writeAttribute(HtmlAttributes.ROWSPAN, 2);
     }
 
     if (popupMenu != null) {
-      String backgroundImage = ResourceManagerUtil.getImageWithPath(facesContext,
-          "image/1x1.gif");
+      String backgroundImage = ResourceManagerUtil.getImageWithPath(facesContext, "image/1x1.gif");
       writer.startElement(HtmlConstants.DIV, null);
-      writer.writeIdAttribute(
-          command.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "popup");
+      writer.writeIdAttribute(command.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "popup");
       writer.writeClassAttribute("tobago-toolBar-button-menu");
       writer.startElement(HtmlConstants.IMG, null);
       writer.writeAttribute(HtmlAttributes.SRC, backgroundImage, false);
       writer.writeClassAttribute("tobago-toolBar-button-menu-background-image");
       writer.endElement(HtmlConstants.IMG);
       writer.endElement(HtmlConstants.DIV);
-      popupMenu.getAttributes().put(Attributes.MENU_POPUP, Boolean.TRUE);
-      popupMenu.getAttributes().put(Attributes.MENU_POPUP_TYPE, "ToolBarButton");
-//      popupMenu.setRendererType(RendererTypes.MENU_BAR);
       if (popupMenu instanceof UIMenu)  {
         ((UIMenu) popupMenu).setLabel(null);
       } else {
         popupMenu.getAttributes().remove(Attributes.LABEL);
       }
-      popupMenu.getAttributes().put(Attributes.IMAGE, "image/toolbarButtonMenu.gif");
+      String image = ResourceManagerUtil.getImageWithPath(facesContext, "image/toolbarButtonMenu.gif");
+      popupMenu.getAttributes().put(Attributes.IMAGE, image);
+      popupMenu.getAttributes().put(Attributes.LABEL, "\u00a0\u00a0"); // non breaking space
+      writer.startElement(HtmlConstants.OL, popupMenu);
+      writer.writeClassAttribute("tobago-menuBar-default");
+      writer.writeStyleAttribute("position:relative;");  // FIXME: use a different style class
       RenderUtil.encode(facesContext, popupMenu);
+      writer.endElement(HtmlConstants.OL);
     }
 
     writer.endElement(HtmlConstants.TD);
   }
 
+  @Override
   public void encodeChildren(FacesContext facesContext, UIComponent component)
       throws IOException {
   }
 
+  @Override
   public boolean getRendersChildren() {
     return true;
   }

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js Tue Mar  2 12:51:04 2010
@@ -15,7 +15,42 @@
  * limitations under the License.
  */
 
-// todo: rename xxx_
+/*
+ jQuery code to manage the menu.
+ The DOM structure looks like this:
+ <html>
+   <body>
+     <ol class="tobago-menuBar-default">
+       <li class="tobago-menu-top">
+         <a id="m1">Menu 1</a>
+       </li>
+       <li class="tobago-menu-top">
+         <a id="m2">Menu 2</a>
+       </li>
+       ...
+     </ol>
+     <div>
+       // page content     
+     </div>
+     <div class="tobago-menu-store">  // container for the sub menus.
+       <ol id="m1::menu">
+         <li class="tobago-menu-parent">
+           <a>Sub Menu 1.1</a>
+             <ol>
+               <li class="tobago-menu-parent">
+                 <a>Sub Sub Menu 1.1.1</a>
+               </li>
+               ...
+     </div>
+   </body>
+ </html>
+ The menu items of the top level (id="m1") are connected to the sub menus of the store div (id="m1::menu").   
+ */
+
+// todo: rename xxx_ and check the other function names.
+/*
+  $(this) is the "a" tag of a menu item.
+ */
 function xxx_tobagoMenuHandelKey(event) {
 
   var handled = false;
@@ -27,14 +62,14 @@
 
   switch (code) {
     case 27: // escape
-      xxx_tobagoMenuSwitchOff($(this).closest(".tobago-menuBar-default"));
+      xxx_tobagoMenuClose(event, $(this));
       handled = true;
       break;
     case 37: // cursor left
       if ($(this).parent().hasClass('tobago-menu-top')) {
         $(this).parent().prev('li').children('a').focus();
-      } else if ($(this).parent().parent().parent().hasClass('tobago-menu-top')) {
-        $(this).parent().parent().parent().prev('li').children('a').focus();
+      } else if ($(this).parent().parent().tobagoMenu_findParentMenu().parent().hasClass('tobago-menu-top')) {
+        $(this).parent().parent().tobagoMenu_findParentMenu().parent().prev('li').children('a').focus();
       } else {
         $(this).closest('ol').prev('a').focus();
       }
@@ -54,13 +89,13 @@
       } else if ($(this).next('ol').size() > 0) {
         $(this).next('ol').children(":nth-child(1)").children('a').focus();
       } else {
-        $(this).closest('.tobago-menu-top').next('li').children('a').focus();
+        $(this).parents('ol:last').tobagoMenu_findParentMenu().parent().next('li').children('a').focus();
       }
       handled = true;
       break;
     case 40: // cursor down
       if ($(this).parent().hasClass('tobago-menu-top')) {
-        $(this).next('ol').children(":nth-child(1)").children('a').focus();
+        $(this).tobagoMenu_findSubMenu().children(":nth-child(1)").children('a').focus();
       } else {
         $(this).parent().nextAll('li').children('a').eq(0).focus();
       }
@@ -72,27 +107,31 @@
   return !handled;
 }
 
+/*
+  $(this) is a <a> tag of a menu item.
+*/
 function xxx_tobagoMenuOpen(event) {
 
+  var li = $(this).parent();
+  var sub = $(this).tobagoMenu_findSubMenu();
+  
   // close menus in other branches
-  $(this).parent().siblings().find("ol").css('visibility', 'hidden');
+  li.siblings().children('a').tobagoMenu_findSubMenu().find('ol').andSelf().css('visibility', 'hidden');
 
   // close sub sub menu 
-  $(this).next("ol").children().find("ol").css('visibility', 'hidden');
+  sub.children().find("ol").css('visibility', 'hidden');
 
   // open sub menu
-  // todo: this must be done only one time...
-  var sub = $(this).next("ol");
-  if (sub.size() > 0) { // XXX check if there is a nicer method
+  if (sub.size() > 0) {
     // compute position
-    if ($(this).parent().hasClass('tobago-menu-top')) {
+    if (li.hasClass('tobago-menu-top')) {
       // is top menu
-      sub.css('left', sub.parent().position().left);
-      sub.css('top', sub.parent().outerHeight());
+      sub.css('left', li.offset().left);
+      sub.css('top', li.offset().top + li.outerHeight());
     } else {
       // is sub menu
-      sub.css('left', sub.parent().position().left + sub.parent().outerWidth());
-      sub.css('top', sub.parent().position().top - 1); // 1 = border-top
+      sub.css('left', li.position().left + li.outerWidth());
+      sub.css('top', li.position().top - 1); // 1 = border-top
     }
 
     // show
@@ -100,12 +139,24 @@
   }
       
   // old "hover" off
-  $(this).parent().siblings('.tobago-menu-selected').removeClass("tobago-menu-selected");
-  $(this).next("ol").children('.tobago-menu-selected').removeClass("tobago-menu-selected");
+  li.siblings('.tobago-menu-selected').removeClass("tobago-menu-selected");
+  sub.children('.tobago-menu-selected').removeClass("tobago-menu-selected");
   // "hover" on
   $(this).parents('li').addClass("tobago-menu-selected");
 }
 
+function xxx_tobagoMenuClose(event, src) {
+  if (src === undefined) {
+    src = $(this);
+  }
+  if (src.parent().hasClass('tobago-menu-top')) {
+    xxx_tobagoMenuSwitchOff(src.parent().parent());
+  } else {
+    xxx_tobagoMenuSwitchOff(src.parents('ol:last').tobagoMenu_findParentMenu().parent().parent());
+  }
+  return false;
+}
+
 /**
 * returns the browser specific event which should be used.
 */
@@ -119,21 +170,26 @@
 }
 
 function xxx_tobagoMenuSwitchOn(menuBar, menu) {
-  menuBar.find("li")
+  menuBar.find('li') // direct menus
+      .add(menuBar.find('li').children('a').tobagoMenu_findSubMenu().find('li')) // add sub menus
       .bind('mouseover', xxx_tobagoMenuMouseOver)
       .children('a')
       .bind('focus', xxx_tobagoMenuOpen)
+      .bind('blur', xxx_tobagoMenuClose)
       .bind(compatibleKeyEvent(), xxx_tobagoMenuHandelKey);
   menu.children('a').focus();
   menuBar.attr('menu-active', 'true');        // write state back
 }
 
 function xxx_tobagoMenuSwitchOff(menuBar) {
-  menuBar.find("ol").css('visibility', 'hidden');
-  menuBar.find("li")
+  menuBar.find("ol")
+      .add(menuBar.find('li').children('a').tobagoMenu_findSubMenu().find('ol').andSelf())
+      .css('visibility', 'hidden');
+  menuBar.find('li').add(menuBar.find('li').children('a').tobagoMenu_findSubMenu().find('li'))
       .unbind('mouseover', xxx_tobagoMenuMouseOver)
       .children('a')
       .unbind('focus', xxx_tobagoMenuOpen)
+      .unbind('blur', xxx_tobagoMenuClose)
       .unbind(compatibleKeyEvent(), xxx_tobagoMenuHandelKey);
   menuBar.attr('menu-active', 'false');        // write state back
 }
@@ -160,4 +216,61 @@
   });
 }
 
+jQuery.tobagoMenuParent = function(element) {
+  var result = [];
+
+  result.push(element);
+
+  return result;
+};
+
+
+/*
+  $(this) is a list of "a" element of a menu item as jQuery object.
+  Returns a list of "ol" objects. All sub menus as jQuery object.
+*/
+(function($) {
+  $.fn.extend({
+    tobagoMenu_findSubMenu: function() {
+      var menu = $(this).next("ol");
+      $(this).each(function() {
+        menu = menu.add(tobagoUtil_findSubComponent($(this), "menu"));
+      });
+      return menu;
+    }
+  });
+})(jQuery);
+
+/*
+  $(this) is a "ol" element which represents a sub menu.
+  returns the "a" element connected with the given sub menu.  
+*/
+(function($) {
+  $.fn.extend({
+    tobagoMenu_findParentMenu: function() {
+      var ol = $(this);
+      if (ol.attr('id').lastIndexOf("::") >= 0) {
+        return tobagoUtil_findSuperComponent(ol);
+    }
+        return ol;
+      }
+  });
+})(jQuery);
+
+function tobagoUtil_findSubComponent(element, subId) {
+  return $(tobagoUtil_getSubComponentId(element.attr('id'), subId));
+}
+
+function tobagoUtil_getSubComponentId(id, subId) {
+  return "#" + id.replace(":", "\\:") + "\\:\\:" + subId; 
+}
+
+function tobagoUtil_findSuperComponent(element) {
+  return $(tobagoUtil_getSuperComponentId(element.attr('id')));
+}
+
+function tobagoUtil_getSuperComponentId(id) {
+  return "#" + id.substring(0, id.lastIndexOf("::")).replace(":", "\\:"); 
+}
+
 xxx_tobagoMenuInit();

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css Tue Mar  2 12:51:04 2010
@@ -938,12 +938,12 @@
   padding: 4px;
 }
 
-.tobago-toolbar-orientation-right {
+.tobago-toolBar-orientation-right {
   right: 0;
   position: absolute;
 }
 
-.tobago-toolbar-button {
+.tobago-toolBar-button {
   float: left;
   font-weight: normal;
   font-family: arial, helvetica, sans-serif;
@@ -957,12 +957,12 @@
   -moz-box-sizing: border-box;
 }
 
-.tobago-toolbar-button-table {
+.tobago-toolBar-button-table {
   font-weight: normal;
   font-family: arial, helvetica, sans-serif;
 }
 
-.tobago-toolbar-button-box-facet {
+.tobago-toolBar-button-box-facet {
   float: left;
 }
 
@@ -998,11 +998,11 @@
   color: #778899;
 }
 
-.tobago-toolbar-button-table-box-facet-disabled {
+.tobago-toolBar-button-table-box-facet-disabled {
   color: #778899;
 }
 
-.tobago-toolbar-label-td {
+.tobago-toolBar-label-td {
   height: 19px; /*  background: lime;*/
   white-space: nowrap;
 }
@@ -1075,7 +1075,8 @@
 
 /* MenuBar, Menu, etc. ------------------------------------------------------------------ */
 
-.tobago-menuBar-default, .tobago-menuBar-default a:link, .tobago-menuBar-default a:visited, .tobago-menuBar-default a:active {
+.tobago-menuBar-default, .tobago-menuBar-default a:link, .tobago-menuBar-default a:visited, .tobago-menuBar-default a:active, 
+.tobago-page-menuStore, .tobago-page-menuStore a:link, .tobago-page-menuStore a:visited, .tobago-page-menuStore a:active {
   color: black;
   font-family: arial, helvetica, sans-serif;
   font-size: 12px;
@@ -1087,7 +1088,9 @@
   text-decoration: none;
 }
 
-.tobago-menuBar-default li {
+
+.tobago-menuBar-default li, 
+.tobago-page-menuStore li {
   background-color: #aabbcc;
   list-style: none outside none;
 }
@@ -1096,7 +1099,8 @@
   background-color: #d8e9fb;
 }
 
-.tobago-menuBar-default {
+.tobago-menuBar-default,
+.tobago-page-menuStore {
   padding: 0;
   margin: 0;
   border-bottom-width: 1px;
@@ -1111,7 +1115,12 @@
   z-index: 1000; /* todo */
 }
 
-.tobago-menuBar-default ol {
+.tobago-page-menuStore {
+  visibility: hidden;
+}
+
+.tobago-menuBar-default ol, 
+.tobago-page-menuStore ol {
   padding: 0;
   margin: 0;
   border-width: 1px;

Modified: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css?rev=918008&r1=918007&r2=918008&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css Tue Mar  2 12:51:04 2010
@@ -645,21 +645,21 @@
   padding: 0px;
 }
 
-.tobago-toolbar-button {
+.tobago-toolBar-button {
   font: bold 12px arial, helvetica, sans-serif;
   color: #660000;
 }
 
-.tobago-toolbar-button-table {
+.tobago-toolBar-button-table {
   font: bold 12px arial, helvetica, sans-serif;
   color: #660000;
 }
 
-.tobago-toolbar-button-table-disabled {
+.tobago-toolBar-button-table-disabled {
   color: #808080;
 }
 
-.tobago-toolbar-button-table-box-facet-disabled {
+.tobago-toolBar-button-table-box-facet-disabled {
   color: #808080;
 }
 
@@ -679,7 +679,7 @@
   background: #dddddd;
 }
 
-.tobago-toolbar-button-box-facet {
+.tobago-toolBar-button-box-facet {
   padding-top: 1px;
   padding-bottom: 1px;
 }
@@ -764,7 +764,8 @@
 
 /* menuBar -------------------------------------------------------- */
 
-.tobago-menuBar-default li {
+.tobago-menuBar-default li,
+.tobago-page-menuStore li {
   background-color: #dddddd;
 }
 
@@ -772,12 +773,14 @@
   background-color: #bbbbbb;
 }
 
-.tobago-menuBar-default {
+.tobago-menuBar-default,
+.tobago-page-menuStore {
   border-bottom-color: #808080;
   background-color: #dddddd;
 }
 
-.tobago-menuBar-default ol {
+.tobago-menuBar-default ol,
+.tobago-page-menuStore ol {
   border-color: #888888;
 }