<?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.
-->
<wd:form
  xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"
  xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
  <wd:widgets>

    <!--
      CVS $Id: form_model_gui_model.xml 433543 2006-08-22 06:22:54Z crossley $
      Author: Timothy Larson
    -->

    <!--
    TODO:
      Add features to "widgets-class" (e.g. move-up, move-down, add-before, add-after).
    -->

    <wd:new id="widgets-class"/>

    <!--
    <wd:struct id="form">
      <wd:widgets>
        <wd:new id="widgets-class"/>
      </wd:widgets>
    </wd:struct>
    -->

    <wd:class id="widgets-class">
      <wd:widgets>
        <wd:repeater id="widgets" initial-size="1">
          <wd:label>Widgets</wd:label>
          <wd:widgets>
            <wd:new id="widget-row-class"/>
          </wd:widgets>
        </wd:repeater>
        <wd:repeater-action id="addWidget" action-command="add-row" repeater="widgets">
          <wd:label>New</wd:label>
        </wd:repeater-action>
        <wd:repeater-action id="removeWidgets" action-command="delete-rows" repeater="widgets" select="select">
          <wd:label>Delete</wd:label>
        </wd:repeater-action>
      </wd:widgets>
    </wd:class>

    <wd:class id="widget-row-class">
      <wd:widgets>
        <wd:booleanfield id="select"><wd:label>Select</wd:label></wd:booleanfield>
        <wd:field id="type">
          <wd:label>Widget Type</wd:label>
          <wd:datatype base="string"/>
          <wd:selection-list>
            <wd:item value=""><wd:label>Nothing</wd:label></wd:item>
            <wd:item value="action"><wd:label>Action</wd:label></wd:item>
            <wd:item value="aggregatefield"><wd:label>AggregateField</wd:label></wd:item>
            <wd:item value="booleanfield"><wd:label>BooleanField</wd:label></wd:item>
            <wd:item value="class"><wd:label>Class</wd:label></wd:item>
            <wd:item value="field"><wd:label>Field</wd:label></wd:item>
            <wd:item value="new"><wd:label>New</wd:label></wd:item>
            <wd:item value="output"><wd:label>Output</wd:label></wd:item>
            <wd:item value="repeater"><wd:label>Repeater</wd:label></wd:item>
            <wd:item value="row-action"><wd:label>RowAction</wd:label></wd:item>
            <wd:item value="struct"><wd:label>Struct</wd:label></wd:item>
            <wd:item value="submit"><wd:label>Submit</wd:label></wd:item>
            <wd:item value="union"><wd:label>Union</wd:label></wd:item>
          </wd:selection-list>
        </wd:field>
        <wd:union id="union" default="" case="type">
          <wd:datatype base="string"/>
          <wd:label>Type</wd:label>
          <wd:widgets>

            <wd:struct id="action">
              <wd:label>Action</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="label-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="aggregatefield">
              <wd:label>AggregateField</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="label-class"/>
                <wd:new id="required-class"/>
                <wd:new id="widgets-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="booleanfield">
              <wd:label>BooleanField</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="label-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="class">
              <wd:label>Class</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="widgets-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="field">
              <wd:label>Field</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="label-class"/>
                <wd:new id="required-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="new">
              <wd:label>New</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="output">
              <wd:label>Output</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="label-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="repeater">
              <wd:label>Repeater</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="label-class"/>
                <wd:new id="initial-size-class"/>
                <wd:new id="widgets-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="row-action">
                <wd:label>RowAction</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="label-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="struct">
              <wd:label>Struct</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="label-class"/>
                <wd:new id="widgets-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="submit">
              <wd:label>Submit</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="label-class"/>
              </wd:widgets>
            </wd:struct>

            <wd:struct id="union">
              <wd:label>Union</wd:label>
              <wd:widgets>
                <wd:new id="id-class"/>
                <wd:new id="label-class"/>
                <wd:new id="widgets-class"/>
              </wd:widgets>
            </wd:struct>

          </wd:widgets>

        </wd:union>
      </wd:widgets>
    </wd:class>
 
    <wd:class id="id-class">
      <wd:widgets>
        <wd:field id="id" required="true">
          <wd:label>Id</wd:label>
          <wd:datatype base="string"/>
        </wd:field>
      </wd:widgets>
    </wd:class>

    <wd:class id="label-class">
      <wd:widgets>
        <wd:field id="label">
          <wd:label>Label</wd:label>
          <wd:datatype base="string"/>
        </wd:field>
      </wd:widgets>
    </wd:class>

    <wd:class id="required-class">
      <wd:widgets>
        <wd:booleanfield id="required">
          <wd:label>Required</wd:label>
        </wd:booleanfield>
      </wd:widgets>
    </wd:class>

    <wd:class id="initial-size-class">
      <wd:widgets>
        <wd:field id="initial-size">
          <wd:label>Initial Size</wd:label>
          <wd:datatype base="long"/>
        </wd:field>
      </wd:widgets>
    </wd:class>

  </wd:widgets>
</wd:form>
