Skip to content

Instantly share code, notes, and snippets.

@werpu
Created June 17, 2011 07:16
Show Gist options
  • Save werpu/1031007 to your computer and use it in GitHub Desktop.
Save werpu/1031007 to your computer and use it in GitHub Desktop.
<ui:component xmlns=""
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ezw="http://java.sun.com/jsf/composite/ezcomp/widgets">
<composite:interface componentType="at.irian.StandardJavascriptComponent">
<composite:attribute name="id" required="true"/>
<composite:attribute name="javascriptVar" />
<composite:attribute name="javascriptClass" default="extras.apache.Toggle"/>
<composite:attribute name="styleClass" />
<composite:attribute name="style" />
<composite:attribute name="open" default="true" />
<composite:attribute name="headStyleClass" />
<composite:attribute name="headStyle" />
<composite:attribute name="contentStyleClass" />
<composite:attribute name="contentStyle" />
<composite:valueHolder name="valueHolder" />
<composite:facet name="head" required="true" />
<composite:facet name="content" required="true" />
<composite:attribute name="externalContentUrl"/>
<composite:attribute name="externalContentTarget" default=".content" />
<composite:attribute name="evalExternalContent" default="false"/>
</composite:interface>
<composite:implementation>
<h:outputScript library="script" name="layout/ContentPane.js"/>
<h:outputScript library="script" name="layout/Toggle.js"/>
<div id="#{cc.clientId}" class="toggle #{cc.attrs.styleClass}" style="#{cc.attrs.style}">
<h:panelGroup style="#{cc.attrs.headStyle}" styleClass="head #{cc.attrs.headStyleClass} toggleControl #{cc.attrs.open == true? 'toggleOn':'toggleOff'}" id="head" layout="block">
<div class="stateIndicator"></div>
<composite:renderFacet name="head"></composite:renderFacet>
</h:panelGroup>
<h:panelGroup tyle="#{cc.attrs.contentStyle}" styleClass="content #{cc.attrs.contentStyleClass} #{cc.attrs.open == true? 'toggleOn':'toggleOff'}" layout="block" id="content">
<composite:renderFacet name="content"></composite:renderFacet>
</h:panelGroup>
<h:panelGroup styleClass="valueHolder">
<h:inputHidden id="valueHolder" styleClass="valueHolder" value="#{cc.attrs.open}" >
</h:inputHidden>
</h:panelGroup>
<script type="text/javascript">
var #{cc.javascriptVar} = new #{cc.attrs.javascriptClass}({
id:"#{cc.clientId}",
toggleOpen:#{cc.attrs.open},
javascriptVar:"#{cc.javascriptVar}"
});
</script>
</div>
</composite:implementation>
</ui:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment