<?xml version="1.0" encoding="UTF-8"?>
<!--
	* Licensed to the Apache Software Foundation (ASF) under one or more
	* contributor license agreements.  See the NOTICE file distributed with
	* this work for additional information regarding copyright ownership.
	* The ASF licenses this file to You 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.
-->

<ui:composition xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:tc="http://myfaces.apache.org/tobago/component"
	xmlns:tfs="http://myfaces.apache.org/tobago/facelet-sandbox">

	<tc:panel>
		<f:facet name="layout">
			<tc:gridLayout rows="auto;auto;auto;auto;auto;*" />
		</f:facet>

		<!-- default settings -->
		<c:if test="${empty isGotoRendered}">
			<c:set var="isGotoRendered" value="true" />
		</c:if>
		<c:if test="${!canDoPrevious}">
			<c:set var="isGotoRendered" value="false" />
			<c:set var="isPreviousRendered" value="false" />
		</c:if>
		<c:if test="${empty isGotoSeparatorRendered}">
			<c:set var="isGotoSeparatorRendered" value="true" />
		</c:if>
		<c:if test="${empty isNavigationSeparatorRendered}">
			<c:set var="isNavigationSeparatorRendered" value="true" />
		</c:if>
		<c:if test="${empty isNavigationRendered}">
			<c:set var="isNavigationRendered" value="true" />
		</c:if>
		<c:set var="replaceNavigation" value="true" />
		<c:if test="${empty navigationSource}">
			<c:set var="replaceNavigation" value="false" />
		</c:if>


		<!-- goto -->
		<c:choose>
			<c:when test="${isGotoRendered}">
				<tfs:wizard-goto controller="${controller}" gotoSource="${gotoSource}" />
			</c:when>
			<!-- placeholder for layout -->
			<c:otherwise>
				<tc:cell />
			</c:otherwise>
		</c:choose>

		<tc:separator rendered="${isGotoSeparatorRendered}" />

		<!-- content -->
		<ui:insert />

		<tc:separator rendered="${isNavigationSeparatorRendered}" />

		<!-- navigation -->
		<c:choose>
			<c:when test="${isNavigationRendered}">
				<tfs:wizard-navigation controller="${controller}"
					isPreviousRendered="${isPreviousRendered}"
					navigationSource="${navigationSource}" />
			</c:when>
			<!-- placeholder for layout -->
			<c:otherwise>
				<tc:cell />
			</c:otherwise>
		</c:choose>

		<!-- layout -->
		<tc:cell />

	</tc:panel>

</ui:composition>
