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/06/08 11:17:34 UTC

svn commit: r952580 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ tobago-example/tobago-example-demo/src/main/webapp/overview/ t...

Author: lofwyr
Date: Tue Jun  8 09:17:31 2010
New Revision: 952580

URL: http://svn.apache.org/viewvc?rev=952580&view=rev
Log:
TOBAGO-891: Rename the facet 'menupopup' to 'dropDownMenu'

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ColumnTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarCommandTagDeclaration.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheet.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/toolbar.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar-fragment.xhtml
    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/TabGroupRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java?rev=952580&r1=952579&r2=952580&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java Tue Jun  8 09:17:31 2010
@@ -27,10 +27,15 @@ public final class Facets {
   public static final String COMPLETE = "complete";
   public static final String CONFIRMATION = "confirmation";
   public static final String CONSTRAINTS = "constraints";
+  public static final String DROP_DOWN_MENU = "dropDownMenu";
   public static final String LABEL = "label";
   public static final String LAYOUT = "layout";
   public static final String LAYOUT_DEFAULT = "layoutDefault";
   public static final String MENUBAR = "menuBar";
+  /**
+   * @deprecated since 1.5.0. Please use {@link #DROP_DOWN_MENU}
+   */
+  @Deprecated
   public static final String MENUPOPUP = "menupopup";
   public static final String PAGER_PAGE = "pagerPage";
   public static final String PAGER_ROW = "pagerRow";

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=952580&r1=952579&r2=952580&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 Tue Jun  8 09:17:31 2010
@@ -17,11 +17,13 @@ package org.apache.myfaces.tobago.intern
  * limitations under the License.
  */
 
+import org.apache.myfaces.tobago.apt.annotation.Facet;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
 import org.apache.myfaces.tobago.component.ComponentTypes;
+import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabel;
 import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
@@ -35,8 +37,14 @@ import org.apache.myfaces.tobago.interna
 @UIComponentTag(
     uiComponent = "org.apache.myfaces.tobago.component.UIColumn",
     uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIColumn",
-    componentType = ComponentTypes.COLUMN)
-//rendererType = "Column")
+    componentType = ComponentTypes.COLUMN,
+    facets = {
+        @Facet(name = Facets.MENUPOPUP, description = "Deprecated. Please use dropDownMenu facet.",
+            allowedChildComponenents = "org.apache.myfaces.tobago.Menu"),
+        @Facet(name = Facets.DROP_DOWN_MENU, description = "Contains a UIMenu instance to render a drop down menu."
+            + " (not implemented yet, work in progress)", // XXX
+            allowedChildComponenents = "org.apache.myfaces.tobago.Menu")
+    })
 public interface ColumnTagDeclaration extends HasIdBindingAndRendered, HasLabel, HasTip, HasMarkup {
   /**
    * Alignment of this column.

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarCommandTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarCommandTagDeclaration.java?rev=952580&r1=952579&r2=952580&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarCommandTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ToolBarCommandTagDeclaration.java Tue Jun  8 09:17:31 2010
@@ -49,7 +49,9 @@ import org.apache.myfaces.tobago.interna
             allowedChildComponenents = ComponentTypes.OUT),
         @Facet(name = Facets.POPUP, description = "Contains a UIPopup instance.",
             allowedChildComponenents = "org.apache.myfaces.tobago.Popup"),
-        @Facet(name = Facets.MENUPOPUP, description = "Contains a UIMenu instance, to render a drop down menu.",
+        @Facet(name = Facets.MENUPOPUP, description = "Deprecated. Please use dropDownMenu facet.",
+            allowedChildComponenents = "org.apache.myfaces.tobago.Menu"),
+        @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 ToolBarCommandTagDeclaration

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheet.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheet.xhtml?rev=952580&r1=952579&r2=952580&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheet.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/overview/sheet.xhtml Tue Jun  8 09:17:31 2010
@@ -148,6 +148,10 @@
         <tc:out value="#{luminary.number}" id="t_number"/>
       </tc:column>
       <tc:column label="#{overviewBundle.solarArrayOrbit}" sortable="true" id="orbit">
+        <f:facet name="dropDownMenu">
+          <tc:menuCommand onclick="alert('Not implemented yet!')">
+          </tc:menuCommand>
+        </f:facet>
         <tc:panel>
           <f:facet name="click">
             <tc:command actionListener="#{demo.selectOrbit}" >

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=952580&r1=952579&r2=952580&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 Tue Jun  8 09:17:31 2010
@@ -73,7 +73,7 @@
 
         <tc:toolBarCommand id="DropDown"
                            label="#{overviewBundle.toolbar_dropDownAction}">
-          <f:facet name="menupopup">
+          <f:facet name="dropDownMenu">
             <tc:menu>
               <tc:menuCommand onclick="alert('test 1')" label="Alert 1"/>
               <tc:menuCommand onclick="alert('test 2')" label="Alert 2"/>
@@ -125,7 +125,7 @@
         <tc:toolBarCommand id="DropDown2" action="overview/toolbar"
                            actionListener="#{overviewController.click}"
                            label="#{overviewBundle.toolbar_dropDownAction}">
-          <f:facet name="menupopup">
+          <f:facet name="dropDownMenu">
             <tc:menu>
               <tc:menuCommand onclick="alert('test 1')" label="Alert 1"/>
               <tc:menuCommand onclick="alert('test 2')" label="Alert 2"/>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar-fragment.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar-fragment.xhtml?rev=952580&r1=952579&r2=952580&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar-fragment.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/toolBar/toolBar-fragment.xhtml Tue Jun  8 09:17:31 2010
@@ -32,7 +32,7 @@
                      tip="link to an external url"/>
   <tc:toolBarCommand label="popup" image="pidgeon-point.jpg"
       tip="a sub menu without any explicit action">
-    <f:facet name="menupopup">
+    <f:facet name="dropDownMenu">
       <tc:menu>
         <tc:menuCommand onclick="alert('Menu 1')" label="Menu 1"/>
         <tc:menuCommand onclick="alert('Menu 2')" label="Menu 2"/>
@@ -41,7 +41,7 @@
   </tc:toolBarCommand>
   <tc:toolBarCommand label="command" image="pidgeon-point.jpg" onclick="alert('Clicked 1!')"
       tip="a command (JavaScript) with a separate sub menu (2 click fields)">
-    <f:facet name="menupopup">
+    <f:facet name="dropDownMenu">
       <tc:menu>
         <tc:menuCommand onclick="alert('Menu 1')" label="Menu 1"/>
         <tc:menuCommand onclick="alert('Menu 2')" label="Menu 2"/>

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=952580&r1=952579&r2=952580&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 Tue Jun  8 09:17:31 2010
@@ -33,6 +33,7 @@ import org.apache.myfaces.tobago.context
 import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
 import org.apache.myfaces.tobago.event.PageAction;
+import org.apache.myfaces.tobago.internal.util.Deprecation;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.layout.LayoutBase;
 import org.apache.myfaces.tobago.layout.Measure;
@@ -702,6 +703,13 @@ public class SheetRenderer extends Layou
       tip = "";
     }
 
+    final UIComponent dropDownMenu = getDropDownMenuFacet(column);
+    if (dropDownMenu != null) {
+      LOG.error("Drop down menu is not implemented in sheets yet!");
+      // Todo: implement it!
+      // Todo: change description in ColumnTagDeclaration after implementing it.
+    }
+
     // sorting
 
     String sorterImage = null;
@@ -801,7 +809,7 @@ public class SheetRenderer extends Layou
       UIMenu menu = (UIMenu) CreateComponentUtils.createComponent(
           facesContext, UIMenu.COMPONENT_TYPE, RendererTypes.MENU, "selectorMenu");
       menu.setTransient(true);
-      column.getFacets().put(Facets.MENUPOPUP, menu);
+      column.getFacets().put(Facets.DROP_DOWN_MENU, menu);
       menu.setImage("image/sheetSelectorMenu.gif");
       menu.setLabel("vv"); //todo remove this after fixing the image above
 
@@ -951,6 +959,19 @@ public class SheetRenderer extends Layou
     writer.endElement(type);
   }
 
+  private UIComponent getDropDownMenuFacet(UIColumn command) {
+    UIComponent result = command.getFacet(Facets.DROP_DOWN_MENU);
+    if (result == null) {
+      result = command.getFacet(Facets.MENUPOPUP);
+      if (result != null) {
+        if (Deprecation.LOG.isWarnEnabled()) {
+          Deprecation.LOG.warn("Facet 'menupopup' was deprecated, please rename to 'dropDownMenu'");
+        }
+      }
+    }
+    return result;
+  }
+
   private Measure getContentBorder(FacesContext facesContext, UISheet data) {
     return getOffsetLeft(facesContext, data).add(getOffsetRight(facesContext, data));
   }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-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/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java?rev=952580&r1=952579&r2=952580&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java Tue Jun  8 09:17:31 2010
@@ -466,7 +466,7 @@ public class TabGroupRenderer extends La
         facesContext, UICommand.COMPONENT_TYPE, null, "all");
     UIMenu menu = (UIMenu) CreateComponentUtils.createComponent(
         facesContext, UIMenu.COMPONENT_TYPE, RendererTypes.MENU, "menu");
-    all.getFacets().put(Facets.MENUPOPUP, menu);
+    all.getFacets().put(Facets.DROP_DOWN_MENU, menu);
     int index = 0;
     for (UIComponent child : (List<UIComponent>) tabGroup.getChildren()) {
       if (child instanceof UITab) {

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=952580&r1=952579&r2=952580&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 Tue Jun  8 09:17:31 2010
@@ -31,6 +31,7 @@ import org.apache.myfaces.tobago.context
 import org.apache.myfaces.tobago.context.ResourceManagerFactory;
 import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.internal.component.UICommandBase;
+import org.apache.myfaces.tobago.internal.util.Deprecation;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
@@ -216,7 +217,7 @@ public abstract class ToolBarRendererBas
     final String clientId = command.getClientId(facesContext);
     final boolean disabled = ComponentUtils.getBooleanAttribute(command, Attributes.DISABLED);
     final LabelWithAccessKey label = new LabelWithAccessKey(command);
-    final UIComponent popupMenu = command.getFacet(Facets.MENUPOPUP);
+    final UIComponent dropDownMenu = getDropDownMenuFacet(command);
     final ResourceManager resources = getResourceManager();
 
     final String labelPosition = getLabelPosition(command.getParent());
@@ -232,7 +233,7 @@ public abstract class ToolBarRendererBas
     final boolean showLabelRight = UIToolBar.LABEL_RIGHT.equals(labelPosition);
     final boolean showLabel = showLabelBottom || showLabelRight;
     // two separate buttons for the command and the sub menu
-    final boolean separateButtons = hasAnyCommand(command) && popupMenu != null;
+    final boolean separateButtons = hasAnyCommand(command) && dropDownMenu != null;
 
     final Measure paddingTop = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-top");
     final Measure paddingMiddle = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-middle");
@@ -336,11 +337,11 @@ public abstract class ToolBarRendererBas
     if (isRightAligned(toolBar)) { // overrides the default in the CSS file.
       itemStyle.setLeft(resources.getThemeMeasure(facesContext, toolBar, "css.border-right-width"));
     }
-    itemStyle.setWidth(popupMenu != null ? buttonStyle.getWidth().add(menuStyle.getWidth()) : buttonStyle.getWidth());
+    itemStyle.setWidth(dropDownMenu != null ? buttonStyle.getWidth().add(menuStyle.getWidth()) : buttonStyle.getWidth());
     itemStyle.setHeight(buttonStyle.getHeight());
 
     // change values when only have one button
-    if (popupMenu != null && !separateButtons && (!lackImage || StringUtils.isNotBlank(label.getText()))) {
+    if (dropDownMenu != null && !separateButtons && (!lackImage || StringUtils.isNotBlank(label.getText()))) {
       openerStyle.setLeft(openerStyle.getLeft().add(buttonStyle.getWidth()));
       buttonStyle.setWidth(buttonStyle.getWidth().add(menuStyle.getWidth()));
     }
@@ -399,13 +400,13 @@ public abstract class ToolBarRendererBas
     }
 
     // render sub menu popup button
-    if (popupMenu != null) {
+    if (dropDownMenu != null) {
       writer.startElement(HtmlConstants.IMG, command);
       String menuImage = ResourceManagerUtils.getImageWithPath(facesContext, "image/toolbarButtonMenu.gif");
       writer.writeAttribute(HtmlAttributes.SRC, menuImage, false);
       writer.writeStyleAttribute(openerStyle);
       writer.endElement(HtmlConstants.IMG);
-      renderPopup(facesContext, writer, popupMenu);
+      renderPopup(facesContext, writer, dropDownMenu);
     }
     writer.endElement(HtmlConstants.SPAN);
     writer.endElement(HtmlConstants.SPAN);
@@ -414,6 +415,19 @@ public abstract class ToolBarRendererBas
     // computation of the width of the toolBar will not be used in the moment.
   }
 
+  private UIComponent getDropDownMenuFacet(UICommandBase command) {
+    UIComponent result = command.getFacet(Facets.DROP_DOWN_MENU);
+    if (result == null) {
+      result = command.getFacet(Facets.MENUPOPUP);
+      if (result != null) {
+        if (Deprecation.LOG.isWarnEnabled()) {
+          Deprecation.LOG.warn("Facet 'menupopup' was deprecated, please rename to 'dropDownMenu'");
+        }
+      }
+    }
+    return result;
+  }
+
   private Measure renderSeparator(
       FacesContext facesContext, UIToolBar toolBar, UIToolBarSeparator separator, TobagoResponseWriter writer,
       Measure width)
@@ -480,7 +494,7 @@ public abstract class ToolBarRendererBas
   }
 
   private String createCommandOnClick(FacesContext facesContext, UICommandBase command) {
-    if (hasNoCommand(command) && command.getFacet(Facets.MENUPOPUP) != null) {
+    if (hasNoCommand(command) && getDropDownMenuFacet(command) != null) {
       return null;
     } else {
       CommandRendererHelper helper = new CommandRendererHelper(facesContext, command);
@@ -501,7 +515,7 @@ public abstract class ToolBarRendererBas
   }
 
   private String createMenuOnClick(UICommandBase command) {
-    if (command.getFacet(Facets.MENUPOPUP) != null) {
+    if (getDropDownMenuFacet(command) != null) {
       return "jQuery(this).find('a').click();event.stopPropagation();";
     } else {
       return null;