<?xml version="1.0"?>
<!--
  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.
-->

<!--
  Template for the Swan form-model editor.

  @version $Id: model_template.xml 449149 2006-09-23 03:58:05Z crossley $
-->

<page
  xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
  xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">

  <title>Swan Form Model Editor</title>

  <content>
    <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST">

      <ft:class id="out-id-class">
        <b><ft:widget-label id="id"/>:</b>
        <ft:widget id="id">
          <fi:styling type="output"/>
        </ft:widget>
      </ft:class>

      <ft:class id="output-label-class">
        <b><ft:widget-label id="label"/>: </b>
        <ft:widget id="label">
          <fi:styling type="output"/>
        </ft:widget>
      </ft:class>

      <ft:class id="output-required-class">
        <b><ft:widget-label id="required"/>: </b>
        <ft:widget id="required">
          <fi:styling type="output"/>
        </ft:widget>
      </ft:class>

      <ft:class id="output-initial-size-class">
        <b><ft:widget-label id="initial-size"/>:</b>
        <ft:widget id="initial-size">
          <fi:styling type="output"/>
        </ft:widget>
      </ft:class>

      <ft:class id="id-class"><b><ft:widget-label id="id"/>:</b><ft:widget id="id"/></ft:class>
      <ft:class id="label-class"><b><ft:widget-label id="label"/>:</b><ft:widget id="label"/></ft:class>
      <ft:class id="required-class"><b><ft:widget-label id="required"/>:</b><ft:widget id="required"/></ft:class>
      <ft:class id="initial-size-class">
        <b><ft:widget-label id="initial-size"/>:</b><ft:widget id="initial-size"/>
      </ft:class>

      <ft:class id="std-id-class">
        <ft:choose path="../../view-selector">
          <ft:when value="fold">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
            </ft:group>
          </ft:when>
          <ft:when value="view">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
            </ft:group>
          </ft:when>
          <ft:when value="edit">
            <ft:group id="stuff">
              <ft:new id="id-class"/>
            </ft:group>
          </ft:when>
        </ft:choose>
      </ft:class>

      <ft:class id="std-id-items-class">
        <ft:choose path="../../view-selector">
          <ft:when value="fold">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
            </ft:group>
          </ft:when>
          <ft:when value="view">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
            </ft:group>
            <ft:new id="items-class"/>
          </ft:when>
          <ft:when value="edit">
            <ft:group id="stuff">
              <ft:new id="id-class"/>
            </ft:group>
            <ft:new id="items-class"/>
          </ft:when>
        </ft:choose>
      </ft:class>

      <ft:class id="std-id-label-class">
        <ft:choose path="../../view-selector">
          <ft:when value="fold">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
            </ft:group>
          </ft:when>
          <ft:when value="view">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
              <ft:new id="output-label-class"/>
            </ft:group>
          </ft:when>
          <ft:when value="edit">
            <ft:group id="stuff">
              <ft:new id="id-class"/>
              <ft:new id="label-class"/>
            </ft:group>
          </ft:when>
        </ft:choose>
      </ft:class>

      <ft:class id="std-id-label-items-class">
        <ft:choose path="../../view-selector">
          <ft:when value="fold">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
            </ft:group>
          </ft:when>
          <ft:when value="view">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
              <ft:new id="output-label-class"/>
            </ft:group>
            <ft:new id="items-class"/>
          </ft:when>
          <ft:when value="edit">
            <ft:group id="stuff">
              <ft:new id="id-class"/>
              <ft:new id="label-class"/>
            </ft:group>
            <ft:new id="items-class"/>
          </ft:when>
        </ft:choose>
      </ft:class>

      <ft:class id="std-id-label-req-class">
        <ft:choose path="../../view-selector">
          <ft:when value="fold">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
            </ft:group>
          </ft:when>
          <ft:when value="view">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
              <ft:new id="output-label-class"/>
              <ft:new id="output-required-class"/>
            </ft:group>
          </ft:when>
          <ft:when value="edit">
            <ft:group id="stuff">
              <ft:new id="id-class"/>
              <ft:new id="label-class"/>
              <ft:new id="required-class"/>
            </ft:group>
          </ft:when>
        </ft:choose>
      </ft:class>

      <ft:class id="std-repeater-class">
        <ft:choose path="../../view-selector">
          <ft:when value="fold">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
            </ft:group>
          </ft:when>
          <ft:when value="view">
            <ft:group id="stuff">
              <ft:new id="out-id-class"/>
              <ft:new id="output-label-class"/>
              <ft:new id="output-initial-size-class"/>
            </ft:group>
            <ft:new id="items-class"/>
          </ft:when>
          <ft:when value="edit">
            <ft:group id="stuff">
              <ft:new id="id-class"/>
              <ft:new id="label-class"/>
              <ft:new id="initial-size-class"/>
            </ft:group>
            <ft:new id="items-class"/>
          </ft:when>
        </ft:choose>
      </ft:class>

      <ft:class id="union-class">
        <ft:union id="union">

          <ft:case id="">
          </ft:case>

          <ft:case id="action">
            <ft:group id="action">
              <ft:new id="std-id-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="aggregatefield">
            <ft:group id="aggregatefield">
              <ft:new id="std-id-label-items-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="booleanfield">
            <ft:group id="booleanfield">
              <ft:new id="std-id-label-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="class">
            <ft:group id="class">
              <ft:new id="std-id-items-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="field">
            <ft:group id="field">
              <ft:new id="std-id-label-req-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="group">
            <ft:group id="group">
              <ft:new id="std-id-label-items-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="new">
            <ft:group id="new">
              <ft:new id="std-id-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="output">
            <ft:group id="output">
              <ft:new id="std-id-label-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="struct">
            <ft:group id="struct">
              <ft:new id="std-id-label-items-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="repeater">
            <ft:group id="repeater">
              <ft:new id="std-repeater-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="temp-repeater">
            <ft:group id="temp-repeater">
              <ft:new id="std-temp-repeater-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="row-action">
            <ft:group id="row-action">
              <ft:new id="std-id-label-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="submit">
            <ft:group id="submit">
              <ft:new id="std-id-label-class"/>
            </ft:group>
          </ft:case>

          <ft:case id="union">
            <ft:group id="union">
              <ft:new id="std-id-label-items-class"/>
            </ft:group>
          </ft:case>

        </ft:union>
      </ft:class>

      <ft:class id="type-selector-class">
        <ft:choose path="view-selector">
          <ft:when value="fold">
            <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>&#160;
          </ft:when>
          <ft:when value="view">
            <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b>&#160;
          </ft:when>
          <ft:when value="edit">
            <ft:widget id="type-selector">
              <fi:styling list-type="dropdown" submit-on-change="true"/>
            </ft:widget>
          </ft:when>
        </ft:choose>
      </ft:class>

      <ft:class id="view-selector-class">
        <ft:choose path="view-selector">
          <ft:when value="fold">
            <ft:widget id="view-view"><fi:styling type="image" src="resources/forms/img/view.gif"/></ft:widget>
            <ft:widget id="edit-view"><fi:styling type="image" src="resources/forms/img/edit.gif"/></ft:widget>
          </ft:when>
          <ft:when value="view">
            <ft:widget id="fold-view"><fi:styling type="image" src="resources/forms/img/fold.gif"/></ft:widget>
            <ft:widget id="edit-view"><fi:styling type="image" src="resources/forms/img/edit.gif"/></ft:widget>
          </ft:when>
          <ft:when value="edit">
            <ft:widget id="fold-view"><fi:styling type="image" src="resources/forms/img/fold.gif"/></ft:widget>
            <ft:widget id="view-view"><fi:styling type="image" src="resources/forms/img/view.gif"/></ft:widget>
          </ft:when>
        </ft:choose>
      </ft:class>

      <ft:class id="item-row-class">
        <span class="actions">
          <ft:widget id="up"><fi:styling type="image" src="resources/forms/img/move_up.gif"/></ft:widget>
          <ft:widget id="down"><fi:styling type="image" src="resources/forms/img/move_down.gif"/></ft:widget>
          <ft:widget id="add"><fi:styling type="image" src="resources/forms/img/new.gif"/></ft:widget>
          &#160;<ft:widget id="delete"><fi:styling type="image" src="resources/forms/img/delete.gif"/></ft:widget>
        </span>
        <ft:new id="view-selector-class"/>
        <ft:new id="type-selector-class"/>
        <ft:new id="union-class"/>
      </ft:class>

      <ft:class id="items-class">
        <ft:widget id="addItem"><fi:styling type="image" src="resources/forms/img/new_child.gif"/></ft:widget>
        <ft:repeater-size id="items"/>
        <ft:repeater-widget id="items">
          <div class="section"><ft:new id="item-row-class"/></div>
        </ft:repeater-widget>
      </ft:class>

      <p>
        <ft:new id="items-class"/>
      </p>
      <ft:widget id="messages"/><br/>
      <input type="submit"/>

    </ft:form-template>
  </content>

</page>
