myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r986842 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/ tobago-example/tobago-example-demo/src/main/webapp/overview/ tobago-example/tobago-example-demo/src/main/webapp/reference/ tobago-example/tob...
Date Wed, 18 Aug 2010 18:30:19 GMT
Author: lofwyr
Date: Wed Aug 18 18:30:18 2010
New Revision: 986842

URL: http://svn.apache.org/viewvc?rev=986842&view=rev
Log:
TOBAGO-606: layout
 - rendering of "embedded" menuBar should be defined in a "menuBar"-facet

Added:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
  (contents, props changed)
      - copied, changed from r986635, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
Removed:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/toolbar.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/menu.jsp
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/popup.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-experimental/src/main/webapp/menu.jsp
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/toolbar.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/toolbar.xhtml?rev=986842&r1=986841&r2=986842&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/toolbar.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/toolbar.xhtml
Wed Aug 18 18:30:18 2010
@@ -163,62 +163,61 @@
       <tc:gridLayout rows="fixed;100px"/>
     </f:facet>
 
-    <tc:menuBar>
+    <f:facet name="menuBar">
+      <tc:menuBar>
 
-      <tc:menu label="Menu 1">
+        <tc:menu label="Menu 1">
 
-        <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:menuCommand link="http://www.atanion.com" disabled="true" label="disabled"/>
+          <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>
 
-        <tx:menuCheckbox action="#{demo.clickButton}" label="#{overviewBundle.toolbar_linkClickme}"
-                         value="#{demo.boolTest}"/>
-      </tc:menu>
-      <tc:menu label="Menu 2">
+          <tc:menuCommand link="http://www.atanion.com" disabled="true" label="disabled"/>
 
-        <tc:menuCommand onclick="alert('action 1')" label="alert 1"/>
+          <tx:menuCheckbox action="#{demo.clickButton}" label="#{overviewBundle.toolbar_linkClickme}"
+                           value="#{demo.boolTest}"/>
+        </tc:menu>
+        <tc:menu label="Menu 2">
 
-        <tc:menu label="Menu 3">
+          <tc:menuCommand onclick="alert('action 1')" label="alert 1"/>
 
-          <tc:menuCommand onclick="alert('action 1')" label="alert 1" image="image/date.gif"/>
+          <tc:menu label="Menu 3">
 
-          <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" image="image/date.gif"/>
 
-          <tc:menuCommand link="http://www.atanion.com" disabled="true" label="#{overviewBundle.toolbar_linkClickme}"
-                          image="image/remove.gif"/>
+            <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 label="#{overviewBundle.toolbar_selectSingleselect}">
+            <tc:menuCommand link="http://www.atanion.com" disabled="true" label="#{overviewBundle.toolbar_linkClickme}"
+                            image="image/remove.gif"/>
 
-            <tx:menuRadio value="#{overviewController.radioValue}" converter="salutationId">
-              <f:selectItems value="#{overviewController.items}"/>
-            </tx:menuRadio>
+            <tc:menu label="#{overviewBundle.toolbar_selectSingleselect}">
 
-          </tc:menu>
+              <tx:menuRadio value="#{overviewController.radioValue}" converter="salutationId">
+                <f:selectItems value="#{overviewController.items}"/>
+              </tx:menuRadio>
 
-          <tc:menuCommand action="#{demo.clickButton}" label="#{overviewBundle.toolbar_linkClickme}"/>
-        </tc:menu>
+            </tc:menu>
 
-        <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:menuCommand action="#{demo.clickButton}" label="#{overviewBundle.toolbar_linkClickme}"/>
+          </tc:menu>
 
-      </tc:menu>
+          <tc:menuSeparator/>
 
-    </tc:menuBar>
+          <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:cell/>
+        </tc:menu>
+      </tc:menuBar>
+    </f:facet>
 
   </tc:box>
 </tc:panel>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/menu.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/menu.jsp?rev=986842&r1=986841&r2=986842&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/menu.jsp
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/menu.jsp
Wed Aug 18 18:30:18 2010
@@ -26,45 +26,46 @@
         <tc:gridLayout rows="fixed;*"/>
       </f:facet>
       <%-- code-sniplet-start id="menuBar" --%>
-      <tc:menuBar>
-        <tc:menu label="_File">
-          <tc:menuCommand label="New File"/>
-          <tc:menuCommand label="Open File"/>
-          <tc:menuCommand label="Save"/>
-          <tc:menuCommand label="Print"/>
-          <tc:menuSeparator/>
-          <tc:menuCommand label="Exit">
-            <f:facet name="confirmation">
-              <tc:out value="Are you sure?"/>
-            </f:facet>
-          </tc:menuCommand>
-          <%--<tx:menuCheckbox action="none" label="Administration Mode"/>--%>
-        </tc:menu>
+      <f:facet name="menuBar">
+        <tc:menuBar>
+          <tc:menu label="_File">
+            <tc:menuCommand label="New File"/>
+            <tc:menuCommand label="Open File"/>
+            <tc:menuCommand label="Save"/>
+            <tc:menuCommand label="Print"/>
+            <tc:menuSeparator/>
+            <tc:menuCommand label="Exit">
+              <f:facet name="confirmation">
+                <tc:out value="Are you sure?"/>
+              </f:facet>
+            </tc:menuCommand>
+            <%--<tx:menuCheckbox action="none" label="Administration Mode"/>--%>
+          </tc:menu>
 
-        <%-- code-sniplet-start id="menu" --%>
-        <tc:menu label="_Edit">
-          <tc:menuCommand label="Copy"/>
-          <tc:menuCommand label="Cut"/>
-          <tc:menuCommand label="Paste"/>
-          <%-- code-sniplet-start id="menuItem" --%>
-          <tc:menuCommand label="Delete"/>
-          <%-- code-sniplet-end id="menuItem" --%>
-          <tc:menuSeparator/>
-          <tc:menu label="_Delete">
-            <tc:menuCommand label="As Spam"/>
-            <tc:menuCommand label="As Newsletter"/>
-            <tc:menuCommand label="As Uninteresting"/>
+          <%-- code-sniplet-start id="menu" --%>
+          <tc:menu label="_Edit">
+            <tc:menuCommand label="Copy"/>
+            <tc:menuCommand label="Cut"/>
+            <tc:menuCommand label="Paste"/>
+            <%-- code-sniplet-start id="menuItem" --%>
+            <tc:menuCommand label="Delete"/>
+            <%-- code-sniplet-end id="menuItem" --%>
+            <tc:menuSeparator/>
+            <tc:menu label="_Delete">
+              <tc:menuCommand label="As Spam"/>
+              <tc:menuCommand label="As Newsletter"/>
+              <tc:menuCommand label="As Uninteresting"/>
+            </tc:menu>
           </tc:menu>
-        </tc:menu>
-        <%-- code-sniplet-end id="menu" --%>
+          <%-- code-sniplet-end id="menu" --%>
 
-        <tc:menu label="_View">
-          <tc:menuCommand label="Snap to Grid"/>
-          <tc:menuCommand label="Show Rulers"/>
-        </tc:menu>
-      </tc:menuBar>
+          <tc:menu label="_View">
+            <tc:menuCommand label="Snap to Grid"/>
+            <tc:menuCommand label="Show Rulers"/>
+          </tc:menu>
+        </tc:menuBar>
+      </f:facet>
       <%-- code-sniplet-end id="menuBar" --%>
-      <tc:cell/>
     </tc:box>
   </jsp:body>
 </layout:overview>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/popup.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/popup.xhtml?rev=986842&r1=986841&r2=986842&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/popup.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/popup.xhtml
Wed Aug 18 18:30:18 2010
@@ -32,13 +32,15 @@
       <tc:gridLayout rows="fixed;fixed;fixed;fixed;fixed;fixed;fixed;*"/>
     </f:facet>
 
-    <tc:menuBar>
-      <tc:menu label="Menu">
-        <tc:menuCommand label="Open Popup">
-          <tc:popupReference for=":page:popup"/>
-        </tc:menuCommand>
-      </tc:menu>
-    </tc:menuBar>
+    <f:facet name="menuBar">
+      <tc:menuBar>
+        <tc:menu label="Menu">
+          <tc:menuCommand label="Open Popup">
+            <tc:popupReference for=":page:popup"/>
+          </tc:menuCommand>
+        </tc:menu>
+      </tc:menuBar>
+    </f:facet>
 
     <tc:panel>
       <f:facet name="layout">

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-experimental/src/main/webapp/menu.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-experimental/src/main/webapp/menu.jsp?rev=986842&r1=986841&r2=986842&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-experimental/src/main/webapp/menu.jsp
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-experimental/src/main/webapp/menu.jsp
Wed Aug 18 18:30:18 2010
@@ -19,16 +19,18 @@
 <%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
 <%@ taglib uri="http://myfaces.apache.org/tobago/extension" prefix="tx" %>
 
-<f:view >
-  <tc:page applicationIcon="icon/favicon.ico"  id="page" width="1000px" height="700px">
+<f:view>
+  <tc:page applicationIcon="icon/favicon.ico" id="page" width="1000px" height="700px">
 
     <tc:box label="Menu">
       <f:facet name="layout">
         <tc:gridLayout rows="fixed;*"/>
       </f:facet>
-      <tc:menuBar>
-        <tc:menu label="File" binding="#{test.fileMenu}" />
-      </tc:menuBar>
+      <f:facet name="menuBar">
+        <tc:menuBar>
+          <tc:menu label="File" binding="#{test.fileMenu}"/>
+        </tc:menuBar>
+      </f:facet>
       <tc:cell/>
     </tc:box>
   </tc:page>

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxRenderer.java?rev=986842&r1=986841&r2=986842&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxRenderer.java
Wed Aug 18 18:30:18 2010
@@ -20,6 +20,7 @@ package org.apache.myfaces.tobago.render
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.component.UIBox;
+import org.apache.myfaces.tobago.component.UIMenuBar;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.BoxRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -85,6 +86,12 @@ public class BoxRenderer extends BoxRend
         contentStyle.setTop(Measure.valueOf(-10));
       }
     }
+
+    final UIMenuBar menuBar = getMenuBarFacet(box);
+    if (menuBar != null) {
+      RenderUtils.encode(facesContext, menuBar);
+    }
+    
     writer.startElement(HtmlElements.DIV, box);
     writer.writeClassAttribute(Classes.create(box, "content")); // needed to be scrollable
inside of the box
     final Measure offsetLeft = getOffsetLeft(facesContext, box);

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java?rev=986842&r1=986841&r2=986842&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
Wed Aug 18 18:30:18 2010
@@ -21,6 +21,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.component.UIBox;
+import org.apache.myfaces.tobago.component.UIMenuBar;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.BoxRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -124,6 +125,11 @@ without shadow
     }
     writer.endElement(HtmlElements.DIV);
 
+    final UIMenuBar menuBar = getMenuBarFacet(box);
+    if (menuBar != null) {
+      RenderUtils.encode(facesContext, menuBar);
+    }
+
     UIPanel toolbar = (UIPanel) box.getFacet(Facets.TOOL_BAR);
     if (toolbar != null) {
       renderToolbar(facesContext, writer, box, toolbar);

Copied: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
(from r986635, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java?p2=myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java&r1=986635&r2=986842&rev=986842&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
Wed Aug 18 18:30:18 2010
@@ -17,15 +17,16 @@ package org.apache.myfaces.tobago.render
  * limitations under the License.
  */
 
-/*
- * Created 09.03.2004 12:26:39.
- * $Id$
- */
-
-
+import org.apache.myfaces.tobago.component.Facets;
+import org.apache.myfaces.tobago.component.UIMenuBar;
+import org.apache.myfaces.tobago.config.Configurable;
+import org.apache.myfaces.tobago.layout.Measure;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
 public abstract class BoxRendererBase extends LayoutComponentRendererBase {
 
   private static final Logger LOG = LoggerFactory.getLogger(BoxRendererBase.class);
@@ -34,4 +35,18 @@ public abstract class BoxRendererBase ex
     return true;
   }
 
+  @Override
+  public Measure getOffsetTop(FacesContext facesContext, Configurable component) {
+
+    Measure offsetTop = super.getOffsetTop(facesContext, component);
+    if (getMenuBarFacet((UIComponent)component) != null) {
+      offsetTop = offsetTop.add(19); // todo: get via theme config
+    }
+    return offsetTop;
+  }
+
+  protected UIMenuBar getMenuBarFacet(UIComponent component) {
+    return (UIMenuBar) component.getFacet(Facets.MENUBAR);
+  }
+
 }

Propchange: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message