Skip to content

Instantly share code, notes, and snippets.

@lfryc
Created June 21, 2012 17:55
Show Gist options
  • Select an option

  • Save lfryc/2967356 to your computer and use it in GitHub Desktop.

Select an option

Save lfryc/2967356 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core" xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite">
<cc:interface>
<cdk:class>org.richfaces.bootstrap.renderkit.CommandButtonRenderer</cdk:class>
<cdk:superclass>org.richfaces.bootstrap.renderkit.CommandButtonRendererBase</cdk:superclass>
<cdk:renderer-type>org.richfaces.bootstrap.CommandButtonRenderer</cdk:renderer-type>
<cdk:renders-children>true</cdk:renders-children>
<cdk:component-base-class>org.richfaces.bootstrap.component.AbstractCommandButton</cdk:component-base-class>
</cc:interface>
<cc:implementation>
<cdk:object type="String" name="type"
value="#{'client' eq component.attributes['mode'].toString() ? 'button' : component.attributes['type'].toString()}" />
<c:choose>
<c:when test="#{component.hasFacet('split')}">
<cdk:renderFragment name="renderSplit" type="#{type}" />
</c:when>
<c:otherwise>
<cdk:renderFragment name="renderCommandButton" type="#{type}" />
</c:otherwise>
</c:choose>
</cc:implementation>
<cdk:fragment name="renderCommandButton">
<cc:interface>
<cc:attribute name="type" type="String" />
<cc:attribute name="split" type="boolean" default="false" />
</cc:interface>
<cc:implementation>
<cdk:object name="styleWhenNotSplit" type="String" value="#{!cc.attrs.split ? component.style : ''}" />
<cdk:object name="styleClassWhenNotSplit" type="String" value="#{!cc.attrs.split ? component.styleClass : ''}" />
<cdk:object name="severityClass" type="String"
value="#{component.severity ne null ? component.severity.buttonClass : ''}" />
<cdk:object name="scaleClass" type="String" value="#{component.scale ne null ? component.scale.buttonStyleClass : ''}" />
<cdk:object name="color" type="String" value="#{component.color}" />
<cdk:object name="colorStyle" type="String" value="color: #{color};" />
<cdk:object name="colorStyleWhenNotEmpty" type="String" value="#{color ne null and !color.equals('') ? colorStyle : ''}" />
<c:choose>
<c:when test="#{component.tag eq 'button'}">
<!-- Button -->
<button name="#{clientId}" value="#{component.value}" class="btn #{styleClassWhenNotSplit} #{severityClass} #{scaleClass}"
style="#{styleWhenNotSplit} #{colorStyleWhenNotEmpty}" onclick="#{this.getOnClick(facesContext, component)}"
cdk:passThrough="title ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout disabled"
type="#{cc.attrs.type}">
<cdk:call expression="encodeId(facesContext, component, split, clientId);" />
<c:if test="#{!empty(component.icon)}">
<i class="icon-#{component.icon}"></i>
#{" "}
</c:if>
#{component.value}
<cdk:call expression="renderChildren(facesContext, component);" />
</button>
</c:when>
<c:when test="#{component.tag eq 'input'}">
<!-- Input -->
<input type="submit" name="#{clientId}" class="btn #{styleClassWhenNotSplit} #{severityClass} #{scaleClass}"
style="#{styleWhenNotSplit} #{colorStyleWhenNotEmpty}" value="#{component.value}"
onclick="#{this.getOnClick(facesContext, component)}" cdk:passThrough="title ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout disabled">
<cdk:call expression="encodeId(facesContext, component, split, clientId);" />
<cdk:call expression="encodeTypeAndImage(facesContext, component);" />
</input>
</c:when>
</c:choose>
</cc:implementation>
</cdk:fragment>
<cdk:fragment name="renderSplit">
<cc:interface>
<cc:attribute name="type" type="String" />
</cc:interface>
<cc:implementation>
<cdk:object name="severityClass" type="String"
value="#{component.severity ne null ? component.severity.buttonClass : ''}" />
<cdk:object name="scaleClass" type="String" value="#{component.scale ne null ? component.scale.buttonStyleClass : ''}" />
<cdk:object name="color" type="String" value="#{component.color}" />
<cdk:object name="colorStyle" type="String" value="border-top-color: #{color}; border-bottom-color: #{color};" />
<cdk:object name="horizontalClass" type="String"
value="#{component.horizontal ne null ? component.horizontal.buttonClass : ''}" />
<div id="#{clientId}" cdk:passThrough="style"
class="btn-group #{component.styleClass} #{component.vertical ne null ? component.vertical.buttonClass : ''}">
<cdk:renderFragment name="renderCommandButton" type="#{type}" split="true" />
<button data-toggle="dropdown" class="btn dropdown-toggle #{severityClass} #{scaleClass} ">
<span class="caret" style="#{color == null ? '' : colorStyle}"></span>
</button>
<ul class="dropdown-menu #{horizontalClass}">
<c:forEach var="child" items="#{component.getFacetChildren('split')}">
<li>
<cdk:call expression="child.encodeAll(facesContext)" />
</li>
</c:forEach>
</ul>
</div>
</cc:implementation>
</cdk:fragment>
</cdk:root>
@pauldijou

Copy link
Copy Markdown

(I wanted to say the "style" attribute in the 1st point)

@lfryc

lfryc commented Jun 25, 2012

Copy link
Copy Markdown
Author

Okay, great, I have made the changes you mentioned and pushed that upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment