| <?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. |
| --> |
| |
| <!-- |
| Model for the Swan form-template editor. |
| |
| @version $Id$ |
| --> |
| |
| <fd:form |
| xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" |
| xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> |
| <fd:widgets> |
| |
| <fd:messages id="messages"/> |
| |
| <fd:new id="items-class"/> |
| |
| <fd:class id="items-class"> |
| <fd:widgets> |
| <fd:repeater id="items" initial-size="0"> |
| <fd:label>Items</fd:label> |
| <fd:widgets> |
| <fd:new id="item-row-class"/> |
| </fd:widgets> |
| </fd:repeater> |
| <fd:repeater-action id="addItem" action-command="add-row" repeater="items"> |
| <fd:label>Add Child</fd:label> |
| <fd:hint>Add child</fd:hint> |
| <fd:on-action> |
| <javascript> |
| var repeater = event.getSourceWidget().lookupWidget("../items"); |
| var view = repeater.getRow(repeater.getSize() - 1).getChild("view-selector"); |
| view.value = "edit"; |
| </javascript> |
| </fd:on-action> |
| </fd:repeater-action> |
| </fd:widgets> |
| </fd:class> |
| |
| <fd:class id="view-selector-class"> |
| <fd:widgets> |
| <fd:field id="view-selector" state="invisible"> |
| <fd:label>View</fd:label> |
| <fd:datatype base="string"/> |
| <fd:selection-list> |
| <fd:item value="fold"><fd:label>Fold</fd:label></fd:item> |
| <fd:item value="view"><fd:label>View</fd:label></fd:item> |
| <fd:item value="edit"><fd:label>Edit</fd:label></fd:item> |
| </fd:selection-list> |
| <fd:on-value-changed> |
| <javascript> |
| var widget = event.getSourceWidget(); |
| var union = widget.lookupWidget("../union"); |
| var type = widget.lookupWidget("../type-selector"); |
| var stuff = union.lookupWidget(union.getValue() + "/stuff"); |
| if("edit".equals(widget.getValue())) { |
| union.state = WidgetState.ACTIVE; |
| if(stuff != null) { |
| stuff.state = WidgetState.ACTIVE; |
| } |
| type.state = WidgetState.ACTIVE; |
| } else if("view".equals(widget.getValue())){ |
| union.state = WidgetState.ACTIVE; |
| if(stuff != null) { |
| stuff.state = WidgetState.DISABLED; |
| } |
| type.state = WidgetState.DISABLED; |
| } else { |
| union.state = WidgetState.DISABLED; |
| type.state = WidgetState.DISABLED; |
| } |
| </javascript> |
| </fd:on-value-changed> |
| </fd:field> |
| <fd:action id="fold-view" action-command="fold-view"> |
| <fd:label>F</fd:label> |
| <fd:hint>Fold</fd:hint> |
| <fd:on-action> |
| <javascript> |
| var view = event.getSourceWidget().lookupWidget("../view-selector"); |
| view.value = "fold"; |
| </javascript> |
| </fd:on-action> |
| </fd:action> |
| <fd:action id="view-view" action-command="view-view"> |
| <fd:label>V</fd:label> |
| <fd:hint>View</fd:hint> |
| <fd:on-action> |
| <javascript> |
| var view = event.getSourceWidget().lookupWidget("../view-selector"); |
| view.value = "view"; |
| </javascript> |
| </fd:on-action> |
| </fd:action> |
| <fd:action id="edit-view" action-command="edit-view"> |
| <fd:label>E</fd:label> |
| <fd:hint>Edit</fd:hint> |
| <fd:on-action> |
| <javascript> |
| var view = event.getSourceWidget().lookupWidget("../view-selector"); |
| view.value = "edit"; |
| </javascript> |
| </fd:on-action> |
| </fd:action> |
| </fd:widgets> |
| </fd:class> |
| |
| <fd:class id="type-selector-class"> |
| <fd:widgets> |
| <fd:field id="type-selector"> |
| <fd:label>Type</fd:label> |
| <fd:datatype base="string"/> |
| <fd:selection-list> |
| <fd:item value=""><fd:label>Nothing</fd:label></fd:item> |
| <fd:item value="case"><fd:label>Case</fd:label></fd:item> |
| <fd:item value="class"><fd:label>Class</fd:label></fd:item> |
| <fd:item value="form-template"><fd:label>Form Template</fd:label></fd:item> |
| <fd:item value="group"><fd:label>Group</fd:label></fd:item> |
| <fd:item value="new"><fd:label>New</fd:label></fd:item> |
| <fd:item value="repeater-size"><fd:label>Repeater Size</fd:label></fd:item> |
| <fd:item value="repeater-widget"><fd:label>Repeater Widget</fd:label></fd:item> |
| <fd:item value="struct"><fd:label>Struct</fd:label></fd:item> |
| <fd:item value="submit"><fd:label>Submit</fd:label></fd:item> |
| <fd:item value="union"><fd:label>Union</fd:label></fd:item> |
| <fd:item value="widget"><fd:label>Widget</fd:label></fd:item> |
| <fd:item value="widget-label"><fd:label>Widget Label</fd:label></fd:item> |
| <fd:item value="default"><fd:label>Default</fd:label></fd:item> |
| <fd:item value="table"><fd:label>Table</fd:label></fd:item> |
| <fd:item value="tr"><fd:label>Table Row</fd:label></fd:item> |
| <fd:item value="td"><fd:label>Table Data</fd:label></fd:item> |
| <fd:item value="p"><fd:label>Paragraph</fd:label></fd:item> |
| <fd:item value="input"><fd:label>Input</fd:label></fd:item> |
| <fd:item value="content"><fd:label>Content</fd:label></fd:item> |
| <fd:item value="title"><fd:label>Title</fd:label></fd:item> |
| <fd:item value="page"><fd:label>Page</fd:label></fd:item> |
| </fd:selection-list> |
| </fd:field> |
| </fd:widgets> |
| </fd:class> |
| |
| <fd:class id="item-row-class"> |
| <fd:widgets> |
| |
| <fd:row-action id="up" action-command="move-up"> |
| <fd:label>^</fd:label> |
| <fd:hint>Move up</fd:hint> |
| </fd:row-action> |
| |
| <fd:row-action id="down" action-command="move-down"> |
| <fd:label>v</fd:label> |
| <fd:hint>Move down</fd:hint> |
| </fd:row-action> |
| |
| <fd:row-action id="add" action-command="add-after"> |
| <fd:label>+</fd:label> |
| <fd:hint>Add after</fd:hint> |
| <fd:on-action> |
| <javascript> |
| var cur_row = Repeater.getParentRow(event.getSourceWidget()); |
| var repeater = cur_row.getParent(); |
| var new_row = repeater.getChild(repeater.indexOf(cur_row)+1); |
| var view = new_row.getChild("view-selector"); |
| view.value = "edit"; |
| </javascript> |
| </fd:on-action> |
| </fd:row-action> |
| |
| <fd:row-action id="delete" action-command="delete"> |
| <fd:label>X</fd:label> |
| <fd:hint>Delete</fd:hint> |
| </fd:row-action> |
| |
| <fd:new id="view-selector-class"/> |
| |
| <fd:new id="type-selector-class"/> |
| |
| <fd:union id="union" default="" case="type-selector"> |
| <fd:label>Type</fd:label> |
| <fd:widgets> |
| |
| <fd:group id="case"> |
| <fd:label>Case</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-not-req-class"/> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="class"> |
| <fd:label>Class</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="form-template"> |
| <fd:label>Form Template</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="group"> |
| <fd:label>Group</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| <fd:new id="label-class"/> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="new"> |
| <fd:label>New</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| </fd:widgets> |
| </fd:group> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="repeater-size"> |
| <fd:label>Repeater Size</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| </fd:widgets> |
| </fd:group> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="repeater-widget"> |
| <fd:label>Repeater Widget</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="struct"> |
| <fd:label>Struct</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| <fd:new id="label-class"/> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="union"> |
| <fd:label>Union</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| <fd:new id="label-class"/> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="widget"> |
| <fd:label>Widget</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| </fd:widgets> |
| </fd:group> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="widget-label"> |
| <fd:label>Widget Label</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| </fd:widgets> |
| </fd:group> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="default"> |
| <fd:label>Default</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| </fd:widgets> |
| </fd:group> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="table"> |
| <fd:label>Table</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="tr"> |
| <fd:label>Table Row</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="td"> |
| <fd:label>Table Data</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="p"> |
| <fd:label>Paragraph</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="input"> |
| <fd:label>Input</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| <fd:new id="id-class"/> |
| </fd:widgets> |
| </fd:group> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="content"> |
| <fd:label>Content</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="title"> |
| <fd:label>Title</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| <fd:group id="page"> |
| <fd:label>Page</fd:label> |
| <fd:widgets> |
| <fd:group id="stuff"> |
| <fd:widgets> |
| </fd:widgets> |
| </fd:group> |
| <fd:new id="items-class"/> |
| </fd:widgets> |
| </fd:group> |
| |
| </fd:widgets> |
| |
| </fd:union> |
| </fd:widgets> |
| </fd:class> |
| |
| <fd:class id="id-not-req-class"> |
| <fd:widgets> |
| <fd:field id="id"> |
| <fd:label>Id</fd:label> |
| <fd:datatype base="string"/> |
| </fd:field> |
| </fd:widgets> |
| </fd:class> |
| |
| <fd:class id="id-class"> |
| <fd:widgets> |
| <fd:field id="id" required="true"> |
| <fd:label>Id</fd:label> |
| <fd:datatype base="string"/> |
| </fd:field> |
| </fd:widgets> |
| </fd:class> |
| |
| <fd:class id="label-class"> |
| <fd:widgets> |
| <fd:field id="label"> |
| <fd:label>Label</fd:label> |
| <fd:datatype base="string"/> |
| </fd:field> |
| </fd:widgets> |
| </fd:class> |
| |
| <fd:class id="required-class"> |
| <fd:widgets> |
| <fd:booleanfield id="required"> |
| <fd:label>Required</fd:label> |
| </fd:booleanfield> |
| </fd:widgets> |
| </fd:class> |
| |
| <fd:class id="initial-size-class"> |
| <fd:widgets> |
| <fd:field id="initial-size"> |
| <fd:label>Initial Size</fd:label> |
| <fd:datatype base="long"/> |
| </fd:field> |
| </fd:widgets> |
| </fd:class> |
| |
| </fd:widgets> |
| </fd:form> |