You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ti...@apache.org on 2005/01/13 22:42:04 UTC
svn commit: r125106 - in cocoon/whiteboard/forms: WEB-INF/xconf java/org/apache/cocoon/forms/binding java/org/apache/cocoon/forms/formmodel java/org/apache/cocoon/forms/transformation samples/swan samples/swan/data samples/swan/flow samples/swan/forms samples/swan/resources samples/swan/resources/css samples/swan/resources/js
Author: tim
Date: Thu Jan 13 13:42:02 2005
New Revision: 125106
URL: http://svn.apache.org/viewcvs?view=rev&rev=125106
Log:
[CForms whiteboard] Add macro and macro repository support to models, bindings, and templates.\nUpdate Swan to use macros and macro repositories.
Added:
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/DefineMacroJXPathBinding.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ExpandMacroJXPathBinding.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ImportJXPathBinding.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ImportJXPathBindingBuilder.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacroJXPathBindingBuilder.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacrosJXPathBinding.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacrosJXPathBindingBuilder.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractTopDefinition.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/DefineMacroDefinition.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ExpandMacroDefinition.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ImportDefinition.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ImportDefinitionBuilder.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacroDefinitionBuilder.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacrosDefinition.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacrosDefinitionBuilder.java (contents, props changed)
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/TopDefinition.java (contents, props changed)
cocoon/whiteboard/forms/samples/swan/data/complex_binding.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/data/complex_model.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/data/complex_template.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/data/medium_binding.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/data/medium_model.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/data/medium_template.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/data/simple_binding.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/data/simple_model.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/data/simple_template.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/binding_mb.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/binding_mm.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/binding_mt.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/editor_binding.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/editor_mb.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/editor_mm.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/editor_model.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/editor_mt.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/editor_success.xsp (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/editor_template.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/model_mb.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/model_mm.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/model_mt.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/sitemap_mb.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/sitemap_mm.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/sitemap_mt.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/swan_binding.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/swan_mm.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/swan_template.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/template_mb.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/template_mm.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/template_mt.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/xreport_mb.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/xreport_mm.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/forms/xreport_mt.xml (contents, props changed)
cocoon/whiteboard/forms/samples/swan/resources/js/
cocoon/whiteboard/forms/samples/swan/resources/js/swan_textareas.js (contents, props changed)
Removed:
cocoon/whiteboard/forms/samples/swan/data/form_model_gui_binding.xml
cocoon/whiteboard/forms/samples/swan/data/form_model_gui_data-result.xml.orig
cocoon/whiteboard/forms/samples/swan/data/form_model_gui_data.xml
cocoon/whiteboard/forms/samples/swan/data/form_model_gui_template_data.xml
cocoon/whiteboard/forms/samples/swan/data/sample_form_1.xml
cocoon/whiteboard/forms/samples/swan/data/sample_form_1_template.xml
cocoon/whiteboard/forms/samples/swan/data/sample_form_2.xml
cocoon/whiteboard/forms/samples/swan/data/sample_form_2_template.xml
cocoon/whiteboard/forms/samples/swan/resources/css/swan.css
Modified:
cocoon/whiteboard/forms/WEB-INF/xconf/cocoon-forms.xconf
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/AbstractCustomBinding.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/Binding.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/FormDefinition.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java
cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsTemplateTransformer.java
cocoon/whiteboard/forms/samples/swan/flow/swan.js
cocoon/whiteboard/forms/samples/swan/forms/binding_binding.xml
cocoon/whiteboard/forms/samples/swan/forms/binding_model.xml
cocoon/whiteboard/forms/samples/swan/forms/binding_template.xml
cocoon/whiteboard/forms/samples/swan/forms/model_binding.xml
cocoon/whiteboard/forms/samples/swan/forms/model_model.xml
cocoon/whiteboard/forms/samples/swan/forms/model_template.xml
cocoon/whiteboard/forms/samples/swan/forms/sitemap_binding.xml
cocoon/whiteboard/forms/samples/swan/forms/sitemap_model.xml
cocoon/whiteboard/forms/samples/swan/forms/sitemap_template.xml
cocoon/whiteboard/forms/samples/swan/forms/template_binding.xml
cocoon/whiteboard/forms/samples/swan/forms/template_model.xml
cocoon/whiteboard/forms/samples/swan/forms/template_template.xml
cocoon/whiteboard/forms/samples/swan/forms/xreport_binding.xml
cocoon/whiteboard/forms/samples/swan/forms/xreport_model.xml
cocoon/whiteboard/forms/samples/swan/forms/xreport_template.xml
cocoon/whiteboard/forms/samples/swan/index.xml
cocoon/whiteboard/forms/samples/swan/resources/swan.xsl
cocoon/whiteboard/forms/samples/swan/sitemap.xmap
Modified: cocoon/whiteboard/forms/WEB-INF/xconf/cocoon-forms.xconf
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/WEB-INF/xconf/cocoon-forms.xconf?view=diff&rev=125106&p1=cocoon/whiteboard/forms/WEB-INF/xconf/cocoon-forms.xconf&r1=125105&p2=cocoon/whiteboard/forms/WEB-INF/xconf/cocoon-forms.xconf&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/WEB-INF/xconf/cocoon-forms.xconf (original)
+++ cocoon/whiteboard/forms/WEB-INF/xconf/cocoon-forms.xconf Thu Jan 13 13:42:02 2005
@@ -21,6 +21,9 @@
<forms-binding logger="forms.binding">
<bindings>
<binding name="group" src="org.apache.cocoon.forms.binding.GroupJXPathBindingBuilder"/>
+ <binding name="import" src="org.apache.cocoon.forms.binding.ImportJXPathBindingBuilder"/>
+ <binding name="macro" src="org.apache.cocoon.forms.binding.MacroJXPathBindingBuilder"/>
+ <binding name="macros" src="org.apache.cocoon.forms.binding.MacrosJXPathBindingBuilder"/>
<binding name="value" src="org.apache.cocoon.forms.binding.ValueJXPathBindingBuilder"/>
<binding name="multi-value" src="org.apache.cocoon.forms.binding.MultiValueJXPathBindingBuilder"/>
<binding name="context" src="org.apache.cocoon.forms.binding.ContextJXPathBindingBuilder"/>
@@ -129,6 +132,9 @@
<widget name="form" src="org.apache.cocoon.forms.formmodel.FormDefinitionBuilder"/>
<widget name="field" src="org.apache.cocoon.forms.formmodel.FieldDefinitionBuilder"/>
<widget name="group" src="org.apache.cocoon.forms.formmodel.GroupDefinitionBuilder"/>
+ <widget name="import" src="org.apache.cocoon.forms.formmodel.ImportDefinitionBuilder"/>
+ <widget name="macro" src="org.apache.cocoon.forms.formmodel.MacroDefinitionBuilder"/>
+ <widget name="macros" src="org.apache.cocoon.forms.formmodel.MacrosDefinitionBuilder"/>
<widget name="repeater" src="org.apache.cocoon.forms.formmodel.RepeaterDefinitionBuilder"/>
<widget name="booleanfield" src="org.apache.cocoon.forms.formmodel.BooleanFieldDefinitionBuilder"/>
<widget name="multivaluefield" src="org.apache.cocoon.forms.formmodel.MultiValueFieldDefinitionBuilder"/>
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/AbstractCustomBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/AbstractCustomBinding.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/AbstractCustomBinding.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/AbstractCustomBinding.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/AbstractCustomBinding.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/AbstractCustomBinding.java Thu Jan 13 13:42:02 2005
@@ -33,12 +33,46 @@
public void setParent(Binding binding) {
this.parent = binding;
}
+
+ /**
+ * Recursively resolves references.
+ */
+ public void resolve() throws BindingException {
+ // Do nothing because we do not know of any child bindings.
+ }
+
/**
* Returns binding definition id.
*/
public String getId() {
return this.id;
}
+
+ public void putMacro(String name, DefineMacroJXPathBinding macro) {
+ this.parent.putMacro(name, macro);
+ }
+
+ public void putMacros(String prefix, MacrosJXPathBinding macros) {
+ this.parent.putMacros(prefix, macros);
+ }
+
+ /**
+ * Gets a macro binding.
+ * @param name Name of the macro binding
+ */
+ public Binding getMacro(String name) {
+ return this.parent.getMacro(name);
+ }
+
+ /**
+ * Gets a macro binding.
+ * @param prefix Prefix of the macro binding
+ * @param name Name of the macro binding
+ */
+ public Binding getMacro(String prefix, String name) {
+ return this.parent.getMacro(prefix, name);
+ }
+
public Binding getClass(String id) {
return this.parent.getClass(id);
}
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/Binding.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/Binding.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/Binding.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/Binding.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/Binding.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/Binding.java Thu Jan 13 13:42:02 2005
@@ -33,9 +33,41 @@
void setParent(Binding binding);
/**
+ * Recursively resolves references.
+ */
+ void resolve() throws BindingException;
+
+ /**
* Gets binding definition id.
*/
String getId();
+
+ /**
+ * Registers a macro binding.
+ * @param name Name of macro binding
+ * @param macro Macro object
+ */
+ void putMacro(String name, DefineMacroJXPathBinding macro);
+
+ /**
+ * Registers macro bindings.
+ * @param prefix Prefix for the macro bindings
+ * @param macros Macros object
+ */
+ void putMacros(String name, MacrosJXPathBinding macros);
+
+ /**
+ * Retrieves a macro binding.
+ * @param name Name of macro binding
+ */
+ Binding getMacro(String name);
+
+ /**
+ * Retrieves a macro binding.
+ * @param prefix Prefix of the macro binding
+ * @param name Name of the macro binding
+ */
+ Binding getMacro(String prefix, String name);
/**
* Gets a binding class.
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ComposedJXPathBindingBase.java Thu Jan 13 13:42:02 2005
@@ -47,6 +47,17 @@
}
/**
+ * Recursively resolves references.
+ */
+ public void resolve() throws BindingException {
+ if (this.subBindings != null) {
+ for (int i = 0; i < this.subBindings.length; i++) {
+ this.subBindings[i].resolve();
+ }
+ }
+ }
+
+ /**
* Receives the logger to use for logging activity, and hands it over to
* the nested children.
*/
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/DefineMacroJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/DefineMacroJXPathBinding.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/DefineMacroJXPathBinding.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.binding;
+
+import org.apache.cocoon.forms.formmodel.Widget;
+import org.apache.commons.jxpath.JXPathContext;
+
+/**
+ * DefineMacroJXPathBinding provides an implementation of a {@link Binding}
+ * which allows the specification of a list of reusable bindings.
+ * <p>
+ * NOTES: <ol>
+ * <li>This Binding uses the provided widget-id as the name for the class.</li>
+ * </ol>
+ *
+ * @version CVS $Id: DefineMacroJXPathBinding.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public class DefineMacroJXPathBinding extends ComposedJXPathBindingBase {
+
+ private final String name;
+
+ /**
+ * Constructs DefineMacroJXPathBinding
+ * @param commonAtts
+ * @param name
+ * @param childBindings
+ */
+ public DefineMacroJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String name, JXPathBindingBase[] childBindings) {
+ super(commonAtts, childBindings);
+ this.name = name;
+ }
+
+ public void setParent(Binding parent) {
+ super.setParent(parent);
+ parent.putMacro(name, this);
+ }
+
+ /**
+ * Returns binding definition id.
+ */
+ public String getId() {
+ return name;
+ }
+
+ /**
+ * Narrows the scope on the form-model to the member widget-field, and
+ * narrows the scope on the object-model to the member xpath-context
+ * before continuing the binding over the child-bindings.
+ */
+ public void doLoad(Widget frmModel, JXPathContext jxpc) {
+ // Do nothing
+ }
+
+ /**
+ * Narrows the scope on the form-model to the member widget-field, and
+ * narrows the scope on the object-model to the member xpath-context
+ * before continuing the binding over the child-bindings.
+ */
+ public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
+ // Do nothing
+ }
+
+ public String toString() {
+ return "DefineMacroJXPathBinding [widget=" + this.name + "]";
+ }
+}
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ExpandMacroJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ExpandMacroJXPathBinding.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ExpandMacroJXPathBinding.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,109 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.binding;
+
+import org.apache.cocoon.forms.formmodel.Widget;
+import org.apache.commons.jxpath.JXPathContext;
+
+/**
+ * ExpandMacroJXPathBinding provides an implementation of a {@link Binding}
+ * that references a class of bindings.
+ * <p>
+ * NOTES: <ol>
+ * <li>This Binding assumes that the provided widget-id points to a
+ * class that contains other widgets.</li>
+ * </ol>
+ *
+ * @version CVS $Id: ExpandMacroJXPathBinding.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public class ExpandMacroJXPathBinding extends ComposedJXPathBindingBase {
+
+ private final String name;
+
+ private Binding macroBinding;
+
+ /**
+ * Constructs NewJXPathBinding
+ * @param commonAtts
+ * @param name
+ * @param childBindings
+ */
+ public ExpandMacroJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
+ String name, JXPathBindingBase[] childBindings) {
+ super(commonAtts, childBindings);
+ this.name = name;
+ this.macroBinding = null;
+ }
+
+ /**
+ * Recursively resolves references.
+ */
+ boolean resolved = false; // DEBUG: remove
+ public void resolve() throws BindingException {
+ resolved = true; // DEBUG: remove
+ String parts[] = name.split(":");
+ switch (parts.length) {
+ case 1:
+ macroBinding = getMacro(name);
+ break;
+ case 2:
+ macroBinding = getMacro(parts[0], parts[1]);
+ break;
+ default:
+ // TODO: Add location information
+ //throw new RuntimeException("Macro \"" + name + "\" does not exist (" + getLocation() + ")");
+ throw new RuntimeException("Macro \"" + name + "\" does not exist");
+ }
+ // Should this code be reachable?
+ if (macroBinding == null) {
+ throw new RuntimeException("Macro \"" + name + "\" does not exist");
+ }
+ }
+
+ /**
+ * Narrows the scope on the form-model to the member widget-field, and
+ * narrows the scope on the object-model to the member xpath-context
+ * before continuing the binding over the child-bindings.
+ */
+ public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
+ Binding[] subBindings = ((ComposedJXPathBindingBase)macroBinding).getChildBindings();
+ if (subBindings != null) {
+ int size = subBindings.length;
+ for (int i = 0; i < size; i++) {
+ subBindings[i].loadFormFromModel(frmModel, jxpc);
+ }
+ }
+ }
+
+ /**
+ * Narrows the scope on the form-model to the member widget-field, and
+ * narrows the scope on the object-model to the member xpath-context
+ * before continuing the binding over the child-bindings.
+ */
+ public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
+ Binding[] subBindings = ((ComposedJXPathBindingBase)macroBinding).getChildBindings();
+ if (subBindings != null) {
+ int size = subBindings.length;
+ for (int i = 0; i < size; i++) {
+ subBindings[i].saveFormToModel(frmModel, jxpc);
+ }
+ }
+ }
+
+ public String toString() {
+ return "ExpandMacroJXPathBinding [widget=" + this.name + "]";
+ }
+}
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ImportJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ImportJXPathBinding.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ImportJXPathBinding.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,143 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.binding;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.cocoon.components.source.SourceUtil;
+import org.apache.cocoon.forms.CacheManager;
+import org.apache.cocoon.forms.formmodel.Widget;
+// TODO: remove
+import org.apache.cocoon.forms.util.DomHelper;
+import org.apache.commons.jxpath.JXPathContext;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+
+
+/**
+ * ImportJXPathBinding imports and associates a
+ * prefix with a source containing macro bindings.
+ *
+ * @version CVS $Id: ImportJXPathBinding.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public class ImportJXPathBinding extends JXPathBindingBase {
+
+ /**
+ * Cache prefix for storing Cocoon Forms models.
+ */
+ private static final String CACHE_PREFIX = "CocoonBinding:";
+
+ private final String prefix;
+ private final String uri;
+
+ JXPathBindingManager.Assistant assistant;
+
+ MacrosJXPathBinding macros = null;
+
+ /**
+ * Constructs ImportJXPathBinding
+ * @param commonAtts
+ * @param prefix
+ * @param uri
+ */
+ public ImportJXPathBinding(JXPathBindingManager.Assistant assistant, String prefix, String uri) {
+ super(JXPathBindingBuilderBase.CommonAttributes.DEFAULT);
+ this.assistant = assistant;
+ this.prefix = prefix;
+ this.uri = uri;
+ }
+
+ /**
+ * Recursively resolves references.
+ */
+ public void resolve() throws BindingException {
+ CacheManager cacheManager;
+ ServiceManager serviceManager = assistant.getServiceManager();
+ Source source = null;
+ try {
+ cacheManager = (CacheManager)serviceManager.lookup(CacheManager.ROLE);
+ SourceResolver resolver = (SourceResolver)serviceManager.lookup(SourceResolver.ROLE);
+ source = resolver.resolveURI(uri);
+ } catch(Exception e) {
+ throw new BindingException("Trouble resolving source: \"" + uri + "\"", e);
+ }
+ macros = (MacrosJXPathBinding)cacheManager.get(source, CACHE_PREFIX);
+ if (macros == null) {
+ try {
+ // Cannot use toDOM because it does not support location information,
+ // which would in turn causes the Javascript binding to fail.
+ // Document doc = SourceUtil.toDOM(source);
+ InputSource is = new InputSource(source.getInputStream());
+ is.setSystemId(source.getURI());
+ Document doc = DomHelper.parse(is, serviceManager);
+ Element docElement = doc.getDocumentElement();
+ try {
+ macros = (MacrosJXPathBinding)this.assistant.getBindingForConfigurationElement(docElement);
+ } catch(ClassCastException e) {
+ throw new BindingException("Top binding in macros file must be \"macros\"", e);
+ }
+ } catch(Exception e) {
+ throw new BindingException("Trouble accessing source: " + uri, e);
+ }
+ // CHECK: Is it ok for the logger to be set here?
+ // Hand the macros the logger to use for logging activity
+ macros.enableLogging(getLogger());
+ // Recursively resolve references
+ macros.resolve();
+ try {
+ cacheManager.set(macros, source, CACHE_PREFIX);
+ } catch(Exception e) {
+ throw new BindingException("Trouble caching source: " + uri, e);
+ }
+ }
+ // Register imported macros.
+ parent.putMacros(prefix, macros);
+
+ }
+
+ /**
+ * Receives the logger to use for logging activity, and hands it over to
+ * the nested children.
+ */
+ public void enableLogging(Logger logger) {
+ super.enableLogging(logger);
+ }
+
+ /**
+ * Narrows the scope on the form-model to the member widget-field, and
+ * narrows the scope on the object-model to the member xpath-context
+ * before continuing the binding over the child-bindings.
+ */
+ public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
+ // Do nothing
+ }
+
+ /**
+ * Narrows the scope on the form-model to the member widget-field, and
+ * narrows the scope on the object-model to the member xpath-context
+ * before continuing the binding over the child-bindings.
+ */
+ public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
+ // Do nothing
+ }
+
+ public String toString() {
+ return "ImportJXPathBinding [prefix=" + this.prefix + " uri=" + this.uri + "]";
+ }
+}
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ImportJXPathBindingBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ImportJXPathBindingBuilder.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/ImportJXPathBindingBuilder.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,48 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.binding;
+
+import org.apache.cocoon.forms.util.DomHelper;
+import org.w3c.dom.Element;
+
+/**
+ * ImportJXPathBindingBuilder provides a helper class for the Factory
+ * implemented in {@link JXPathBindingManager} that helps construct the
+ * actual {@link NewJXPathBinding} out of the configuration in the
+ * provided configElement which looks like:
+ * <pre><code>
+ * <fb:import prefix="<i>prefix-string</i>" uri="<i>uri-string</i>"/>
+ * </code></pre>
+ *
+ * @version CVS $Id: ImportJXPathBindingBuilder.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public class ImportJXPathBindingBuilder
+ extends JXPathBindingBuilderBase {
+
+ public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
+ throws BindingException {
+ try {
+ String prefix = DomHelper.getAttribute(bindingElm, "prefix");
+ String uri = DomHelper.getAttribute(bindingElm, "uri");
+ ImportJXPathBinding importBinding = new ImportJXPathBinding(assistant, prefix, uri);
+ return importBinding;
+ } catch (BindingException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new BindingException("Error building import binding defined at " + DomHelper.getLocation(bindingElm), e);
+ }
+ }
+}
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java Thu Jan 13 13:42:02 2005
@@ -50,6 +50,16 @@
protected Binding parent;
/**
+ * Cache of macro definitions
+ */
+ protected Map macros;
+
+ /**
+ * Cache of prefix to macros mappings
+ */
+ protected Map prefixes;
+
+ /**
* Cache of class definitions
*/
protected Map classes;
@@ -78,10 +88,86 @@
}
/**
+ * Recursively resolves references.
+ */
+ public void resolve() throws BindingException {
+ // Do nothing because we do not know of any child bindings.
+ }
+
+ /**
* Returns binding definition id.
*/
public String getId() {
return null;
+ }
+
+ public void putMacro(String name, DefineMacroJXPathBinding macro) {
+ if (macros == null) {
+ macros = new HashMap();
+ }
+ // TODO: Report error on duplicates
+ macros.put(name, macro);
+ }
+
+ public void putMacros(String prefix, MacrosJXPathBinding macros) {
+ if (prefixes == null) {
+ prefixes = new HashMap();
+ }
+ // TODO: Report error on duplicate
+ prefixes.put(prefix, macros);
+ }
+
+ /**
+ * Gets a macro binding.
+ * @param name Name of the macro binding
+ */
+ public Binding getMacro(String name) {
+ DefineMacroJXPathBinding macro = null;
+ if (macros != null) {
+ // Query cache for macros
+ macro = (DefineMacroJXPathBinding)macros.get(name);
+ }
+ if (macro == null) {
+ // Query parent for macro
+ if (parent != null) {
+ macro = (DefineMacroJXPathBinding)parent.getMacro(name);
+ // Cache result
+ if (macros == null) {
+ macros = new HashMap();
+ }
+ macros.put(name, macro);
+ } else {
+ throw new RuntimeException("Macro \"" + name + "\" not found (" + getLocation() + ")");
+ }
+ }
+ return macro;
+ }
+
+ /**
+ * Gets a macro binding.
+ * @param prefix Prefix of the macro binding
+ * @param name Name of the macro binding
+ */
+ public Binding getMacro(String prefix, String name) {
+ DefineMacroJXPathBinding macro = null;
+ if (prefixes != null) {
+ // Query prefix cache for macro
+ MacrosJXPathBinding macros = (MacrosJXPathBinding)prefixes.get(prefix);
+ if (macros != null) {
+ macro = (DefineMacroJXPathBinding)macros.getMacro(name);
+ }
+ }
+ if (macro == null) {
+ // Query parent for macro
+ if (parent != null) {
+ // The parent reports the error for us if the macro is not found
+ macro = (DefineMacroJXPathBinding)parent.getMacro(prefix, name);
+ // TODO: Cache result
+ } else {
+ throw new RuntimeException("Macro \"" + name + "\" not found (" + getLocation() + ")");
+ }
+ }
+ return macro;
}
public Binding getClass(String id) {
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java Thu Jan 13 13:42:02 2005
@@ -176,7 +176,7 @@
* Interpretes the value of the lenient attribute into a Boolean object
* allowing three-state logic (true/false/unset)
* @param leniency value of the @lenient attribute
- * @return null if the leniency parameter is null or a String otherwise the allowed values
+ * @return null if the leniency parameter is is null or a String otherwise the allowed values
*/
private static Boolean decideLeniency(String leniency) {
return BooleanUtils.toBooleanObject(leniency);
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java Thu Jan 13 13:42:02 2005
@@ -111,6 +111,9 @@
}
}
+ // Recursively resolve references
+ binding.resolve();
+
this.cacheManager.set(binding, source, PREFIX);
} catch (BindingException e) {
throw e;
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacroJXPathBindingBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacroJXPathBindingBuilder.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacroJXPathBindingBuilder.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,72 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.binding;
+
+import org.apache.cocoon.forms.util.DomHelper;
+import org.w3c.dom.Element;
+
+/**
+ * MacroJXPathBindingBuilder provides a helper class for the Factory
+ * implemented in {@link JXPathBindingManager} that helps construct an
+ * actual {@link DefineMacroJXPathBinding} or {@link ExpandMacroJXPathBinding}
+ * out of the configuration in the provided configElement which looks like:
+ * <pre><code>
+ * <fb:macro define="<i>macro-id</i>">
+ * <fb:value id="<i>sub-widget-id</i>" path="<i>relative-xpath</i>"
+ * direction="<i>load|save</i>" lenient="<i>true|false</i>" />
+ * </fb:macro>
+ * </code></pre>
+ * or
+ * <pre><code>
+ * <fb:macro expand="<i>macro-id</i>">
+ * <fb:value id="<i>sub-widget-id</i>" path="<i>relative-xpath</i>"
+ * direction="<i>load|save</i>" lenient="<i>true|false</i>" />
+ * </fb:macro>
+ * </code></pre>
+ *
+ * @version CVS $Id: MacroJXPathBindingBuilder.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public class MacroJXPathBindingBuilder
+ extends JXPathBindingBuilderBase {
+
+ public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
+ throws BindingException {
+ try {
+ String define = DomHelper.getAttribute(bindingElm, "define", null);
+ String expand = DomHelper.getAttribute(bindingElm, "expand", null);
+ CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
+
+ JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
+
+ if (define != null && !"".equals(define)) {
+ DefineMacroJXPathBinding macroBinding
+ = new DefineMacroJXPathBinding(commonAtts, define, childBindings);
+ return macroBinding;
+ } else if (expand != null && !"".equals(expand)) {
+ ExpandMacroJXPathBinding macroBinding
+ = new ExpandMacroJXPathBinding(commonAtts, expand, childBindings);
+ return macroBinding;
+ } else {
+ throw new BindingException("Macro must be defined or expanded at " + DomHelper.getLocation(bindingElm));
+ }
+
+ } catch (BindingException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new BindingException("Error building macro binding defined at " + DomHelper.getLocation(bindingElm), e);
+ }
+ }
+}
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacrosJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacrosJXPathBinding.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacrosJXPathBinding.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,62 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.binding;
+
+import org.apache.cocoon.forms.formmodel.Widget;
+import org.apache.commons.jxpath.JXPathContext;
+
+/**
+ * MacrosJXPathBinding provides an implementation of a {@link Binding}
+ * which allows the specification of a list of importable macros.
+ * <p>
+ * NOTES: <ol>
+ * <li>This Binding uses the provided widget-id as the name for the class.</li>
+ * </ol>
+ *
+ * @version CVS $Id: MacrosJXPathBinding.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public class MacrosJXPathBinding extends ComposedJXPathBindingBase {
+
+ /**
+ * Constructs MacrosJXPathBinding
+ * @param childBindings
+ */
+ public MacrosJXPathBinding(JXPathBindingBase[] childBindings) {
+ super(JXPathBindingBuilderBase.CommonAttributes.DEFAULT, childBindings);
+ }
+
+ /**
+ * Narrows the scope on the form-model to the member widget-field, and
+ * narrows the scope on the object-model to the member xpath-context
+ * before continuing the binding over the child-bindings.
+ */
+ public void doLoad(Widget frmModel, JXPathContext jxpc) {
+ // Do nothing
+ }
+
+ /**
+ * Narrows the scope on the form-model to the member widget-field, and
+ * narrows the scope on the object-model to the member xpath-context
+ * before continuing the binding over the child-bindings.
+ */
+ public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
+ // Do nothing
+ }
+
+ public String toString() {
+ return "DefineMacroJXPathBinding";
+ }
+}
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacrosJXPathBindingBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacrosJXPathBindingBuilder.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/MacrosJXPathBindingBuilder.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.binding;
+
+import org.apache.cocoon.forms.util.DomHelper;
+import org.w3c.dom.Element;
+
+/**
+ * MacrosJXPathBindingBuilder provides a helper class for the Factory
+ * implemented in {@link JXPathBindingManager} that helps construct a
+ * list of {@link DefineMacroJXPathBinding}s from a source, out of the
+ * configuration in the provided configElement which looks like:
+ * <pre><code>
+ * <fb:macros>
+ * <fb:macro define="<i>macro-id</i>"</i>">
+ * <fb:value id="<i>sub-widget-id</i>" path="<i>relative-xpath</i>"
+ * direction="<i>load|save</i>" lenient="<i>true|false</i>"/>
+ * </fb:macro>
+ * </fb:macros>
+ * </code></pre>
+ *
+ * @version CVS $Id: MacrosJXPathBindingBuilder.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public class MacrosJXPathBindingBuilder
+ extends JXPathBindingBuilderBase {
+
+ public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
+ throws BindingException {
+ try {
+ JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
+ MacrosJXPathBinding macrosBinding = new MacrosJXPathBinding(childBindings);
+ return macrosBinding;
+ } catch (BindingException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new BindingException("Error building macros binding defined at " + DomHelper.getLocation(bindingElm), e);
+ }
+ }
+}
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java Thu Jan 13 13:42:02 2005
@@ -48,7 +48,10 @@
this.classBinding = null;
}
- private void resolve() throws BindingException {
+ /**
+ * Recursively resolves references.
+ */
+ public void resolve() throws BindingException {
classBinding = getClass(widgetId);
if (classBinding == null) {
throw new BindingException("Class \"" + widgetId + "\" does not exist");
@@ -61,8 +64,6 @@
* before continuing the binding over the child-bindings.
*/
public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
- if (classBinding == null)
- resolve();
Binding[] subBindings = ((ComposedJXPathBindingBase)classBinding).getChildBindings();
if (subBindings != null) {
int size = subBindings.length;
@@ -78,8 +79,6 @@
* before continuing the binding over the child-bindings.
*/
public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
- if (classBinding == null)
- resolve();
Binding[] subBindings = ((ComposedJXPathBindingBase)classBinding).getChildBindings();
if (subBindings != null) {
int size = subBindings.length;
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/RepeaterJXPathBinding.java Thu Jan 13 13:42:02 2005
@@ -90,6 +90,16 @@
}
/**
+ * Recursively resolves references.
+ */
+ public void resolve() throws BindingException {
+ this.rowBinding.resolve();
+ this.insertRowBinding.resolve();
+ this.deleteRowBinding.resolve();
+ this.identityBinding.resolve();
+ }
+
+ /**
* Binds the unique-id of the repeated rows, and narrows the context on
* objectModelContext and Repeater to the repeated rows before handing
* over to the actual binding-children.
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java Thu Jan 13 13:42:02 2005
@@ -57,6 +57,13 @@
this.deleteIfEmpty = deleteIfEmpty;
}
+ /**
+ * Recursively resolves references.
+ */
+ public void resolve() throws BindingException {
+ this.rowBinding.resolve();
+ }
+
public void doLoad(Widget frmModel, JXPathContext jctx)
throws BindingException {
// Find the repeater and clear it
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java Thu Jan 13 13:42:02 2005
@@ -68,6 +68,14 @@
this.deleteIfEmpty = deleteIfEmpty;
}
+ /**
+ * Recursively resolves references.
+ */
+ public void resolve() throws BindingException {
+ this.rowBinding.resolve();
+ this.insertRowBinding.resolve();
+ }
+
public void doLoad(Widget frmModel, JXPathContext jctx) throws BindingException {
// (There should be a general widget type checker for all the bindings to use,
// coupled with a general informative exception class to throw if the widget is
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinition.java Thu Jan 13 13:42:02 2005
@@ -40,8 +40,14 @@
}
public void addWidgetDefinition(WidgetDefinition definition) throws Exception, DuplicateIdException {
- definition.setParent(this);
- definitions.addWidgetDefinition(definition);
+ if (definition != null) {
+ definition.setParent(this);
+ if (definition instanceof DefineMacroDefinition) {
+ getTopDefinition().putMacroDefinition(definition.getId(), (DefineMacroDefinition)definition);
+ } else {
+ definitions.addWidgetDefinition(definition);
+ }
+ }
}
public void resolve(List parents, WidgetDefinition parent) throws Exception {
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractTopDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractTopDefinition.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractTopDefinition.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,68 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The {@link AbstractTopDefinition}.
+ *
+ * @version $Id: AbstractTopDefinition.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public abstract class AbstractTopDefinition
+ extends AbstractContainerDefinition implements TopDefinition {
+
+ private Map macros;
+ private Map prefixes;
+
+ public AbstractTopDefinition() {
+ super();
+ }
+
+ public void putMacroDefinition(String name, DefineMacroDefinition macro) {
+ if (macros == null)
+ macros = new HashMap();
+ macros.put(name, macro);
+ }
+
+ public void putMacrosDefinition(String prefix, MacrosDefinition macros) {
+ if (this.prefixes == null)
+ this.prefixes = new HashMap();
+ this.prefixes.put(prefix, macros);
+ }
+
+ public DefineMacroDefinition getMacroDefinition(String name) {
+ if (macros == null)
+ macros = new HashMap();
+ DefineMacroDefinition macro = (DefineMacroDefinition)this.macros.get(name);
+ if (macro == null)
+ throw new RuntimeException("Macro \"" + name + "\" does not exist");
+ return macro;
+ }
+
+ public DefineMacroDefinition getMacroDefinition(String prefix, String name) {
+ if (this.prefixes == null)
+ this.prefixes = new HashMap();
+ MacrosDefinition macros = (MacrosDefinition)this.prefixes.get(prefix);
+ // TODO: Add line:col info
+ if (macros == null)
+ throw new RuntimeException("Prefix \"" + prefix + "\" is not registered (" + getLocation() + ")");
+ return macros.getMacroDefinition(name);
+ }
+}
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java Thu Jan 13 13:42:02 2005
@@ -36,6 +36,7 @@
* @version $Id$
*/
public abstract class AbstractWidgetDefinition implements WidgetDefinition {
+ private TopDefinition topDefinition;
private FormDefinition formDefinition;
protected WidgetDefinition parent;
@@ -49,6 +50,23 @@
private WidgetState state = WidgetState.ACTIVE;
protected CreateListener createListener;
+
+ public TopDefinition getTopDefinition() {
+ if (this.topDefinition == null) {
+ if (this instanceof TopDefinition) {
+ this.topDefinition = (TopDefinition)this;
+ if (this instanceof FormDefinition) {
+ this.formDefinition = (FormDefinition)this;
+ }
+ } else {
+ this.topDefinition = this.parent.getTopDefinition();
+ if (this.topDefinition instanceof FormDefinition) {
+ this.formDefinition = (FormDefinition)this.topDefinition;
+ }
+ }
+ }
+ return this.topDefinition;
+ }
public FormDefinition getFormDefinition() {
if (this.formDefinition == null) {
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/DefineMacroDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/DefineMacroDefinition.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/DefineMacroDefinition.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,28 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+/**
+ * A {@link WidgetDefinition} which holds a collection of {@link WidgetDefinition}s
+ * and which can be instantiated with an {@link ExpandMacroDefinition}.
+ *
+ * @version $Id: DefineMacroDefinition.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public class DefineMacroDefinition extends AbstractContainerDefinition {
+ public Widget createInstance() {
+ return null;
+ }
+}
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ExpandMacroDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ExpandMacroDefinition.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ExpandMacroDefinition.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,101 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+// TODO: The exception messages should use I18n.
+/**
+ * This is the "{@link WidgetDefinition}" which is used to instantiate a
+ * {@link DefineMacroDefinition}. The resolve step replaces this definition with
+ * the definitions contained in the referenced {@link DefineMacroDefinition}.
+ *
+ * @version $Id: ExpandMacroDefinition.java 46126 2004-09-15 18:42:28Z tim $
+ */
+public class ExpandMacroDefinition extends AbstractWidgetDefinition {
+ private boolean resolving;
+ private DefineMacroDefinition macroDefinition;
+
+ public ExpandMacroDefinition() {
+ super();
+ resolving = false;
+ macroDefinition = null;
+ }
+
+ private DefineMacroDefinition getDefineMacroDefinition() throws Exception {
+ TopDefinition topDefinition = getTopDefinition();
+ String parts[] = getId().split(":");
+ DefineMacroDefinition macroDefinition = null;
+ switch (parts.length) {
+ case 1:
+ macroDefinition = getTopDefinition().getMacroDefinition(getId());
+ break;
+ case 2:
+ macroDefinition = getTopDefinition().getMacroDefinition(parts[0], parts[1]);
+ break;
+ default:
+ throw new RuntimeException("Error: Macro " + getId() + " does not exist.");
+ }
+ if (macroDefinition == null)
+ throw new Exception("ExpandMacroDefinition: Define macro with id \"" + getId()
+ + "\" does not exist (" + getLocation() + ")");
+ return macroDefinition;
+ }
+
+ // TODO: Should we add checking for union defaults which would cause non-terminating recursion?
+ public void resolve(List parents, WidgetDefinition parent) throws Exception {
+ // Non-terminating recursion detection
+ if (resolving) {
+ // Search up parent list in hopes of finding a "Union" before
+ // finding previous macro expansion for this macro".
+ ListIterator parentsIt = parents.listIterator(parents.size());
+ while(parentsIt.hasPrevious()) {
+ WidgetDefinition definition = (WidgetDefinition)parentsIt.previous();
+ if (definition instanceof UnionDefinition) break;
+ if (definition == this)
+ throw new Exception("ExpandMacroDefinition: Non-terminating recursion detected in widget definition : "
+ + parent.getId() + " (" + getLocation() + ")");
+ }
+ }
+ // Resolution
+ resolving = true;
+ parents.add(this);
+ macroDefinition = getDefineMacroDefinition();
+ Iterator definitionsIt = macroDefinition.getWidgetDefinitions().iterator();
+ parents.add(this);
+ while (definitionsIt.hasNext()) {
+ WidgetDefinition definition = (WidgetDefinition)definitionsIt.next();
+ if (definition instanceof ContainerDefinition) {
+ ((ContainerDefinition)definition).resolve(parents, parent);
+ }
+ if (definition instanceof ExpandMacroDefinition) {
+ ((ExpandMacroDefinition)definition).resolve(parents, parent);
+ } else if (definition instanceof NewDefinition) {
+ ((ExpandMacroDefinition)definition).resolve(parents, parent);
+ } else {
+ ((ContainerDefinition)parent).addWidgetDefinition(definition);
+ }
+ }
+ parents.remove(parents.size()-1);
+ resolving = false;
+ }
+
+ public Widget createInstance() {
+ return null;
+ }
+}
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/FormDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/FormDefinition.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/FormDefinition.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/FormDefinition.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/FormDefinition.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/FormDefinition.java Thu Jan 13 13:42:02 2005
@@ -27,7 +27,8 @@
*
* @version $Id$
*/
-public class FormDefinition extends AbstractContainerDefinition {
+public class FormDefinition extends AbstractTopDefinition {
+
private ProcessingPhaseListener listener;
public FormDefinition() {
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ImportDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ImportDefinition.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ImportDefinition.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,59 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+// TODO: The exception messages should use I18n.
+/**
+ * This is the "{@link WidgetDefinition}" which is used to register
+ * a prefix to macros mapping during the resolve step.
+ *
+ * @version $Id: ImportDefinition.java 46126 2004-09-15 18:42:28Z tim $
+ */
+public class ImportDefinition extends AbstractWidgetDefinition {
+ private boolean resolving;
+ private String prefix;
+ private MacrosDefinition macrosDefinition;
+
+ public ImportDefinition(String prefix, MacrosDefinition macrosDefinition) {
+ super();
+ resolving = false;
+ this.prefix = prefix;
+ this.macrosDefinition = macrosDefinition;
+ }
+
+ private ClassDefinition getClassDefinition() throws Exception {
+ FormDefinition formDefinition = getFormDefinition();
+ WidgetDefinition classDefinition = formDefinition.getWidgetDefinition(getId());
+ if (classDefinition == null)
+ throw new Exception("NewDefinition: Class with id \"" + getId() + "\" does not exist (" + getLocation() + ")");
+ if (!(classDefinition instanceof ClassDefinition))
+ throw new Exception("NewDefinition: Id \"" + getId() + "\" is not a class (" + getLocation() + ")");
+ return (ClassDefinition)classDefinition;
+ }
+
+ public void resolve(List parents, WidgetDefinition parent) throws Exception {
+ // Register imported macros.
+ getTopDefinition().putMacrosDefinition(this.prefix, this.macrosDefinition);
+ }
+
+ public Widget createInstance() {
+ return null;
+ }
+}
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ImportDefinitionBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ImportDefinitionBuilder.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/ImportDefinitionBuilder.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,88 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.apache.cocoon.components.source.SourceUtil;
+import org.apache.cocoon.forms.CacheManager;
+import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.util.DomHelper;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+
+/**
+ * Builds {MacroDefinition}s.
+ *
+ * @version $Id: ImportDefinitionBuilder.java 47104 2004-09-23 14:16:39Z sylvain $
+ */
+public class ImportDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
+ /**
+ * Cache prefix for storing Cocoon Forms models.
+ */
+ private static final String CACHE_PREFIX = "CocoonModel:";
+
+ public WidgetDefinition buildWidgetDefinition(Element element) throws Exception {
+ MacrosDefinition macrosDefinition = null;
+ CacheManager cacheManager;
+
+ // Load macro definitions from a source and map them to a prefix
+ String prefix = DomHelper.getAttribute(element, "prefix", null);
+ String uri = DomHelper.getAttribute(element, "uri", null);
+ Source source = null;
+ try {
+ SourceResolver resolver = (SourceResolver)serviceManager.lookup(SourceResolver.ROLE);
+ source = resolver.resolveURI(uri);
+ } catch(Exception e) {
+ throw new RuntimeException("Trouble resolving source: \"" + uri + "\", " + e.getMessage());
+ }
+ cacheManager = (CacheManager)serviceManager.lookup(CacheManager.ROLE);
+ macrosDefinition = (MacrosDefinition)cacheManager.get(source, CACHE_PREFIX);
+ if (macrosDefinition == null) {
+ try {
+ // Cannot use toDOM because it does not support location information,
+ // which would in turn causes the Javascript binding to fail.
+ // Document doc = SourceUtil.toDOM(source);
+ InputSource is = new InputSource(source.getInputStream());
+ is.setSystemId(source.getURI());
+ Document doc = DomHelper.parse(is, serviceManager);
+ Element macrosElement = doc.getDocumentElement();
+
+ // TODO: Make error more informative (line:col of import and source URI)
+ if (!Constants.DEFINITION_NS.equals(macrosElement.getNamespaceURI())
+ || !"macros".equals(macrosElement.getLocalName())) {
+ throw new RuntimeException("Root of imported source must be "
+ + Constants.DEFINITION_PREFIX + ":macros");
+ }
+ macrosDefinition = (MacrosDefinition)buildAnotherWidgetDefinition(macrosElement);
+ } catch(Exception e) {
+ throw new RuntimeException("Trouble accessing source: " + uri + ", " + e.getMessage());
+ }
+ try {
+ cacheManager.set(macrosDefinition, source, CACHE_PREFIX);
+ } catch(Exception e) {
+ throw new RuntimeException("Trouble caching source: " + uri + ", " + e.getMessage());
+ }
+ }
+ ImportDefinition definition = new ImportDefinition(prefix, macrosDefinition);
+ return definition;
+ }
+}
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacroDefinitionBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacroDefinitionBuilder.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacroDefinitionBuilder.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,71 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.util.DomHelper;
+import org.w3c.dom.Element;
+
+/**
+ * Builds {DefineMacroDefinition}s and {ExpandMacroDefinition}s.
+ *
+ * @version $Id: MacroDefinitionBuilder.java 47104 2004-09-23 14:16:39Z sylvain $
+ */
+public class MacroDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
+
+ public WidgetDefinition buildWidgetDefinition(Element element) throws Exception {
+ String expand = DomHelper.getAttribute(element, "expand", null);
+ String define = DomHelper.getAttribute(element, "define", null);
+ boolean doExpand = expand != null && !"".equals(expand);
+ boolean doDefine = define != null && !"".equals(define);
+
+ if (doExpand) {
+ ExpandMacroDefinition definition = new ExpandMacroDefinition();
+ if (expand.length() < 1) {
+ throw new Exception("Expand attribute must not be empty on '" + element.getTagName()
+ + "' at " + DomHelper.getLocation(element));
+ }
+ definition.setId(expand);
+ return definition;
+ }
+ if (doDefine) {
+ DefineMacroDefinition definition = new DefineMacroDefinition();
+ if (define.length() < 1) {
+ throw new Exception("Define attribute must not be empty on '" + element.getTagName()
+ + "' at " + DomHelper.getLocation(element));
+ }
+ definition.setId(define);
+ setDisplayData(element, definition);
+ setValidators(element, definition);
+
+ Element widgetsElement = DomHelper.getChildElement(element, Constants.DEFINITION_NS, "widgets", true);
+ // All child elements of the widgets element are widgets
+ Element[] widgetElements = DomHelper.getChildElements(widgetsElement, Constants.DEFINITION_NS);
+ for (int i = 0; i < widgetElements.length; i++) {
+ Element widgetElement = widgetElements[i];
+ WidgetDefinition widgetDefinition = buildAnotherWidgetDefinition(widgetElement);
+ definition.addWidgetDefinition(widgetDefinition);
+ }
+
+ return definition;
+ } // End if define
+ if (!doExpand && !doDefine) {
+ throw new RuntimeException("Macro must either be defined or expanded.");
+ }
+ // Keep compiler from complaining
+ return null;
+ }
+}
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacrosDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacrosDefinition.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacrosDefinition.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A {@link WidgetDefinition} which holds {@link WidgetDefinition} macros.
+ *
+ * @version $Id: MacrosDefinition.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public class MacrosDefinition extends AbstractTopDefinition {
+
+ public MacrosDefinition() {
+ super();
+ }
+
+ public void resolve() throws Exception {
+ List parents = new ArrayList();
+ parents.add(this);
+ resolve(parents, this);
+ }
+
+ public Widget createInstance() {
+ return null;
+ }
+}
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacrosDefinitionBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacrosDefinitionBuilder.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacrosDefinitionBuilder.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.util.DomHelper;
+import org.w3c.dom.Element;
+
+/**
+ * Builds {@link MacrosDefinition}s.
+ *
+ * @version $Id: MacrosDefinitionBuilder.java 47104 2004-09-23 14:16:39Z sylvain $
+ */
+public class MacrosDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
+
+ public WidgetDefinition buildWidgetDefinition(Element macrosElement) throws Exception {
+ MacrosDefinition macrosDefinition = new MacrosDefinition();
+
+ Element widgetsElement = DomHelper.getChildElement(macrosElement, Constants.DEFINITION_NS, "widgets", true);
+ // TODO: We should restrict to only allowing macro defininitions at this level
+ // All child elements of the widgets element are widget definitions
+ Element[] widgetElements = DomHelper.getChildElements(widgetsElement, Constants.DEFINITION_NS);
+ for (int i = 0; i < widgetElements.length; i++) {
+ Element widgetElement = widgetElements[i];
+ WidgetDefinition widgetDefinition = buildAnotherWidgetDefinition(widgetElement);
+ macrosDefinition.addWidgetDefinition(widgetDefinition);
+ }
+
+ macrosDefinition.resolve();
+ /*
+ CacheManager cacheManager = (CacheManager)serviceManager.lookup(CacheManager.ROLE);
+ cacheManager.put(macrosDefinition, source, CACHE_PREFIX);
+ */
+ return macrosDefinition;
+ }
+}
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinition.java Thu Jan 13 13:42:02 2005
@@ -72,7 +72,9 @@
if (definition instanceof ContainerDefinition) {
((ContainerDefinition)definition).resolve(parents, parent);
}
- if (definition instanceof NewDefinition) {
+ if (definition instanceof ExpandMacroDefinition) {
+ ((ExpandMacroDefinition)definition).resolve(parents, parent);
+ } else if (definition instanceof NewDefinition) {
((NewDefinition)definition).resolve(parents, parent);
} else {
((ContainerDefinition)parent).addWidgetDefinition(definition);
Added: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/TopDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/TopDefinition.java?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/TopDefinition.java Thu Jan 13 13:42:02 2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A {@link WidgetDefinition} which stores
+ * references to {@link DefineMacroDefinition}s.
+ *
+ * @version $Id: TopDefinition.java 56582 2004-11-04 10:16:22Z sylvain $
+ */
+public interface TopDefinition {
+ public void putMacroDefinition(String name, DefineMacroDefinition macro);
+
+ public void putMacrosDefinition(String prefix, MacrosDefinition macros);
+
+ public DefineMacroDefinition getMacroDefinition(String name);
+
+ public DefineMacroDefinition getMacroDefinition(String prefix, String name);
+}
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java Thu Jan 13 13:42:02 2005
@@ -29,6 +29,12 @@
public interface WidgetDefinition {
/**
+ * @return the {@link TopDefinition} to which this widget belongs,
+ * either a {@link FormDefinition} or a {@link MacrosDefinition}.
+ */
+ public TopDefinition getTopDefinition();
+
+ /**
* Gets the {@link FormDefinition}.
*/
public FormDefinition getFormDefinition();
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java Thu Jan 13 13:42:02 2005
@@ -46,8 +46,10 @@
public void addWidgetDefinition(WidgetDefinition widgetDefinition) throws DuplicateIdException {
String id = widgetDefinition.getId();
- // Do not add NewDefinition id's hash.
- if (!(widgetDefinition instanceof NewDefinition)) {
+ // Do not add ImportDefinition, ExpandMacroDefinition, or NewDefinition id's hash.
+ if (!(widgetDefinition instanceof ImportDefinition
+ || widgetDefinition instanceof ExpandMacroDefinition
+ || widgetDefinition instanceof NewDefinition)) {
if (widgetDefinitionsById.containsKey(id)) {
String duplicateLocation = widgetDefinition.getLocation();
String containerLocation = definition.getLocation();
@@ -85,15 +87,22 @@
parents.add(definition);
while (this.definitionsIt.hasNext()) {
WidgetDefinition widgetDefinition = (WidgetDefinition)this.definitionsIt.next();
+ // DefineMacroDefinition's get resolved by ExpandMacroDefinition rather than here.
// ClassDefinition's get resolved by NewDefinition rather than here.
if (!(widgetDefinition instanceof ClassDefinition)) {
- if (widgetDefinition instanceof NewDefinition) {
+ if (widgetDefinition instanceof ExpandMacroDefinition) {
+ // Remove ExpandMacroDefinition in preparation for its referenced class of widget definitions to be added.
+ this.definitionsIt.remove();
+ ((ExpandMacroDefinition)widgetDefinition).resolve(parents, definition);
+ } else if (widgetDefinition instanceof NewDefinition) {
// Remove NewDefinition in preparation for its referenced class of widget definitions to be added.
this.definitionsIt.remove();
((NewDefinition)widgetDefinition).resolve(parents, definition);
} else {
if (widgetDefinition instanceof ContainerDefinition)
((ContainerDefinition)widgetDefinition).resolve(parents, definition);
+ else if (widgetDefinition instanceof ImportDefinition)
+ ((ImportDefinition)widgetDefinition).resolve(parents, definition);
}
}
}
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java Thu Jan 13 13:42:02 2005
@@ -16,6 +16,11 @@
package org.apache.cocoon.forms.transformation;
import org.apache.avalon.excalibur.pool.Recyclable;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.components.source.SourceUtil;
+import org.apache.cocoon.forms.CacheManager;
import org.apache.cocoon.forms.Constants;
import org.apache.cocoon.forms.formmodel.AggregateField;
import org.apache.cocoon.forms.formmodel.ContainerWidget;
@@ -32,6 +37,7 @@
import org.apache.cocoon.xml.SaxBuffer;
import org.apache.cocoon.xml.XMLUtils;
import org.apache.commons.jxpath.JXPathException;
+import org.apache.excalibur.source.Source;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
@@ -63,7 +69,12 @@
*
* @version CVS $Id$
*/
-public class EffectWidgetReplacingPipe extends EffectPipe {
+public class EffectWidgetReplacingPipe extends EffectPipe implements Serviceable {
+
+ /**
+ * Cache prefix for storing Cocoon Forms templates.
+ */
+ private static final String CACHE_PREFIX = "CocoonTemplate:";
/**
* Form location attribute on <code>ft:form-template</code> element, containing
@@ -79,6 +90,9 @@
private static final String CONTINUATION_ID = "continuation-id";
private static final String FORM_TEMPLATE_EL = "form-template";
private static final String GROUP = "group";
+ private static final String IMPORT = "import";
+ private static final String MACRO = "macro";
+ private static final String MACROS = "macros";
private static final String NEW = "new";
private static final String REPEATER_SIZE = "repeater-size";
private static final String REPEATER_WIDGET = "repeater-widget";
@@ -90,12 +104,19 @@
private static final String WIDGET = "widget";
private static final String WIDGET_LABEL = "widget-label";
+ protected ServiceManager manager;
+ protected CacheManager cacheManager;
+
+ protected LinkedList chooseWidgets;
protected Widget contextWidget;
protected LinkedList contextWidgets;
- protected LinkedList chooseWidgets;
- protected String widgetPath;
+ protected Map macros;
+ protected LinkedList prefixStack;
+ protected Map prefixes;
+ protected LinkedList paramStack;
+ protected Map params;
protected Widget widget;
- protected Map classes;
+ protected String widgetPath;
private final AggregateWidgetHandler aggregateWidgetHandler = new AggregateWidgetHandler();
private final ChooseHandler chooseHandler = new ChooseHandler();
@@ -105,8 +126,15 @@
private final DocHandler docHandler = new DocHandler();
private final FormHandler formHandler = new FormHandler();
private final GroupHandler groupHandler = new GroupHandler();
+ private final ImportHandler importHandler = new ImportHandler();
+ private final MacroDocHandler macroDocHandler = new MacroDocHandler();
+ private final MacroHandler macroHandler = new MacroHandler();
+ private final MacroDefineHandler macroDefineHandler = new MacroDefineHandler();
+ private final MacroExpandHandler macroExpandHandler = new MacroExpandHandler();
+ private final MacrosHandler macrosHandler = new MacrosHandler();
private final NestedHandler nestedHandler = new NestedHandler();
private final NewHandler newHandler = new NewHandler();
+ private final ParamHandler paramHandler = new ParamHandler();
private final RepeaterSizeHandler repeaterSizeHandler = new RepeaterSizeHandler();
private final RepeaterWidgetHandler repeaterWidgetHandler = new RepeaterWidgetHandler();
private final RepeaterWidgetLabelHandler repeaterWidgetLabelHandler = new RepeaterWidgetLabelHandler();
@@ -144,6 +172,8 @@
templates.put(CLASS, classHandler);
templates.put(CONTINUATION_ID, continuationIdHandler);
templates.put(GROUP, groupHandler);
+ templates.put(IMPORT, importHandler);
+ templates.put(MACRO, macroHandler);
templates.put(NEW, newHandler);
templates.put(REPEATER_SIZE, repeaterSizeHandler);
templates.put(REPEATER_WIDGET, repeaterWidgetHandler);
@@ -155,8 +185,9 @@
templates.put(WIDGET_LABEL, widgetLabelHandler);
}
- private void throwSAXException(String message) throws SAXException{
- throw new SAXException("EffectFormTemplateTransformer: " + message);
+ public void service(ServiceManager manager) throws ServiceException {
+ this.manager = manager;
+ this.cacheManager = (CacheManager)manager.lookup(CacheManager.ROLE);
}
public void init(Widget contextWidget, FormsPipelineConfig pipeContext) {
@@ -167,9 +198,17 @@
handler = docHandler;
// Initialize widget related variables
- contextWidgets = new LinkedList();
chooseWidgets = new LinkedList();
- classes = new HashMap();
+ contextWidgets = new LinkedList();
+ macros = new HashMap();
+ paramStack = new LinkedList();
+ params = new HashMap();
+ prefixStack = new LinkedList();
+ prefixes = new HashMap();
+ }
+
+ private void throwSAXException(String message) throws SAXException{
+ throw new SAXException("EffectFormTemplateTransformer: " + message);
}
protected String getLocation() {
@@ -409,7 +448,10 @@
public Handler process() throws SAXException {
switch (event) {
case EVENT_START_ELEMENT:
- widgetPath = getWidgetId(input.attrs);
+ String id = getWidgetId(input.attrs);
+ if (id.startsWith("@"))
+ id = (String)params.get(id.substring(1));
+ widgetPath = id;
Widget widget = getWidget(widgetPath);
widget.generateLabel(getContentHandler());
widget = null;
@@ -429,7 +471,11 @@
public Handler process() throws SAXException {
switch (event) {
case EVENT_START_ELEMENT:
- widgetPath = getWidgetId(input.attrs);
+ String id = getWidgetId(input.attrs);
+ if (id.startsWith("@")) {
+ id = (String)params.get(id.substring(1));
+ }
+ widgetPath = id;
widget = getWidget(widgetPath);
if (isVisible(widget)) {
@@ -772,22 +818,231 @@
}
}
+ protected class ImportHandler extends Handler {
+ public Handler process() throws SAXException {
+ switch (event) {
+ case EVENT_START_ELEMENT:
+ String prefix = input.attrs.getValue("prefix");
+ String uri = input.attrs.getValue("uri");
+ Source source = null;
+ try {
+ source = pipeContext.resolver.resolveURI(uri);
+ } catch(Exception e) {
+ throw new RuntimeException("Trouble resolving source: \"" + uri + "\", " + e.getMessage());
+ }
+ // TODO: Decide how to deal with imports which duplicate the prefix and/or uri
+ Map myMacros = (Map)cacheManager.get(source, CACHE_PREFIX);
+ if (myMacros == null) {
+ locators.addFirst(locator);
+ handlers.addFirst(handler);
+ prefixStack.addFirst(prefixes);
+ prefixStack.addFirst(macros);
+ handler = macroDocHandler;
+ prefixes = new HashMap();
+ macros = new HashMap();
+ try {
+ SourceUtil.toSAX(source, (ContentHandler)EffectWidgetReplacingPipe.this);
+ } catch(Exception e) {
+ throw new RuntimeException("Trouble accessing source: " + uri + ", " + e.getMessage());
+ }
+ // Hack.
+ macros.put("prefixes", prefixes);
+ try {
+ cacheManager.set(macros, source, CACHE_PREFIX);
+ } catch(Exception e) {
+ throw new RuntimeException("Trouble caching source: " + uri + ", " + e.getMessage());
+ }
+ myMacros = macros;
+ macros = (Map)prefixStack.removeFirst();
+ prefixes = (Map)prefixStack.removeFirst();
+ handler = (Handler)handlers.removeFirst();
+ locator = (Locator)locators.removeFirst();
+ }
+ // Register imported macros.
+ prefixes.put(prefix, myMacros);
+ return this;
+ case EVENT_ELEMENT:
+ return nullHandler;
+ case EVENT_END_ELEMENT:
+ return this;
+ default:
+ return this;
+ }
+ }
+ }
+
+ protected class MacroDocHandler extends Handler {
+ public Handler process() throws SAXException {
+ switch(event) {
+ case EVENT_ELEMENT:
+ if (Constants.TEMPLATE_NS.equals(input.uri) && MACROS.equals(input.loc)) {
+ return macrosHandler;
+ }
+ throw new RuntimeException("Encountered \""
+ + input.uri + "." + input.loc + "\", but root element must be \""
+ + Constants.TEMPLATE_NS + "." + MACROS + "\"");
+ default:
+ return this;
+ }
+ }
+ }
+
+ protected class MacrosHandler extends Handler {
+ public Handler process() throws SAXException {
+ switch(event) {
+ case EVENT_ELEMENT:
+ if (Constants.TEMPLATE_NS.equals(input.uri) && MACRO.equals(input.loc)) {
+ return macroHandler;
+ } else if (Constants.TEMPLATE_NS.equals(input.uri) && IMPORT.equals(input.loc)) {
+ return importHandler;
+ }
+ throw new RuntimeException("Encountered \"" + input.uri + "." + input.loc
+ + "\", but only " + Constants.TEMPLATE_NS + "." + MACRO
+ + " and " + Constants.TEMPLATE_NS + "." + IMPORT
+ + " elements are allowed as children of a " + Constants.TEMPLATE_NS
+ + "." + MACROS + " element.");
+ default:
+ return this;
+ }
+ }
+ }
+
+ protected class MacroHandler extends Handler {
+ public Handler process() throws SAXException {
+ switch (event) {
+ case EVENT_START_ELEMENT:
+ String define = input.attrs.getValue("define");
+ String expand = input.attrs.getValue("expand");
+ if (define != null && !"".equals(define)) {
+ return macroDefineHandler.process();
+ } else if (expand != null && !"".equals(expand)) {
+ return macroExpandHandler.process();
+ } else {
+ String location = null;
+ if (locator != null) {
+ location = " (" + locator.getSystemId() + ":"
+ + locator.getLineNumber() + ":" + locator.getColumnNumber() + ")";
+ }
+ throw new RuntimeException("Macro must either be define'ed or expand'ed" + location);
+ }
+ default:
+ throw new RuntimeException("Error encountered by MacroHandler.");
+ }
+ }
+ }
+
+ protected class MacroDefineHandler extends Handler {
+ public Handler process() throws SAXException {
+ switch (event) {
+ case EVENT_START_ELEMENT:
+ widgetPath = input.attrs.getValue("define");
+ out.bufferInit();
+ return this;
+ case EVENT_ELEMENT:
+ return bufferHandler;
+ case EVENT_END_ELEMENT:
+ macros.put(widgetPath, out.getBuffer());
+ out.bufferFini();
+ return this;
+ default:
+ out.buffer();
+ return this;
+ }
+ }
+ }
+
+ protected class MacroExpandHandler extends Handler {
+ public Handler process() throws SAXException {
+ switch (event) {
+ case EVENT_START_ELEMENT:
+ widgetPath = input.attrs.getValue("expand");
+ paramStack.addFirst(params);
+ params = new HashMap();
+ return this;
+ case EVENT_ELEMENT:
+ return paramHandler;
+ case EVENT_END_ELEMENT:
+ boolean prefixed = false;
+ String parts[] = widgetPath.split(":");
+ SaxBuffer macroBuffer = null;
+ switch (parts.length) {
+ case 1:
+ macroBuffer = (SaxBuffer)macros.get(widgetPath);
+ break;
+ case 2:
+ prefixed = true;
+ Map prefixMap = (Map)prefixes.get(parts[0]);
+ if (prefixMap == null) {
+ throw new RuntimeException("Prefix: " + parts[0] + " does not exist.");
+ }
+ macroBuffer = (SaxBuffer)prefixMap.get(parts[1]);
+ prefixStack.addFirst(prefixes);
+ prefixStack.addFirst(macros);
+ macros = prefixMap;
+ prefixes = (Map)macros.get("prefixes");
+ break;
+ default:
+ throw new RuntimeException("Error: Macro " + widgetPath + " does not exist.");
+ }
+ if (macroBuffer == null) {
+ String location = null;
+ if (locator != null) {
+ location = " (" + locator.getSystemId() + ":"
+ + locator.getLineNumber() + ":" + locator.getColumnNumber() + ")";
+ }
+ throwSAXException("Macro expand: Macro \"" + widgetPath + "\" does not exist" + location);
+ }
+ handlers.addFirst(handler);
+ handler = nestedHandler;
+ macroBuffer.toSAX(EffectWidgetReplacingPipe.this);
+ params = (Map)paramStack.removeFirst();
+ handler = (Handler)handlers.removeFirst();
+ if (prefixed) {
+ macros = (Map)prefixStack.removeFirst();
+ prefixes = (Map)prefixStack.removeFirst();
+ }
+ return this;
+ default:
+ out.copy();
+ return this;
+ }
+ }
+ }
+
+ protected class ParamHandler extends Handler {
+ public Handler process() throws SAXException {
+ switch (event) {
+ case EVENT_START_ELEMENT:
+ if (Constants.TEMPLATE_NS.equals(input.uri)) {
+ if ("param".equals(input.loc)) {
+ String name = input.attrs.getValue("name");
+ String value = input.attrs.getValue("value");
+ params.put(name, value);
+ }
+ }
+ return nullHandler;
+ default:
+ return this;
+ }
+ }
+ }
+
protected class NewHandler extends Handler {
public Handler process() throws SAXException {
switch (event) {
case EVENT_START_ELEMENT:
widgetPath = getWidgetId(input.attrs);
- SaxBuffer classBuffer = (SaxBuffer)classes.get(widgetPath);
- if (classBuffer == null) {
+ SaxBuffer macroBuffer = (SaxBuffer)macros.get(widgetPath);
+ if (macroBuffer == null) {
throwSAXException("New: Class \"" + widgetPath + "\" does not exist.");
}
handlers.addFirst(handler);
handler = nestedHandler;
- classBuffer.toSAX(EffectWidgetReplacingPipe.this);
+ macroBuffer.toSAX(EffectWidgetReplacingPipe.this);
handler = (Handler)handlers.removeFirst();
return this;
case EVENT_ELEMENT:
- return nullHandler;
+ return paramHandler;
case EVENT_END_ELEMENT:
return this;
default:
@@ -807,7 +1062,7 @@
case EVENT_ELEMENT:
return bufferHandler;
case EVENT_END_ELEMENT:
- classes.put(widgetPath, out.getBuffer());
+ macros.put(widgetPath, out.getBuffer());
out.bufferFini();
return this;
default:
@@ -929,8 +1184,11 @@
for (int i = 0; i < names.length; i++) {
String name = names[i];
int position = newAtts.getIndex(name);
- String newValue = pipeContext.translateText(newAtts.getValue(position));
- newAtts.setValue(position, newValue);
+ // TODO: Should we indicate an error if the name is not found in newAtts?
+ if (position >= 0) {
+ String newValue = pipeContext.translateText(newAtts.getValue(position));
+ newAtts.setValue(position, newValue);
+ }
}
}
return newAtts;
@@ -989,9 +1247,16 @@
public void recycle() {
super.recycle();
this.contextWidget = null;
+ this.contextWidgets = null;
this.widget = null;
this.widgetPath = null;
this.pipeContext = null;
this.namespacePrefix = null;
+ this.chooseWidgets = null;
+ this.macros = null;
+ this.params = null;
+ this.paramStack = null;
+ this.prefixes = null;
+ this.prefixStack = null;
}
}
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java Thu Jan 13 13:42:02 2005
@@ -26,6 +26,7 @@
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.Session;
+import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.forms.formmodel.Form;
import org.apache.cocoon.i18n.I18nUtils;
import org.apache.cocoon.xml.AttributesImpl;
@@ -45,6 +46,11 @@
*/
public static final String CFORMSKEY = "CocoonFormsInstance";
+ /**
+ * Source resolver.
+ */
+ public final SourceResolver resolver;
+
/**
* Name of the request attribute under which the Cocoon Form is stored (optional). */
private final String attributeName;
@@ -77,6 +83,18 @@
private FormsPipelineConfig(JXPathContext jxpc, Request req, Locale localeParam,
String attName, String actionExpression, String method) {
+ this.resolver = null;
+ this.attributeName = attName;
+ this.request = req;
+ this.jxpathContext =jxpc;
+ this.localeParameter = localeParam;
+ this.formAction = translateText(actionExpression);
+ this.formMethod = method;
+ }
+
+ private FormsPipelineConfig(SourceResolver resolver, JXPathContext jxpc, Request req, Locale localeParam,
+ String attName, String actionExpression, String method) {
+ this.resolver = resolver;
this.attributeName = attName;
this.request = req;
this.jxpathContext =jxpc;
@@ -95,6 +113,20 @@
* settings in the sitemap.
*/
public static FormsPipelineConfig createConfig(Map objectModel, Parameters parameters) {
+ return createConfig(null, objectModel, parameters);
+ }
+
+ /**
+ * Creates and initializes a FormsPipelineConfig object based on the passed
+ * arguments of the setup() of the specific Pipeline-component.
+ *
+ * @param resolver the SourceResolver as passed in the setup()
+ * @param objectModel the objectmodel as passed in the setup()
+ * @param parameters the parameters as passed in the setup()
+ * @return an instance of FormsPipelineConfig initialized according to the
+ * settings in the sitemap.
+ */
+ public static FormsPipelineConfig createConfig(SourceResolver resolver, Map objectModel, Parameters parameters) {
// create and set the jxpathContext...
Object flowContext = FlowHelper.getContextObject(objectModel);
WebContinuation wk = FlowHelper.getWebContinuation(objectModel);
@@ -120,7 +152,7 @@
// Note generator will also need some text to go on the submit-button?
// Alternative to adding more here is to apply xinclude ?
- return new FormsPipelineConfig(jxpc, request, localeParameter,
+ return new FormsPipelineConfig(resolver, jxpc, request, localeParameter,
attributeName, actionExpression, formMethod);
}
Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsTemplateTransformer.java
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsTemplateTransformer.java?view=diff&rev=125106&p1=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsTemplateTransformer.java&r1=125105&p2=cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsTemplateTransformer.java&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsTemplateTransformer.java (original)
+++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsTemplateTransformer.java Thu Jan 13 13:42:02 2005
@@ -36,7 +36,7 @@
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters parameters)
throws ProcessingException, SAXException, IOException {
- FormsPipelineConfig pipeContext = FormsPipelineConfig.createConfig(objectModel, parameters);
+ FormsPipelineConfig pipeContext = FormsPipelineConfig.createConfig(resolver, objectModel, parameters);
super.init(null, pipeContext);
}
}
Added: cocoon/whiteboard/forms/samples/swan/data/complex_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/complex_binding.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/data/complex_binding.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,236 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+
+<!--
+Binding for example CForms form model GUI.
+
+@version CVS $Id: form_model_gui_binding.xml,v 1.3 2004/04/12 14:05:09 tim Exp $
+-->
+
+<fb:context
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ path="/fd:form"
+ lenient="true">
+
+ <fb:new id="widgets-class"/>
+
+ <fb:class id="widgets-class">
+ <fb:temp-repeater id="widgets"
+ parent-path="fd:widgets"
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind><fb:new id="widget-row-class"/></fb:on-bind>
+ </fb:temp-repeater>
+ </fb:class>
+
+ <fb:class id="widget-row-class">
+ <fb:new id="view-selector-class"/>
+ <fb:javascript id="type-selector" path="." direction="load">
+ <fb:load-form>
+ widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName());
+ if("view".equals(widget.lookupWidget("../view-selector").getValue())) {
+ widget.setProcessRequests(false);
+ widget.lookupWidget("../union").setProcessRequests(false);
+ }
+ </fb:load-form>
+ </fb:javascript>
+ <fb:union id="union" path=".">
+ <fb:new id="action-class"/>
+ <fb:new id="aggregatefield-class"/>
+ <fb:new id="booleanfield-class"/>
+ <fb:new id="class-class"/>
+ <fb:new id="field-class"/>
+ <fb:new id="new-class"/>
+ <fb:new id="output-class"/>
+ <fb:new id="repeater-class"/>
+ <fb:new id="row-action-class"/>
+ <fb:new id="struct-class"/>
+ <fb:new id="submit-class"/>
+ <fb:new id="union-class"/>
+ </fb:union>
+ </fb:class>
+
+ <fb:class id="view-selector-class">
+ <fb:javascript id="view-selector" path="." direction="load">
+ <fb:load-form>
+ widget.setValue("view");
+ </fb:load-form>
+ </fb:javascript>
+ </fb:class>
+
+ <fb:class id="label-class">
+ <fb:value id="label" path="fd:label"/>
+ </fb:class>
+
+ <fb:class id="action-class">
+ <fb:case id="action" path=".">
+ <fb:insert-node><fd:action/>
+</fb:insert-node>
+ <fb:struct id="action" path="fd:action">
+ <fb:value id="id" path="@id"/>
+ <fb:new id="label-class"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="aggregatefield-class">
+ <fb:case id="aggregatefield" path=".">
+ <fb:insert-node><fd:aggregatefield/>
+</fb:insert-node>
+ <fb:struct id="aggregatefield" path="fd:aggregatefield">
+ <fb:value id="id" path="@id"/>
+ <fb:new id="label-class"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ <fb:new id="widgets-class"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="booleanfield-class">
+ <fb:case id="booleanfield" path=".">
+ <fb:insert-node><fd:booleanfield/>
+</fb:insert-node>
+ <fb:struct id="booleanfield" path="fd:booleanfield">
+ <fb:value id="id" path="@id"/>
+ <fb:new id="label-class"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="class-class">
+ <fb:case id="class" path=".">
+ <fb:insert-node><fd:class/>
+</fb:insert-node>
+ <fb:struct id="class" path="fd:class" direction="load">
+ <fb:value id="id" path="@id"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ <fb:new id="widgets-class"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="field-class">
+ <fb:case id="field" path=".">
+ <fb:insert-node><fd:field/>
+</fb:insert-node>
+ <fb:struct id="field" path="fd:field">
+ <fb:value id="id" path="@id"/>
+ <fb:new id="label-class"/>
+ <fb:value id="required" path="@required">
+ <fd:convertor datatype="boolean"/>
+ </fb:value>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="new-class">
+ <fb:case id="new" path=".">
+ <fb:insert-node><fd:new/>
+</fb:insert-node>
+ <fb:struct id="new" path="fd:new">
+ <fb:value id="id" path="@id"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="output-class">
+ <fb:case id="output" path=".">
+ <fb:insert-node><fd:output/>
+</fb:insert-node>
+ <fb:struct id="output" path="fd:output">
+ <fb:value id="id" path="@id"/>
+ <fb:new id="label-class"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="repeater-class">
+ <fb:case id="repeater" path=".">
+ <fb:insert-node><fd:repeater/>
+</fb:insert-node>
+ <fb:struct id="repeater" path="fd:repeater">
+ <fb:value id="id" path="@id"/>
+ <fb:new id="label-class"/>
+ <fb:value id="initial-size" path="@initial-size">
+ <fd:convertor datatype="long"/>
+ </fb:value>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ <fb:new id="widgets-class"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="row-action-class">
+ <fb:case id="row-action" path=".">
+ <fb:insert-node><fd:row-action/>
+</fb:insert-node>
+ <fb:struct id="row-action" path="fd:row-action">
+ <fb:value id="id" path="@id"/>
+ <fb:new id="label-class"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="struct-class">
+ <fb:case id="struct" path=".">
+ <fb:insert-node><fd:struct/>
+</fb:insert-node>
+ <fb:struct id="struct" path="fd:struct">
+ <fb:value id="id" path="@id"/>
+ <fb:new id="label-class"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ <fb:new id="widgets-class"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="submit-class">
+ <fb:case id="submit" path=".">
+ <fb:insert-node><fd:submit/>
+</fb:insert-node>
+ <fb:struct id="submit" path="fd:submit">
+ <fb:value id="id" path="@id"/>
+ <fb:new id="label-class"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+ <fb:class id="union-class">
+ <fb:case id="union" path=".">
+ <fb:insert-node><fd:union/>
+</fb:insert-node>
+ <fb:struct id="union" path="fd:union">
+ <fb:value id="id" path="@id"/>
+ <fb:new id="label-class"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ <fb:new id="widgets-class"/>
+ </fb:struct>
+ </fb:case>
+ </fb:class>
+
+</fb:context>
Added: cocoon/whiteboard/forms/samples/swan/data/complex_model.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/complex_model.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/data/complex_model.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:form
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+ <fd:action id="action"><fd:label>Action</fd:label></fd:action>
+ <fd:aggregatefield id="aggregatefield">
+ <fd:label>Aggregate Field</fd:label>
+ <fd:widgets>
+ <fd:field id="aggregatefield1" required="true"><fd:label>Aggregate Field 1</fd:label></fd:field>
+ <fd:field id="aggregatefield2" required="true"><fd:label>Aggregate Field 2</fd:label></fd:field>
+ </fd:widgets>
+ </fd:aggregatefield>
+ <fd:booleanfield id="booleanfield"><fd:label>Boolean Field</fd:label></fd:booleanfield>
+ <fd:class id="class">
+ <fd:label>Class</fd:label>
+ <fd:widgets>
+ <fd:booleanfield id="booleanfield"><fd:label>Boolean Field</fd:label></fd:booleanfield>
+ <fd:field id="field"><fd:label>Field</fd:label></fd:field>
+ </fd:widgets>
+ </fd:class>
+ <fd:field id="field" required="true"><fd:label>Field</fd:label></fd:field>
+ <fd:macro define="macro">
+ <fd:field id="field"><fd:label>Field</fd:label></fd:field>
+ </fd:macro>
+ <fd:macro expand="macro"/>
+ <fd:new id="class"/>
+ <fd:output id="output"><fd:label>Output</fd:label></fd:output>
+ <fd:repeater id="repeater" initial-size="2">
+ <fd:label>Repeater</fd:label>
+ <fd:widgets>
+ <fd:field id="field"><fd:label>Field</fd:label></fd:field>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:row-action id="row-action"><fd:label>RowAction</fd:label></fd:row-action>
+ <fd:struct id="struct">
+ <fd:label>Struct</fd:label>
+ <fd:widgets>
+ <fd:booleanfield id="booleanfield"><fd:label>Boolean Field</fd:label></fd:booleanfield>
+ <fd:field id="field" required="true"><fd:label>Field</fd:label></fd:field>
+ </fd:widgets>
+ </fd:struct>
+ <fd:submit id="submit"><fd:label>Submit</fd:label></fd:submit>
+ <fd:union id="union">
+ <fd:label>Union</fd:label>
+ <fd:widgets>
+ <fd:booleanfield id="booleanfield"><fd:label>Boolean Field</fd:label></fd:booleanfield>
+ <fd:field id="field"><fd:label>Field</fd:label></fd:field>
+ </fd:widgets>
+ </fd:union>
+ </fd:widgets>
+</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/data/complex_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/complex_template.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/data/complex_template.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,171 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<page
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+
+ <!--
+ CVS $Id: form_model_gui_template.xml,v 1.2 2004/04/12 14:05:09 tim Exp $
+ -->
+
+ <!--
+ TODO: Add features to "widgets-class" (e.g. move-up, move-down, add-before, add-after).
+ -->
+
+ <title>Form GUI</title>
+
+ <content>
+ <ft:form-template action="#{$continuation/id}.continue" method="POST">
+
+ <ft:class id="id-class"><ft:widget-label id="id"/>:<ft:widget id="id"/></ft:class>
+ <ft:class id="label-class"><ft:widget-label id="label"/>:<ft:widget id="label"/></ft:class>
+ <ft:class id="required-class"><ft:widget-label id="required"/>:<ft:widget id="required"/></ft:class>
+ <ft:class id="initial-size-class"><ft:widget-label id="initial-size"/>:<ft:widget id="initial-size"/></ft:class>
+
+ <ft:class id="widget-row-class">
+ <td>
+ <ft:widget id="select"/>
+ </td>
+ <td>
+ <ft:widget id="type">
+ <fi:styling list-type="dropdown" submit-on-change="true"/>
+ </ft:widget>
+
+ <ft:union id="union">
+
+ <ft:case id="">
+ </ft:case>
+
+ <ft:case id="action">
+ <ft:struct id="action">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="aggregatefield">
+ <ft:struct id="aggregatefield">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ <ft:new id="widgets-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="booleanfield">
+ <ft:struct id="booleanfield">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="class">
+ <ft:struct id="class">
+ <ft:new id="id-class"/>
+ <ft:new id="widgets-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="field">
+ <ft:struct id="field">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ <ft:new id="required-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="new">
+ <ft:struct id="new">
+ <ft:new id="id-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="output">
+ <ft:struct id="output">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="struct">
+ <ft:struct id="struct">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ <ft:new id="widgets-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="repeater">
+ <ft:struct id="repeater">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ <ft:new id="initial-size-class"/>
+ <ft:new id="widgets-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="row-action">
+ <ft:struct id="row-action">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="submit">
+ <ft:struct id="submit">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="union">
+ <ft:struct id="union">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ <ft:new id="widgets-class"/>
+ </ft:struct>
+ </ft:case>
+
+ </ft:union>
+ </td>
+ </ft:class>
+
+ <ft:class id="widgets-class">
+ <ft:repeater-size id="widgets"/>
+ <table border="4">
+ <ft:repeater-widget id="widgets">
+ <tr><ft:new id="widget-row-class"/></tr>
+ </ft:repeater-widget>
+ </table>
+ <ft:widget id="addWidget"/>
+ <ft:widget id="removeWidgets"/><br/>
+ </ft:class>
+
+ <table align="center" border="3">
+ <tr>
+ <td>
+ <p>
+ <ft:new id="widgets-class"/>
+ </p>
+ <input type="submit"/>
+ </td>
+ </tr>
+ </table>
+
+ </ft:form-template>
+ </content>
+
+</page>
Deleted: /cocoon/whiteboard/forms/samples/swan/data/form_model_gui_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/form_model_gui_binding.xml?view=auto&rev=125105
==============================================================================
Deleted: /cocoon/whiteboard/forms/samples/swan/data/form_model_gui_data-result.xml.orig
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/form_model_gui_data-result.xml.orig?view=auto&rev=125105
==============================================================================
Deleted: /cocoon/whiteboard/forms/samples/swan/data/form_model_gui_data.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/form_model_gui_data.xml?view=auto&rev=125105
==============================================================================
Deleted: /cocoon/whiteboard/forms/samples/swan/data/form_model_gui_template_data.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/form_model_gui_template_data.xml?view=auto&rev=125105
==============================================================================
Added: cocoon/whiteboard/forms/samples/swan/data/medium_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/medium_binding.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/data/medium_binding.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:form
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:booleanfield id="samp-booleanfield"><fd:label>Sample BooleanField for sample form 2</fd:label></fd:booleanfield>
+
+ <fd:field id="samp-field" required="true"><fd:label>Sample Field</fd:label></fd:field>
+
+ </fd:widgets>
+</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/data/medium_model.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/medium_model.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/data/medium_model.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:form
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:booleanfield id="samp-booleanfield"><fd:label>Sample BooleanField for sample form 2</fd:label></fd:booleanfield>
+
+ <fd:field id="samp-field" required="true"><fd:label>Sample Field</fd:label></fd:field>
+
+ </fd:widgets>
+</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/data/medium_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/medium_template.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/data/medium_template.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,171 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<page
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+
+ <!--
+ CVS $Id: form_model_gui_template.xml,v 1.2 2004/04/12 14:05:09 tim Exp $
+ -->
+
+ <!--
+ TODO: Add features to "widgets-class" (e.g. move-up, move-down, add-before, add-after).
+ -->
+
+ <title>Form GUI</title>
+
+ <content>
+ <ft:form-template action="#{$continuation/id}.continue" method="POST">
+
+ <ft:class id="id-class"><ft:widget-label id="id"/>:<ft:widget id="id"/></ft:class>
+ <ft:class id="label-class"><ft:widget-label id="label"/>:<ft:widget id="label"/></ft:class>
+ <ft:class id="required-class"><ft:widget-label id="required"/>:<ft:widget id="required"/></ft:class>
+ <ft:class id="initial-size-class"><ft:widget-label id="initial-size"/>:<ft:widget id="initial-size"/></ft:class>
+
+ <ft:class id="widget-row-class">
+ <td>
+ <ft:widget id="select"/>
+ </td>
+ <td>
+ <ft:widget id="type">
+ <fi:styling list-type="dropdown" submit-on-change="true"/>
+ </ft:widget>
+
+ <ft:union id="union">
+
+ <ft:case id="">
+ </ft:case>
+
+ <ft:case id="action">
+ <ft:struct id="action">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="aggregatefield">
+ <ft:struct id="aggregatefield">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ <ft:new id="widgets-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="booleanfield">
+ <ft:struct id="booleanfield">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="class">
+ <ft:struct id="class">
+ <ft:new id="id-class"/>
+ <ft:new id="widgets-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="field">
+ <ft:struct id="field">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ <ft:new id="required-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="new">
+ <ft:struct id="new">
+ <ft:new id="id-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="output">
+ <ft:struct id="output">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="struct">
+ <ft:struct id="struct">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ <ft:new id="widgets-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="repeater">
+ <ft:struct id="repeater">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ <ft:new id="initial-size-class"/>
+ <ft:new id="widgets-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="row-action">
+ <ft:struct id="row-action">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="submit">
+ <ft:struct id="submit">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ </ft:struct>
+ </ft:case>
+
+ <ft:case id="union">
+ <ft:struct id="union">
+ <ft:new id="id-class"/>
+ <ft:new id="label-class"/>
+ <ft:new id="widgets-class"/>
+ </ft:struct>
+ </ft:case>
+
+ </ft:union>
+ </td>
+ </ft:class>
+
+ <ft:class id="widgets-class">
+ <ft:repeater-size id="widgets"/>
+ <table border="4">
+ <ft:repeater-widget id="widgets">
+ <tr><ft:new id="widget-row-class"/></tr>
+ </ft:repeater-widget>
+ </table>
+ <ft:widget id="addWidget"/>
+ <ft:widget id="removeWidgets"/><br/>
+ </ft:class>
+
+ <table align="center" border="3">
+ <tr>
+ <td>
+ <p>
+ <ft:new id="widgets-class"/>
+ </p>
+ <input type="submit"/>
+ </td>
+ </tr>
+ </table>
+
+ </ft:form-template>
+ </content>
+
+</page>
Deleted: /cocoon/whiteboard/forms/samples/swan/data/sample_form_1.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/sample_form_1.xml?view=auto&rev=125105
==============================================================================
Deleted: /cocoon/whiteboard/forms/samples/swan/data/sample_form_1_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/sample_form_1_template.xml?view=auto&rev=125105
==============================================================================
Deleted: /cocoon/whiteboard/forms/samples/swan/data/sample_form_2.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/sample_form_2.xml?view=auto&rev=125105
==============================================================================
Deleted: /cocoon/whiteboard/forms/samples/swan/data/sample_form_2_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/sample_form_2_template.xml?view=auto&rev=125105
==============================================================================
Added: cocoon/whiteboard/forms/samples/swan/data/simple_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/simple_binding.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/data/simple_binding.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+--><fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:field id="samp-field" required="true"><fd:label>Sample Field for sample form 1</fd:label></fd:field>
+ <fd:output id="output-field"><fd:label>This is my output field yet again</fd:label></fd:output>
+ </fd:widgets>
+</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/data/simple_model.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/simple_model.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/data/simple_model.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+--><fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:field id="samp-field" required="true"><fd:label>Sample Field for sample form 1</fd:label></fd:field>
+ <fd:output id="output-field"><fd:label>This is my output field yet again</fd:label></fd:output>
+ </fd:widgets>
+</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/data/simple_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/data/simple_template.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/data/simple_template.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<page
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+
+ <!--
+ CVS $Id: form_model_gui_template.xml,v 1.2 2004/04/12 14:05:09 tim Exp $
+ -->
+
+ <!--
+ TODO: Add features to "widgets-class" (e.g. move-up, move-down, add-before, add-after).
+ -->
+
+ <title>Form GUI</title>
+
+ <content>
+ <ft:form-template action="#{$continuation/id}.continue" method="POST">
+
+ <ft:widget-label id="samp-field"/>:<ft:widget id="samp-field"/>
+ <ft:widget-label id="output-field"/>:<ft:widget id="output-field"/>
+
+ </ft:form-template>
+ </content>
+
+</page>
Modified: cocoon/whiteboard/forms/samples/swan/flow/swan.js
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/flow/swan.js?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/flow/swan.js&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/flow/swan.js&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/flow/swan.js (original)
+++ cocoon/whiteboard/forms/samples/swan/flow/swan.js Thu Jan 13 13:42:02 2005
@@ -17,6 +17,10 @@
// CVS $Id$
+function editor(form) {
+ editor_gui(form, "editor");
+}
+
function binding_gui(form) {
editor_gui(form, "binding");
}
@@ -37,6 +41,22 @@
editor_gui(form, "xreport");
}
+function bind(form, allowed_files, documentURI) {
+ if (!present(documentURI, allowed_files)) {
+ cocoon.sendPage(type + "-error-pipeline");
+ return;
+ }
+
+ // prepend data directory
+ documentURI = "data/" + documentURI;
+
+ // parse the document to a DOM-tree
+ var document = loadDocument(documentURI);
+
+ // bind the document data to the form
+ form.load(document);
+}
+
function editor_gui(form, type) {
var locale = determineLocale();
@@ -46,21 +66,26 @@
// get the documentURI parameter from the sitemap which
// contains the location of the file to be edited
var documentURI = cocoon.parameters["documentURI"];
+ var documentURI1 = cocoon.parameters["documentURI1"];
+ var documentURI2 = cocoon.parameters["documentURI2"];
+ var documentURI3 = cocoon.parameters["documentURI3"];
// Yes, this is a hack, but it closes
// the read-any-file security hole so
// that this can work out-of-the-box.
var allowed_files = [
"report1.xml", "sitemap.xmap",
- "form_model_gui_binding.xml", "form_model_gui_data.xml",
- "form_model_gui_template_data.xml",
- "sample_form_1.xml", "sample_form_1_template.xml",
- "sample_form_2.xml", "sample_form_2_template.xml"
+ "simple_binding.xml", "simple_model.xml", "simple_template.xml",
+ "medium_binding.xml", "medium_model.xml", "medium_template.xml",
+ "complex_binding.xml", "complex_model.xml", "complex_template.xml"
];
- if (!present(documentURI, allowed_files)) {
- cocoon.sendPage(type + "-error-pipeline");
- return;
+ if (type != "editor") {
+ bind(form, allowed_files, documentURI);
+ } else {
+ bind(form, allowed_files, documentURI1);
+ bind(form, allowed_files, documentURI2);
+ bind(form, allowed_files, documentURI3);
}
// prepend data directory
Modified: cocoon/whiteboard/forms/samples/swan/forms/binding_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/binding_binding.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/binding_binding.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/binding_binding.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/binding_binding.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/binding_binding.xml Thu Jan 13 13:42:02 2005
@@ -24,214 +24,11 @@
<fb:context
xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
- path="/fb:context"
+ path="."
lenient="true">
- <fb:new id="items-class"/>
+ <fb:import prefix="binding" uri="forms/binding_mb.xml"/>
- <fb:class id="aggregate-class">
- <fb:case id="aggregate" path=".">
- <fb:insert-node><fb:aggregate/>
-</fb:insert-node>
- <fb:group id="aggregate" path="fd:aggregate">
- <fb:group id="stuff" path=".">
- <fb:new id="id-class"/>
- <fb:new id="path-class"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="class-class">
- <fb:case id="class" path=".">
- <fb:insert-node><fb:class/>
-</fb:insert-node>
- <fb:group id="class" path="fb:class">
- <fb:group id="stuff" path=".">
- <fb:new id="id-class"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="group-class">
- <fb:case id="group" path=".">
- <fb:insert-node><fd:group/>
-</fb:insert-node>
- <fb:group id="group" path="fd:group">
- <fb:group id="stuff" path=".">
- <fb:new id="id-class"/>
- <fb:new id="label-class"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="javascript-class">
- <fb:case id="javascript" path=".">
- <fb:insert-node><fb:javascript/>
-</fb:insert-node>
- <fb:group id="javascript" path="fb:javascript">
- <fb:group id="stuff" path=".">
- <fb:new id="text-class"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="new-class">
- <fb:case id="new" path=".">
- <fb:insert-node><fb:new/>
-</fb:insert-node>
- <fb:group id="new" path="fb:new">
- <fb:group id="stuff" path=".">
- <fb:new id="id-class"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="repeater-class">
- <fb:case id="repeater" path=".">
- <fb:insert-node><fb:repeater/>
-</fb:insert-node>
- <fb:group id="repeater" path="fb:repeater">
- <fb:group id="stuff" path=".">
- <fb:insert-node>
- <fb:on-bind/>
- </fb:insert-node>
- <fb:new id="id-class"/>
- <fb:new id="parent-path-class"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="temp-repeater-class">
- <fb:case id="temp-repeater" path=".">
- <fb:insert-node><fb:temp-repeater/>
-</fb:insert-node>
- <fb:group id="temp-repeater" path="fb:temp-repeater">
- <fb:group id="stuff" path=".">
- <fb:new id="id-class"/>
- <fb:new id="parent-path-class"/>
- <fb:insert-node>
- <fb:on-bind/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="union-class">
- <fb:case id="union" path=".">
- <fb:insert-node><fb:union/>
-</fb:insert-node>
- <fb:group id="union" path="fb:union">
- <fb:group id="stuff" path=".">
- <fb:new id="id-class"/>
- <fb:new id="path-class"/>
- <fb:insert-node>
- <fd:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="value-class">
- <fb:case id="value" path=".">
- <fb:insert-node><fb:value/>
-</fb:insert-node>
- <fb:group id="value" path="fb:value">
- <fb:group id="stuff" path=".">
- <fb:new id="id-class"/>
- <fb:value id="path" path="@path"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="struct-class">
- <fb:case id="struct" path=".">
- <fb:insert-node><fd:struct/>
-</fb:insert-node>
- <fb:group id="struct" path="fd:struct">
- <fb:group id="stuff" path=".">
- <fb:new id="id-class"/>
- <fb:new id="label-class"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="id-class">
- <fb:value id="id" path="@id"/>
- </fb:class>
-
- <fb:class id="label-class">
- <fb:value id="label" path="fd:label"/>
- </fb:class>
-
- <fb:class id="parent-path-class">
- <fb:value id="parent-path" path="@parent-path"/>
- </fb:class>
-
- <fb:class id="path-class">
- <fb:value id="path" path="@path"/>
- </fb:class>
-
- <fb:class id="text-class">
- <fb:value id="text" path="@text"/>
- </fb:class>
-
- <fb:class id="view-selector-class">
- <fb:javascript id="view-selector" path="." direction="load">
- <fb:load-form>
- widget.setValue("edit");
- </fb:load-form>
- </fb:javascript>
- </fb:class>
-
- <fb:class id="items-class">
- <fb:temp-repeater id="items"
- parent-path="."
- row-path="*" row-path-insert="."
- virtual-rows="true">
- <fb:on-bind><fb:new id="item-row-class"/></fb:on-bind>
- </fb:temp-repeater>
- </fb:class>
-
- <fb:class id="item-row-class">
- <fb:javascript id="type-selector" path="." direction="load">
- <fb:load-form>
- widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName());
- </fb:load-form>
- </fb:javascript>
- <fb:union id="union" path=".">
- <fb:new id="aggregate-class"/>
- <fb:new id="class-class"/>
- <fb:new id="group-class"/>
- <fb:new id="javascript-class"/>
- <fb:new id="new-class"/>
- <fb:new id="temp-repeater-class"/>
- <fb:new id="struct-class"/>
- <fb:new id="union-class"/>
- <fb:new id="value-class"/>
- </fb:union>
- <!--
- The view-selector binding must happen last,
- so that all the widgets will exist that the
- view-selector's on-value-changed handler needs.
- -->
- <fb:new id="view-selector-class"/>
- </fb:class>
+ <fb:macro expand="binding:binding"/>
</fb:context>
Added: cocoon/whiteboard/forms/samples/swan/forms/binding_mb.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/binding_mb.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/binding_mb.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,221 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+
+<!--
+Binding for Swan form binding editor.
+
+@version CVS $Id$
+-->
+
+<fb:macros
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
+
+ <fb:import prefix="swan" uri="forms/swan_binding.xml"/>
+
+ <fb:macro define="binding">
+ <fb:context path="/fb:context" lenient="true">
+ <fb:macro expand="items"/>
+ </fb:context>
+ </fb:macro>
+
+ <fb:macro define="items">
+ <fb:temp-repeater id="items"
+ parent-path="."
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind><fb:macro expand="item-row"/></fb:on-bind>
+ </fb:temp-repeater>
+ </fb:macro>
+
+ <fb:macro define="item-row">
+ <fb:javascript id="type-selector" path="." direction="load">
+ <fb:load-form>
+ widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName());
+ </fb:load-form>
+ </fb:javascript>
+ <fb:union id="union" path=".">
+ <fb:macro expand="aggregate"/>
+ <fb:macro expand="class"/>
+ <fb:macro expand="group"/>
+ <fb:macro expand="javascript"/>
+ <fb:macro expand="new"/>
+ <fb:macro expand="temp-repeater"/>
+ <fb:macro expand="struct"/>
+ <fb:macro expand="union"/>
+ <fb:macro expand="value"/>
+ </fb:union>
+ <!--
+ The view-selector binding must happen last,
+ so that all the widgets will exist that the
+ view-selector's on-value-changed handler needs.
+ -->
+ <fb:macro expand="swan:view-selector"/>
+ </fb:macro>
+
+ <fb:macro define="aggregate">
+ <fb:case id="aggregate" path=".">
+ <fb:insert-node><fb:aggregate/>
+</fb:insert-node>
+ <fb:group id="aggregate" path="fd:aggregate">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="swan:path"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="class">
+ <fb:case id="class" path=".">
+ <fb:insert-node><fb:class/>
+</fb:insert-node>
+ <fb:group id="class" path="fb:class">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="group">
+ <fb:case id="group" path=".">
+ <fb:insert-node><fd:group/>
+</fb:insert-node>
+ <fb:group id="group" path="fd:group">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="swan:label"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="javascript">
+ <fb:case id="javascript" path=".">
+ <fb:insert-node><fb:javascript/>
+</fb:insert-node>
+ <fb:group id="javascript" path="fb:javascript">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="text"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="new">
+ <fb:case id="new" path=".">
+ <fb:insert-node><fb:new/>
+</fb:insert-node>
+ <fb:group id="new" path="fb:new">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="repeater">
+ <fb:case id="repeater" path=".">
+ <fb:insert-node><fb:repeater/>
+</fb:insert-node>
+ <fb:group id="repeater" path="fb:repeater">
+ <fb:group id="stuff" path=".">
+ <fb:insert-node>
+ <fb:on-bind/>
+ </fb:insert-node>
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="parent-path"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="temp-repeater">
+ <fb:case id="temp-repeater" path=".">
+ <fb:insert-node><fb:temp-repeater/>
+</fb:insert-node>
+ <fb:group id="temp-repeater" path="fb:temp-repeater">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="parent-path"/>
+ <fb:insert-node>
+ <fb:on-bind/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="union">
+ <fb:case id="union" path=".">
+ <fb:insert-node><fb:union/>
+</fb:insert-node>
+ <fb:group id="union" path="fb:union">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="swan:path"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="value">
+ <fb:case id="value" path=".">
+ <fb:insert-node><fb:value/>
+</fb:insert-node>
+ <fb:group id="value" path="fb:value">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:value id="path" path="@path"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="struct">
+ <fb:case id="struct" path=".">
+ <fb:insert-node><fd:struct/>
+</fb:insert-node>
+ <fb:group id="struct" path="fd:struct">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="swan:label"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="parent-path">
+ <fb:value id="parent-path" path="@parent-path"/>
+ </fb:macro>
+
+ <fb:macro define="text">
+ <fb:value id="text" path="@text"/>
+ </fb:macro>
+
+</fb:macros>
Added: cocoon/whiteboard/forms/samples/swan/forms/binding_mm.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/binding_mm.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/binding_mm.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,210 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:macros
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:import prefix="swan" uri="forms/swan_mm.xml"/>
+
+ <fd:macro define="binding">
+ <fd:widgets>
+ <fd:messages id="messages"/>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="items">
+ <fd:widgets>
+ <fd:repeater id="items" initial-size="0">
+ <fd:label>Items</fd:label>
+ <fd:widgets>
+ <fd:macro expand="item-row"/>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:macro expand="swan:add-item"/>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="type-selector">
+ <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="aggregate"><fd:label>Aggregate</fd:label></fd:item>
+ <fd:item value="class"><fd:label>Class</fd:label></fd:item>
+ <fd:item value="group"><fd:label>Group</fd:label></fd:item>
+ <fd:item value="javascript"><fd:label>Javascript</fd:label></fd:item>
+ <fd:item value="new"><fd:label>New</fd:label></fd:item>
+ <fd:item value="repeater"><fd:label>Repeater</fd:label></fd:item>
+ <fd:item value="temp-repeater"><fd:label>Repeater</fd:label></fd:item>
+ <fd:item value="struct"><fd:label>Struct</fd:label></fd:item>
+ <fd:item value="union"><fd:label>Union</fd:label></fd:item>
+ <fd:item value="value"><fd:label>Value</fd:label></fd:item>
+ </fd:selection-list>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="item-row">
+ <fd:widgets>
+
+ <fd:macro expand="swan:item-actions"/>
+ <fd:macro expand="swan:view-selector"/>
+ <fd:macro expand="type-selector"/>
+
+ <fd:union id="union" default="" case="type-selector">
+ <fd:label>Type</fd:label>
+ <fd:widgets>
+
+ <fd:group id="class">
+ <fd:label>Class</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="javascript">
+ <fd:label>Javascript</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:text"/>
+ <fd:macro expand="swan:path"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="new">
+ <fd:label>New</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="union">
+ <fd:label>Union</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:path"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="value">
+ <fd:label>Value</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:path"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="aggregate">
+ <fd:label>Aggregate</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ <fd:macro expand="swan:required"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="group">
+ <fd:label>Group</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="repeater">
+ <fd:label>Repeater</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ <fd:macro expand="swan:initial-size"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="temp-repeater">
+ <fd:label>Repeater</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:parent-path"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="struct">
+ <fd:label>Struct</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ </fd:widgets>
+
+ </fd:union>
+ </fd:widgets>
+ </fd:macro>
+
+ </fd:widgets>
+</fd:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/binding_model.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/binding_model.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/binding_model.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/binding_model.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/binding_model.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/binding_model.xml Thu Jan 13 13:42:02 2005
@@ -19,444 +19,9 @@
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<fd:widgets>
- <!--
- CVS $Id$
- -->
+ <fd:import prefix="binding" uri="forms/binding_mm.xml"/>
- <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.setValue("edit");
- // View is selected by buttons.
- view.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </javascript>
- </fd:on-action>
- </fd:repeater-action>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="view-selector-class">
- <fd:widgets>
- <fd:field id="view-selector">
- <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.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- if(stuff != null) {
- stuff.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- }
- type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- } else if("view".equals(widget.getValue())){
- union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- if(stuff != null) {
- stuff.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- }
- type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- } else {
- union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- type.setState(Packages.org.apache.cocoon.forms.formmodel.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="action"><fd:label>Action</fd:label></fd:item>
- <fd:item value="aggregatefield"><fd:label>AggregateField</fd:label></fd:item>
- <fd:item value="booleanfield"><fd:label>BooleanField</fd:label></fd:item>
- <fd:item value="class"><fd:label>Class</fd:label></fd:item>
- <fd:item value="field"><fd:label>Field</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="output"><fd:label>Output</fd:label></fd:item>
- <fd:item value="repeater"><fd:label>Repeater</fd:label></fd:item>
- <fd:item value="temp-repeater"><fd:label>Repeater</fd:label></fd:item>
- <fd:item value="row-action"><fd:label>RowAction</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="value"><fd:label>Value</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 = Packages.org.apache.cocoon.forms.formmodel.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.setValue("edit");
- // View is selected by buttons.
- view.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </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="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="javascript">
- <fd:label>Javascript</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="text-class"/>
- <fd:new id="path-class"/>
- </fd:widgets>
- </fd:group>
- </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="union">
- <fd:label>Union</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="path-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="value">
- <fd:label>Value</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="path-class"/>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:group>
-
-
- <fd:group id="action">
- <fd:label>Action</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:widgets>
- </fd:group>
-
- <fd:group id="aggregatefield">
- <fd:label>AggregateField</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="label-class"/>
- <fd:new id="required-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="booleanfield">
- <fd:label>BooleanField</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:widgets>
- </fd:group>
-
- <fd:group id="field">
- <fd:label>Field</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="label-class"/>
- <fd:new id="required-class"/>
- </fd:widgets>
- </fd:group>
- </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="output">
- <fd:label>Output</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:widgets>
- </fd:group>
-
- <fd:group id="repeater">
- <fd:label>Repeater</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="label-class"/>
- <fd:new id="initial-size-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="temp-repeater">
- <fd:label>Repeater</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="parent-path-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="row-action">
- <fd:label>RowAction</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: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="submit">
- <fd:label>Submit</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:widgets>
- </fd:group>
-
- </fd:widgets>
-
- </fd:union>
- </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="text-class">
- <fd:widgets>
- <fd:field id="text">
- <fd:label>Text</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="parent-path-class">
- <fd:widgets>
- <fd:field id="parent-path" required="true">
- <fd:label>Parent Path</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="path-class">
- <fd:widgets>
- <fd:field id="path" required="true">
- <fd:label>Path</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:macro expand="binding:binding"/>
</fd:widgets>
</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/forms/binding_mt.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/binding_mt.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/binding_mt.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,131 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<ft:macros
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+
+ <ft:import prefix="swan" uri="forms/swan_template.xml"/>
+
+ <ft:macro define="binding">
+ <ft:macro expand="item-list"/>
+ </ft:macro>
+
+ <ft:macro define="types">
+ <ft:union id="union">
+
+ <ft:case id="">
+ </ft:case>
+
+ <ft:case id="aggregate">
+ <ft:group id="aggregate">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:path"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="class">
+ <ft:group id="class">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="context">
+ <ft:group id="context">
+ <ft:macro expand="swan:path"/>
+ <ft:macro expand="swan:items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="group">
+ <ft:group id="group">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:path"/>
+ <ft:macro expand="swan:items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="javascript">
+ <ft:group id="javascript">
+ <ft:macro expand="swan:text"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="new">
+ <ft:group id="new">
+ <ft:macro expand="swan:id"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="repeater">
+ <ft:group id="repeater">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:parent-path"/>
+ <ft:macro expand="swan:items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="temp-repeater">
+ <ft:group id="temp-repeater">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:parent-path"/>
+ <ft:macro expand="swan:items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="struct">
+ <ft:group id="struct">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:path"/>
+ <ft:macro expand="swan:items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="union">
+ <ft:group id="union">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:path"/>
+ <ft:macro expand="swan:items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="value">
+ <ft:group id="value">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:path"/>
+ </ft:group>
+ </ft:case>
+
+ </ft:union>
+ </ft:macro>
+
+ <ft:macro define="item-row">
+ <ft:macro expand="swan:item-actions"/>
+ <ft:macro expand="swan:view-selector"/>
+ <ft:macro expand="swan:type-selector"/>
+ <ft:macro expand="types"/>
+ </ft:macro>
+
+ <ft:macro define="item-list">
+ <ft:macro expand="swan:add-item"/>
+ <ft:repeater-size id="items"/>
+ <ft:repeater-widget id="items">
+ <div class="section"><ft:macro expand="item-row"/></div>
+ </ft:repeater-widget>
+ </ft:macro>
+
+</ft:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/binding_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/binding_template.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/binding_template.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/binding_template.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/binding_template.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/binding_template.xml Thu Jan 13 13:42:02 2005
@@ -23,397 +23,10 @@
<content>
<ft:form-template action="#{$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-parent-path-class">
- <b><ft:widget-label id="parent-path"/>:</b>
- <ft:widget id="parent-path">
- <fi:styling type="output"/>
- </ft:widget>
- </ft:class>
-
- <ft:class id="output-path-class">
- <b><ft:widget-label id="path"/>:</b>
- <ft:widget id="path">
- <fi:styling type="output"/>
- </ft:widget>
- </ft:class>
-
- <ft:class id="output-text-class">
- <b><ft:widget-label id="text"/>:</b>
- <ft:widget id="text">
- <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="parent-path-class"><b><ft:widget-label id="parent-path"/>:</b><ft:widget id="parent-path"/></ft:class>
- <ft:class id="path-class"><b><ft:widget-label id="path"/>:</b><ft:widget id="path"/></ft:class>
- <ft:class id="text-class"><b><ft:widget-label id="text"/>:</b><ft:widget id="text"/></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-path-class">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="out-id-class"/>
- <ft:new id="output-path-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="out-id-class"/>
- <ft:new id="output-path-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="id-class"/>
- <ft:new id="path-class"/>
- </ft:group>
- </ft:when>
- </ft:choose>
- </ft:class>
-
- <ft:class id="std-id-path-items-class">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="out-id-class"/>
- <ft:new id="output-path-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="out-id-class"/>
- <ft:new id="output-path-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="path-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:class>
-
- <ft:class id="std-javascript-class">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="output-text-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="output-text-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="text-class"/>
- </ft:group>
- </ft:when>
- </ft:choose>
- </ft:class>
-
- <ft:class id="std-path-items-class">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="output-path-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="output-path-class"/>
- <ft:new id="items-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="path-class"/>
- <ft:new id="items-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:new id="output-path-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="out-id-class"/>
- <ft:new id="output-parent-path-class"/>
- <ft:new id="items-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="id-class"/>
- <ft:new id="parent-path-class"/>
- <ft:new id="items-class"/>
- </ft:group>
- </ft:when>
- </ft:choose>
- </ft:class>
-
- <ft:class id="std-temp-repeater-class">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="out-id-class"/>
- <ft:new id="output-parent-path-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="out-id-class"/>
- <ft:new id="output-parent-path-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="parent-path-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="aggregate">
- <ft:group id="aggregate">
- <ft:new id="std-id-path-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="context">
- <ft:group id="context">
- <ft:new id="std-path-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="group">
- <ft:group id="group">
- <ft:new id="std-id-path-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="javascript">
- <ft:group id="javascript">
- <ft:new id="std-javascript-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="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="struct">
- <ft:group id="struct">
- <ft:new id="std-id-path-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="union">
- <ft:group id="union">
- <ft:new id="std-id-path-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="value">
- <ft:group id="value">
- <ft:new id="std-id-path-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> 
- </ft:when>
- <ft:when value="view">
- <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b> 
- </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/img/view.gif"/></ft:widget>
- <ft:widget id="edit-view"><fi:styling type="image" src="resources/img/edit.gif"/></ft:widget>
- </ft:when>
- <ft:when value="view">
- <ft:widget id="fold-view"><fi:styling type="image" src="resources/img/fold.gif"/></ft:widget>
- <ft:widget id="edit-view"><fi:styling type="image" src="resources/img/edit.gif"/></ft:widget>
- </ft:when>
- <ft:when value="edit">
- <ft:widget id="fold-view"><fi:styling type="image" src="resources/img/fold.gif"/></ft:widget>
- <ft:widget id="view-view"><fi:styling type="image" src="resources/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/img/move_up.gif"/></ft:widget>
- <ft:widget id="down"><fi:styling type="image" src="resources/img/move_down.gif"/></ft:widget>
- <ft:widget id="add"><fi:styling type="image" src="resources/img/new.gif"/></ft:widget>
-  <ft:widget id="delete"><fi:styling type="image" src="resources/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/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>
+ <ft:import prefix="binding" uri="forms/binding_mt.xml"/>
<p>
- <ft:new id="items-class"/>
+ <ft:macro expand="binding:binding"/>
</p>
<ft:widget id="messages"/><br/>
<input type="submit"/>
Added: cocoon/whiteboard/forms/samples/swan/forms/editor_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/editor_binding.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/editor_binding.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fb:context
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+ path="." lenient="true">
+
+ <fb:import prefix="binding" uri="forms/editor_mb.xml"/>
+
+ <fb:macro expand ="binding:binding"/>
+
+</fb:context>
Added: cocoon/whiteboard/forms/samples/swan/forms/editor_mb.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/editor_mb.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/editor_mb.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fb:macros
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+
+ <fb:import prefix="binding" uri="forms/binding_mb.xml"/>
+ <fb:import prefix="model" uri="forms/model_mb.xml"/>
+ <fb:import prefix="template" uri="forms/template_mb.xml"/>
+
+ <fb:macro define="binding">
+ <fb:context path="." lenient="true">
+
+ <fb:group id="binding" path=".">
+ <fb:macro expand="binding:binding"/>
+ </fb:group>
+
+ <fb:group id="model" path=".">
+ <fb:macro expand="model:model"/>
+ </fb:group>
+
+ <fb:group id="template" path=".">
+ <fb:macro expand="template:template"/>
+ </fb:group>
+
+ </fb:context>
+ </fb:macro>
+
+</fb:macros>
Added: cocoon/whiteboard/forms/samples/swan/forms/editor_mm.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/editor_mm.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/editor_mm.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:macros
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:import prefix="binding" uri="forms/binding_mm.xml"/>
+ <fd:import prefix="model" uri="forms/model_mm.xml"/>
+ <fd:import prefix="template" uri="forms/template_mm.xml"/>
+
+ <fd:macro define="model">
+ <fd:widgets>
+
+ <fd:group id="binding">
+ <fd:widgets>
+ <fd:macro expand="binding:binding"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="model">
+ <fd:widgets>
+ <fd:macro expand="model:model"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="template">
+ <fd:widgets>
+ <fd:macro expand="template:template"/>
+ </fd:widgets>
+ </fd:group>
+
+ </fd:widgets>
+ </fd:macro>
+
+ </fd:widgets>
+</fd:macros>
Added: cocoon/whiteboard/forms/samples/swan/forms/editor_model.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/editor_model.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/editor_model.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:form
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:import prefix="model" uri="forms/editor_mm.xml"/>
+
+ <fd:macro expand="model:model"/>
+
+ </fd:widgets>
+</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/forms/editor_mt.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/editor_mt.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/editor_mt.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<ft:macros
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+
+ <ft:import prefix="binding" uri="forms/binding_mt.xml"/>
+ <ft:import prefix="model" uri="forms/model_mt.xml"/>
+ <ft:import prefix="template" uri="forms/template_mt.xml"/>
+
+ <ft:macro define="template">
+ <ft:group id="binding">
+ <ft:macro expand="binding:binding"/>
+ </ft:group>
+
+ <ft:group id="model">
+ <ft:macro expand="model:model"/>
+ </ft:group>
+
+ <ft:group id="template">
+ <ft:macro expand="template:template"/>
+ </ft:group>
+ </ft:macro>
+
+</ft:macros>
Added: cocoon/whiteboard/forms/samples/swan/forms/editor_success.xsp
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/editor_success.xsp?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/editor_success.xsp Thu Jan 13 13:42:02 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<xsp:page language="java"
+ xmlns:xsp="http://apache.org/xsp">
+
+ <!--
+ CVS $Id: form_model_gui_success.xsp,v 1.3 2004/05/07 20:54:21 mpo Exp $
+ -->
+
+ <xsp:structure>
+ <xsp:include>org.apache.cocoon.forms.formmodel.*</xsp:include>
+ </xsp:structure>
+
+ <page>
+ <title>Sample form result</title>
+ <content>
+ <xsp:logic>
+ // get reference to form and some of the widgets on it
+ Form form = (Form)request.getAttribute("editor_gui");
+ Repeater repeater = (Repeater)form.lookupWidget("items");
+ </xsp:logic>
+
+ Repeater has <xsp:expr>repeater.getSize()</xsp:expr> row(s).
+ </content>
+ </page>
+</xsp:page>
Added: cocoon/whiteboard/forms/samples/swan/forms/editor_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/editor_template.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/editor_template.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<page
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+
+ <title>Swan Form Editor</title>
+
+ <content>
+ <ft:form-template action="#{$continuation/id}.continue" method="POST">
+ <ft:import prefix="template" uri="forms/editor_mt.xml"/>
+ <ft:macro expand="template:template"/>
+ </ft:form-template>
+ </content>
+
+</page>
Modified: cocoon/whiteboard/forms/samples/swan/forms/model_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/model_binding.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/model_binding.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/model_binding.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/model_binding.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/model_binding.xml Thu Jan 13 13:42:02 2005
@@ -24,260 +24,11 @@
<fb:context
xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
- path="/fd:form"
+ path="."
lenient="true">
- <fb:new id="items-class"/>
+ <fb:import prefix="model" uri="forms/model_mb.xml"/>
- <fb:class id="action-class">
- <fb:case id="action" path=".">
- <fb:insert-node><fd:action/>
-</fb:insert-node>
- <fb:group id="action" path="fd:action">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="aggregatefield-class">
- <fb:case id="aggregatefield" path=".">
- <fb:insert-node><fd:aggregatefield/>
-</fb:insert-node>
- <fb:group id="aggregatefield" path="fd:aggregatefield">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- <!-- TODO: required -->
- <fb:insert-node>
- <fd:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="booleanfield-class">
- <fb:case id="booleanfield" path=".">
- <fb:insert-node><fd:booleanfield/>
-</fb:insert-node>
- <fb:group id="booleanfield" path="fd:booleanfield">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="class-class">
- <fb:case id="class" path=".">
- <fb:insert-node><fd:class/>
-</fb:insert-node>
- <fb:group id="class" path="fd:class" direction="load">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:insert-node>
- <fd:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="field-class">
- <fb:case id="field" path=".">
- <fb:insert-node><fd:field/>
-</fb:insert-node>
- <fb:group id="field" path="fd:field">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- <fb:value id="required" path="@required">
- <fd:convertor datatype="boolean"/>
- </fb:value>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="group-class">
- <fb:case id="group" path=".">
- <fb:insert-node><fd:group/>
-</fb:insert-node>
- <fb:group id="group" path="fd:group">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- <fb:insert-node>
- <fd:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="new-class">
- <fb:case id="new" path=".">
- <fb:insert-node><fd:new/>
-</fb:insert-node>
- <fb:group id="new" path="fd:new">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="output-class">
- <fb:case id="output" path=".">
- <fb:insert-node><fd:output/>
-</fb:insert-node>
- <fb:group id="output" path="fd:output">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="repeater-class">
- <fb:case id="repeater" path=".">
- <fb:insert-node><fd:repeater/>
-</fb:insert-node>
- <fb:group id="repeater" path="fd:repeater">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- <fb:value id="initial-size" path="@initial-size">
- <fd:convertor datatype="long"/>
- </fb:value>
- <fb:insert-node>
- <fd:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="row-action-class">
- <fb:case id="row-action" path=".">
- <fb:insert-node><fd:row-action/>
-</fb:insert-node>
- <fb:group id="row-action" path="fd:row-action">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="struct-class">
- <fb:case id="struct" path=".">
- <fb:insert-node><fd:struct/>
-</fb:insert-node>
- <fb:group id="struct" path="fd:struct">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- <fb:insert-node>
- <fd:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="submit-class">
- <fb:case id="submit" path=".">
- <fb:insert-node><fd:submit/>
-</fb:insert-node>
- <fb:group id="submit" path="fd:submit">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="union-class">
- <fb:case id="union" path=".">
- <fb:insert-node><fd:union/>
-</fb:insert-node>
- <fb:group id="union" path="fd:union">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- <fb:insert-node>
- <fd:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="view-selector-class">
- <fb:javascript id="view-selector" path="." direction="load">
- <fb:load-form>
- widget.setValue("view");
- // View is selected by buttons.
- widget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </fb:load-form>
- </fb:javascript>
- </fb:class>
-
- <fb:class id="items-class">
- <fb:temp-repeater id="items"
- parent-path="fd:widgets"
- row-path="*" row-path-insert="."
- virtual-rows="true">
- <fb:on-bind><fb:new id="item-row-class"/></fb:on-bind>
- </fb:temp-repeater>
- </fb:class>
-
- <fb:class id="item-row-class">
- <fb:javascript id="type-selector" path="." direction="load">
- <fb:load-form>
- var node = jxpathPointer.getNode().getFirstChild();
- widget.setValue(node.getLocalName());
- </fb:load-form>
- </fb:javascript>
- <fb:union id="union" path=".">
- <fb:new id="action-class"/>
- <fb:new id="aggregatefield-class"/>
- <fb:new id="booleanfield-class"/>
- <fb:new id="class-class"/>
- <fb:new id="field-class"/>
- <fb:new id="group-class"/>
- <fb:new id="new-class"/>
- <fb:new id="output-class"/>
- <fb:new id="repeater-class"/>
- <fb:new id="row-action-class"/>
- <fb:new id="struct-class"/>
- <fb:new id="submit-class"/>
- <fb:new id="union-class"/>
- </fb:union>
- <!--
- The view-selector binding must happen last,
- so that all the widgets will exist that the
- view-selector's on-value-changed handler needs.
- -->
- <fb:new id="view-selector-class"/>
- </fb:class>
-
- <fb:class id="label-class">
- <fb:value id="label" path="fd:label"/>
- </fb:class>
+ <fb:macro expand="model:model"/>
</fb:context>
Added: cocoon/whiteboard/forms/samples/swan/forms/model_mb.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/model_mb.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/model_mb.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,299 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+
+<!--
+Binding for Swan form model editor.
+
+@version CVS $Id: form_model_gui_binding.xml,v 1.3 2004/04/12 14:05:09 tim Exp $
+-->
+
+<fb:macros
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
+
+ <fb:import prefix="swan" uri="forms/swan_binding.xml"/>
+
+ <fb:macro define="model">
+ <fb:context path="/fd:form" lenient="true">
+ <fb:macro expand="items"/>
+ </fb:context>
+ </fb:macro>
+
+ <fb:macro define="items">
+ <fb:temp-repeater id="items"
+ parent-path="fd:widgets"
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind><fb:macro expand="item-row"/></fb:on-bind>
+ </fb:temp-repeater>
+ </fb:macro>
+
+ <fb:macro define="unwrapped-items">
+ <fb:temp-repeater id="items"
+ parent-path="."
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind><fb:macro expand="item-row"/></fb:on-bind>
+ </fb:temp-repeater>
+ </fb:macro>
+
+ <fb:macro define="item-row">
+ <fb:javascript id="type-selector" path="." direction="load">
+ <fb:load-form>
+ var node = jxpathPointer.getNode().getFirstChild();
+ widget.setValue(node.getLocalName());
+ </fb:load-form>
+ </fb:javascript>
+ <fb:union id="union" path=".">
+ <fb:macro expand="action"/>
+ <fb:macro expand="aggregatefield"/>
+ <fb:macro expand="booleanfield"/>
+ <fb:macro expand="class"/>
+ <fb:macro expand="field"/>
+ <fb:macro expand="group"/>
+ <fb:macro expand="macro"/>
+ <fb:macro expand="new"/>
+ <fb:macro expand="output"/>
+ <fb:macro expand="repeater"/>
+ <fb:macro expand="row-action"/>
+ <fb:macro expand="struct"/>
+ <fb:macro expand="submit"/>
+ <fb:macro expand="union"/>
+ </fb:union>
+ <!--
+ The view-selector binding must happen last,
+ so that all the widgets will exist that the
+ view-selector's on-value-changed handler needs.
+ -->
+ <fb:macro expand="swan:view-selector"/>
+ </fb:macro>
+
+ <fb:macro define="label">
+ <fb:value id="label" path="fd:label"/>
+ </fb:macro>
+
+ <fb:macro define="action">
+ <fb:case id="action" path=".">
+ <fb:insert-node><fd:action/>
+</fb:insert-node>
+ <fb:group id="action" path="fd:action">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="aggregatefield">
+ <fb:case id="aggregatefield" path=".">
+ <fb:insert-node><fd:aggregatefield/>
+</fb:insert-node>
+ <fb:group id="aggregatefield" path="fd:aggregatefield">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ <fb:macro expand="swan:required"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="booleanfield">
+ <fb:case id="booleanfield" path=".">
+ <fb:insert-node><fd:booleanfield/>
+</fb:insert-node>
+ <fb:group id="booleanfield" path="fd:booleanfield">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="class">
+ <fb:case id="class" path=".">
+ <fb:insert-node><fd:class/>
+</fb:insert-node>
+ <fb:group id="class" path="fd:class" direction="load">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="field">
+ <fb:case id="field" path=".">
+ <fb:insert-node><fd:field/>
+</fb:insert-node>
+ <fb:group id="field" path="fd:field">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ <fb:macro expand="swan:required"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="group">
+ <fb:case id="group" path=".">
+ <fb:insert-node><fd:group/>
+</fb:insert-node>
+ <fb:group id="group" path="fd:group">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="macro">
+ <fb:case id="macro" path=".">
+ <fb:insert-node><fd:macro/>
+</fb:insert-node>
+ <fb:group id="macro" path="fd:macro">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:define"/>
+ <fb:macro expand="swan:expand"/>
+ </fb:group>
+ <fb:macro expand="unwrapped-items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="new">
+ <fb:case id="new" path=".">
+ <fb:insert-node><fd:new/>
+</fb:insert-node>
+ <fb:group id="new" path="fd:new">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="output">
+ <fb:case id="output" path=".">
+ <fb:insert-node><fd:output/>
+</fb:insert-node>
+ <fb:group id="output" path="fd:output">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="repeater">
+ <fb:case id="repeater" path=".">
+ <fb:insert-node><fd:repeater/>
+</fb:insert-node>
+ <fb:group id="repeater" path="fd:repeater">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ <fb:value id="initial-size" path="@initial-size">
+ <fd:convertor datatype="long"/>
+ </fb:value>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="row-action">
+ <fb:case id="row-action" path=".">
+ <fb:insert-node><fd:row-action/>
+</fb:insert-node>
+ <fb:group id="row-action" path="fd:row-action">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="struct">
+ <fb:case id="struct" path=".">
+ <fb:insert-node><fd:struct/>
+</fb:insert-node>
+ <fb:group id="struct" path="fd:struct">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="submit">
+ <fb:case id="submit" path=".">
+ <fb:insert-node><fd:submit/>
+</fb:insert-node>
+ <fb:group id="submit" path="fd:submit">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="union">
+ <fb:case id="union" path=".">
+ <fb:insert-node><fd:union/>
+</fb:insert-node>
+ <fb:group id="union" path="fd:union">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="label"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+</fb:macros>
Added: cocoon/whiteboard/forms/samples/swan/forms/model_mm.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/model_mm.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/model_mm.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,268 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:macros
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:import prefix="swan" uri="forms/swan_mm.xml"/>
+
+ <fd:macro define="model">
+ <fd:widgets>
+ <fd:messages id="messages"/>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="items">
+ <fd:widgets>
+ <fd:repeater id="items" initial-size="0">
+ <fd:label>Items</fd:label>
+ <fd:widgets>
+ <fd:macro expand="item-row"/>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:macro expand="swan:add-item"/>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="type-selector">
+ <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="action"><fd:label>Action</fd:label></fd:item>
+ <fd:item value="aggregatefield"><fd:label>AggregateField</fd:label></fd:item>
+ <fd:item value="booleanfield"><fd:label>BooleanField</fd:label></fd:item>
+ <fd:item value="class"><fd:label>Class</fd:label></fd:item>
+ <fd:item value="field"><fd:label>Field</fd:label></fd:item>
+ <fd:item value="group"><fd:label>Group</fd:label></fd:item>
+ <fd:item value="macro"><fd:label>Macro</fd:label></fd:item>
+ <fd:item value="new"><fd:label>New</fd:label></fd:item>
+ <fd:item value="output"><fd:label>Output</fd:label></fd:item>
+ <fd:item value="repeater"><fd:label>Repeater</fd:label></fd:item>
+ <fd:item value="row-action"><fd:label>RowAction</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:selection-list>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="item-row">
+ <fd:widgets>
+
+ <fd:macro expand="swan:item-actions"/>
+ <fd:macro expand="swan:view-selector"/>
+ <fd:macro expand="type-selector"/>
+
+ <fd:union id="union" default="" case="type-selector">
+ <fd:label>Type</fd:label>
+ <fd:widgets>
+
+ <fd:group id="action">
+ <fd:label>Action</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:output id="help">
+ <fd:hint>Action widget, often rendered as a button</fd:hint>
+ <fd:help>Action widget, often rendered as a button</fd:help>
+ <fd:datatype base="string"/>
+ </fd:output>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="aggregatefield">
+ <fd:label>AggregateField</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ <fd:macro expand="swan:required"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="booleanfield">
+ <fd:label>BooleanField</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="class">
+ <fd:label>Class</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="field">
+ <fd:label>Field</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ <fd:macro expand="swan:required"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="group">
+ <fd:label>Group</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="macro">
+ <fd:label>Macro</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:define"/>
+ <fd:macro expand="swan:expand"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="new">
+ <fd:label>New</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="output">
+ <fd:label>Output</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="repeater">
+ <fd:label>Repeater</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ <fd:macro expand="swan:initial-size"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="row-action">
+ <fd:label>RowAction</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="struct">
+ <fd:label>Struct</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="submit">
+ <fd:label>Submit</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="union">
+ <fd:label>Union</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ </fd:widgets>
+
+ </fd:union>
+ </fd:widgets>
+ </fd:macro>
+
+ </fd:widgets>
+</fd:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/model_model.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/model_model.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/model_model.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/model_model.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/model_model.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/model_model.xml Thu Jan 13 13:42:02 2005
@@ -19,376 +19,9 @@
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<fd:widgets>
- <!--
- CVS $Id$
- -->
+ <fd:import prefix="model" uri="forms/model_mm.xml"/>
- <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.setValue("edit");
- // View is selected by buttons.
- view.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </javascript>
- </fd:on-action>
- </fd:repeater-action>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="view-selector-class">
- <fd:widgets>
- <fd:field id="view-selector">
- <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.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- if(stuff != null) {
- stuff.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- }
- type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- } else if("view".equals(widget.getValue())){
- union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- if(stuff != null) {
- stuff.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- }
- type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- } else {
- union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- type.setState(Packages.org.apache.cocoon.forms.formmodel.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="action"><fd:label>Action</fd:label></fd:item>
- <fd:item value="aggregatefield"><fd:label>AggregateField</fd:label></fd:item>
- <fd:item value="booleanfield"><fd:label>BooleanField</fd:label></fd:item>
- <fd:item value="class"><fd:label>Class</fd:label></fd:item>
- <fd:item value="field"><fd:label>Field</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="output"><fd:label>Output</fd:label></fd:item>
- <fd:item value="repeater"><fd:label>Repeater</fd:label></fd:item>
- <fd:item value="row-action"><fd:label>RowAction</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: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 = Packages.org.apache.cocoon.forms.formmodel.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.setValue("edit");
- // View is selected by buttons.
- view.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </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="action">
- <fd:label>Action</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:widgets>
- </fd:group>
-
- <fd:group id="aggregatefield">
- <fd:label>AggregateField</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="label-class"/>
- <fd:new id="required-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="booleanfield">
- <fd:label>BooleanField</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: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="field">
- <fd:label>Field</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="label-class"/>
- <fd:new id="required-class"/>
- </fd:widgets>
- </fd:group>
- </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="output">
- <fd:label>Output</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:widgets>
- </fd:group>
-
- <fd:group id="repeater">
- <fd:label>Repeater</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="label-class"/>
- <fd:new id="initial-size-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="row-action">
- <fd:label>RowAction</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: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="submit">
- <fd:label>Submit</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: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:widgets>
-
- </fd:union>
- </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:macro expand="model:model"/>
</fd:widgets>
</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/forms/model_mt.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/model_mt.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/model_mt.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,178 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<ft:macros
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+
+ <ft:import prefix="swan" uri="forms/swan_template.xml"/>
+
+ <ft:macro define="model">
+ <ft:macro expand="item-list"/>
+ </ft:macro>
+
+ <ft:macro define="item-row">
+ <ft:macro expand="swan:item-actions"/>
+ <ft:macro expand="swan:view-selector"/>
+ <ft:macro expand="swan:type-selector"/>
+ <ft:macro expand="types"/>
+ </ft:macro>
+
+ <ft:macro define="item-list">
+ <ft:macro expand="swan:addItem"/>
+ <ft:repeater-size id="items"/>
+ <ft:repeater-widget id="items">
+ <div class="section"><ft:macro expand="item-row"/></div>
+ </ft:repeater-widget>
+ </ft:macro>
+
+ <ft:macro define="items">
+ <ft:choose path="../../view-selector">
+ <ft:when value="fold">
+ </ft:when>
+ <ft:when value="view">
+ <ft:macro expand="item-list"/>
+ </ft:when>
+ <ft:when value="edit">
+ <ft:macro expand="item-list"/>
+ </ft:when>
+ </ft:choose>
+ </ft:macro>
+
+ <ft:macro define="types">
+ <ft:union id="union">
+
+ <ft:case id="">
+ </ft:case>
+
+ <ft:case id="action">
+ <ft:group id="action">
+ <ft:macro expand="swan:help"/>
+ <ft:macro expand="swan:id"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="aggregatefield">
+ <ft:group id="aggregatefield">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="booleanfield">
+ <ft:group id="booleanfield">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="class">
+ <ft:group id="class">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="field">
+ <ft:group id="field">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ <ft:macro expand="swan:required"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="group">
+ <ft:group id="group">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="macro">
+ <ft:group id="macro">
+ <ft:macro expand="swan:define"/>
+ <ft:macro expand="swan:expand"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="new">
+ <ft:group id="new">
+ <ft:macro expand="swan:id"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="output">
+ <ft:group id="output">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="struct">
+ <ft:group id="struct">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="repeater">
+ <ft:group id="repeater">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ <ft:macro expand="swan:initial-size"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="temp-repeater">
+ <ft:group id="temp-repeater">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ <ft:macro expand="swan:initial-size"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="row-action">
+ <ft:group id="row-action">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="submit">
+ <ft:group id="submit">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="union">
+ <ft:group id="union">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ </ft:union>
+ </ft:macro>
+
+</ft:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/model_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/model_template.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/model_template.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/model_template.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/model_template.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/model_template.xml Thu Jan 13 13:42:02 2005
@@ -23,327 +23,10 @@
<content>
<ft:form-template action="#{$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> 
- </ft:when>
- <ft:when value="view">
- <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b> 
- </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/img/view.gif"/></ft:widget>
- <ft:widget id="edit-view"><fi:styling type="image" src="resources/img/edit.gif"/></ft:widget>
- </ft:when>
- <ft:when value="view">
- <ft:widget id="fold-view"><fi:styling type="image" src="resources/img/fold.gif"/></ft:widget>
- <ft:widget id="edit-view"><fi:styling type="image" src="resources/img/edit.gif"/></ft:widget>
- </ft:when>
- <ft:when value="edit">
- <ft:widget id="fold-view"><fi:styling type="image" src="resources/img/fold.gif"/></ft:widget>
- <ft:widget id="view-view"><fi:styling type="image" src="resources/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/img/move_up.gif"/></ft:widget>
- <ft:widget id="down"><fi:styling type="image" src="resources/img/move_down.gif"/></ft:widget>
- <ft:widget id="add"><fi:styling type="image" src="resources/img/new.gif"/></ft:widget>
-  <ft:widget id="delete"><fi:styling type="image" src="resources/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/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>
+ <ft:import prefix="model" uri="forms/model_mt.xml"/>
<p>
- <ft:new id="items-class"/>
+ <ft:macro expand="model:model"/>
</p>
<ft:widget id="messages"/><br/>
<input type="submit"/>
Modified: cocoon/whiteboard/forms/samples/swan/forms/sitemap_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/sitemap_binding.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/sitemap_binding.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/sitemap_binding.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/sitemap_binding.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/sitemap_binding.xml Thu Jan 13 13:42:02 2005
@@ -23,246 +23,12 @@
<fb:context
xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
- xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
xmlns:map="http://apache.org/cocoon/sitemap/1.0"
- path="/map:sitemap"
+ path="."
lenient="true">
- <fb:new id="items-class"/>
+ <fb:import prefix="sitemap" uri="forms/sitemap_mb.xml"/>
- <fb:class id="call-class">
- <fb:case id="call" path=".">
- <fb:insert-node><map:call/>
-</fb:insert-node>
- <fb:group id="call" path="map:call">
- <fb:group id="stuff" path=".">
- <fb:value id="continuation" path="@continuation"/>
- <fb:value id="resource" path="@resource"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="components-class">
- <fb:case id="components" path=".">
- <fb:insert-node><map:components/>
-</fb:insert-node>
- <fb:group id="components" path="map:components">
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="views-class">
- <fb:case id="views" path=".">
- <fb:insert-node><map:views/>
-</fb:insert-node>
- <fb:group id="views" path="map:views">
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="resources-class">
- <fb:case id="resources" path=".">
- <fb:insert-node><map:resources/>
-</fb:insert-node>
- <fb:group id="resources" path="map:resources">
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="flow-class">
- <fb:case id="flow" path=".">
- <fb:insert-node><map:flow/>
-</fb:insert-node>
- <fb:group id="flow" path="map:flow">
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="generate-class">
- <fb:case id="generate" path=".">
- <fb:insert-node><map:generate/>
-</fb:insert-node>
- <fb:group id="generate" path="map:generate">
- <fb:group id="stuff" path=".">
- <fb:value id="type" path="@type"/>
- <fb:value id="src" path="@src"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="match-class">
- <fb:case id="match" path=".">
- <fb:insert-node><map:match/>
-</fb:insert-node>
- <fb:group id="match" path="map:match">
- <fb:group id="stuff" path=".">
- <fb:value id="pattern" path="@pattern"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="parameter-class">
- <fb:case id="parameter" path=".">
- <fb:insert-node><map:parameter/>
-</fb:insert-node>
- <fb:group id="parameter" path="map:parameter">
- <fb:group id="stuff" path=".">
- <fb:value id="name" path="@name"/>
- <fb:value id="value" path="@value"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="pipeline-class">
- <fb:case id="pipeline" path=".">
- <fb:insert-node><map:pipeline/>
-</fb:insert-node>
- <fb:group id="pipeline" path="map:pipeline">
- <fb:group id="stuff" path=".">
- <fb:value id="type" path="@type"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="pipelines-class">
- <fb:case id="pipelines" path=".">
- <fb:insert-node><map:pipelines/>
-</fb:insert-node>
- <fb:group id="pipelines" path="map:pipelines">
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="read-class">
- <fb:case id="read" path=".">
- <fb:insert-node><map:read/>
-</fb:insert-node>
- <fb:group id="read" path="map:read">
- <fb:group id="stuff" path=".">
- <fb:new id="type-class"/>
- <fb:new id="src-class"/>
- <fb:insert-node>
- <fd:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="redirect-to-class">
- <fb:case id="redirect-to" path=".">
- <fb:insert-node><map:redirect-to/>
-</fb:insert-node>
- <fb:group id="redirect-to" path="map:redirect-to">
- <fb:group id="stuff" path=".">
- <fb:new id="uri-class"/>
- <fb:insert-node>
- <fd:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="serialize-class">
- <fb:case id="serialize" path=".">
- <fb:insert-node><map:serialize/>
-</fb:insert-node>
- <fb:group id="serialize" path="map:serialize">
- <fb:group id="stuff" path=".">
- <fb:value id="type" path="@type"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="transform-class">
- <fb:case id="transform" path=".">
- <fb:insert-node><map:transform/>
-</fb:insert-node>
- <fb:group id="transform" path="map:transform">
- <fb:group id="stuff" path=".">
- <fb:value id="type" path="@type"/>
- <fb:value id="src" path="@src"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="view-selector-class">
- <fb:javascript id="view-selector" path="." direction="load">
- <fb:load-form>
- widget.setValue("view");
- // View is selected by buttons.
- widget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </fb:load-form>
- </fb:javascript>
- </fb:class>
-
- <fb:class id="items-class">
- <fb:temp-repeater id="items"
- parent-path="."
- row-path="*" row-path-insert="."
- virtual-rows="true">
- <fb:on-bind><fb:new id="item-row-class"/></fb:on-bind>
- </fb:temp-repeater>
- </fb:class>
-
- <fb:class id="item-row-class">
- <fb:javascript id="type-selector" path="." direction="load">
- <fb:load-form>
- widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName());
- </fb:load-form>
- </fb:javascript>
- <fb:union id="union" path=".">
- <fb:new id="components-class"/>
- <fb:new id="pipelines-class"/>
- <fb:new id="pipeline-class"/>
- <fb:new id="match-class"/>
- <fb:new id="generate-class"/>
- <fb:new id="transform-class"/>
- <fb:new id="serialize-class"/>
- <fb:new id="call-class"/>
- <fb:new id="read-class"/>
- <fb:new id="redirect-to-class"/>
- <fb:new id="parameter-class"/>
- </fb:union>
- <!--
- The view-selector binding must happen last,
- so that all the widgets will exist that the
- view-selector's on-value-changed handler needs.
- -->
- <fb:new id="view-selector-class"/>
- </fb:class>
-
- <fb:class id="label-class">
- <fb:value id="label" path="fd:label"/>
- </fb:class>
-
- <fb:class id="src-class">
- <fb:value id="src" path="@src"/>
- </fb:class>
-
- <fb:class id="type-class">
- <fb:value id="type" path="@type"/>
- </fb:class>
-
- <fb:class id="uri-class">
- <fb:value id="uri" path="@uri"/>
- </fb:class>
+ <fb:macro expand="sitemap:sitemap"/>
</fb:context>
Added: cocoon/whiteboard/forms/samples/swan/forms/sitemap_mb.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/sitemap_mb.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/sitemap_mb.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,251 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+
+<!--
+Binding for example CForms sitemap editor GUI.
+
+@version CVS $Id: form_model_gui_binding.xml,v 1.3 2004/04/12 14:05:09 tim Exp $
+-->
+
+<fb:macros
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+ <fb:import prefix="swan" uri="forms/swan_binding.xml"/>
+
+ <fb:macro define="sitemap">
+ <fb:context path="/map:sitemap" lenient="true">
+ <fb:macro expand="items"/>
+ </fb:context>
+ </fb:macro>
+
+ <fb:macro define="items">
+ <fb:temp-repeater id="items"
+ parent-path="."
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind><fb:macro expand="item-row"/></fb:on-bind>
+ </fb:temp-repeater>
+ </fb:macro>
+
+ <fb:macro define="item-row">
+ <fb:javascript id="type-selector" path="." direction="load">
+ <fb:load-form>
+ widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName());
+ </fb:load-form>
+ </fb:javascript>
+ <fb:union id="union" path=".">
+ <fb:macro expand="components"/>
+ <fb:macro expand="pipelines"/>
+ <fb:macro expand="pipeline"/>
+ <fb:macro expand="match"/>
+ <fb:macro expand="generate"/>
+ <fb:macro expand="transform"/>
+ <fb:macro expand="serialize"/>
+ <fb:macro expand="call"/>
+ <fb:macro expand="read"/>
+ <fb:macro expand="redirect-to"/>
+ <fb:macro expand="parameter"/>
+ </fb:union>
+ <!--
+ The view-selector binding must happen last,
+ so that all the widgets will exist that the
+ view-selector's on-value-changed handler needs.
+ -->
+ <fb:macro expand="swan:view-selector"/>
+ </fb:macro>
+
+ <fb:macro define="src">
+ <fb:value id="src" path="@src"/>
+ </fb:macro>
+
+ <fb:macro define="type">
+ <fb:value id="type" path="@type"/>
+ </fb:macro>
+
+ <fb:macro define="uri">
+ <fb:value id="uri" path="@uri"/>
+ </fb:macro>
+
+ <fb:macro define="call">
+ <fb:case id="call" path=".">
+ <fb:insert-node><map:call/>
+</fb:insert-node>
+ <fb:group id="call" path="map:call">
+ <fb:group id="stuff" path=".">
+ <fb:value id="continuation" path="@continuation"/>
+ <fb:value id="resource" path="@resource"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="components">
+ <fb:case id="components" path=".">
+ <fb:insert-node><map:components/>
+</fb:insert-node>
+ <fb:group id="components" path="map:components">
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="views">
+ <fb:case id="views" path=".">
+ <fb:insert-node><map:views/>
+</fb:insert-node>
+ <fb:group id="views" path="map:views">
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="resources">
+ <fb:case id="resources" path=".">
+ <fb:insert-node><map:resources/>
+</fb:insert-node>
+ <fb:group id="resources" path="map:resources">
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="flow">
+ <fb:case id="flow" path=".">
+ <fb:insert-node><map:flow/>
+</fb:insert-node>
+ <fb:group id="flow" path="map:flow">
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="generate">
+ <fb:case id="generate" path=".">
+ <fb:insert-node><map:generate/>
+</fb:insert-node>
+ <fb:group id="generate" path="map:generate">
+ <fb:group id="stuff" path=".">
+ <fb:value id="type" path="@type"/>
+ <fb:value id="src" path="@src"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="match">
+ <fb:case id="match" path=".">
+ <fb:insert-node><map:match/>
+</fb:insert-node>
+ <fb:group id="match" path="map:match">
+ <fb:group id="stuff" path=".">
+ <fb:value id="pattern" path="@pattern"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="parameter">
+ <fb:case id="parameter" path=".">
+ <fb:insert-node><map:parameter/>
+</fb:insert-node>
+ <fb:group id="parameter" path="map:parameter">
+ <fb:group id="stuff" path=".">
+ <fb:value id="name" path="@name"/>
+ <fb:value id="value" path="@value"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="pipeline">
+ <fb:case id="pipeline" path=".">
+ <fb:insert-node><map:pipeline/>
+</fb:insert-node>
+ <fb:group id="pipeline" path="map:pipeline">
+ <fb:group id="stuff" path=".">
+ <fb:value id="type" path="@type"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="pipelines">
+ <fb:case id="pipelines" path=".">
+ <fb:insert-node><map:pipelines/>
+</fb:insert-node>
+ <fb:group id="pipelines" path="map:pipelines">
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="read">
+ <fb:case id="read" path=".">
+ <fb:insert-node><map:read/>
+</fb:insert-node>
+ <fb:group id="read" path="map:read">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="type"/>
+ <fb:macro expand="src"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="redirect-to">
+ <fb:case id="redirect-to" path=".">
+ <fb:insert-node><map:redirect-to/>
+</fb:insert-node>
+ <fb:group id="redirect-to" path="map:redirect-to">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="uri"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="serialize">
+ <fb:case id="serialize" path=".">
+ <fb:insert-node><map:serialize/>
+</fb:insert-node>
+ <fb:group id="serialize" path="map:serialize">
+ <fb:group id="stuff" path=".">
+ <fb:value id="type" path="@type"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="transform">
+ <fb:case id="transform" path=".">
+ <fb:insert-node><map:transform/>
+</fb:insert-node>
+ <fb:group id="transform" path="map:transform">
+ <fb:group id="stuff" path=".">
+ <fb:value id="type" path="@type"/>
+ <fb:value id="src" path="@src"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+</fb:macros>
Added: cocoon/whiteboard/forms/samples/swan/forms/sitemap_mm.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/sitemap_mm.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/sitemap_mm.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,251 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:macros
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:import prefix="swan" uri="forms/swan_mm.xml"/>
+
+ <fd:macro define="sitemap">
+ <fd:widgets>
+ <fd:messages id="messages"/>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="items">
+ <fd:widgets>
+ <fd:repeater id="items" initial-size="0">
+ <fd:label>Items</fd:label>
+ <fd:widgets>
+ <fd:macro expand="item-row"/>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:macro expand="swan:add-item"/>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="type-selector">
+ <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="components"><fd:label>Components</fd:label></fd:item>
+ <fd:item value="views"><fd:label>Views</fd:label></fd:item>
+ <fd:item value="resources"><fd:label>Resources</fd:label></fd:item>
+ <fd:item value="flow"><fd:label>Flow</fd:label></fd:item>
+ <fd:item value="pipelines"><fd:label>Pipelines</fd:label></fd:item>
+ <fd:item value="pipeline"><fd:label>Pipeline</fd:label></fd:item>
+ <fd:item value="match"><fd:label>Match</fd:label></fd:item>
+ <fd:item value="generate"><fd:label>Generate</fd:label></fd:item>
+ <fd:item value="transform"><fd:label>Transform</fd:label></fd:item>
+ <fd:item value="serialize"><fd:label>Serialize</fd:label></fd:item>
+ <fd:item value="call"><fd:label>Call</fd:label></fd:item>
+ <fd:item value="read"><fd:label>Read</fd:label></fd:item>
+ <fd:item value="redirect-to"><fd:label>Redirect To</fd:label></fd:item>
+ <fd:item value="parameter"><fd:label>Parameter</fd:label></fd:item>
+ </fd:selection-list>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="item-row">
+ <fd:widgets>
+
+ <fd:macro expand="swan:item-actions"/>
+ <fd:macro expand="swan:view-selector"/>
+ <fd:macro expand="type-selector"/>
+
+ <fd:union id="union" default="" case="type-selector">
+ <fd:label>Type</fd:label>
+ <fd:widgets>
+
+ <fd:group id="components">
+ <fd:label>Components</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="views">
+ <fd:label>Views</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="resources">
+ <fd:label>Resources</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="flow">
+ <fd:label>Flow</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="pipelines">
+ <fd:label>Pipelines</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="pipeline">
+ <fd:label>Pipeline</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:type"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="match">
+ <fd:label>Match</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:pattern"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="generate">
+ <fd:label>Generate</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:type"/>
+ <fd:macro expand="swan:src"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="transform">
+ <fd:label>Transform</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:type"/>
+ <fd:macro expand="swan:src"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="serialize">
+ <fd:label>Serialize</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:type"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="call">
+ <fd:label>Call</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:continuation"/>
+ <fd:macro expand="swan:resource"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="read">
+ <fd:label>Read</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:type"/>
+ <fd:macro expand="swan:src"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="redirect-to">
+ <fd:label>Redirect To</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:uri"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="parameter">
+ <fd:label>Parameter</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:name"/>
+ <fd:macro expand="swan:value"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:group>
+
+ </fd:widgets>
+
+ </fd:union>
+
+ </fd:widgets>
+ </fd:macro>
+
+ </fd:widgets>
+</fd:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/sitemap_model.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/sitemap_model.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/sitemap_model.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/sitemap_model.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/sitemap_model.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/sitemap_model.xml Thu Jan 13 13:42:02 2005
@@ -19,450 +19,9 @@
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<fd:widgets>
- <!--
- CVS $Id$
- -->
+ <fd:import prefix="sitemap" uri="forms/sitemap_mm.xml"/>
- <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.setValue("edit");
- // View is selected by buttons.
- view.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </javascript>
- </fd:on-action>
- </fd:repeater-action>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="view-selector-class">
- <fd:widgets>
- <fd:field id="view-selector">
- <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.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- if(stuff != null) {
- stuff.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- }
- type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- } else if("view".equals(widget.getValue())){
- union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- if(stuff != null) {
- stuff.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- }
- type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- } else {
- union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- type.setState(Packages.org.apache.cocoon.forms.formmodel.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="components"><fd:label>Components</fd:label></fd:item>
- <fd:item value="views"><fd:label>Views</fd:label></fd:item>
- <fd:item value="resources"><fd:label>Resources</fd:label></fd:item>
- <fd:item value="flow"><fd:label>Flow</fd:label></fd:item>
- <fd:item value="pipelines"><fd:label>Pipelines</fd:label></fd:item>
- <fd:item value="pipeline"><fd:label>Pipeline</fd:label></fd:item>
- <fd:item value="match"><fd:label>Match</fd:label></fd:item>
- <fd:item value="generate"><fd:label>Generate</fd:label></fd:item>
- <fd:item value="transform"><fd:label>Transform</fd:label></fd:item>
- <fd:item value="serialize"><fd:label>Serialize</fd:label></fd:item>
- <fd:item value="call"><fd:label>Call</fd:label></fd:item>
- <fd:item value="read"><fd:label>Read</fd:label></fd:item>
- <fd:item value="redirect-to"><fd:label>Redirect To</fd:label></fd:item>
- <fd:item value="parameter"><fd:label>Parameter</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 = Packages.org.apache.cocoon.forms.formmodel.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.setValue("edit");
- // View is selected by buttons.
- view.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </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="components">
- <fd:label>Components</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="views">
- <fd:label>Views</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="resources">
- <fd:label>Resources</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="flow">
- <fd:label>Flow</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="pipelines">
- <fd:label>Pipelines</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="pipeline">
- <fd:label>Pipeline</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="type-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="match">
- <fd:label>Match</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="pattern-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="generate">
- <fd:label>Generate</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="type-class"/>
- <fd:new id="src-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="transform">
- <fd:label>Transform</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="type-class"/>
- <fd:new id="src-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="serialize">
- <fd:label>Serialize</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="type-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="call">
- <fd:label>Call</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="continuation-class"/>
- <fd:new id="resource-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="read">
- <fd:label>Read</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="type-class"/>
- <fd:new id="src-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="redirect-to">
- <fd:label>Redirect To</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="uri-class"/>
- </fd:widgets>
- </fd:group>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="parameter">
- <fd:label>Parameter</fd:label>
- <fd:widgets>
- <fd:group id="stuff">
- <fd:widgets>
- <fd:new id="name-class"/>
- <fd:new id="value-class"/>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:group>
-
- </fd:widgets>
-
- </fd:union>
-
- </fd:widgets>
- </fd:class>
-
- <fd:class id="continuation-class">
- <fd:widgets>
- <fd:field id="continuation">
- <fd:label>Continuation</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="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: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="name-class">
- <fd:widgets>
- <fd:field id="name">
- <fd:label>Name</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="pattern-class">
- <fd:widgets>
- <fd:field id="pattern">
- <fd:label>Pattern</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="resource-class">
- <fd:widgets>
- <fd:field id="resource">
- <fd:label>Resource</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="src-class">
- <fd:widgets>
- <fd:field id="src">
- <fd:label>Src</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="type-class">
- <fd:widgets>
- <fd:field id="type">
- <fd:label>Type</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="uri-class">
- <fd:widgets>
- <fd:field id="uri">
- <fd:label>URI</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="value-class">
- <fd:widgets>
- <fd:field id="value">
- <fd:label>Value</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
+ <fd:macro expand="sitemap:sitemap"/>
</fd:widgets>
</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/forms/sitemap_mt.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/sitemap_mt.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/sitemap_mt.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,203 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<ft:macros
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+
+ <ft:import prefix="swan" uri="forms/swan_template.xml"/>
+
+ <ft:macro define="continuation">
+ <ft:macro expand="swan:view-attr">
+ <ft:param name="path" value="continuation"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="the-items">
+ <ft:macro expand="swan:addItem"/>
+ <ft:repeater-size id="items"/>
+ <ft:repeater-widget id="items">
+ <div class="section">
+ <ft:macro expand="swan:item-actions"/>
+ <ft:macro expand="swan:view-selector"/>
+ <ft:macro expand="swan:type-selector"/>
+ <ft:macro expand="union"/>
+ </div>
+ </ft:repeater-widget>
+ </ft:macro>
+
+ <ft:macro define="items">
+ <ft:choose path="../../view-selector">
+ <ft:when value="fold">
+ </ft:when>
+ <ft:when value="view">
+ <ft:macro expand="the-items"/>
+ </ft:when>
+ <ft:when value="edit">
+ <ft:macro expand="the-items"/>
+ </ft:when>
+ </ft:choose>
+ </ft:macro>
+
+ <ft:macro define="name">
+ <ft:macro expand="swan:view-attr">
+ <ft:param name="path" value="name"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="pattern">
+ <ft:macro expand="swan:view-attr">
+ <ft:param name="path" value="pattern"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="resource">
+ <ft:macro expand="swan:view-attr">
+ <ft:param name="path" value="resource"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="src">
+ <ft:macro expand="swan:view-attr">
+ <ft:param name="path" value="src"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="type">
+ <ft:macro expand="swan:view-attr">
+ <ft:param name="path" value="type"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="uri">
+ <ft:macro expand="swan:view-attr">
+ <ft:param name="path" value="uri"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="value">
+ <ft:macro expand="swan:view-attr">
+ <ft:param name="path" value="value"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="union">
+ <ft:union id="union">
+
+ <ft:case id="">
+ </ft:case>
+
+ <ft:case id="call">
+ <ft:group id="call">
+ <ft:macro expand="continuation"/>
+ <ft:macro expand="resource"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="components">
+ <ft:group id="components">
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="views">
+ <ft:group id="views">
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="resources">
+ <ft:group id="resources">
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="flow">
+ <ft:group id="flow">
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="generate">
+ <ft:group id="generate">
+ <ft:macro expand="src"/>
+ <ft:macro expand="type"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="match">
+ <ft:group id="match">
+ <ft:macro expand="pattern"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="parameter">
+ <ft:group id="parameter">
+ <ft:macro expand="name"/>
+ <ft:macro expand="value"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="pipeline">
+ <ft:group id="pipeline">
+ <ft:macro expand="type"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="pipelines">
+ <ft:group id="pipelines">
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="read">
+ <ft:group id="read">
+ <ft:macro expand="type"/>
+ <ft:macro expand="src"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="redirect-to">
+ <ft:group id="redirect-to">
+ <ft:macro expand="uri"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="serialize">
+ <ft:group id="serialize">
+ <ft:macro expand="type"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="transform">
+ <ft:group id="transform">
+ <ft:macro expand="type"/>
+ <ft:macro expand="src"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ </ft:union>
+ </ft:macro>
+
+ <ft:macro define="sitemap">
+ <ft:macro expand="the-items"/>
+ </ft:macro>
+
+</ft:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/sitemap_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/sitemap_template.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/sitemap_template.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/sitemap_template.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/sitemap_template.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/sitemap_template.xml Thu Jan 13 13:42:02 2005
@@ -23,448 +23,10 @@
<content>
<ft:form-template action="#{$continuation/id}.continue" method="POST">
- <ft:class id="ocontinuation-class">
- <ft:widget-label id="continuation"/>:
- <b><ft:widget id="continuation">
- <fi:styling type="output"/>
- </ft:widget></b>
- </ft:class>
-
- <ft:class id="oid-class">
- <ft:widget-label id="id"/>:
- <b><ft:widget id="id">
- <fi:styling type="output"/>
- </ft:widget></b>
- </ft:class>
-
- <ft:class id="olabel-class">
- <ft:widget-label id="label"/>:
- <b><ft:widget id="label">
- <fi:styling type="output"/>
- </ft:widget></b>
- </ft:class>
-
- <ft:class id="oname-class">
- <ft:widget-label id="name"/>:
- <b><ft:widget id="name">
- <fi:styling type="output"/>
- </ft:widget></b>
- </ft:class>
-
- <ft:class id="opattern-class">
- <ft:widget-label id="pattern"/>:
- <b><ft:widget id="pattern">
- <fi:styling type="output"/>
- </ft:widget></b>
- </ft:class>
-
- <ft:class id="oresource-class">
- <b><ft:widget-label id="resource"/>:</b>
- <ft:widget id="resource">
- <fi:styling type="output"/>
- </ft:widget>
- </ft:class>
-
- <ft:class id="osrc-class">
- <ft:widget-label id="src"/>:
- <b><ft:widget id="src">
- <fi:styling type="output"/>
- </ft:widget></b>
- </ft:class>
-
- <ft:class id="otype-class">
- <ft:widget-label id="type"/>:
- <b><ft:widget id="type">
- <fi:styling type="output"/>
- </ft:widget></b>
- </ft:class>
-
- <ft:class id="ouri-class">
- <ft:widget-label id="uri"/>:
- <b><ft:widget id="uri">
- <fi:styling type="output"/>
- </ft:widget></b>
- </ft:class>
-
- <ft:class id="ovalue-class">
- <ft:widget-label id="value"/>:
- <b><ft:widget id="value">
- <fi:styling type="output"/>
- </ft:widget></b>
- </ft:class>
-
- <ft:class id="continuation-class"><b><ft:widget-label id="continuation"/>:</b><ft:widget id="continuation"/></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="name-class"><b><ft:widget-label id="name"/>:</b><ft:widget id="name"/></ft:class>
- <ft:class id="pattern-class"><b><ft:widget-label id="pattern"/>:</b><ft:widget id="pattern"/></ft:class>
- <ft:class id="resource-class"><b><ft:widget-label id="resource"/>:</b><ft:widget id="resource"/></ft:class>
- <ft:class id="src-class"><b><ft:widget-label id="src"/>:</b><ft:widget id="src"/></ft:class>
- <ft:class id="type-class"><b><ft:widget-label id="type"/>:</b><ft:widget id="type"/></ft:class>
- <ft:class id="uri-class"><b><ft:widget-label id="uri"/>:</b><ft:widget id="uri"/></ft:class>
- <ft:class id="value-class"><b><ft:widget-label id="value"/>:</b><ft:widget id="value"/></ft:class>
-
- <ft:class id="union-class">
- <ft:union id="union">
-
- <ft:case id="">
- </ft:case>
-
- <ft:case id="call">
- <ft:group id="call">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="ocontinuation-class"/>
- <ft:new id="oresource-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="ocontinuation-class"/>
- <ft:new id="oresource-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="continuation-class"/>
- <ft:new id="resource-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="components">
- <ft:group id="components">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- </ft:when>
- <ft:when value="view">
- </ft:when>
- <ft:when value="edit">
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="views">
- <ft:group id="views">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- </ft:when>
- <ft:when value="view">
- </ft:when>
- <ft:when value="edit">
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="resources">
- <ft:group id="resources">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- </ft:when>
- <ft:when value="view">
- </ft:when>
- <ft:when value="edit">
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="flow">
- <ft:group id="flow">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- </ft:when>
- <ft:when value="view">
- </ft:when>
- <ft:when value="edit">
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="generate">
- <ft:group id="generate">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="osrc-class"/>
- <ft:new id="otype-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="osrc-class"/>
- <ft:new id="otype-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="src-class"/>
- <ft:new id="type-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="match">
- <ft:group id="match">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="opattern-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="opattern-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="pattern-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="parameter">
- <ft:group id="parameter">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="oname-class"/>
- <ft:new id="ovalue-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="oname-class"/>
- <ft:new id="ovalue-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="name-class"/>
- <ft:new id="value-class"/>
- </ft:group>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="pipeline">
- <ft:group id="pipeline">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="otype-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="otype-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="type-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="pipelines">
- <ft:group id="pipelines">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <!-- Nothing -->
- </ft:when>
- <ft:when value="view">
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="read">
- <ft:group id="read">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="otype-class"/>
- <ft:new id="osrc-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="otype-class"/>
- <ft:new id="osrc-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="type-class"/>
- <ft:new id="src-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="redirect-to">
- <ft:group id="redirect-to">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="ouri-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="ouri-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="uri-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="serialize">
- <ft:group id="serialize">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="otype-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="otype-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="type-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="transform">
- <ft:group id="transform">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="otype-class"/>
- <ft:new id="osrc-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="otype-class"/>
- <ft:new id="osrc-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="type-class"/>
- <ft:new id="src-class"/>
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </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> 
- </ft:when>
- <ft:when value="view">
- <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b> 
- </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/img/view.gif"/></ft:widget>
- <ft:widget id="edit-view"><fi:styling type="image" src="resources/img/edit.gif"/></ft:widget>
- </ft:when>
- <ft:when value="view">
- <ft:widget id="fold-view"><fi:styling type="image" src="resources/img/fold.gif"/></ft:widget>
- <ft:widget id="edit-view"><fi:styling type="image" src="resources/img/edit.gif"/></ft:widget>
- </ft:when>
- <ft:when value="edit">
- <ft:widget id="fold-view"><fi:styling type="image" src="resources/img/fold.gif"/></ft:widget>
- <ft:widget id="view-view"><fi:styling type="image" src="resources/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/img/move_up.gif"/></ft:widget>
- <ft:widget id="down"><fi:styling type="image" src="resources/img/move_down.gif"/></ft:widget>
- <ft:widget id="add"><fi:styling type="image" src="resources/img/new.gif"/></ft:widget>
-  <ft:widget id="delete"><fi:styling type="image" src="resources/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/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>
+ <ft:import prefix="sitemap" uri="forms/sitemap_mt.xml"/>
<p>
- <ft:new id="items-class"/>
+ <ft:macro expand="sitemap:sitemap"/>
</p>
<ft:widget id="messages"/><br/>
<input type="submit"/>
Added: cocoon/whiteboard/forms/samples/swan/forms/swan_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/swan_binding.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/swan_binding.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,248 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+
+<!--
+Binding for Swan form binding editor.
+-->
+
+<fb:macros
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ lenient="true">
+
+ <fb:macro define="define">
+ <fb:value id="define" path="@define"/>
+ </fb:macro>
+
+ <fb:macro define="expand">
+ <fb:value id="expand" path="@expand"/>
+ </fb:macro>
+
+ <fb:macro define="id">
+ <fb:value id="id" path="@id"/>
+ </fb:macro>
+
+ <fb:macro define="label">
+ <fb:value id="label" path="fd:label"/>
+ </fb:macro>
+
+ <fb:macro define="path">
+ <fb:value id="path" path="@path"/>
+ </fb:macro>
+
+ <fb:macro define="required">
+ <fb:value id="required" path="@required">
+ <fd:convertor datatype="boolean"/>
+ </fb:value>
+ </fb:macro>
+
+ <fb:macro define="aggregate-class">
+ <fb:case id="aggregate" path=".">
+ <fb:insert-node><fb:aggregate/>
+</fb:insert-node>
+ <fb:group id="aggregate" path="fd:aggregate">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="id"/>
+ <fb:macro expand="path"/>
+ </fb:group>
+ <fb:macro expand="items-class"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="class-class">
+ <fb:case id="class" path=".">
+ <fb:insert-node><fb:class/>
+</fb:insert-node>
+ <fb:group id="class" path="fb:class">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="id"/>
+ </fb:group>
+ <fb:macro expand="items-class"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="group-class">
+ <fb:case id="group" path=".">
+ <fb:insert-node><fd:group/>
+</fb:insert-node>
+ <fb:group id="group" path="fd:group">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="id"/>
+ <fb:macro expand="label"/>
+ </fb:group>
+ <fb:macro expand="items-class"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="javascript-class">
+ <fb:case id="javascript" path=".">
+ <fb:insert-node><fb:javascript/>
+</fb:insert-node>
+ <fb:group id="javascript" path="fb:javascript">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="text-class"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="new-class">
+ <fb:case id="new" path=".">
+ <fb:insert-node><fb:new/>
+</fb:insert-node>
+ <fb:group id="new" path="fb:new">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="id"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="repeater-class">
+ <fb:case id="repeater" path=".">
+ <fb:insert-node><fb:repeater/>
+</fb:insert-node>
+ <fb:group id="repeater" path="fb:repeater">
+ <fb:group id="stuff" path=".">
+ <fb:insert-node>
+ <fb:on-bind/>
+ </fb:insert-node>
+ <fb:macro expand="id"/>
+ <fb:macro expand="parent-path-class"/>
+ </fb:group>
+ <fb:macro expand="items-class"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="temp-repeater-class">
+ <fb:case id="temp-repeater" path=".">
+ <fb:insert-node><fb:temp-repeater/>
+</fb:insert-node>
+ <fb:group id="temp-repeater" path="fb:temp-repeater">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="id"/>
+ <fb:macro expand="parent-path-class"/>
+ <fb:insert-node>
+ <fb:on-bind/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items-class"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="union-class">
+ <fb:case id="union" path=".">
+ <fb:insert-node><fb:union/>
+</fb:insert-node>
+ <fb:group id="union" path="fb:union">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="id"/>
+ <fb:macro expand="path"/>
+ <fb:insert-node>
+ <fd:widgets/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items-class"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="value-class">
+ <fb:case id="value" path=".">
+ <fb:insert-node><fb:value/>
+</fb:insert-node>
+ <fb:group id="value" path="fb:value">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="id"/>
+ <fb:value id="path" path="@path"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="struct-class">
+ <fb:case id="struct" path=".">
+ <fb:insert-node><fd:struct/>
+</fb:insert-node>
+ <fb:group id="struct" path="fd:struct">
+ <fb:group id="stuff" path=".">
+ <fb:macro expand="id"/>
+ <fb:macro expand="label"/>
+ </fb:group>
+ <fb:macro expand="items-class"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="parent-path-class">
+ <fb:value id="parent-path" path="@parent-path"/>
+ </fb:macro>
+
+ <fb:macro define="text-class">
+ <fb:value id="text" path="@text"/>
+ </fb:macro>
+
+ <fb:macro define="view-selector">
+ <fb:javascript id="view-selector" path="." direction="load">
+ <fb:load-form>
+ widget.setValue("view");
+ // View is selected by buttons.
+ widget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
+ </fb:load-form>
+ </fb:javascript>
+ </fb:macro>
+
+ <fb:macro define="items-class">
+ <fb:temp-repeater id="items"
+ parent-path="."
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind><fb:macro expand="item-row-class"/></fb:on-bind>
+ </fb:temp-repeater>
+ </fb:macro>
+
+ <fb:macro define="item-row-class">
+ <fb:javascript id="type-selector" path="." direction="load">
+ <fb:load-form>
+ widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName());
+ </fb:load-form>
+ </fb:javascript>
+ <fb:union id="union" path=".">
+ <fb:macro expand="aggregate-class"/>
+ <fb:macro expand="class-class"/>
+ <fb:macro expand="group-class"/>
+ <fb:macro expand="javascript-class"/>
+ <fb:macro expand="new-class"/>
+ <fb:macro expand="temp-repeater-class"/>
+ <fb:macro expand="struct-class"/>
+ <fb:macro expand="union-class"/>
+ <fb:macro expand="value-class"/>
+ </fb:union>
+ <!--
+ The view-selector binding must happen last,
+ so that all the widgets will exist that the
+ view-selector's on-value-changed handler needs.
+ -->
+ <fb:macro expand="view-selector"/>
+ </fb:macro>
+
+</fb:macros>
Added: cocoon/whiteboard/forms/samples/swan/forms/swan_mm.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/swan_mm.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/swan_mm.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,307 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:macros
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:macro define="item-actions">
+ <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 = Packages.org.apache.cocoon.forms.formmodel.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.setValue("edit");
+ // View is selected by buttons.
+ view.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
+ </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:widgets>
+ </fd:macro>
+
+ <fd:macro define="view-selector">
+ <fd:widgets>
+ <fd:field id="view-selector">
+ <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.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
+ if(stuff != null) {
+ stuff.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
+ }
+ type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
+ } else if("view".equals(widget.getValue())){
+ union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
+ if(stuff != null) {
+ stuff.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
+ }
+ type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
+ } else {
+ union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
+ type.setState(Packages.org.apache.cocoon.forms.formmodel.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:macro>
+
+ <fd:macro define="add-item">
+ <fd:widgets>
+ <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.setValue("edit");
+ // View is selected by buttons.
+ view.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
+ </javascript>
+ </fd:on-action>
+ </fd:repeater-action>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="continuation">
+ <fd:widgets>
+ <fd:field id="continuation">
+ <fd:label>Continuation</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="define">
+ <fd:widgets>
+ <fd:field id="define" required="false">
+ <fd:label>Define</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="expand">
+ <fd:widgets>
+ <fd:field id="expand" required="false">
+ <fd:label>Expand</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="id">
+ <fd:widgets>
+ <fd:field id="id" required="true">
+ <fd:hint>Id string</fd:hint>
+ <fd:help>Id string</fd:help>
+ <fd:label>Id</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="id-not-req">
+ <fd:widgets>
+ <fd:field id="id">
+ <fd:label>Id</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="initial-size">
+ <fd:widgets>
+ <fd:field id="initial-size">
+ <fd:label>Initial Size</fd:label>
+ <fd:datatype base="long"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="label">
+ <fd:widgets>
+ <fd:field id="label">
+ <fd:label>Label</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="name">
+ <fd:widgets>
+ <fd:field id="name">
+ <fd:label>Name</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="parent-path">
+ <fd:widgets>
+ <fd:field id="parent-path" required="true">
+ <fd:label>Parent Path</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="path">
+ <fd:widgets>
+ <fd:field id="path" required="true">
+ <fd:label>Path</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="pattern">
+ <fd:widgets>
+ <fd:field id="pattern">
+ <fd:label>Pattern</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="required">
+ <fd:widgets>
+ <fd:booleanfield id="required">
+ <fd:label>Required</fd:label>
+ </fd:booleanfield>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="resource">
+ <fd:widgets>
+ <fd:field id="resource">
+ <fd:label>Resource</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="src">
+ <fd:widgets>
+ <fd:field id="src">
+ <fd:label>Src</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="text">
+ <fd:widgets>
+ <fd:field id="text">
+ <fd:label>Text</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="type">
+ <fd:widgets>
+ <fd:field id="type">
+ <fd:label>Type</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="uri">
+ <fd:widgets>
+ <fd:field id="uri">
+ <fd:label>URI</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="value">
+ <fd:widgets>
+ <fd:field id="value">
+ <fd:label>Value</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ </fd:widgets>
+</fd:macros>
Added: cocoon/whiteboard/forms/samples/swan/forms/swan_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/swan_template.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/swan_template.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,269 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+
+<ft:macros
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+
+ <ft:macro define="fold">
+ <ft:widget id="fold-view"><fi:styling type="image" src="resources/img/fold.gif"/></ft:widget>
+ </ft:macro>
+
+ <ft:macro define="view">
+ <ft:widget id="view-view"><fi:styling type="image" src="resources/img/view.gif"/></ft:widget>
+ </ft:macro>
+
+ <ft:macro define="edit">
+ <ft:widget id="edit-view"><fi:styling type="image" src="resources/img/edit.gif"/></ft:widget>
+ </ft:macro>
+
+ <ft:macro define="view-selector">
+ <ft:choose path="view-selector">
+ <ft:when value="fold">
+ <ft:macro expand="view"/>
+ <ft:macro expand="edit"/>
+ </ft:when>
+ <ft:when value="view">
+ <ft:macro expand="fold"/>
+ <ft:macro expand="edit"/>
+ </ft:when>
+ <ft:when value="edit">
+ <ft:macro expand="fold"/>
+ <ft:macro expand="view"/>
+ </ft:when>
+ </ft:choose>
+ </ft:macro>
+
+ <ft:macro define="type-selector">
+ <ft:choose path="view-selector">
+ <ft:when value="fold">
+ <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b> 
+ </ft:when>
+ <ft:when value="view">
+ <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b> 
+ </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:macro>
+
+ <ft:macro define="item-actions">
+ <span class="actions">
+ <ft:widget id="up"><fi:styling type="image" src="resources/img/move_up.gif"/></ft:widget>
+ <ft:widget id="down"><fi:styling type="image" src="resources/img/move_down.gif"/></ft:widget>
+ <ft:widget id="add"><fi:styling type="image" src="resources/img/new.gif"/></ft:widget>
+  
+ <ft:widget id="delete"><fi:styling type="image" src="resources/img/delete.gif"/></ft:widget>
+ </span>
+ </ft:macro>
+
+ <ft:macro define="add-item">
+ <ft:widget id="addItem"><fi:styling type="image" src="resources/img/new_child.gif"/></ft:widget>
+ </ft:macro>
+
+ <!--
+ <ft:macro define="addItem">
+ <ft:macro expand="add-item"/>
+ </ft:macro>
+ -->
+
+ <ft:macro define="addItem">
+ <ft:widget id="addItem"><fi:styling type="image" src="resources/img/new_child.gif"/></ft:widget>
+ </ft:macro>
+
+ <ft:macro define="view-attr">
+ <ft:choose path="../../view-selector">
+ <ft:when value="fold">
+ <ft:group id="stuff">
+ <ft:widget-label id="@path"/>:
+ <b><ft:widget id="@path">
+ <fi:styling type="output"/>
+ </ft:widget></b>
+ </ft:group>
+ </ft:when>
+ <ft:when value="view">
+ <ft:group id="stuff">
+ <ft:widget-label id="@path"/>:
+ <b><ft:widget id="@path">
+ <fi:styling type="output"/>
+ </ft:widget></b>
+ </ft:group>
+ </ft:when>
+ <ft:when value="edit">
+ <ft:group id="stuff">
+ <ft:widget-label id="@path"/>:
+ <b><ft:widget id="@path"/></b>
+ </ft:group>
+ </ft:when>
+ </ft:choose>
+ </ft:macro>
+
+ <ft:macro define="continuation">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="continuation"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="the-items">
+ <ft:macro expand="addItem"/>
+ <ft:repeater-size id="items"/>
+ <ft:repeater-widget id="items">
+ <div class="section">
+ <ft:macro expand="item-actions"/>
+ <ft:macro expand="view-selector"/>
+ <ft:macro expand="type-selector"/>
+ <ft:macro expand="union-class"/>
+ </div>
+ </ft:repeater-widget>
+ </ft:macro>
+
+ <ft:macro define="define">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="define"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="expand">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="expand"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="help">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="help"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="id">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="id"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="initial-size">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="initial-size"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="items">
+ <ft:choose path="../../view-selector">
+ <ft:when value="fold">
+ </ft:when>
+ <ft:when value="view">
+ <ft:macro expand="the-items"/>
+ </ft:when>
+ <ft:when value="edit">
+ <ft:macro expand="the-items"/>
+ </ft:when>
+ </ft:choose>
+ </ft:macro>
+
+ <ft:macro define="label">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="label"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="name">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="name"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="path">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="path"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="parent-path">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="parent-path"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="pattern">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="pattern"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="required">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="required"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="resource">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="resource"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="src">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="src"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="text">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="text"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="type">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="type"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="uri">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="uri"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="value">
+ <ft:macro expand="view-attr">
+ <ft:param name="path" value="value"/>
+ </ft:macro>
+ </ft:macro>
+
+ <ft:macro define="union-class">
+ <ft:union id="union">
+
+ <ft:case id="">
+ </ft:case>
+
+ <ft:case id="call">
+ <ft:group id="call">
+ <ft:macro expand="continuation"/>
+ <ft:macro expand="resource"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ </ft:union>
+ </ft:macro>
+
+</ft:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/template_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/template_binding.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/template_binding.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/template_binding.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/template_binding.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/template_binding.xml Thu Jan 13 13:42:02 2005
@@ -24,285 +24,11 @@
<fb:context
xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
- path="/page"
+ path="."
lenient="true">
- <fb:new id="items-class"/>
+ <fb:import prefix="template" uri="forms/template_mb.xml"/>
- <fb:class id="case-class">
- <fb:case id="case" path=".">
- <fb:insert-node><ft:case/>
-</fb:insert-node>
- <fb:group id="case" path="ft:case">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="class-class">
- <fb:case id="class" path=".">
- <fb:insert-node><ft:class/>
-</fb:insert-node>
- <fb:group id="class" path="ft:class">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="form-template-class">
- <fb:case id="form-template" path=".">
- <fb:insert-node><ft:form-template/>
-</fb:insert-node>
- <fb:group id="form-template" path="ft:form-template">
- <fb:group id="stuff" path=".">
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="group-class">
- <fb:case id="group" path=".">
- <fb:insert-node><ft:group/>
-</fb:insert-node>
- <fb:group id="group" path="ft:group">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- <fb:insert-node>
- <ft:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="new-class">
- <fb:case id="new" path=".">
- <fb:insert-node><ft:new/>
-</fb:insert-node>
- <fb:group id="new" path="ft:new">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="repeater-size-class">
- <fb:case id="repeater-size" path=".">
- <fb:insert-node><ft:repeater-size/>
-</fb:insert-node>
- <fb:group id="repeater-size" path="ft:repeater-size">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="repeater-widget-class">
- <fb:case id="repeater-widget" path=".">
- <fb:insert-node><ft:repeater-widget/>
-</fb:insert-node>
- <fb:group id="repeater-widget" path="ft:repeater-widget">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:insert-node></fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="struct-class">
- <fb:case id="struct" path=".">
- <fb:insert-node><ft:struct/>
-</fb:insert-node>
- <fb:group id="struct" path="ft:struct">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- <fb:new id="label-class"/>
- <fb:insert-node>
- <ft:widgets/>
- </fb:insert-node>
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="union-class">
- <fb:case id="union" path=".">
- <fb:insert-node><ft:union/>
-</fb:insert-node>
- <fb:group id="union" path="ft:union">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- </fb:group>
- <!--<ft:new id="label-class"/>-->
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="widget-class">
- <fb:case id="widget" path=".">
- <fb:insert-node><ft:widget/>
-</fb:insert-node>
- <fb:group id="widget" path="ft:widget">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="widget-label-class">
- <fb:case id="widget-label" path=".">
- <fb:insert-node><ft:widget-label/>
-</fb:insert-node>
- <fb:group id="widget-label" path="ft:widget-label">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- </fb:group>
- </fb:group>
- </fb:case>
- </fb:class>
-
- <fb:class id="default-class">
-
- <fb:case id="table" path=".">
- <fb:insert-node><table/></fb:insert-node>
- <fb:group id="table" path="table">
- <fb:group id="stuff" path=".">
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
-
- <fb:case id="tr" path=".">
- <fb:insert-node><tr/></fb:insert-node>
- <fb:group id="tr" path="tr">
- <fb:group id="stuff" path=".">
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
-
- <fb:case id="td" path=".">
- <fb:insert-node><td/></fb:insert-node>
- <fb:group id="td" path="td">
- <fb:group id="stuff" path=".">
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
-
- <fb:case id="p" path=".">
- <fb:insert-node><p/></fb:insert-node>
- <fb:group id="p" path="p">
- <fb:group id="stuff" path=".">
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
-
- <fb:case id="input" path=".">
- <fb:insert-node><input/></fb:insert-node>
- <fb:group id="input" path="input">
- <fb:group id="stuff" path=".">
- <fb:value id="id" path="@id"/>
- </fb:group>
- </fb:group>
- </fb:case>
-
- <fb:case id="content" path=".">
- <fb:insert-node><content/></fb:insert-node>
- <fb:group id="content" path="content">
- <fb:group id="stuff" path=".">
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
-
- <fb:case id="title" path=".">
- <fb:insert-node><title/></fb:insert-node>
- <fb:group id="title" path="title">
- <fb:group id="stuff" path=".">
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
-
- <fb:case id="page" path=".">
- <fb:insert-node><page/></fb:insert-node>
- <fb:group id="page" path="page">
- <fb:group id="stuff" path=".">
- </fb:group>
- <fb:new id="items-class"/>
- </fb:group>
- </fb:case>
-
- </fb:class>
-
- <fb:class id="view-selector-class">
- <fb:javascript id="view-selector" path="." direction="load">
- <fb:load-form>
- widget.setValue("view");
- // View is selected by buttons.
- widget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </fb:load-form>
- </fb:javascript>
- </fb:class>
-
- <fb:class id="items-class">
- <fb:temp-repeater id="items"
- parent-path="."
- row-path="*" row-path-insert="."
- virtual-rows="true">
- <fb:on-bind><fb:new id="item-row-class"/></fb:on-bind>
- </fb:temp-repeater>
- </fb:class>
-
- <fb:class id="item-row-class">
- <fb:javascript id="type-selector" path="." direction="load">
- <fb:load-form>
- var node = jxpathPointer.getNode().getFirstChild();
- widget.setValue(node.getLocalName());
- </fb:load-form>
- </fb:javascript>
- <fb:union id="union" path=".">
- <fb:new id="case-class"/>
- <fb:new id="class-class"/>
- <fb:new id="form-template-class"/>
- <fb:new id="group-class"/>
- <fb:new id="new-class"/>
- <fb:new id="repeater-size-class"/>
- <fb:new id="repeater-widget-class"/>
- <fb:new id="struct-class"/>
- <fb:new id="union-class"/>
- <fb:new id="widget-class"/>
- <fb:new id="widget-label-class"/>
- <fb:new id="default-class"/>
- </fb:union>
- <!--
- The view-selector binding must happen last,
- so that all the widgets will exist that the
- view-selector's on-value-changed handler needs.
- -->
- <fb:new id="view-selector-class"/>
- </fb:class>
-
- <fb:class id="label-class">
- <fb:value id="label" path="ft:label"/>
- </fb:class>
+ <fb:macro expand="template:template"/>
</fb:context>
Added: cocoon/whiteboard/forms/samples/swan/forms/template_mb.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/template_mb.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/template_mb.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,302 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+
+<!--
+Binding for Swan form template editor.
+
+@version CVS $Id$
+-->
+
+<fb:macros
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template">
+
+ <fb:import prefix="swan" uri="forms/swan_binding.xml"/>
+
+ <fb:macro define="template">
+ <fb:context path="/page" lenient="true">
+ <fb:macro expand="items"/>
+ </fb:context>
+ </fb:macro>
+
+ <fb:macro define="items">
+ <fb:temp-repeater id="items"
+ parent-path="."
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind><fb:macro expand="item-row"/></fb:on-bind>
+ </fb:temp-repeater>
+ </fb:macro>
+
+ <fb:macro define="item-row">
+ <fb:javascript id="type-selector" path="." direction="load">
+ <fb:load-form>
+ var node = jxpathPointer.getNode().getFirstChild();
+ widget.setValue(node.getLocalName());
+ </fb:load-form>
+ </fb:javascript>
+ <fb:union id="union" path=".">
+ <fb:macro expand="case"/>
+ <fb:macro expand="class"/>
+ <fb:macro expand="form-template"/>
+ <fb:macro expand="group"/>
+ <fb:macro expand="new"/>
+ <fb:macro expand="repeater-size"/>
+ <fb:macro expand="repeater-widget"/>
+ <fb:macro expand="struct"/>
+ <fb:macro expand="union"/>
+ <fb:macro expand="widget"/>
+ <fb:macro expand="widget-label"/>
+ <fb:macro expand="default"/>
+ </fb:union>
+ <!--
+ The view-selector binding must happen last,
+ so that all the widgets will exist that the
+ view-selector's on-value-changed handler needs.
+ -->
+ <fb:macro expand="swan:view-selector"/>
+ </fb:macro>
+
+ <fb:macro define="label">
+ <fb:value id="label" path="ft:label"/>
+ </fb:macro>
+
+ <fb:macro define="case">
+ <fb:case id="case" path=".">
+ <fb:insert-node><ft:case/>
+</fb:insert-node>
+ <fb:group id="case" path="ft:case">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="class">
+ <fb:case id="class" path=".">
+ <fb:insert-node><ft:class/>
+</fb:insert-node>
+ <fb:group id="class" path="ft:class">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="form-template">
+ <fb:case id="form-template" path=".">
+ <fb:insert-node><ft:form-template/>
+</fb:insert-node>
+ <fb:group id="form-template" path="ft:form-template">
+ <fb:group id="stuff" path=".">
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="group">
+ <fb:case id="group" path=".">
+ <fb:insert-node><ft:group/>
+</fb:insert-node>
+ <fb:group id="group" path="ft:group">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ <fb:macro expand="label"/>
+ <fb:insert-node>
+ <ft:widgets/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="new">
+ <fb:case id="new" path=".">
+ <fb:insert-node><ft:new/>
+</fb:insert-node>
+ <fb:group id="new" path="ft:new">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="repeater-size">
+ <fb:case id="repeater-size" path=".">
+ <fb:insert-node><ft:repeater-size/>
+</fb:insert-node>
+ <fb:group id="repeater-size" path="ft:repeater-size">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="repeater-widget">
+ <fb:case id="repeater-widget" path=".">
+ <fb:insert-node><ft:repeater-widget/>
+</fb:insert-node>
+ <fb:group id="repeater-widget" path="ft:repeater-widget">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ <fb:insert-node></fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="struct">
+ <fb:case id="struct" path=".">
+ <fb:insert-node><ft:struct/>
+</fb:insert-node>
+ <fb:group id="struct" path="ft:struct">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ <fb:macro expand="label"/>
+ <fb:insert-node>
+ <ft:widgets/>
+ </fb:insert-node>
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="union">
+ <fb:case id="union" path=".">
+ <fb:insert-node><ft:union/>
+</fb:insert-node>
+ <fb:group id="union" path="ft:union">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ </fb:group>
+ <!--<ft:new id="label"/>-->
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="widget">
+ <fb:case id="widget" path=".">
+ <fb:insert-node><ft:widget/>
+</fb:insert-node>
+ <fb:group id="widget" path="ft:widget">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="widget-label">
+ <fb:case id="widget-label" path=".">
+ <fb:insert-node><ft:widget-label/>
+</fb:insert-node>
+ <fb:group id="widget-label" path="ft:widget-label">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+ </fb:macro>
+
+ <fb:macro define="default">
+
+ <fb:case id="table" path=".">
+ <fb:insert-node><table/></fb:insert-node>
+ <fb:group id="table" path="table">
+ <fb:group id="stuff" path=".">
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+
+ <fb:case id="tr" path=".">
+ <fb:insert-node><tr/></fb:insert-node>
+ <fb:group id="tr" path="tr">
+ <fb:group id="stuff" path=".">
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+
+ <fb:case id="td" path=".">
+ <fb:insert-node><td/></fb:insert-node>
+ <fb:group id="td" path="td">
+ <fb:group id="stuff" path=".">
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+
+ <fb:case id="p" path=".">
+ <fb:insert-node><p/></fb:insert-node>
+ <fb:group id="p" path="p">
+ <fb:group id="stuff" path=".">
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+
+ <fb:case id="input" path=".">
+ <fb:insert-node><input/></fb:insert-node>
+ <fb:group id="input" path="input">
+ <fb:group id="stuff" path=".">
+ <fb:value id="id" path="@id"/>
+ </fb:group>
+ </fb:group>
+ </fb:case>
+
+ <fb:case id="content" path=".">
+ <fb:insert-node><content/></fb:insert-node>
+ <fb:group id="content" path="content">
+ <fb:group id="stuff" path=".">
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+
+ <fb:case id="title" path=".">
+ <fb:insert-node><title/></fb:insert-node>
+ <fb:group id="title" path="title">
+ <fb:group id="stuff" path=".">
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+
+ <fb:case id="page" path=".">
+ <fb:insert-node><page/></fb:insert-node>
+ <fb:group id="page" path="page">
+ <fb:group id="stuff" path=".">
+ </fb:group>
+ <fb:macro expand="items"/>
+ </fb:group>
+ </fb:case>
+
+ </fb:macro>
+
+</fb:macros>
Added: cocoon/whiteboard/forms/samples/swan/forms/template_mm.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/template_mm.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/template_mm.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,323 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:macros
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:import prefix="swan" uri="forms/swan_mm.xml"/>
+
+ <fd:macro define="template">
+ <fd:widgets>
+ <fd:messages id="messages"/>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="items">
+ <fd:widgets>
+ <fd:repeater id="items" initial-size="0">
+ <fd:label>Items</fd:label>
+ <fd:widgets>
+ <fd:macro expand="item-row"/>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:macro expand="swan:add-item"/>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="type-selector">
+ <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:macro>
+
+ <fd:macro define="item-row">
+ <fd:widgets>
+
+ <fd:macro expand="swan:item-actions"/>
+ <fd:macro expand="swan:view-selector"/>
+ <fd:macro expand="type-selector"/>
+
+ <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:macro expand="swan:id-not-req"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="class">
+ <fd:label>Class</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </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:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="group">
+ <fd:label>Group</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="new">
+ <fd:label>New</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ </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:macro expand="swan:id"/>
+ </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:macro expand="swan:id"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="struct">
+ <fd:label>Struct</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="union">
+ <fd:label>Union</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ <fd:macro expand="swan:label"/>
+ </fd:widgets>
+ </fd:group>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="widget">
+ <fd:label>Widget</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ </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:macro expand="swan:id"/>
+ </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:macro expand="swan:id"/>
+ </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:macro expand="items"/>
+ </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:macro expand="items"/>
+ </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:macro expand="items"/>
+ </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:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="input">
+ <fd:label>Input</fd:label>
+ <fd:widgets>
+ <fd:group id="stuff">
+ <fd:widgets>
+ <fd:macro expand="swan:id"/>
+ </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:macro expand="items"/>
+ </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:macro expand="items"/>
+ </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:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ </fd:widgets>
+
+ </fd:union>
+ </fd:widgets>
+ </fd:macro>
+
+ </fd:widgets>
+</fd:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/template_model.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/template_model.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/template_model.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/template_model.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/template_model.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/template_model.xml Thu Jan 13 13:42:02 2005
@@ -19,459 +19,9 @@
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<fd:widgets>
- <!--
- CVS $Id$
- -->
+ <fd:import prefix="template" uri="forms/template_mm.xml"/>
- <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.setValue("edit");
- // View is selected by buttons.
- view.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </javascript>
- </fd:on-action>
- </fd:repeater-action>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="view-selector-class">
- <fd:widgets>
- <fd:field id="view-selector">
- <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.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- if(stuff != null) {
- stuff.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- }
- type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- } else if("view".equals(widget.getValue())){
- union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
- if(stuff != null) {
- stuff.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- }
- type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- } else {
- union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- type.setState(Packages.org.apache.cocoon.forms.formmodel.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 = Packages.org.apache.cocoon.forms.formmodel.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.setValue("edit");
- // View is selected by buttons.
- view.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
- </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:macro expand="template:template"/>
</fd:widgets>
</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/forms/template_mt.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/template_mt.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/template_mt.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,192 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<ft:macros
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+
+ <ft:import prefix="swan" uri="forms/swan_template.xml"/>
+
+ <ft:macro define="template">
+ <ft:macro expand="item-list"/>
+ </ft:macro>
+
+ <ft:macro define="item-row">
+ <ft:macro expand="swan:item-actions"/>
+ <ft:macro expand="swan:view-selector"/>
+ <ft:macro expand="swan:type-selector"/>
+ <ft:macro expand="types"/>
+ </ft:macro>
+
+ <ft:macro define="item-list">
+ <ft:macro expand="swan:addItem"/>
+ <ft:repeater-size id="items"/>
+ <ft:repeater-widget id="items">
+ <div class="section"><ft:macro expand="item-row"/></div>
+ </ft:repeater-widget>
+ </ft:macro>
+
+ <ft:macro define="items">
+ <ft:choose path="../../view-selector">
+ <ft:when value="fold">
+ </ft:when>
+ <ft:when value="view">
+ <ft:macro expand="item-list"/>
+ </ft:when>
+ <ft:when value="edit">
+ <ft:macro expand="item-list"/>
+ </ft:when>
+ </ft:choose>
+ </ft:macro>
+
+ <ft:macro define="types">
+ <ft:union id="union">
+
+ <ft:case id="">
+ </ft:case>
+
+ <ft:case id="case">
+ <ft:group id="case">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="class">
+ <ft:group id="class">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="content">
+ <ft:group id="content">
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="default">
+ <ft:group id="default">
+ <ft:macro expand="swan:id"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="form-template">
+ <ft:group id="form-template">
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="group">
+ <ft:group id="group">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="input">
+ <ft:group id="input">
+ <ft:macro expand="swan:id"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="new">
+ <ft:group id="new">
+ <ft:macro expand="swan:id"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="p">
+ <ft:group id="p">
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="page">
+ <ft:group id="page">
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="repeater-size">
+ <ft:group id="repeater-size">
+ <ft:macro expand="swan:id"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="repeater-widget">
+ <ft:group id="repeater-widget">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="struct">
+ <ft:group id="struct">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="swan:label"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="table">
+ <ft:group id="table">
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="td">
+ <ft:group id="td">
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="title">
+ <ft:group id="title">
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="tr">
+ <ft:group id="tr">
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="union">
+ <ft:group id="union">
+ <ft:macro expand="swan:id"/>
+ <ft:macro expand="items"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="widget">
+ <ft:group id="widget">
+ <ft:macro expand="swan:id"/>
+ </ft:group>
+ </ft:case>
+
+ <ft:case id="widget-label">
+ <ft:group id="widget-label">
+ <ft:macro expand="swan:id"/>
+ </ft:group>
+ </ft:case>
+
+ </ft:union>
+ </ft:macro>
+
+</ft:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/template_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/template_template.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/template_template.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/template_template.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/template_template.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/template_template.xml Thu Jan 13 13:42:02 2005
@@ -23,297 +23,10 @@
<content>
<ft:form-template action="#{$continuation/id}.continue" method="POST">
- <ft:class id="id-class">
- <ft:widget-label id="id"/>:<ft:widget id="id"/>
- </ft:class>
-
- <ft:class id="label-class">
- <ft:widget-label id="label"/>:<ft:widget id="label"/>
- </ft:class>
-
- <ft:class id="output-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="std-id-class">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="output-id-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="output-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-label-class">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- <ft:new id="output-label-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="output-label-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- <ft:new id="label-class"/>
- </ft:group>
- </ft:when>
- </ft:choose>
- </ft:class>
-
- <ft:class id="std-items-class">
- <ft:choose path="../../view-selector">
- <ft:when value="fold">
- <ft:group id="stuff">
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- </ft:group>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:group id="stuff">
- </ft:group>
- <ft:new id="items-class"/>
- </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="output-id-class"/>
- </ft:group>
- </ft:when>
- <ft:when value="view">
- <ft:group id="stuff">
- <ft:new id="output-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="union-class">
- <ft:union id="union">
-
- <ft:case id="">
- </ft:case>
-
- <ft:case id="case">
- <ft:group id="case">
- <ft:new id="std-id-items-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="content">
- <ft:group id="content">
- <ft:new id="std-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="default">
- <ft:group id="default">
- <ft:new id="std-id-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="form-template">
- <ft:group id="form-template">
- <ft:new id="std-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="group">
- <ft:group id="group">
- <ft:new id="std-id-class"/>
- <ft:new id="std-label-class"/>
- <ft:new id="std-id-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="input">
- <ft:group id="input">
- <ft:new id="std-id-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="p">
- <ft:group id="p">
- <ft:new id="items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="page">
- <ft:group id="page">
- <ft:new id="items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="repeater-size">
- <ft:group id="repeater-size">
- <ft:new id="std-id-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="repeater-widget">
- <ft:group id="repeater-widget">
- <ft:new id="std-id-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="struct">
- <ft:group id="struct">
- <ft:new id="std-id-class"/>
- <ft:new id="std-label-class"/>
- <ft:new id="std-id-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="table">
- <ft:group id="table">
- <ft:new id="std-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="td">
- <ft:group id="td">
- <ft:new id="std-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="title">
- <ft:group id="title">
- <ft:new id="std-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="tr">
- <ft:group id="tr">
- <ft:new id="std-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="union">
- <ft:group id="union">
- <ft:new id="std-id-items-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="widget">
- <ft:group id="widget">
- <ft:new id="std-id-class"/>
- </ft:group>
- </ft:case>
-
- <ft:case id="widget-label">
- <ft:group id="widget-label">
- <ft:new id="std-id-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> 
- </ft:when>
- <ft:when value="view">
- <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b> 
- </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/img/view.gif"/></ft:widget>
- <ft:widget id="edit-view"><fi:styling type="image" src="resources/img/edit.gif"/></ft:widget>
- </ft:when>
- <ft:when value="view">
- <ft:widget id="fold-view"><fi:styling type="image" src="resources/img/fold.gif"/></ft:widget>
- <ft:widget id="edit-view"><fi:styling type="image" src="resources/img/edit.gif"/></ft:widget>
- </ft:when>
- <ft:when value="edit">
- <ft:widget id="fold-view"><fi:styling type="image" src="resources/img/fold.gif"/></ft:widget>
- <ft:widget id="view-view"><fi:styling type="image" src="resources/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/img/move_up.gif"/></ft:widget>
- <ft:widget id="down"><fi:styling type="image" src="resources/img/move_down.gif"/></ft:widget>
- <ft:widget id="add"><fi:styling type="image" src="resources/img/new.gif"/></ft:widget>
-  <ft:widget id="delete"><fi:styling type="image" src="resources/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/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>
+ <ft:import prefix="template" uri="forms/template_mt.xml"/>
<p>
- <ft:new id="items-class"/>
+ <ft:macro expand="template:template"/>
</p>
<ft:widget id="messages"/><br/>
<input type="submit"/>
Modified: cocoon/whiteboard/forms/samples/swan/forms/xreport_binding.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/xreport_binding.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/xreport_binding.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/xreport_binding.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/xreport_binding.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/xreport_binding.xml Thu Jan 13 13:42:02 2005
@@ -24,148 +24,11 @@
<fb:context
xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
- path="/report"
+ path="."
lenient="true">
- <fb:new id="id-class"/>
- <fb:new id="name-class"/>
- <fb:new id="description-class"/>
- <fb:new id="req-ds-type-class"/>
- <fb:new id="catalogs-class"/>
- <fb:new id="flow-class"/>
- <fb:new id="output-class"/>
+ <fb:import prefix="xreport" uri="forms/xreport_mb.xml"/>
- <fb:class id="catalog-class">
- <fb:value id="catalog" path="catalog"/>
- </fb:class>
-
- <fb:class id="catalogs-class">
- <fb:temp-repeater id="catalogs"
- parent-path="catalogs"
- row-path="*" row-path-insert="."
- virtual-rows="true">
- <fb:on-bind><fb:new id="catalog-class"/></fb:on-bind>
- </fb:temp-repeater>
- </fb:class>
-
- <fb:class id="database-class">
- <fb:group id="database" path="database">
- <fb:new id="sql-class"/>
- </fb:group>
- </fb:class>
-
- <fb:class id="datatype-id-class">
- <fb:value id="datatype-id" path="@datatype-id"/>
- </fb:class>
-
- <fb:class id="description-class">
- <fb:value id="description" path="description"/>
- </fb:class>
-
- <fb:class id="dialect-class">
- <fb:temp-repeater id="dialect"
- parent-path="dialect"
- row-path="*" row-path-insert="."
- virtual-rows="true">
- <fb:on-bind>
- <fb:javascript id="sql-type-selector" path="." direction="load">
- <fb:load-form>
- widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName());
- </fb:load-form>
- </fb:javascript>
- <fb:union id="type" path=".">
- <fb:new id="literal-class"/>
- <fb:new id="sql-parameter-class"/>
- </fb:union>
- </fb:on-bind>
- </fb:temp-repeater>
- </fb:class>
-
- <fb:class id="flow-class">
- <fb:temp-repeater id="flow"
- parent-path="flow"
- row-path="*" row-path-insert="."
- virtual-rows="true">
- <fb:on-bind><fb:new id="step-class"/></fb:on-bind>
- </fb:temp-repeater>
- </fb:class>
-
- <fb:class id="id-class">
- <fb:value id="id" path="@id"/>
- </fb:class>
-
- <fb:class id="interaction-class">
- <fb:temp-repeater id="interaction"
- parent-path="interaction"
- row-path="*" row-path-insert="."
- virtual-rows="true">
- <fb:on-bind><fb:new id="step-parameter-class"/></fb:on-bind>
- </fb:temp-repeater>
- </fb:class>
-
- <fb:class id="name-class">
- <fb:value id="name" path="name"/>
- </fb:class>
-
- <fb:class id="req-ds-type-class">
- <fb:value id="req-ds-type" path="required-datasource-type"/>
- </fb:class>
-
- <fb:class id="label-class">
- <fb:value id="label" path="fd:label"/>
- </fb:class>
-
- <fb:class id="literal-class">
- <fb:value id="literal" path="literal"/>
- </fb:class>
-
- <fb:class id="output-class">
- <fb:group id="output" path="output">
- <fb:new id="database-class"/>
- </fb:group>
- </fb:class>
-
- <fb:class id="required-class">
- <fb:value id="required" path="@required">
- <fd:convertor datatype="boolean"/>
- </fb:value>
- </fb:class>
-
- <fb:class id="sql-class">
- <fb:group id="sql" path="sql">
- <fb:new id="dialect-class"/>
- </fb:group>
- </fb:class>
-
- <fb:class id="sql-parameter-class">
- <fb:value id="sql-parameter" path="parameter/@idref"/>
- </fb:class>
-
- <fb:class id="step-class">
- <fb:insert-node><step/>
-</fb:insert-node>
- <fb:group id="step" path="step">
- <fb:new id="id-class"/>
- <fb:new id="interaction-class"/>
- </fb:group>
- </fb:class>
-
- <fb:class id="step-parameter-class">
- <fb:insert-node><parameter/>
-</fb:insert-node>
- <fb:group id="step-parameter" path="parameter">
- <fb:new id="id-class"/>
- <fb:new id="required-class"/>
- <fb:new id="datatype-id-class"/>
- </fb:group>
- </fb:class>
-
- <fb:class id="view-selector-class">
- <fb:javascript id="view-selector" path="." direction="load">
- <fb:load-form>
- widget.setValue("edit");
- </fb:load-form>
- </fb:javascript>
- </fb:class>
+ <fb:macro expand="xreport:xreport"/>
</fb:context>
Added: cocoon/whiteboard/forms/samples/swan/forms/xreport_mb.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/xreport_mb.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/xreport_mb.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,171 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+
+<!--
+Binding for example CForms form model GUI.
+
+@version CVS $Id: form_model_gui_binding.xml,v 1.3 2004/04/12 14:05:09 tim Exp $
+-->
+
+<fb:macros
+ xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
+
+ <fb:import prefix="swan" uri="forms/swan_binding.xml"/>
+
+ <fb:macro define="xreport">
+ <fb:context path="/report" lenient="true">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="name"/>
+ <fb:macro expand="description"/>
+ <fb:macro expand="req-ds-type"/>
+ <fb:macro expand="catalogs"/>
+ <fb:macro expand="flow"/>
+ <fb:macro expand="output"/>
+ </fb:context>
+ </fb:macro>
+
+ <fb:macro define="catalog">
+ <fb:value id="catalog" path="catalog"/>
+ </fb:macro>
+
+ <fb:macro define="catalogs">
+ <fb:group id="catalogs" path=".">
+ <fb:temp-repeater id="list"
+ parent-path="catalogs"
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind><fb:macro expand="catalog"/></fb:on-bind>
+ </fb:temp-repeater>
+ </fb:group>
+ </fb:macro>
+
+ <fb:macro define="database">
+ <fb:group id="database" path="database">
+ <fb:macro expand="sql"/>
+ </fb:group>
+ </fb:macro>
+
+ <fb:macro define="datatype-id">
+ <fb:value id="datatype-id" path="@datatype-id"/>
+ </fb:macro>
+
+ <fb:macro define="description">
+ <fb:value id="description" path="description"/>
+ </fb:macro>
+
+ <fb:macro define="dialect">
+ <fb:group id="dialect" path=".">
+ <fb:temp-repeater id="list"
+ parent-path="dialect"
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind>
+ <fb:javascript id="sql-type-selector" path="." direction="load">
+ <fb:load-form>
+ widget.setValue(jxpathPointer.getNode().getFirstChild().getLocalName());
+ </fb:load-form>
+ </fb:javascript>
+ <fb:union id="type" path=".">
+ <fb:macro expand="literal"/>
+ <fb:macro expand="sql-parameter"/>
+ </fb:union>
+ </fb:on-bind>
+ </fb:temp-repeater>
+ </fb:group>
+ </fb:macro>
+
+ <fb:macro define="flow">
+ <fb:group id="flow" path=".">
+ <fb:temp-repeater id="list"
+ parent-path="flow"
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind><fb:macro expand="step"/></fb:on-bind>
+ </fb:temp-repeater>
+ </fb:group>
+ </fb:macro>
+
+ <fb:macro define="interaction">
+ <fb:group id="interaction" path=".">
+ <fb:temp-repeater id="list"
+ parent-path="interaction"
+ row-path="*" row-path-insert="."
+ virtual-rows="true">
+ <fb:on-bind><fb:macro expand="step-parameter"/></fb:on-bind>
+ </fb:temp-repeater>
+ </fb:group>
+ </fb:macro>
+
+ <fb:macro define="name">
+ <fb:value id="name" path="name"/>
+ </fb:macro>
+
+ <fb:macro define="req-ds-type">
+ <fb:value id="req-ds-type" path="required-datasource-type"/>
+ </fb:macro>
+
+ <fb:macro define="label">
+ <fb:value id="label" path="fd:label"/>
+ </fb:macro>
+
+ <fb:macro define="literal">
+ <fb:value id="literal" path="literal"/>
+ </fb:macro>
+
+ <fb:macro define="output">
+ <fb:group id="output" path="output">
+ <fb:macro expand="database"/>
+ </fb:group>
+ </fb:macro>
+
+ <fb:macro define="required">
+ <fb:value id="required" path="@required">
+ <fd:convertor datatype="boolean"/>
+ </fb:value>
+ </fb:macro>
+
+ <fb:macro define="sql">
+ <fb:group id="sql" path="sql">
+ <fb:macro expand="dialect"/>
+ </fb:group>
+ </fb:macro>
+
+ <fb:macro define="sql-parameter">
+ <fb:value id="sql-parameter" path="parameter/@idref"/>
+ </fb:macro>
+
+ <fb:macro define="step">
+ <fb:insert-node><step/>
+</fb:insert-node>
+ <fb:group id="step" path="step">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="interaction"/>
+ </fb:group>
+ </fb:macro>
+
+ <fb:macro define="step-parameter">
+ <fb:insert-node><parameter/>
+</fb:insert-node>
+ <fb:group id="step-parameter" path="parameter">
+ <fb:macro expand="swan:id"/>
+ <fb:macro expand="required"/>
+ <fb:macro expand="datatype-id"/>
+ </fb:group>
+ </fb:macro>
+
+</fb:macros>
Added: cocoon/whiteboard/forms/samples/swan/forms/xreport_mm.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/xreport_mm.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/xreport_mm.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,543 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<fd:macros
+ xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+ <fd:widgets>
+
+ <fd:macro define="xreport">
+ <fd:widgets>
+ <fd:messages id="messages"/>
+ <fd:macro expand="id"/>
+ <fd:macro expand="name"/>
+ <fd:macro expand="description"/>
+ <fd:macro expand="req-ds-type"/>
+ <fd:macro expand="catalogs"/>
+ <fd:macro expand="flow"/>
+ <fd:macro expand="output"/>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="add-item">
+ <fd:widgets>
+ <fd:repeater-action id="addItem" action-command="add-row" repeater="list">
+ <fd:label>Add Child</fd:label>
+ <fd:hint>Add child</fd:hint>
+ </fd:repeater-action>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="items">
+ <fd:widgets>
+ <fd:group id="items">
+ <fd:widgets>
+ <fd:repeater id="list" initial-size="1">
+ <fd:label>Items</fd:label>
+ <fd:widgets>
+ <fd:macro expand="item-row"/>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:macro expand="add-item"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="select">
+ <fd:widgets>
+ <fd:booleanfield id="select"><fd:label>Select</fd:label></fd:booleanfield>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="type-selector">
+ <fd:widgets>
+ <fd:field id="type-selector">
+ <fd:label>Widget Type</fd:label>
+ <fd:datatype base="string"/>
+ <fd:selection-list>
+ <fd:item value=""><fd:label>Nothing</fd:label></fd:item>
+ <fd:item value="database"><fd:label>Database</fd:label></fd:item>
+ <fd:item value="dialect"><fd:label>Dialect</fd:label></fd:item>
+ <fd:item value="flow"><fd:label>Flow</fd:label></fd:item>
+ <fd:item value="interaction"><fd:label>Interaction</fd:label></fd:item>
+ <fd:item value="literal"><fd:label>Literal</fd:label></fd:item>
+ <fd:item value="output"><fd:label>Output</fd:label></fd:item>
+ <fd:item value="parameter"><fd:label>Parameter</fd:label></fd:item>
+ <fd:item value="sql"><fd:label>Sql</fd:label></fd:item>
+ <fd:item value="step"><fd:label>Step</fd:label></fd:item>
+ </fd:selection-list>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="item-row">
+ <fd:widgets>
+ <fd:macro expand="select"/>
+ <fd:macro expand="type-selector"/>
+ <fd:union id="union" default="" case="type-selector">
+ <fd:label>Type</fd:label>
+ <fd:widgets>
+
+ <fd:group id="column">
+ <fd:label>Column</fd:label>
+ <fd:widgets>
+ <fd:macro expand="id"/>
+ <fd:macro expand="field"/>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="columns">
+ <fd:label>Columns</fd:label>
+ <fd:widgets>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:macro expand="database"/>
+
+ <fd:group id="dialect">
+ <fd:label>Dialect</fd:label>
+ <fd:widgets>
+ <fd:macro expand="types"/>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:macro expand="flow"/>
+
+ <fd:group id="interaction">
+ <fd:label>Interaction</fd:label>
+ <fd:widgets>
+ <fd:macro expand="label"/>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="link">
+ <fd:label>link</fd:label>
+ <fd:widgets>
+ <fd:macro expand="title"/>
+ <fd:macro expand="report-id-elem"/>
+ <fd:macro expand="link-parameter"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="links">
+ <fd:label>Links</fd:label>
+ <fd:widgets>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:macro expand="output"/>
+
+ <fd:macro expand="step-parameter"/>
+
+ <fd:group id="sql">
+ <fd:label>Sql</fd:label>
+ <fd:widgets>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="step">
+ <fd:label>Step</fd:label>
+ <fd:widgets>
+ <fd:macro expand="id"/>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="subreport">
+ <fd:label>Subreport</fd:label>
+ <fd:widgets>
+ <fd:macro expand="id"/>
+ <fd:macro expand="report-id"/>
+ <fd:macro expand="datasource-id"/>
+ <fd:macro expand="name"/>
+ <fd:macro expand="description"/>
+ <fd:macro expand="subreport-parameter"/>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="subreports">
+ <fd:label>Subreports</fd:label>
+ <fd:widgets>
+ <fd:macro expand="items"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="title">
+ <fd:label>Title</fd:label>
+ <fd:widgets>
+ <fd:macro expand="title"/>
+ </fd:widgets>
+ </fd:group>
+
+ <fd:group id="type">
+ <fd:label>Type</fd:label>
+ <fd:widgets>
+ <fd:macro expand="base"/>
+ </fd:widgets>
+ </fd:group>
+
+ </fd:widgets>
+
+ </fd:union>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="base">
+ <fd:widgets>
+ <fd:field id="base">
+ <fd:label>Base</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="catalog">
+ <fd:widgets>
+ <fd:field id="catalog" required="true">
+ <fd:label>Catalog</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="catalogs">
+ <fd:widgets>
+ <fd:group id="catalogs">
+ <fd:widgets>
+ <fd:repeater id="list" initial-size="0">
+ <fd:label>Catalogs</fd:label>
+ <fd:widgets>
+ <fd:macro expand="item-actions"/>
+ <fd:macro expand="catalog"/>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:macro expand="add-item"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="item-actions">
+ <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:row-action>
+
+ <fd:row-action id="delete" action-command="delete">
+ <fd:label>X</fd:label>
+ <fd:hint>Delete</fd:hint>
+ </fd:row-action>
+
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="database">
+ <fd:widgets>
+ <fd:group id="database">
+ <fd:label>Database</fd:label>
+ <fd:widgets>
+ <fd:macro expand="sql"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="datasource-id">
+ <fd:widgets>
+ <fd:field id="datasource-id" required="true">
+ <fd:label>Datasource ID</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="datatype-id">
+ <fd:widgets>
+ <fd:field id="datatype-id" required="true">
+ <fd:label>Datatype ID</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="description">
+ <fd:widgets>
+ <fd:field id="description" required="true">
+ <fd:label>Description</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="dialect">
+ <fd:widgets>
+ <fd:group id="dialect">
+ <fd:widgets>
+ <fd:repeater id="list" initial-size="0">
+ <fd:label>Flow</fd:label>
+ <fd:widgets>
+ <fd:macro expand="item-actions"/>
+ <fd:field id="sql-type-selector">
+ <fd:label>Type</fd:label>
+ <fd:datatype base="string"/>
+ <fd:selection-list>
+ <fd:item value="literal"><fd:label>Text</fd:label></fd:item>
+ <fd:item value="parameter"><fd:label>Param</fd:label></fd:item>
+ </fd:selection-list>
+ </fd:field>
+ <fd:union id="type" case="sql-type-selector">
+ <fd:widgets>
+ <fd:macro expand="literal"/>
+ <fd:macro expand="sql-parameter"/>
+ </fd:widgets>
+ </fd:union>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:macro expand="add-item"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="field">
+ <fd:widgets>
+ <fd:field id="field" required="true">
+ <fd:label>Field</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="flow">
+ <fd:widgets>
+ <fd:group id="flow">
+ <fd:widgets>
+ <fd:repeater id="list" initial-size="0">
+ <fd:label>Flow</fd:label>
+ <fd:widgets>
+ <fd:macro expand="item-actions"/>
+ <fd:macro expand="step"/>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:macro expand="add-item"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="id">
+ <fd:widgets>
+ <fd:field id="id" required="true">
+ <fd:label>Id</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="interaction">
+ <fd:widgets>
+ <fd:group id="interaction">
+ <fd:widgets>
+ <fd:repeater id="list" initial-size="0">
+ <fd:label>Interaction</fd:label>
+ <fd:widgets>
+ <fd:macro expand="item-actions"/>
+ <fd:macro expand="step-parameter"/>
+ </fd:widgets>
+ </fd:repeater>
+ <fd:macro expand="add-item"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="label">
+ <fd:widgets>
+ <fd:field id="label">
+ <fd:label>Label</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="link-parameter">
+ <fd:widgets>
+ <fd:field id="link-parameter" required="true">
+ <fd:label>Parameter</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="literal">
+ <fd:widgets>
+ <fd:field id="literal">
+ <fd:label>Literal</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="name">
+ <fd:widgets>
+ <fd:field id="name" required="true">
+ <fd:label>Name</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="output">
+ <fd:widgets>
+ <fd:group id="output">
+ <fd:label>Output</fd:label>
+ <fd:widgets>
+ <fd:macro expand="database"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="report-id">
+ <fd:widgets>
+ <fd:field id="report-id" required="true">
+ <fd:label>Report ID</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="report-id-elem">
+ <fd:widgets>
+ <fd:field id="report-id-elem" required="true">
+ <fd:label>Report ID</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="req-ds-type">
+ <fd:widgets>
+ <fd:field id="req-ds-type" required="true">
+ <fd:label>Required Datasource Type</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="required">
+ <fd:widgets>
+ <fd:booleanfield id="required">
+ <fd:label>Required</fd:label>
+ </fd:booleanfield>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="sql">
+ <fd:widgets>
+ <fd:group id="sql">
+ <fd:label>Sql</fd:label>
+ <fd:widgets>
+ <fd:macro expand="dialect"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="sql-parameter">
+ <fd:widgets>
+ <fd:field id="sql-parameter" required="true">
+ <fd:label>Parameter</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="step">
+ <fd:widgets>
+ <fd:group id="step">
+ <fd:label>Step</fd:label>
+ <fd:widgets>
+ <fd:macro expand="id"/>
+ <fd:macro expand="interaction"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="step-parameter">
+ <fd:widgets>
+ <fd:group id="step-parameter">
+ <fd:label>Parameter</fd:label>
+ <fd:widgets>
+ <fd:macro expand="id"/>
+ <fd:macro expand="required"/>
+ <fd:macro expand="datatype-id"/>
+ </fd:widgets>
+ </fd:group>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="subreport-parameter">
+ <fd:widgets>
+ <fd:field id="subreport-parameter" required="true">
+ <fd:label>Parameter</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="title">
+ <fd:widgets>
+ <fd:field id="title">
+ <fd:label>Title</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ <fd:macro define="types">
+ <fd:widgets>
+ <fd:field id="types" required="true">
+ <fd:label>Types</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ </fd:widgets>
+ </fd:macro>
+
+ </fd:widgets>
+</fd:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/xreport_model.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/xreport_model.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/xreport_model.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/xreport_model.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/xreport_model.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/xreport_model.xml Thu Jan 13 13:42:02 2005
@@ -19,524 +19,9 @@
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<fd:widgets>
- <!--
- CVS $Id$
- -->
+ <fd:import prefix="xreport" uri="forms/xreport_mm.xml"/>
- <!--
- TODO:
- Add features to "items-class" (e.g. move-up, move-down, add-before, add-after).
- -->
-
- <fd:new id="id-class"/>
- <fd:new id="name-class"/>
- <fd:new id="description-class"/>
- <fd:new id="req-ds-type-class"/>
- <fd:new id="catalogs-class"/>
- <fd:new id="flow-class"/>
- <fd:new id="output-class"/>
- <fd:new id="items-class"/>
-
- <fd:class id="items-class">
- <fd:widgets>
- <fd:repeater id="items" initial-size="1">
- <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>New</fd:label>
- </fd:repeater-action>
- <fd:repeater-action id="removeItems" action-command="delete-rows" repeater="items" select="select">
- <fd:label>Del</fd:label>
- </fd:repeater-action>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="select-class">
- <fd:widgets>
- <fd:booleanfield id="select"><fd:label>Select</fd:label></fd:booleanfield>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="view-selector-class">
- <fd:widgets>
- <fd:field id="view-selector">
- <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 parent = widget.getParent();
- //var union = parent.getChild("union");
- //var type = parent.getChild("type-selector");
- var union = widget.lookupWidget("../union");
- var type = widget.lookupWidget("../type-selector");
- if(widget.getValue().equals("edit")) {
- union.setProcessRequests(true);
- type.setProcessRequests(true);
- } else {
- union.setProcessRequests(false);
- type.setProcessRequests(false);
- }
- </javascript>
- </fd:on-value-changed>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="type-selector-class">
- <fd:widgets>
- <fd:field id="type-selector">
- <fd:label>Widget Type</fd:label>
- <fd:datatype base="string"/>
- <fd:selection-list>
- <fd:item value=""><fd:label>Nothing</fd:label></fd:item>
- <fd:item value="database"><fd:label>Database</fd:label></fd:item>
- <fd:item value="dialect"><fd:label>Dialect</fd:label></fd:item>
- <fd:item value="flow"><fd:label>Flow</fd:label></fd:item>
- <fd:item value="interaction"><fd:label>Interaction</fd:label></fd:item>
- <fd:item value="literal"><fd:label>Literal</fd:label></fd:item>
- <fd:item value="output"><fd:label>Output</fd:label></fd:item>
- <fd:item value="parameter"><fd:label>Parameter</fd:label></fd:item>
- <fd:item value="sql"><fd:label>Sql</fd:label></fd:item>
- <fd:item value="step"><fd:label>Step</fd:label></fd:item>
- </fd:selection-list>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="item-row-class">
- <fd:widgets>
- <fd:new id="select-class"/>
- <fd:new id="view-selector-class"/>
- <fd:new id="type-selector-class"/>
- <fd:union id="union" default="" case="type-selector">
- <fd:datatype base="string"/>
- <fd:label>Type</fd:label>
- <fd:widgets>
-
- <fd:group id="column">
- <fd:label>Column</fd:label>
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="field-class"/>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="columns">
- <fd:label>Columns</fd:label>
- <fd:widgets>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:new id="database-class"/>
-
- <fd:group id="dialect">
- <fd:label>Dialect</fd:label>
- <fd:widgets>
- <fd:new id="types-class"/>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:new id="flow-class"/>
-
- <fd:group id="interaction">
- <fd:label>Interaction</fd:label>
- <fd:widgets>
- <fd:new id="label-class"/>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="link">
- <fd:label>link</fd:label>
- <fd:widgets>
- <fd:new id="title-class"/>
- <fd:new id="report-id-elem-class"/>
- <fd:new id="link-parameter-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="links">
- <fd:label>Links</fd:label>
- <fd:widgets>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:new id="output-class"/>
-
- <fd:new id="step-parameter-class"/>
-
- <fd:group id="sql">
- <fd:label>Sql</fd:label>
- <fd:widgets>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="step">
- <fd:label>Step</fd:label>
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="subreport">
- <fd:label>Subreport</fd:label>
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="report-id-class"/>
- <fd:new id="datasource-id-class"/>
- <fd:new id="name-class"/>
- <fd:new id="description-class"/>
- <fd:new id="subreport-parameter-class"/>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="subreports">
- <fd:label>Subreports</fd:label>
- <fd:widgets>
- <fd:new id="items-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="title">
- <fd:label>Title</fd:label>
- <fd:widgets>
- <fd:new id="title-class"/>
- </fd:widgets>
- </fd:group>
-
- <fd:group id="type">
- <fd:label>Type</fd:label>
- <fd:widgets>
- <fd:new id="base-class"/>
- </fd:widgets>
- </fd:group>
-
- </fd:widgets>
-
- </fd:union>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="base-class">
- <fd:widgets>
- <fd:field id="base">
- <fd:label>Base</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="catalog-class">
- <fd:widgets>
- <fd:field id="catalog" required="true">
- <fd:label>Catalog</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="catalogs-class">
- <fd:widgets>
- <fd:repeater id="catalogs" initial-size="0">
- <fd:label>Catalogs</fd:label>
- <fd:widgets>
- <fd:new id="catalog-class"/>
- </fd:widgets>
- </fd:repeater>
- <fd:repeater-action id="addCatalog" action-command="add-row" repeater="catalogs">
- <fd:label>New</fd:label>
- </fd:repeater-action>
- <fd:repeater-action id="removeCatalogs" action-command="delete-rows" repeater="catalogs" select="select">
- <fd:label>Del</fd:label>
- </fd:repeater-action>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="database-class">
- <fd:widgets>
- <fd:group id="database">
- <fd:label>Database</fd:label>
- <fd:widgets>
- <fd:new id="sql-class"/>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="datasource-id-class">
- <fd:widgets>
- <fd:field id="datasource-id" required="true">
- <fd:label>Datasource ID</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="datatype-id-class">
- <fd:widgets>
- <fd:field id="datatype-id" required="true">
- <fd:label>Datatype ID</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="description-class">
- <fd:widgets>
- <fd:field id="description" required="true">
- <fd:label>Description</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="dialect-class">
- <fd:widgets>
- <fd:repeater id="dialect" initial-size="0">
- <fd:label>Flow</fd:label>
- <fd:widgets>
- <fd:field id="sql-type-selector">
- <fd:label>Type</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- <fd:union id="type" case="sql-type-selector">
- <fd:widgets>
- <fd:new id="literal-class"/>
- <fd:new id="sql-parameter-class"/>
- </fd:widgets>
- </fd:union>
- </fd:widgets>
- </fd:repeater>
- <fd:repeater-action id="addItem" action-command="add-row" repeater="dialect">
- <fd:label>New</fd:label>
- </fd:repeater-action>
- <fd:repeater-action id="removeItems" action-command="delete-rows" repeater="dialect" select="select">
- <fd:label>Del</fd:label>
- </fd:repeater-action>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="field-class">
- <fd:widgets>
- <fd:field id="field" required="true">
- <fd:label>Field</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="flow-class">
- <fd:widgets>
- <fd:repeater id="flow" initial-size="0">
- <fd:label>Flow</fd:label>
- <fd:widgets>
- <fd:new id="step-class"/>
- </fd:widgets>
- </fd:repeater>
- <fd:repeater-action id="addStep" action-command="add-row" repeater="flow">
- <fd:label>New</fd:label>
- </fd:repeater-action>
- <fd:repeater-action id="removeStep" action-command="delete-rows" repeater="flow" select="select">
- <fd:label>Del</fd:label>
- </fd:repeater-action>
- </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="interaction-class">
- <fd:widgets>
- <fd:repeater id="interaction" initial-size="0">
- <fd:label>Interaction</fd:label>
- <fd:widgets>
- <fd:new id="step-parameter-class"/>
- </fd:widgets>
- </fd:repeater>
- <fd:repeater-action id="addParameter" action-command="add-row" repeater="interaction">
- <fd:label>New</fd:label>
- </fd:repeater-action>
- <fd:repeater-action id="removeParameters" action-command="delete-rows" repeater="interaction" select="select">
- <fd:label>Del</fd:label>
- </fd:repeater-action>
- </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="link-parameter-class">
- <fd:widgets>
- <fd:field id="link-parameter" required="true">
- <fd:label>Parameter</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="literal-class">
- <fd:widgets>
- <fd:field id="literal">
- <fd:label>Literal</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="name-class">
- <fd:widgets>
- <fd:field id="name" required="true">
- <fd:label>Name</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="output-class">
- <fd:widgets>
- <fd:group id="output">
- <fd:label>Output</fd:label>
- <fd:widgets>
- <fd:new id="database-class"/>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="report-id-class">
- <fd:widgets>
- <fd:field id="report-id" required="true">
- <fd:label>Report ID</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="report-id-elem-class">
- <fd:widgets>
- <fd:field id="report-id-elem" required="true">
- <fd:label>Report ID</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="req-ds-type-class">
- <fd:widgets>
- <fd:field id="req-ds-type" required="true">
- <fd:label>Required Datasource Type</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="sql-class">
- <fd:widgets>
- <fd:group id="sql">
- <fd:label>Sql</fd:label>
- <fd:widgets>
- <fd:new id="dialect-class"/>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="sql-parameter-class">
- <fd:widgets>
- <fd:field id="sql-parameter" required="true">
- <fd:label>Parameter</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="step-class">
- <fd:widgets>
- <fd:group id="step">
- <fd:label>Step</fd:label>
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="interaction-class"/>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="step-parameter-class">
- <fd:widgets>
- <fd:group id="step-parameter">
- <fd:label>Parameter</fd:label>
- <fd:widgets>
- <fd:new id="id-class"/>
- <fd:new id="required-class"/>
- <fd:new id="datatype-id-class"/>
- </fd:widgets>
- </fd:group>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="subreport-parameter-class">
- <fd:widgets>
- <fd:field id="subreport-parameter" required="true">
- <fd:label>Parameter</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="title-class">
- <fd:widgets>
- <fd:field id="title">
- <fd:label>Title</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
-
- <fd:class id="types-class">
- <fd:widgets>
- <fd:field id="types" required="true">
- <fd:label>Types</fd:label>
- <fd:datatype base="string"/>
- </fd:field>
- </fd:widgets>
- </fd:class>
+ <fd:macro expand="xreport:xreport"/>
</fd:widgets>
</fd:form>
Added: cocoon/whiteboard/forms/samples/swan/forms/xreport_mt.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/xreport_mt.xml?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/forms/xreport_mt.xml Thu Jan 13 13:42:02 2005
@@ -0,0 +1,190 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<ft:macros
+ xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+
+ <ft:import prefix="swan" uri="forms/swan_template.xml"/>
+
+ <ft:macro define="catalog">
+ <ft:widget id="catalog"/>
+ </ft:macro>
+
+ <ft:macro define="catalogs">
+ <ft:group id="catalogs">
+ <b><ft:widget-label id="list"/>:</b>
+ <ft:macro expand="swan:addItem"/>
+ <ft:repeater-size id="list"/>
+ <ft:repeater-widget id="list">
+ <div class="section">
+ <ft:macro expand="swan:item-actions"/>
+ <ft:macro expand="catalog"/>
+ </div>
+ </ft:repeater-widget>
+ </ft:group>
+ </ft:macro>
+
+ <ft:macro define="database">
+ <b><ft:widget-label id="database"/>:</b>
+ <ft:group id="database">
+ <ft:macro expand="sql"/>
+ </ft:group>
+ </ft:macro>
+
+ <ft:macro define="datatype-id">
+ <b><ft:widget-label id="datatype-id"/>:</b>
+ <ft:widget id="datatype-id"/>
+ </ft:macro>
+
+ <ft:macro define="description">
+ <td><b><ft:widget-label id="description"/>:</b></td>
+ <td><ft:widget id="description"/></td>
+ </ft:macro>
+
+ <ft:macro define="sql-type-selector">
+ <ft:widget id="sql-type-selector">
+ <fi:styling submit-on-change="true"/>
+ </ft:widget>
+ </ft:macro>
+
+ <ft:macro define="dialect">
+ <ft:group id="dialect">
+ <b><ft:widget-label id="list"/>:</b>
+ <ft:macro expand="swan:addItem"/>
+ <ft:repeater-size id="list"/>
+ <ft:repeater-widget id="list">
+ <div class="section">
+ <ft:macro expand="swan:item-actions"/>
+ <ft:macro expand="sql-type-selector"/>
+ <ft:union id="type">
+ <ft:case id="literal">
+ <ft:macro expand="literal"/>
+ </ft:case>
+ <ft:case id="parameter">
+ <ft:macro expand="sql-parameter"/>
+ </ft:case>
+ </ft:union>
+ </div>
+ </ft:repeater-widget>
+ </ft:group>
+ </ft:macro>
+
+ <ft:macro define="flow">
+ <ft:group id="flow">
+ <b><ft:widget-label id="list"/>:</b>
+ <ft:macro expand="swan:addItem"/>
+ <ft:repeater-size id="list"/>
+ <ft:repeater-widget id="list">
+ <div class="section">
+ <ft:macro expand="swan:item-actions"/>
+ <ft:macro expand="step"/>
+ </div>
+ </ft:repeater-widget>
+ </ft:group>
+ </ft:macro>
+
+ <ft:macro define="id">
+ <td><b><ft:widget-label id="id"/>:</b></td>
+ <td><ft:widget id="id"/></td>
+ </ft:macro>
+
+ <ft:macro define="interaction">
+ <ft:group id="interaction">
+ <ft:macro expand="swan:addItem"/>
+ <ft:repeater-size id="list"/>
+ <ft:repeater-widget id="list">
+ <div class="section">
+ <ft:macro expand="swan:item-actions"/>
+ <ft:macro expand="step-parameter"/>
+ </div>
+ </ft:repeater-widget>
+ </ft:group>
+ </ft:macro>
+
+ <ft:macro define="literal">
+ <ft:widget id="literal">
+ <fi:styling type="textarea" rows="1" cols="80"/>
+ </ft:widget>
+ </ft:macro>
+
+ <ft:macro define="name">
+ <td><b><ft:widget-label id="name"/>:</b></td>
+ <td><ft:widget id="name"/></td>
+ </ft:macro>
+
+ <ft:macro define="output">
+ <b><ft:widget-label id="output"/>:</b>
+ <ft:group id="output">
+ <ft:macro expand="database"/>
+ </ft:group>
+ </ft:macro>
+
+ <ft:macro define="req-ds-type">
+ <td><b><ft:widget-label id="req-ds-type"/>:</b></td>
+ <td><ft:widget id="req-ds-type"/></td>
+ </ft:macro>
+
+ <ft:macro define="required">
+ <b><ft:widget-label id="required"/>:</b>
+ <ft:widget id="required"/>
+ </ft:macro>
+
+ <ft:macro define="sql">
+ <b><ft:widget-label id="sql"/>:</b>
+ <ft:group id="sql">
+ <ft:macro expand="dialect"/>
+ </ft:group>
+ </ft:macro>
+
+ <ft:macro define="sql-parameter">
+ <b><ft:widget-label id="sql-parameter"/>:</b>
+ <ft:widget id="sql-parameter"/>
+ </ft:macro>
+
+ <ft:macro define="step">
+ <b><ft:widget-label id="step"/>:</b>
+ <ft:group id="step">
+ <ft:macro expand="id"/>
+ <ft:macro expand="interaction"/>
+ </ft:group>
+ </ft:macro>
+
+ <ft:macro define="step-parameter">
+ <b><ft:widget-label id="step-parameter"/>:</b>
+ <ft:group id="step-parameter">
+ <ft:macro expand="id"/>
+ <ft:macro expand="required"/>
+ <ft:macro expand="datatype-id"/>
+ </ft:group>
+ </ft:macro>
+
+ <ft:macro define="xreport">
+ <div class="section">
+ <table>
+ <tr><ft:macro expand="id"/></tr>
+ <tr><ft:macro expand="name"/></tr>
+ <tr><ft:macro expand="description"/></tr>
+ <tr><ft:macro expand="req-ds-type"/></tr>
+ </table>
+ <ft:macro expand="catalogs"/>
+ <ft:macro expand="flow"/>
+ <ft:macro expand="output"/>
+ <input type="submit"/>
+ </div>
+ </ft:macro>
+
+</ft:macros>
Modified: cocoon/whiteboard/forms/samples/swan/forms/xreport_template.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/forms/xreport_template.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/forms/xreport_template.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/forms/xreport_template.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/forms/xreport_template.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/forms/xreport_template.xml Thu Jan 13 13:42:02 2005
@@ -18,505 +18,14 @@
xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
- <!--
- TODO: Add features to "items-class" (e.g. move-up, move-down, add-before, add-after).
- -->
-
- <script type="text/javascript">
- <!--
-
- function countLines(str, cols) {
- var hard_lines = -2;
- var pos = 0;
- while (true) {
- pos = str.indexOf("\n", pos + 1);
- hard_lines ++;
- if (pos == -1) break;
- }
- var soft_lines = Math.round(str.length / (cols-1));
- if (hard_lines > soft_lines) soft_lines = hard_lines;
- return soft_lines;
- }
-
- function resizeTextareas() {
- var form = document.forms[0];
- for (var i in form) {
- if (!form[i]) continue;
- if(typeof form[i].rows != "number") continue;
- form[i].rows = countLines(form[i].value,form[i].cols) + 1;
- }
- setTimeout("resizeTextareas();", 300);
- }
-
- resizeTextareas();
-
- // -->
- </script>
-
- <title>xReport Editor</title>
+ <title>Swan xReporter Report Editor</title>
<content>
<ft:form-template action="#{$continuation/id}.continue" method="POST">
- <ft:class id="output-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="union-class">
- <ft:union id="union">
-
- <ft:case id="">
- </ft:case>
-
- <!--
- <ft:union id="view">
- <ft:case id="view">
- <ft:group id="view">
- </ft:group>
- </ft:case>
- <ft:case id="edit">
- <ft:group id="edit">
- </ft:group>
- </ft:case>
- </ft:union>
- -->
-
- <ft:case id="action">
- <ft:group id="action">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="aggregatefield">
- <ft:group id="aggregatefield">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="booleanfield">
- <ft:group id="booleanfield">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="class">
- <ft:group id="class">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="field">
- <ft:group id="field">
- Hello
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- Viewing
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- <ft:new id="output-required-class"/>
- </ft:when>
- <ft:when value="edit">
- Editing
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- <ft:new id="required-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="group">
- <ft:group id="group">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="new">
- <ft:group id="new">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="output">
- <ft:group id="output">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="struct">
- <ft:group id="struct">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="repeater">
- <ft:group id="repeater">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- <ft:new id="output-initial-size-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- <ft:new id="initial-size-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="row-action">
- <ft:group id="row-action">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="submit">
- <ft:group id="submit">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- </ft:when>
- </ft:choose>
- </ft:group>
- </ft:case>
-
- <ft:case id="union">
- <ft:group id="union">
- <ft:choose path="../../view-selector">
- <ft:when value="view">
- <ft:new id="output-id-class"/>
- <ft:new id="output-label-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- <ft:when value="edit">
- <ft:new id="id-class"/>
- <ft:new id="label-class"/>
- <ft:new id="items-class"/>
- </ft:when>
- </ft:choose>
- </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> 
- </ft:when>
- <ft:when value="view">
- <b>[<ft:widget id="type-selector"><fi:styling type="output"/></ft:widget>]</b> 
- </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:widget id="view-selector">
- <fi:styling list-type="dropdown" submit-on-change="true"/>
- </ft:widget>
- </ft:class>
-
- <ft:class id="item-row-class">
- <td>
- <ft:widget id="select"/>
- </td>
- <td>
- <ft:new id="view-selector-class"/>
- </td>
- <td>
- <ft:new id="type-selector-class"/>
- <ft:new id="union-class"/>
- </td>
- </ft:class>
-
- <ft:class id="items-class">
- <ft:repeater-size id="items"/>
- <table border="4">
- <ft:repeater-widget id="items">
- <tr><ft:new id="item-row-class"/></tr>
- </ft:repeater-widget>
- </table>
- <ft:widget id="addItem"/>
- <ft:widget id="removeItems"/><br/>
- </ft:class>
-
- <ft:class id="catalog-class">
- <b><ft:widget-label id="catalog"/>:</b>
- <ft:widget id="catalog"/>
- </ft:class>
-
- <ft:class id="catalogs-class">
- <ft:repeater-size id="catalogs"/>
- <ul>
- <ft:repeater-widget id="catalogs">
- <li><ft:new id="catalog-class"/></li>
- </ft:repeater-widget>
- </ul>
- <ft:widget id="addCatalog"/>
- <ft:widget id="removeCatalogs"/><br/>
- </ft:class>
-
- <ft:class id="database-class">
- <b><ft:widget-label id="database"/>:</b>
- <ft:group id="database">
- <ft:new id="sql-class"/>
- </ft:group>
- </ft:class>
-
- <ft:class id="datatype-id-class">
- <b><ft:widget-label id="datatype-id"/>:</b>
- <ft:widget id="datatype-id"/>
- </ft:class>
-
- <ft:class id="description-class">
- <b><ft:widget-label id="description"/>:</b>
- <ft:widget id="description"/>
- </ft:class>
-
- <ft:class id="dialect-class">
- <b><ft:widget-label id="dialect"/>:</b>
- <ft:repeater-size id="dialect"/>
- <ul>
- <ft:repeater-widget id="dialect">
- <li>
- <ft:union id="type">
- <ft:case id="literal">
- <ft:new id="literal-class"/>
- </ft:case>
- <ft:case id="parameter">
- <ft:new id="sql-parameter-class"/>
- </ft:case>
- </ft:union>
- </li>
- </ft:repeater-widget>
- </ul>
- <ft:widget id="addItem"/>
- <ft:widget id="removeItems"/><br/>
- </ft:class>
-
- <ft:class id="flow-class">
- <b><ft:widget-label id="flow"/>:</b>
- <ft:repeater-size id="flow"/>
- <ul>
- <ft:repeater-widget id="flow">
- <li><ft:new id="step-class"/></li>
- </ft:repeater-widget>
- </ul>
- <ft:widget id="addStep"/>
- <ft:widget id="removeStep"/><br/>
- </ft:class>
-
- <ft:class id="interaction-class">
- <ft:repeater-size id="interaction"/>
- <ul>
- <ft:repeater-widget id="interaction">
- <li><ft:new id="step-parameter-class"/></li>
- </ft:repeater-widget>
- </ul>
- <ft:widget id="addParameter"/>
- <ft:widget id="removeParameters"/><br/>
- </ft:class>
-
- <ft:class id="literal-class">
- <ft:widget id="literal">
- <fi:styling type="textarea" rows="1" cols="80"/>
- </ft:widget>
- </ft:class>
-
- <ft:class id="name-class">
- <b><ft:widget-label id="name"/>:</b>
- <ft:widget id="name"/>
- </ft:class>
-
- <ft:class id="output-class">
- <b><ft:widget-label id="output"/>:</b>
- <ft:group id="output">
- <ft:new id="database-class"/>
- </ft:group>
- </ft:class>
-
- <ft:class id="req-ds-type-class">
- <b><ft:widget-label id="req-ds-type"/>:</b>
- <ft:widget id="req-ds-type"/>
- </ft:class>
-
- <ft:class id="sql-class">
- <b><ft:widget-label id="sql"/>:</b>
- <ft:group id="sql">
- <ft:new id="dialect-class"/>
- </ft:group>
- </ft:class>
-
- <ft:class id="sql-parameter-class">
- <b><ft:widget-label id="sql-parameter"/>:</b>
- <ft:widget id="sql-parameter"/>
- </ft:class>
-
- <ft:class id="step-class">
- <b><ft:widget-label id="step"/>:</b>
- <ft:group id="step">
- <ft:new id="id-class"/>
- <ft:new id="interaction-class"/>
- </ft:group>
- </ft:class>
-
- <ft:class id="step-parameter-class">
- <b><ft:widget-label id="step-parameter"/>:</b>
- <ft:group id="step-parameter">
- <ft:new id="id-class"/>
- <ft:new id="required-class"/>
- <ft:new id="datatype-id-class"/>
- </ft:group>
- </ft:class>
+ <ft:import prefix="xreport" uri="forms/xreport_mt.xml"/>
- <table border="3">
- <tr>
- <td>
- <ft:new id="id-class"/><br/>
- <ft:new id="name-class"/><br/>
- <ft:new id="description-class"/><br/>
- <ft:new id="req-ds-type-class"/><br/>
- <ft:new id="catalogs-class"/><br/>
- <ft:new id="flow-class"/><br/>
- <ft:new id="output-class"/><br/>
- <p>
- <ft:new id="items-class"/>
- </p>
- <input type="submit"/>
- </td>
- </tr>
- </table>
+ <ft:macro expand="xreport:xreport"/>
</ft:form-template>
</content>
Modified: cocoon/whiteboard/forms/samples/swan/index.xml
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/index.xml?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/index.xml&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/index.xml&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/index.xml (original)
+++ cocoon/whiteboard/forms/samples/swan/index.xml Thu Jan 13 13:42:02 2005
@@ -18,39 +18,7 @@
<html>
<head>
- <style type="text/css">
- li {
- list-style-type: none
- }
-
- /* The actions buttons, placed on the right */
- .actions {
- float: right;
- padding-top: 0.2em;
- }
-
- /* A "section" contains stuff, related actions and substuff */
- div.section {
- padding-top: 0.4em;
- padding-bottom: 0.4em;
- padding-left: 0.4em;
- border: 1px dotted black;
- mmargin-top: 0.4em;
- margin-bottom: -1px;
- }
-
- /* Indent sub-sections (recursively) */
- div.section div.section {
- margin-left: 3em;
- border-right: none;
- }
-
- /* Change bg color depending on nesting depth */
- div.section div.section { background-color: #F0F0F0; }
- div.section div.section div.section { background-color: #E0E0E0; }
- div.section div.section div.section div.section { background-color: #D0D0D0; }
- div.section div.section div.section div.section div.section { background-color: #C0C0C0; }
- </style>
+ <link rel="stylesheet" type="text/css" href="swan/resources/css/swan_sections.css" />
<title>Swan: CForms-based XML Editor Demo</title>
<h2>Swan: CForms-based XML Editor Demo</h2>
@@ -65,38 +33,45 @@
<b>Sample xReport</b>
<div class="section">
<b>xReport:</b>
- <a href="xreport.flow?file=report1.xml">report</a><br/>
+ <a href="xreport.flow?file=report1.xml">report</a>
</div>
</div>
<div class="section">
<b>Sample Sitemap</b>
<div class="section">
<b>Sitemap:</b>
- <a href="sitemap.flow?file=sitemap.xmap">sitemap</a><br/>
+ <a href="sitemap.flow?file=sitemap.xmap">sitemap</a>
+ </div>
+ </div>
+ <div class="section">
+ <b>Sample Form Editor</b>
+ <div class="section">
+ <b>Complex:</b>
+ <a href="editor.flow?file1=complex_binding.xml&file2=complex_model.xml&file3=complex_template.xml">form</a>
</div>
</div>
<div class="section">
<b>Sample Forms</b>
<div class="section">
<b>Simple:</b>
- <a href="binding.flow?file=sample_form_1.xml">binding</a>
- <a href="model.flow?file=sample_form_1.xml">model</a>
- <a href="template.flow?file=sample_form_1_template.xml">template</a><br/>
+ <a href="binding.flow?file=simple_binding.xml">binding</a>
+ <a href="model.flow?file=simple_model.xml">model</a>
+ <a href="template.flow?file=simple_template.xml">template</a>
</div>
<div class="section">
<b>Medium:</b>
- <a href="binding.flow?file=sample_form_2.xml">binding</a>
- <a href="model.flow?file=sample_form_2.xml">model</a>
- <a href="template.flow?file=sample_form_2_template.xml">template</a><br/>
+ <a href="binding.flow?file=medium_binding.xml">binding</a>
+ <a href="model.flow?file=medium_model.xml">model</a>
+ <a href="template.flow?file=medium_template.xml">template</a>
</div>
<div class="section">
<b>Complex:</b>
- <a href="binding.flow?file=form_model_gui_binding.xml">binding</a>
- <a href="model.flow?file=form_model_gui_data.xml">model</a>
- <a href="template.flow?file=form_model_gui_template_data.xml">template</a><br/>
+ <a href="binding.flow?file=complex_binding.xml">binding</a>
+ <a href="model.flow?file=complex_model.xml">model</a>
+ <a href="template.flow?file=complex_template.xml">template</a>
</div>
</div>
- <a href="profile.html">Profiling Data</a><br/>
+ <a href="profile.html">Profiling Data</a>
</body>
</html>
Deleted: /cocoon/whiteboard/forms/samples/swan/resources/css/swan.css
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/resources/css/swan.css?view=auto&rev=125105
==============================================================================
Added: cocoon/whiteboard/forms/samples/swan/resources/js/swan_textareas.js
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/resources/js/swan_textareas.js?view=auto&rev=125106
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/forms/samples/swan/resources/js/swan_textareas.js Thu Jan 13 13:42:02 2005
@@ -0,0 +1,41 @@
+/*
+* Copyright 1999-2004 The Apache Software Foundation
+*
+* Licensed 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.
+*/
+
+function countLines(str, cols) {
+ var hard_lines = -2;
+ var pos = 0;
+ while (true) {
+ pos = str.indexOf("\n", pos + 1);
+ hard_lines ++;
+ if (pos == -1) break;
+ }
+ var soft_lines = Math.round(str.length / (cols-1));
+ if (hard_lines > soft_lines) soft_lines = hard_lines;
+ return soft_lines;
+}
+
+function resizeTextareas() {
+ var form = document.forms[0];
+ for (var i in form) {
+ if (!form[i]) continue;
+ if(typeof form[i].rows != "number") continue;
+ form[i].rows = countLines(form[i].value,form[i].cols) + 1;
+ }
+ setTimeout("resizeTextareas();", 300);
+}
+
+resizeTextareas();
+
Modified: cocoon/whiteboard/forms/samples/swan/resources/swan.xsl
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/resources/swan.xsl?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/resources/swan.xsl&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/resources/swan.xsl&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/resources/swan.xsl (original)
+++ cocoon/whiteboard/forms/samples/swan/resources/swan.xsl Thu Jan 13 13:42:02 2005
@@ -26,7 +26,8 @@
<xsl:apply-templates/>
<xsl:apply-templates select="." mode="forms-page"/>
<xsl:apply-templates select="." mode="forms-field"/>
- <link href="swan/resources/css/swan.css" type="text/css" rel="stylesheet"/>
+ <link href="swan/resources/css/swan_sections.css" type="text/css" rel="stylesheet"/>
+ <script src="swan/resources/js/swan_textareas.js" type="text/javascript"></script>
</head>
</xsl:template>
Modified: cocoon/whiteboard/forms/samples/swan/sitemap.xmap
Url: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/swan/sitemap.xmap?view=diff&rev=125106&p1=cocoon/whiteboard/forms/samples/swan/sitemap.xmap&r1=125105&p2=cocoon/whiteboard/forms/samples/swan/sitemap.xmap&r2=125106
==============================================================================
--- cocoon/whiteboard/forms/samples/swan/sitemap.xmap (original)
+++ cocoon/whiteboard/forms/samples/swan/sitemap.xmap Thu Jan 13 13:42:02 2005
@@ -95,7 +95,7 @@
</map:pipeline>
- <map:pipeline type="profile-caching">
+ <map:pipeline type="noncaching">
<map:match pattern="">
<map:generate src="index.xml"/>
@@ -154,7 +154,18 @@
| Doubles as a showcase for class, new, struct, union widgets
-->
- <!-- TODO: Fix edit-any-file security hole! -->
+ <map:match pattern="editor.flow">
+ <map:call function="handleForm">
+ <map:parameter name="function" value="editor"/>
+ <map:parameter name="form-definition" value="forms/editor_model.xml"/>
+ <map:parameter name="attribute-name" value="editor_gui"/>
+ <map:parameter name="bindingURI" value="forms/editor_binding.xml"/>
+ <map:parameter name="documentURI1" value="{request-param:file1}"/>
+ <map:parameter name="documentURI2" value="{request-param:file2}"/>
+ <map:parameter name="documentURI3" value="{request-param:file3}"/>
+ </map:call>
+ </map:match>
+
<map:match pattern="binding.flow">
<map:call function="handleForm">
<map:parameter name="function" value="binding_gui"/>