Skip to content

Instantly share code, notes, and snippets.

@pauldijou
Created June 14, 2012 17:04
Show Gist options
  • Select an option

  • Save pauldijou/2931503 to your computer and use it in GitHub Desktop.

Select an option

Save pauldijou/2931503 to your computer and use it in GitHub Desktop.
CommandButtonTemplate
<?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="java.lang.String" name="type" value="#{'client' eq component.attributes['mode'].toString() ? 'button' : component.attributes['type'].toString()}"/>
<c:choose>
<c:when test="#{component.hasFacet('split')}">
<div class="btn-group #{component.verticalPositionStyleClass}">
<cdk:renderFragment name="renderCommandButton" type="#{type}" />
<button class="btn dropdown-toggle #{component.severity ne null ? component.severity.buttonClass : ''} #{component.scale ne null ? component.scale.buttonStyleClass : ''}" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu #{component.horizontalPositionStyleClass}">
<c:forEach var="child" items="#{component.getFacet('split').getChildren()}">
<li>
<cdk:call expression="child.encodeAll(facesContext)" />
</li>
</c:forEach>
</ul>
</div>
</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="java.lang.String" />
</cc:interface>
<cc:implementation>
<c:choose>
<c:when test="#{component.tag eq 'button'}">
<cdk:renderFragment name="renderButton" type="#{cc.attrs.type}" />
</c:when>
<c:when test="#{component.tag eq 'input'}">
<cdk:renderFragment name="renderInput" type="#{cc.attrs.type}" />
</c:when>
</c:choose>
</cc:implementation>
</cdk:fragment>
<cdk:fragment name="renderButton">
<cc:interface>
<cc:attribute name="type" type="java.lang.String" required="true" />
</cc:interface>
<cc:implementation>
<button id="#{clientId}"
name="#{clientId}" class="btn #{component.styleClass} #{component.severity ne null ? component.severity.buttonClass : ''} #{component.scale ne null ? component.scale.buttonStyleClass : ''}"
value="#{component.value}"
onclick="#{this.getOnClick(facesContext, component)}"
cdk:passThrough="style ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout disabled"
type="#{cc.attrs.type}">
<c:if test="#{!empty(component.icon)}">
<i class="icon-#{component.icon}"></i>#{" "}
</c:if>
#{component.value}
<cdk:call expression="renderChildren(facesContext, component);" />
</button>
</cc:implementation>
</cdk:fragment>
<cdk:fragment name="renderInput">
<cc:interface>
<cc:attribute name="type" type="java.lang.String" />
</cc:interface>
<cc:implementation>
<input id="#{clientId}"
name="#{clientId}"
type="submit"
class="btn #{component.styleClass} #{component.severity ne null ? component.severity.buttonClass : ''} #{component.scale ne null ? component.scale.buttonStyleClass : ''}"
value="#{component.value}"
onclick="#{this.getOnClick(facesContext, component)}"
cdk:passThrough="style ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout disabled">
<cdk:call expression="encodeTypeAndImage(facesContext, component);"/>
</input>
</cc:implementation>
</cdk:fragment>
</cdk:root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment