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/08/09 11:14:25 UTC

svn commit: r1512212 - in /myfaces/tobago/trunk/tobago-theme: tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/ tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/sca...

Author: weber
Date: Fri Aug  9 09:14:25 2013
New Revision: 1512212

URL: http://svn.apache.org/r1512212
Log:
TOBAGO-1293 - DropDown Menu in toolbar ignores rendered attribute

Added:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/toolbarButtonMenuDisabled.gif   (with props)
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/toolbarButtonMenuDisabled.gif   (with props)
    myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/toolbarButtonMenuDisabled.gif   (with props)
Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java

Added: myfaces/tobago/trunk/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/toolbarButtonMenuDisabled.gif
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/toolbarButtonMenuDisabled.gif?rev=1512212&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/image/toolbarButtonMenuDisabled.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

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=1512212&r1=1512211&r2=1512212&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 Fri Aug  9 09:14:25 2013
@@ -248,8 +248,9 @@ public abstract class ToolBarRendererBas
     final boolean showLabelBottom = UIToolBar.LABEL_BOTTOM.equals(labelPosition);
     final boolean showLabelRight = UIToolBar.LABEL_RIGHT.equals(labelPosition);
     final boolean showLabel = showLabelBottom || showLabelRight;
+    final boolean showDropDownMenu = dropDownMenu != null && dropDownMenu.isRendered();
     // two separate buttons for the command and the sub menu
-    final boolean separateButtons = hasAnyCommand(command) && dropDownMenu != null;
+    final boolean separateButtons = hasAnyCommand(command) && showDropDownMenu;
 
     final Measure paddingTop = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-top");
     final Measure paddingMiddle = resources.getThemeMeasure(facesContext, toolBar, "custom.padding-middle");
@@ -354,17 +355,17 @@ public abstract class ToolBarRendererBas
       itemStyle.setLeft(resources.getThemeMeasure(facesContext, toolBar, "css.border-right-width"));
     }
     itemStyle.setWidth(
-        dropDownMenu != null ? buttonStyle.getWidth().add(menuStyle.getWidth()) : buttonStyle.getWidth());
+        showDropDownMenu ? buttonStyle.getWidth().add(menuStyle.getWidth()) : buttonStyle.getWidth());
     itemStyle.setHeight(buttonStyle.getHeight());
 
     // XXX hack
-    if (dropDownMenu != null && lackImage && !showLabel) {
+    if (showDropDownMenu && lackImage && !showLabel) {
       itemStyle.setWidth(openerStyle.getWidth());
       buttonStyle.setWidth(openerStyle.getWidth());
     }
 
     // change values when only have one button
-    if (dropDownMenu != null && !separateButtons && (!lackImage || StringUtils.isNotBlank(label.getText()))) {
+    if (showDropDownMenu && !separateButtons && (!lackImage || StringUtils.isNotBlank(label.getText()))) {
       openerStyle.setLeft(openerStyle.getLeft().add(buttonStyle.getWidth()));
       buttonStyle.setWidth(buttonStyle.getWidth().add(menuStyle.getWidth()));
     }
@@ -383,7 +384,7 @@ public abstract class ToolBarRendererBas
     writer.writeStyleAttribute(itemStyle);
 
     writer.startElement(HtmlElements.SPAN, command);
-    if (separateButtons || dropDownMenu == null) {
+    if (separateButtons || !showDropDownMenu) {
       writer.writeClassAttribute(Classes.create(toolBar, "button", selected ? Markup.SELECTED : Markup.NULL));
     } else {
       writer.writeClassAttribute(Classes.create(toolBar, "menu"));
@@ -436,9 +437,11 @@ public abstract class ToolBarRendererBas
     }
 
     // render sub menu popup button
-    if (dropDownMenu != null) {
+    if (showDropDownMenu) {
       writer.startElement(HtmlElements.IMG, command);
-      String menuImage = ResourceManagerUtils.getImageWithPath(facesContext, "image/toolbarButtonMenu.gif");
+      boolean dropDownDisabled = ComponentUtils.getBooleanAttribute(dropDownMenu, Attributes.DISABLED) || disabled;
+      String menuImage = ResourceManagerUtils
+          .getImageOrDisabledImageWithPath(facesContext, "image/toolbarButtonMenu.gif", dropDownDisabled);
       writer.writeAttribute(HtmlAttributes.SRC, menuImage, false);
       writer.writeStyleAttribute(openerStyle);
       writer.endElement(HtmlElements.IMG);

Added: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/toolbarButtonMenuDisabled.gif
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/image/toolbarButtonMenuDisabled.gif?rev=1512212&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/image/toolbarButtonMenuDisabled.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/toolbarButtonMenuDisabled.gif
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/toolbarButtonMenuDisabled.gif?rev=1512212&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/tobago/trunk/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/toolbarButtonMenuDisabled.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream