<!--
  ~ Copyright 2004-2014 ICEsoft Technologies Canada Corp.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the
  ~ License. You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an "AS
  ~ IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  ~ express or implied. See the License for the specific language
  ~ governing permissions and limitations under the License.
  -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:ice="http://www.icesoft.com/icefaces/component"
                xmlns:ace="http://www.icefaces.org/icefaces/components"
                xmlns:ui="http://java.sun.com/jsf/facelets">
<!--
Available ui:params to pass:
 title
 description
 resourceValue
-->
    <div class="example">
        <ace:panel header="#{title}" id="examplePanel" styleClass="containerPanelStyle">
        <div class="content">
            <div class="desc">
                <ice:outputText value="#{description}" escape="false" nospan="true"/>
            </div>
            <h:panelGroup layout="block" styleClass="instance" rendered="#{navigationModel.renderAsExample}">
                <ui:insert name="example"/>
            </h:panelGroup>
        </div>
            <f:facet name="header">  
				<h:outputText value="#{title}"  escape="false"/>
				<h:form>
				<ace:menuBar direction="down left" styleClass="documentation-menu">
					<ace:multiColumnSubmenu label="Documentation">
						<ace:menuColumn>
							<ace:submenu label="WIKI Documentation">
								<c:forEach items="#{wikiResources}" var="wiki">
								   <ace:menuItem value="#{wiki.title}" url="#{wiki.resource}" urlEncoding="none" target="_blank"/>
								</c:forEach>
							</ace:submenu>
						</ace:menuColumn>
						<ace:menuColumn>
							<ace:submenu label="TLD Documentation">
								<c:forEach items="#{tldResources}" var="tld">
								   <ace:menuItem value="#{tld.title}" url="#{tld.resource}" urlEncoding="none" target="_blank"/>
								</c:forEach>
							</ace:submenu>
						</ace:menuColumn>
					</ace:multiColumnSubmenu>
				</ace:menuBar>
				</h:form>
            </f:facet>  
        </ace:panel>
        
        <h:form id="sourceCodeForm" rendered="#{navigationModel.renderAsExample}">
            <ace:panel id="sourceCodePanel" collapsed="#{navigationModel.sourceCodeToggleStatus}" toggleable="true" header="Source Code" styleClass="containerPanelStyle rimeHeightAdjustment">
                <ace:ajax event="toggle" execute="@this"/>
                <div class="resources">
                    <ace:tabSet clientSide="true" selectedIndex="0"
                                rendered="#{not empty resourceValue}">
                        <c:forEach items="#{resourceValue}"
                                   var="exRes">
                            <ace:tabPane label="#{exRes.title}">
								<div style="background-color:#fff;">
									<h:outputText escape="false" value="#{sourceCodeLoaderConnection[exRes.resource]}" />
								</div>
                            </ace:tabPane>
                        </c:forEach>
                    </ace:tabSet>
                </div>
            </ace:panel>
        </h:form>
    </div>
</ui:composition>