You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2013/07/25 10:57:05 UTC

svn commit: r1506849 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ tobag...

Author: weber
Date: Thu Jul 25 08:57:05 2013
New Revision: 1506849

URL: http://svn.apache.org/r1506849
Log:
TOBAGO-1287 - Readd dropDownMenu to sheet column header

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnTagDeclaration.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnTagDeclaration.java?rev=1506849&r1=1506848&r2=1506849&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnTagDeclaration.java Thu Jul 25 08:57:05 2013
@@ -47,8 +47,7 @@ import javax.faces.component.UIColumn;
     componentFamily = UIColumn.COMPONENT_FAMILY,
     rendererType = RendererTypes.COLUMN,
     facets = {
-        @Facet(name = Facets.DROP_DOWN_MENU, description = "Contains a UIMenu instance to render a drop down menu."
-            + " (not implemented yet, work in progress)", // XXX
+        @Facet(name = Facets.DROP_DOWN_MENU, description = "Contains a UIMenu instance to render a drop down menu.",
             allowedChildComponenents = "org.apache.myfaces.tobago.Menu")
     })
 public interface ColumnTagDeclaration

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnRenderer.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/ColumnRenderer.java?rev=1506849&r1=1506848&r2=1506849&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ColumnRenderer.java Thu Jul 25 08:57:05 2013
@@ -23,8 +23,11 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.UILink;
 import org.apache.myfaces.tobago.component.UIOut;
 import org.apache.myfaces.tobago.context.Markup;
+import org.apache.myfaces.tobago.internal.component.AbstractUIMenu;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
+import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.apache.myfaces.tobago.util.FacetUtils;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -65,6 +68,14 @@ public class ColumnRenderer extends Layo
   }
 
   @Override
+  public void prepareRendersChildren(FacesContext facesContext, UIComponent component) throws IOException {
+    AbstractUIMenu dropDownMenu = FacetUtils.getDropDownMenu(component);
+    if (dropDownMenu != null) {
+      RenderUtils.prepareRendererAll(facesContext, dropDownMenu);
+    }
+  }
+
+  @Override
   public boolean getRendersChildren() {
     return true;
   }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-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/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=1506849&r1=1506848&r2=1506849&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Thu Jul 25 08:57:05 2013
@@ -42,6 +42,7 @@ import org.apache.myfaces.tobago.event.P
 import org.apache.myfaces.tobago.internal.component.AbstractUIColumn;
 import org.apache.myfaces.tobago.internal.component.AbstractUIColumnNode;
 import org.apache.myfaces.tobago.internal.component.AbstractUIData;
+import org.apache.myfaces.tobago.internal.component.AbstractUIMenu;
 import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
 import org.apache.myfaces.tobago.internal.component.AbstractUISheet;
 import org.apache.myfaces.tobago.internal.context.ResourceManagerFactory;
@@ -843,7 +844,25 @@ public class SheetRenderer extends Layou
           if (column instanceof UIColumnSelector) {
             renderColumnSelectorHeader(facesContext, writer, sheet);
           } else {
-             RenderUtils.encode(facesContext, cellComponent);
+            RenderUtils.encode(facesContext, cellComponent);
+
+            AbstractUIMenu dropDownMenu = FacetUtils.getDropDownMenu(column);
+            // render sub menu popup button
+            if (dropDownMenu != null && dropDownMenu.isRendered()) {
+
+              writer.startElement(HtmlElements.SPAN, column);
+              writer.writeClassAttribute(Classes.create(column, "menu"));
+
+              writer.startElement(HtmlElements.IMG, column);
+              String menuImage = ResourceManagerUtils.getImageWithPath(facesContext, "image/sheetSelectorMenu.gif");
+              writer.writeAttribute(HtmlAttributes.TITLE, "", false);
+              writer.writeAttribute(HtmlAttributes.SRC, menuImage, false);
+              writer.endElement(HtmlElements.IMG);
+              ToolBarRendererBase.renderDropDownMenu(facesContext, writer, dropDownMenu);
+
+              writer.endElement(HtmlElements.SPAN);
+            }
+
           }
 
           if (sorterImage != null) {
@@ -1087,11 +1106,9 @@ public class SheetRenderer extends Layou
 
   @Override
   public void prepareRendersChildren(FacesContext facesContext, UIComponent component) throws IOException {
-/*
     UISheet sheet = (UISheet) component;
     for (UIColumn column : sheet.getRenderedColumns()) {
       RenderUtils.prepareRendererAll(facesContext, column);
     }
-*/
   }
 }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-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/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java?rev=1506849&r1=1506848&r2=1506849&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java Thu Jul 25 08:57:05 2013
@@ -573,7 +573,8 @@ public abstract class ToolBarRendererBas
     return facesContext.getExternalContext().getRequestContextPath() + image;
   }
 
-  private void renderDropDownMenu(FacesContext facesContext, TobagoResponseWriter writer, AbstractUIMenu dropDownMenu)
+  public static void renderDropDownMenu(
+      FacesContext facesContext, TobagoResponseWriter writer, AbstractUIMenu dropDownMenu)
       throws IOException {
     writer.startElement(HtmlElements.OL, dropDownMenu);
     // XXX fix naming conventions for CSS classes

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css?rev=1506849&r1=1506848&r2=1506849&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css Thu Jul 25 08:57:05 2013
@@ -989,9 +989,9 @@ hr.tobago-separator {
     border-width: 0;
 }
 
-.tobago-sheet-header-markup-ascending span, .tobago-sheet-header-markup-descending span {
-  margin-right: 15px;
-}
+/*.tobago-sheet-header-markup-ascending span, .tobago-sheet-header-markup-descending span {*/
+  /*margin-right: 15px;*/
+/*}*/
 
 .tobago-sheet-header-markup-ascending img, .tobago-sheet-header-markup-descending img {
   position: absolute;
@@ -1013,6 +1013,21 @@ hr.tobago-separator {
   cursor: col-resize; /* col-resize is allowed in CSS3+IE6, opera has a separate definition */
 }
 
+.tobago-column-menu {
+  position: absolute;
+  border-width: 0;
+  padding: 0;
+  margin: 0;
+  background-color: transparent;
+  vertical-align: middle;
+}
+
+.tobago-column-menu img{
+  position: relative;
+  top: 0px;
+  right: 0px;
+}
+
 .tobago-sheet-body {
   overflow: auto;
   position: relative;

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js?rev=1506849&r1=1506848&r2=1506849&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js Thu Jul 25 08:57:05 2013
@@ -264,7 +264,8 @@ Tobago.Menu.switchOn = function(menuBar,
       .bind(compatibleKeyEvent(), Tobago.Menu.handelKey);
   var a = menu.children('a');
   if (! a.data("tobago-ignore-focus")) { // can be removed, after refactoring to a jQuery widget variable
-    if (menu.parents(".tobago-toolBar").size() == 0 && menu.parents(".tobago-box-headerToolBar").size() == 0) {
+    if (menu.parents(".tobago-toolBar").size() == 0 && menu.parents(".tobago-box-headerToolBar").size() == 0
+        && menu.parents(".tobago-column-menu").size() == 0) {
       a.trigger("focus");
     } else {
       // XXX the call in the previous line doesn't work with toolBar -> dropDown (don't know why), so using direct call
@@ -363,11 +364,12 @@ Tobago.Menu.init = function(elements) {
 //  jQuery(".tobago-page-menuStore").append(menus.children("ol"));
 
   var toolBarMenu = Tobago.Utils.selectWidthJQuery(
-      elements, ".tobago-toolBar-menu, .tobago-boxToolBar-menu, .tobago-tabGroupToolBar-menu");
+      elements, ".tobago-toolBar-menu, .tobago-boxToolBar-menu, .tobago-tabGroupToolBar-menu, .tobago-column-menu");
   // a click on toolBar menu opener -> forward to .tobago-menu-markup-top
   toolBarMenu.click(function(event) {
     jQuery(this).find('a').click();
     event.stopPropagation();
+    return false;
   });
 
   // init context menus