<?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.
-->

<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">

  <application>
    <navigation-handler>
      org.apache.myfaces.tobago.example.demo.MultiplePageDeclarationLanguageNavigationHandler
    </navigation-handler>
    <locale-config>
      <default-locale>en</default-locale>
      <supported-locale>en_US</supported-locale>
      <supported-locale>en_GB</supported-locale>
      <supported-locale>de</supported-locale>
      <supported-locale>de_DE</supported-locale>
      <supported-locale>de_AT</supported-locale>
      <supported-locale>de_CH</supported-locale>
      <supported-locale>es</supported-locale>
      <supported-locale>ja</supported-locale>
      <supported-locale>ja_JP</supported-locale>
      <supported-locale>ru</supported-locale>
      <supported-locale>ru_RU</supported-locale>
      <supported-locale>zh</supported-locale>
      <supported-locale>zh_TW</supported-locale>
    </locale-config>
    <resource-bundle>
      <base-name>org.apache.myfaces.tobago.example.demo.DemoBundle</base-name>
      <var>overviewBundle</var>
    </resource-bundle>
  </application>

  <converter>
    <converter-id>salutationId</converter-id>
    <converter-class>org.apache.myfaces.tobago.example.data.SalutationConverter</converter-class>
  </converter>

  <managed-bean>
    <managed-bean-name>treeController</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.TreeController</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>

  <lifecycle>
    <phase-listener>org.apache.myfaces.tobago.example.demo.SynchronizeNavigationPhaseListener</phase-listener>
    <!--<phase-listener>org.apache.myfaces.tobago.util.DebugPhaseListener</phase-listener>-->
  </lifecycle>

  <managed-bean>
    <managed-bean-name>info</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.ServerInfo</managed-bean-class>
    <managed-bean-scope>application</managed-bean-scope>
  </managed-bean>

  <managed-bean>
    <managed-bean-name>pageDeclarationLanguage</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.PageDeclarationLanguageBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>

  <!--  overview  -->

  <lifecycle>
    <phase-listener>
      org.apache.myfaces.tobago.example.demo.clientConfig.ClientConfigPhaseListener
    </phase-listener>
  </lifecycle>

  <managed-bean>
    <managed-bean-name>clientConfigController</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.clientConfig.ClientConfigController</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>

  <!--<navigation-rule>
    <from-view-id>/tobago-module-client/clientConfig.jsp</from-view-id>
    <navigation-case>
      <from-action>#{clientConfigController.submit}</from-action>
      <to-view-id>/tobago-module-client/clientConfig.jsp</to-view-id>
    </navigation-case>
  </navigation-rule>-->

  <managed-bean>
    <managed-bean-name>clientConfigController2</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.clientConfig.ClientConfigController</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>

  <managed-bean>
    <managed-bean-name>validationSeverity</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.overview.ValidationSeverity</managed-bean-class>
    <managed-bean-scope>none</managed-bean-scope>
  </managed-bean>

  <!--best practice-->

  <managed-bean>
    <managed-bean-name>bestPracticeController</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.bestpractice.BestPracticeController</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>

  <managed-bean>
    <managed-bean-name>birdController</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.BirdController</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>

  <managed-bean>
    <managed-bean-name>transitionController</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.bestpractice.TransitionController</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>

  <managed-bean>
    <managed-bean-name>customizer</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.bestpractice.ToolBarCustomizer</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>

  <navigation-rule>
    <navigation-case>
      <from-outcome>best-practice/intro</from-outcome>
      <to-view-id>/content/12-best-practice/best-practice.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>best-practice/error</from-outcome>
      <to-view-id>/content/12-best-practice/00/error.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>best-practice/theme</from-outcome>
      <to-view-id>/content/12-best-practice/01/theme.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>best-practice/transition</from-outcome>
      <to-view-id>/content/12-best-practice/02/transition.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>best-practice/transition-after-sleep</from-outcome>
      <to-view-id>/content/12-best-practice/02/x-transition-after-sleep.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>best-practice/non-faces-response</from-outcome>
      <to-view-id>/content/12-best-practice/03/non-faces-response.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>best-practice/tool-bar-customizer</from-outcome>
      <to-view-id>/content/05-toolBar/00/tool-bar-customizer.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>best-practice/facelets-as-resources</from-outcome>
      <to-view-id>/content/12-best-practice/04/facelets-as-resources.xhtml</to-view-id>
    </navigation-case>
  </navigation-rule>

  <navigation-rule>
    <from-view-id>/content/12-best-practice/00/error.xhtml</from-view-id>
    <navigation-case>
      <from-outcome>error-404</from-outcome>
      <to-view-id>/content/12-best-practice/00/x-not-existing-page.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>syntax</from-outcome>
      <to-view-id>/content/12-best-practice/00/x-error-in-syntax.jsp</to-view-id>
    </navigation-case>
  </navigation-rule>

  <converter>
    <converter-id>org.apache.myfaces.tobago.example.demo.OnOffConverter</converter-id>
    <converter-class>org.apache.myfaces.tobago.example.demo.OnOffConverter</converter-class>
  </converter>

  <factory>
    <exception-handler-factory>
      org.apache.myfaces.tobago.example.demo.TestExceptionHandlerFactory
    </exception-handler-factory>
  </factory>

  <managed-bean>
    <managed-bean-name>upload</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.Upload</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>

  <managed-bean>
    <managed-bean-name>treeEditor</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.TreeEditor</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>

  <managed-bean>
    <managed-bean-name>fishPond</managed-bean-name>
    <managed-bean-class>org.apache.myfaces.tobago.example.demo.nonfacesrequest.FishPond</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>

</faces-config>
