Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/GroupDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/GroupDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/GroupDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/GroupDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -24,13 +24,13 @@ * * @version $Id$ */ -public class GroupDefinitionBuilder extends AbstractWidgetDefinitionBuilder { +public final class GroupDefinitionBuilder extends AbstractWidgetDefinitionBuilder { public WidgetDefinition buildWidgetDefinition(Element element) throws Exception { GroupDefinition definition = new GroupDefinition(); - setCommonProperties(element, definition); + + super.setupDefinition(element, definition); 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 @@ -41,6 +41,7 @@ definition.addWidgetDefinition(widgetDefinition); } + definition.makeImmutable(); return definition; } }
Modified: 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=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacroDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MacroDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -49,7 +49,7 @@ } definition.setId(define); setDisplayData(element, definition); - setValidators(element, definition); + //setValidators(element, definition); Element widgetsElement = DomHelper.getChildElement(element, Constants.DEFINITION_NS, "widgets", true); // All child elements of the widgets element are widgets Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Messages.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Messages.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Messages.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Messages.java Fri Mar 4 07:47:41 2005 @@ -48,7 +48,7 @@ this.definition = definition; } - protected WidgetDefinition getDefinition() { + public WidgetDefinition getDefinition() { return this.definition; } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MessagesDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MessagesDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MessagesDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MessagesDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -22,11 +22,12 @@ * * @version $Id$ */ -public class MessagesDefinitionBuilder extends AbstractWidgetDefinitionBuilder { +public final class MessagesDefinitionBuilder extends AbstractWidgetDefinitionBuilder { public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception { MessagesDefinition messagesDefinition = new MessagesDefinition(); - setCommonProperties(widgetElement, messagesDefinition); + super.setupDefinition(widgetElement, messagesDefinition); setDisplayData(widgetElement, messagesDefinition); + messagesDefinition.makeImmutable(); return messagesDefinition; } } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java Fri Mar 4 07:47:41 2005 @@ -49,7 +49,7 @@ * * @version $Id$ */ -public class MultiValueField extends AbstractWidget implements ValidationErrorAware, SelectableWidget { +public class MultiValueField extends AbstractWidget implements ValidationErrorAware, SelectableWidget, DataWidget { private static final String MULTIVALUEFIELD_EL = "multivaluefield"; private static final String VALUES_EL = "values"; @@ -68,7 +68,7 @@ this.definition = definition; } - protected WidgetDefinition getDefinition() { + public WidgetDefinition getDefinition() { return definition; } @@ -147,11 +147,7 @@ contentHandler.endElement(Constants.INSTANCE_NS, VALUES_EL, Constants.INSTANCE_PREFIX_COLON + VALUES_EL); // the selection list (a MultiValueField has per definition always a SelectionList) - if (this.selectionList != null) { - this.selectionList.generateSaxFragment(contentHandler, locale); - } else { - definition.getSelectionList().generateSaxFragment(contentHandler, locale); - } + this.selectionList.generateSaxFragment(contentHandler, locale); // validation message element if (validationError != null) { @@ -190,8 +186,11 @@ * @param selectionList The new selection list. */ public void setSelectionList(SelectionList selectionList) { - if (selectionList != null && - selectionList.getDatatype() != null && + if (selectionList == null) { + throw new IllegalArgumentException("An MultiValueField's selection list cannot be null."); + } + + if (selectionList.getDatatype() != null && selectionList.getDatatype() != definition.getDatatype()) { throw new RuntimeException("Tried to assign a SelectionList that is not associated with this widget's datatype."); @@ -213,16 +212,6 @@ } /** - * Delete this field's selection list. - */ - public void removeSelectionList() { - this.selectionList = null; - if(this.definition != null) { - this.definition.setSelectionList(null); - } - } - - /** * Set this field's selection list using values from an in-memory * object. The <code>object</code> parameter should point to a collection * (Java collection or array, or Javascript array) of objects. Each object @@ -243,7 +232,12 @@ } public void broadcastEvent(WidgetEvent event) { - this.definition.fireValueChangedEvent((ValueChangedEvent)event); + if (event instanceof ValueChangedEvent) { + this.definition.fireValueChangedEvent((ValueChangedEvent)event); + } else { + // Other kinds of events + super.broadcastEvent(event); + } } public ValidationError getValidationError() { Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinition.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinition.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinition.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinition.java Fri Mar 4 07:47:41 2005 @@ -22,7 +22,10 @@ */ public class MultiValueFieldDefinition extends FieldDefinition { public Widget createInstance() { - return new MultiValueField(this); + MultiValueField field = new MultiValueField(this); + // Set the initial selection list, if any + field.setSelectionList(getSelectionList()); + return field; } public void setRequired(boolean required) { Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/MultiValueFieldDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -15,13 +15,8 @@ */ package org.apache.cocoon.forms.formmodel; -import java.util.Iterator; - -import org.w3c.dom.Element; -import org.apache.cocoon.forms.Constants; -import org.apache.cocoon.forms.datatype.Datatype; -import org.apache.cocoon.forms.event.ValueChangedListener; import org.apache.cocoon.forms.util.DomHelper; +import org.w3c.dom.Element; /** * Builds [EMAIL PROTECTED] MultiValueFieldDefinition}s. @@ -29,30 +24,14 @@ * @version $Id$ */ public class MultiValueFieldDefinitionBuilder extends AbstractDatatypeWidgetDefinitionBuilder { + public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception { MultiValueFieldDefinition definition = new MultiValueFieldDefinition(); - setCommonProperties(widgetElement, definition); - setDisplayData(widgetElement, definition); - setValidators(widgetElement, definition); - - Element datatypeElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "datatype"); - if (datatypeElement == null) { - throw new Exception("A nested datatype element is required for the widget " - + widgetElement.getTagName() + " with id \"" + definition.getId() - + "\" at " + DomHelper.getLocation(widgetElement)); - } - - Datatype datatype = datatypeManager.createDatatype(datatypeElement, true); - definition.setDatatype(datatype); - - boolean hasSelectionList = buildSelectionList(widgetElement, definition); - if (!hasSelectionList) - throw new Exception("Error: multivaluefields always require a selectionlist at " + DomHelper.getLocation(widgetElement)); - - Iterator iter = buildEventListeners(widgetElement, "on-value-changed", ValueChangedListener.class).iterator(); - while (iter.hasNext()) { - definition.addValueChangedListener((ValueChangedListener)iter.next()); - } + setupDefinition(widgetElement, definition); + if (definition.getSelectionList() == null) + throw new Exception("Error: multivaluefield always require a selectionlist at " + + DomHelper.getLocation(widgetElement)); + definition.makeImmutable(); return definition; } } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/NewDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -26,7 +26,8 @@ public WidgetDefinition buildWidgetDefinition(Element element) throws Exception { NewDefinition definition = new NewDefinition(); - setCommonProperties(element, definition); + super.setupDefinition(element, definition); + definition.makeImmutable(); return definition; } } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Output.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Output.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Output.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Output.java Fri Mar 4 07:47:41 2005 @@ -51,7 +51,7 @@ this.definition = definition; } - protected WidgetDefinition getDefinition() { + public WidgetDefinition getDefinition() { return definition; } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/OutputDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/OutputDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/OutputDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/OutputDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -17,9 +17,6 @@ package org.apache.cocoon.forms.formmodel; import org.w3c.dom.Element; -import org.apache.cocoon.forms.Constants; -import org.apache.cocoon.forms.datatype.Datatype; -import org.apache.cocoon.forms.util.DomHelper; /** * Builds [EMAIL PROTECTED] OutputDefinition}s. @@ -27,22 +24,11 @@ * @version $Id$ */ public class OutputDefinitionBuilder extends AbstractDatatypeWidgetDefinitionBuilder { + public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception { OutputDefinition definition = new OutputDefinition(); - setCommonProperties(widgetElement, definition); - - Element datatypeElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "datatype"); - if (datatypeElement == null) { - throw new Exception("A nested datatype element is required for the widget " - + widgetElement.getTagName() + " with id \"" + definition.getId() - + "\" at " + DomHelper.getLocation(widgetElement)); - } - - Datatype datatype = datatypeManager.createDatatype(datatypeElement, false); - definition.setDatatype(datatype); - - setDisplayData(widgetElement, definition); - + setupDefinition(widgetElement, definition); + definition.makeImmutable(); return definition; } } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java Fri Mar 4 07:47:41 2005 @@ -50,13 +50,23 @@ public Repeater(RepeaterDefinition repeaterDefinition) { super(repeaterDefinition); this.definition = repeaterDefinition; - // setup initial size - removeRows(); + // Setup initial size. Do not call addRow() as it will call initialize() + // on the newly created rows, which is not what we want here. + for (int i = 0; i < this.definition.getInitialSize(); i++) { + rows.add(new RepeaterRow(definition)); + } } public WidgetDefinition getDefinition() { return definition; } + + public void initialize() { + for (int i = 0; i < this.rows.size(); i++) { + ((RepeaterRow)rows.get(i)).initialize(); + } + super.initialize(); + } public int getSize() { return rows.size(); @@ -157,11 +167,19 @@ this.rows.set(index, temp); } } - + /** - * Clears all rows from the repeater and go back to the initial size + * @deprecated [EMAIL PROTECTED] #clear()} + * */ public void removeRows() { + clear(); + } + + /** + * Clears all rows from the repeater and go back to the initial size + */ + public void clear() { rows.clear(); // and reset to initial size @@ -321,7 +339,7 @@ // return Repeater.this.getLocation(); // } // - protected WidgetDefinition getDefinition() { + public WidgetDefinition getDefinition() { return Repeater.this.definition; } @@ -333,14 +351,16 @@ public Form getForm() { return Repeater.this.getForm(); } - -// public String getNamespace() { -// return getParent().getNamespace() + "." + getId(); -// } -// -// public String getFullyQualifiedId() { -// return getParent().getNamespace() + "." + getId(); -// } + + public void initialize() { + // Initialize children but don't call super.initialize() that would call the repeater's + // on-create handlers for each row. + // FIXME(SW): add an 'on-create-row' handler? + Iterator it = this.getChildren(); + while(it.hasNext()) { + ((Widget)it.next()).initialize(); + } + } public boolean validate() { // Validate only child widtgets, as the definition's validators are those of the parent repeater @@ -365,19 +385,6 @@ throws SAXException { // this widget has its display-data generated in the context of the repeater } - -// //TODO: reuse available implementation on superclass -// public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException { -// AttributesImpl rowAttrs = new AttributesImpl(); -// rowAttrs.addCDATAAttribute("id", getFullyQualifiedId()); -// contentHandler.startElement(Constants.INSTANCE_NS, ROW_EL, Constants.INSTANCE_PREFIX_COLON + ROW_EL, rowAttrs); -// Iterator widgetIt = widgets.iterator(); -// while (widgetIt.hasNext()) { -// Widget widget = (Widget)widgetIt.next(); -// widget.generateSaxFragment(contentHandler, locale); -// } -// contentHandler.endElement(Constants.INSTANCE_NS, ROW_EL, Constants.INSTANCE_PREFIX_COLON + ROW_EL); -// } public void broadcastEvent(WidgetEvent event) { throw new UnsupportedOperationException("Widget " + this.getRequestParameterName() + " doesn't handle events."); Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java Fri Mar 4 07:47:41 2005 @@ -15,6 +15,9 @@ */ package org.apache.cocoon.forms.formmodel; +import org.apache.cocoon.forms.event.ActionEvent; +import org.apache.cocoon.forms.event.ActionListener; + /** * Abstract repeater action. Subclasses will typically just self-add an * event handler that will act on the repeater. @@ -56,4 +59,89 @@ return this.name; } + //--------------------------------------------------------------------------------------------- + + /** + * The definition of a repeater action that deletes the selected rows of a sibling repeater. + * <p> + * The action listeners attached to this action, if any, are called <em>before</em> the rows + * are actually removed + */ + public static class DeleteRowsActionDefinition extends RepeaterActionDefinition { + + private String selectName; + + public DeleteRowsActionDefinition(String repeaterName, String selectName) { + super(repeaterName); + this.selectName = selectName; + } + + public boolean hasActionListeners() { + // we always want to be notified + return true; + } + + public void fireActionEvent(ActionEvent event) { + // Call action listeners, if any + super.fireActionEvent(event); + + // and actually delete the rows + Repeater repeater = ((RepeaterAction)event.getSource()).getRepeater(); + for (int i = repeater.getSize() - 1; i >= 0; i--) { + Repeater.RepeaterRow row = repeater.getRow(i); + if (Boolean.TRUE.equals(row.getChild(this.selectName).getValue())) { + repeater.removeRow(i); + } + } + } + } + + //--------------------------------------------------------------------------------------------- + + /** + * The definition of a repeater action that adds a row to a sibling repeater. + */ + public static class AddRowActionDefinition extends RepeaterActionDefinition { + + public AddRowActionDefinition(String repeaterName) { + super(repeaterName); + + this.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + Repeater repeater = ((RepeaterAction)event.getSource()).getRepeater(); + repeater.addRow(); + } + }); + } + } + + //--------------------------------------------------------------------------------------------- + + /** + * The definition of a repeater action that insert rows before the selected rows in a sibling repeater. + */ + public static class InsertRowsActionDefinition extends RepeaterActionDefinition { + + private String selectName; + + public InsertRowsActionDefinition(String repeaterName, String selectWidgetName) { + super(repeaterName); + this.selectName = selectWidgetName; + + this.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + Repeater repeater = ((RepeaterAction)event.getSource()).getRepeater(); + for (int i = repeater.getSize() - 1; i >= 0; i--) { + Repeater.RepeaterRow row = repeater.getRow(i); + Widget selectWidget = row.getChild(selectName); + if (Boolean.TRUE.equals(selectWidget.getValue())) { + // Clear selection and add a row + selectWidget.setValue(Boolean.FALSE); + repeater.addRow(i); + } + } + } + }); + } + } } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -20,24 +20,33 @@ import org.apache.cocoon.forms.Constants; import org.apache.cocoon.forms.event.ActionListener; import org.apache.cocoon.forms.util.DomHelper; +import org.apache.cocoon.util.log.DeprecationLogger; import org.w3c.dom.Element; /** * Builds a <code><fd:repeater-action/></code> * - * <p>Two actions are defined: + * <p>Three actions are defined: * <ul> * <li> - * <code><fd:repeater-action id="add" action-command="add-row" + * <code><fd:repeater-action id="add" command="add-row" * repeater="repeater-id"/></code>: when activated, adds a row to the * sibling repeater named "repeater-id". * </li> * <li> - * <code><fd:repeater-action id="rm" action-command="delete-rows" + * <code><fd:repeater-action id="rm" command="delete-rows" * repeater="repeater-id" select="select-id"/></code>: removes the * selected rows from the sibling repeater named "repeater-id". The * selected rows are identified by the boolean field "select-id" present * in each row. + * </li> + * <li> + * <code><fd:repeater-action id="insert" command="insert-rows" + * repeater="repeater-id" select="select-id"/></code>: inserts rows before + * the selected rows from the sibling repeater named "repeater-id". The + * selected rows are identified by the boolean field "select-id" present + * in each row. + * </li> * </ul> * * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a> @@ -45,13 +54,26 @@ */ public class RepeaterActionDefinitionBuilder extends AbstractWidgetDefinitionBuilder { - public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception { - String actionCommand = DomHelper.getAttribute(widgetElement, "action-command"); + // Get the "command" attribute + String actionCommand = DomHelper.getAttribute(widgetElement, "command", null); + + // If unspecified, check the deprecated "action-command" deprecated attribute + if (actionCommand == null) { + actionCommand = DomHelper.getAttribute(widgetElement, "action-command", null); + if (actionCommand != null) { + DeprecationLogger.log("The 'action-command' attribute is deprecated and replaced by 'command', at " + + DomHelper.getLocation(widgetElement)); + } + } + if (actionCommand == null) { + throw new Exception("Missing attribute 'command' at " + DomHelper.getLocation(widgetElement)); + } + + RepeaterActionDefinition definition = createDefinition(widgetElement, actionCommand); - setCommonProperties(widgetElement, definition); + super.setupDefinition(widgetElement, definition); setDisplayData(widgetElement, definition); - setValidators(widgetElement, definition); definition.setActionCommand(actionCommand); @@ -67,19 +89,23 @@ definition.addActionListener((ActionListener)iter.next()); } + definition.makeImmutable(); return definition; } protected RepeaterActionDefinition createDefinition(Element element, String actionCommand) throws Exception { + String repeater = DomHelper.getAttribute(element, "repeater"); if ("delete-rows".equals(actionCommand)) { - String repeater = DomHelper.getAttribute(element, "repeater"); String select = DomHelper.getAttribute(element, "select"); - return new DeleteRowsActionDefinition(repeater, select); + return new RepeaterActionDefinition.DeleteRowsActionDefinition(repeater, select); } else if ("add-row".equals(actionCommand)) { - String repeater = DomHelper.getAttribute(element, "repeater"); - return new AddRowActionDefinition(repeater); + return new RepeaterActionDefinition.AddRowActionDefinition(repeater); + + } else if ("insert-rows".equals(actionCommand)) { + String select = DomHelper.getAttribute(element, "select"); + return new RepeaterActionDefinition.InsertRowsActionDefinition(repeater, select); } else { throw new Exception("Unknown repeater action '" + actionCommand + "' at " + DomHelper.getLineLocation(element)); Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RepeaterDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -24,16 +24,15 @@ * * @version $Id$ */ -public class RepeaterDefinitionBuilder extends AbstractWidgetDefinitionBuilder { +public final class RepeaterDefinitionBuilder extends AbstractWidgetDefinitionBuilder { public WidgetDefinition buildWidgetDefinition(Element repeaterElement) throws Exception { int initialSize = DomHelper.getAttributeAsInteger(repeaterElement, "initial-size", 0); RepeaterDefinition repeaterDefinition = new RepeaterDefinition(initialSize); - setCommonProperties(repeaterElement, repeaterDefinition); + super.setupDefinition(repeaterElement, repeaterDefinition); setDisplayData(repeaterElement, repeaterDefinition); - setValidators(repeaterElement, repeaterDefinition); Element widgetsElement = DomHelper.getChildElement(repeaterElement, Constants.DEFINITION_NS, "widgets", true); // All child elements of the widgets element are widgets @@ -43,6 +42,7 @@ repeaterDefinition.addWidgetDefinition(widgetDefinition); } + repeaterDefinition.makeImmutable(); return repeaterDefinition; } } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -20,6 +20,7 @@ import org.apache.cocoon.forms.Constants; import org.apache.cocoon.forms.event.ActionListener; import org.apache.cocoon.forms.util.DomHelper; +import org.apache.cocoon.util.log.DeprecationLogger; import org.w3c.dom.Element; /** @@ -31,9 +32,23 @@ public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception { - String actionCommand = DomHelper.getAttribute(widgetElement, "action-command"); + // Get the "command" attribute + String actionCommand = DomHelper.getAttribute(widgetElement, "command", null); + + // If unspecified, check the deprecated "action-command" deprecated attribute + if (actionCommand == null) { + actionCommand = DomHelper.getAttribute(widgetElement, "action-command", null); + if (actionCommand != null) { + DeprecationLogger.log("The 'action-command' attribute is deprecated and replaced by 'command', at " + + DomHelper.getLocation(widgetElement)); + } + } + if (actionCommand == null) { + throw new Exception("Missing attribute 'command' at " + DomHelper.getLocation(widgetElement)); + } + RowActionDefinition definition = createDefinition(widgetElement, actionCommand); - setCommonProperties(widgetElement, definition); + super.setupDefinition(widgetElement, definition); setDisplayData(widgetElement, definition); definition.setActionCommand(actionCommand); @@ -50,6 +65,7 @@ definition.addActionListener((ActionListener)iter.next()); } + definition.makeImmutable(); return definition; } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SelectableWidget.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SelectableWidget.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SelectableWidget.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SelectableWidget.java Fri Mar 4 07:47:41 2005 @@ -18,16 +18,36 @@ import org.apache.cocoon.forms.datatype.SelectionList; /** - * @version $Id$ + * A [EMAIL PROTECTED] Widget} that can have a selection list. The initial selection list is set by the + * widget's [EMAIL PROTECTED] WidgetDefinition}, and can be changed afterwards. The selection list can + * be removed by setting the list to <code>null</code>. * + * @version $Id$ */ public interface SelectableWidget extends Widget { + /** + * Set the widget's selection list given a [EMAIL PROTECTED] SelectionList}. + * + * @param selectionList the selection list or <code>null</code> to have no selection list. + */ public void setSelectionList(SelectionList selectionList); + /** + * Set the widget's selection list given a source URI where the list will be read from. + * + * @param uri the selection list's URI + */ public void setSelectionList(String uri); + /** + * Set the widgdet's selection given an object and XPath expressions. + * + * @param model the selection list model. This is typically a collection or an array of objects + * in which <code>valuePath</code> and <code>labelPath</code> will extract some data. + * @param valuePath the XPath expression to extract values + * @param labelPath the XPath expression to extract labels (can be absent in which case the value is + * used as label). + */ public void setSelectionList(Object model, String valuePath, String labelPath); - - public void removeSelectionList(); } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Struct.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Struct.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Struct.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Struct.java Fri Mar 4 07:47:41 2005 @@ -18,23 +18,17 @@ /** * A container [EMAIL PROTECTED] Widget} which can hold zero or more child widgets. - * + * + * @deprecated replaced by [EMAIL PROTECTED] Group} * @version $Id$ */ -public class Struct extends AbstractContainerWidget { +public class Struct extends Group { private static final String STRUCT_EL = "struct"; - private final StructDefinition definition; - - public Struct(StructDefinition definition) { + public Struct(GroupDefinition definition) { super(definition); - this.definition = definition; - } - - protected WidgetDefinition getDefinition() { - return this.definition; } - + /** * @return "struct" */ Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/StructDefinition.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/StructDefinition.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/StructDefinition.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/StructDefinition.java Fri Mar 4 07:47:41 2005 @@ -18,9 +18,10 @@ /** * The [EMAIL PROTECTED] WidgetDefinition} corresponding to a [EMAIL PROTECTED] Struct} widget. * + * @deprecated replaced by [EMAIL PROTECTED] GroupDefinition} * @version $Id$ */ -public class StructDefinition extends AbstractContainerDefinition { +public class StructDefinition extends GroupDefinition { public Widget createInstance() { Struct structWidget = new Struct(this); Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/StructDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/StructDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/StructDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/StructDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -18,19 +18,20 @@ import org.w3c.dom.Element; import org.apache.cocoon.forms.Constants; import org.apache.cocoon.forms.util.DomHelper; +import org.apache.cocoon.util.log.DeprecationLogger; /** * Builds {StructDefinition}s. * + * @deprecated replaced by [EMAIL PROTECTED] GroupDefinitionBuilder} * @version $Id$ */ public class StructDefinitionBuilder extends AbstractWidgetDefinitionBuilder { public WidgetDefinition buildWidgetDefinition(Element element) throws Exception { StructDefinition definition = new StructDefinition(); - setCommonProperties(element, definition); + super.setupDefinition(element, definition); 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 @@ -41,6 +42,8 @@ definition.addWidgetDefinition(widgetDefinition); } + definition.makeImmutable(); + DeprecationLogger.log("Use of 'fd:struct' is deprecated. Use 'fd:group' instead, at " + definition.getLocation()); return definition; } } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SubmitDefinition.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SubmitDefinition.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SubmitDefinition.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SubmitDefinition.java Fri Mar 4 07:47:41 2005 @@ -27,6 +27,7 @@ private boolean validateForm; public void setValidateForm(boolean validateForm) { + checkMutable(); this.validateForm = validateForm; } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SubmitDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SubmitDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SubmitDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/SubmitDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -26,7 +26,7 @@ * * <p>The syntax is as follows: * <pre> - * <wd:submit id="sub-id" action-command="cmd" validate="false"> + * <wd:submit id="sub-id" command="cmd" validate="false"> * </pre> * The "validate" attribute can have the value <code>true</code> or * <code>false</code> and determines if the form is to be validated @@ -35,15 +35,13 @@ * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a> * @version $Id$ */ -public class SubmitDefinitionBuilder extends ActionDefinitionBuilder { +public final class SubmitDefinitionBuilder extends ActionDefinitionBuilder { public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception { - SubmitDefinition definition = (SubmitDefinition)super.buildWidgetDefinition(widgetElement); + SubmitDefinition definition = new SubmitDefinition(); + super.setupDefinition(widgetElement, definition); definition.setValidateForm(DomHelper.getAttributeAsBoolean(widgetElement, "validate", true)); + definition.makeImmutable(); return definition; - } - - protected ActionDefinition createDefinition() { - return new SubmitDefinition(); - } + } } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Union.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Union.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Union.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Union.java Fri Mar 4 07:47:41 2005 @@ -47,7 +47,7 @@ //item.enteredValue = (String)definition.getDefaultValue(); } - protected WidgetDefinition getDefinition() { + public WidgetDefinition getDefinition() { return definition; } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinition.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinition.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinition.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinition.java Fri Mar 4 07:47:41 2005 @@ -51,6 +51,7 @@ */ public void setCaseWidgetId(String id) { + checkMutable(); caseWidgetId = id; } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UnionDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -24,14 +24,13 @@ * * @version $Id$ */ -public class UnionDefinitionBuilder extends AbstractWidgetDefinitionBuilder { +public final class UnionDefinitionBuilder extends AbstractWidgetDefinitionBuilder { public WidgetDefinition buildWidgetDefinition(Element element) throws Exception { UnionDefinition definition = new UnionDefinition(); - setCommonProperties(element, definition); + super.setupDefinition(element, definition); definition.setCaseWidgetId(DomHelper.getAttribute(element, "case", "")); 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 @@ -42,6 +41,7 @@ definition.addWidgetDefinition(widgetDefinition); } + definition.makeImmutable(); return definition; } // TODO: Need to add code somewhere to build a selection list for the case widget. Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Upload.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Upload.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Upload.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Upload.java Fri Mar 4 07:47:41 2005 @@ -56,7 +56,7 @@ return this.uploadDefinition; } - protected WidgetDefinition getDefinition() { + public WidgetDefinition getDefinition() { return uploadDefinition; } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinitionBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinitionBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinitionBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/UploadDefinitionBuilder.java Fri Mar 4 07:47:41 2005 @@ -25,18 +25,18 @@ * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a> * @version $Id$ */ -public class UploadDefinitionBuilder extends AbstractWidgetDefinitionBuilder { +public final class UploadDefinitionBuilder extends AbstractWidgetDefinitionBuilder { public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception { String mimeTypes = DomHelper.getAttribute(widgetElement, "mime-types", null); boolean required = DomHelper.getAttributeAsBoolean(widgetElement, "required", false); UploadDefinition uploadDefinition = new UploadDefinition(required, mimeTypes); - setCommonProperties(widgetElement, uploadDefinition); + super.setupDefinition(widgetElement, uploadDefinition); setDisplayData(widgetElement, uploadDefinition); - setValidators(widgetElement, uploadDefinition); + uploadDefinition.makeImmutable(); return uploadDefinition; } } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Widget.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Widget.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Widget.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/Widget.java Fri Mar 4 07:47:41 2005 @@ -97,6 +97,13 @@ public Form getForm(); /** + * Get this widget's definition. + * + * @return the widget's definition + */ + public WidgetDefinition getDefinition(); + + /** * Get the widget's own state. Note that this state is <em>not</em> the one actually considered * for handling requests and producing output. For these matters, the combined state is used. * @@ -146,24 +153,6 @@ public Widget lookupWidget(String path); /** - * Controls whether [EMAIL PROTECTED] #readFromRequest(FormContext formContext)} - * processes the request parameter(s) for this widget and its children. - */ - public void setProcessRequests(boolean processRequests); - - /** - * Controls whether [EMAIL PROTECTED] #readFromRequest(FormContext formContext)} - * processes the request parameter(s) for this widget. - */ - public void setProcessMyRequests(boolean processMyRequests); - - /** - * Controls whether [EMAIL PROTECTED] #readFromRequest(FormContext formContext)} - * processes the request parameter(s) for children of this widget. - */ - public void setProcessChildRequests(boolean processChildRequests); - - /** * Lets this widget read its data from a request. At this point the Widget * may try to convert the request parameter to its native datatype (if it * is not a string), but it should not yet generate any validation errors. @@ -198,16 +187,26 @@ public void generateLabel(ContentHandler contentHandler) throws SAXException; /** - * @return the value of the widget. For some widgets (notably ContainerWidgets) - * this may not make sense, those should then simply return null here. + * Get the value of a widget. + * <p> + * Not all widgets do have a value (notably [EMAIL PROTECTED] ContainerWidget}s, + * but this method is provided here as a convenience to ease writing and avoiding casts. + * + * @return the value of the widget. + * @throws UnsupportedOperationException if this widget doesn't have a value. */ - public Object getValue(); + public Object getValue() throws UnsupportedOperationException; /** - * Sets the value of this widget to the given object. Some widgets may not support this - * method, those should throw an runtime exception if you try to set their value anyway. + * Sets the value of this widget. + * <p> + * Not all widgets do have a value (notably [EMAIL PROTECTED] ContainerWidget}s, + * but this method is provided here as a convenience to ease writing and avoiding casts. + * + * @param value the new widget's value. + * @throws UnsupportedOperationException if this widget doesn't have a value. */ - public void setValue(Object object); + public void setValue(Object value) throws UnsupportedOperationException; /** * @return whether this widget is required to be filled in. As with [EMAIL PROTECTED] #getValue()}, 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&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java Fri Mar 4 07:47:41 2005 @@ -32,7 +32,7 @@ public class WidgetDefinitionList { private List widgetDefinitions = new ArrayList(); private Map widgetDefinitionsById = new HashMap(); - private WidgetDefinition definition; + private WidgetDefinition containerDefinition; private boolean resolving; private ListIterator definitionsIt = widgetDefinitions.listIterator(); @@ -40,7 +40,7 @@ * @param definition the widget definition to which this container delegate belongs */ public WidgetDefinitionList(WidgetDefinition definition) { - this.definition = definition; + this.containerDefinition = definition; resolving = false; } @@ -52,11 +52,11 @@ || widgetDefinition instanceof NewDefinition)) { if (widgetDefinitionsById.containsKey(id)) { String duplicateLocation = widgetDefinition.getLocation(); - String containerLocation = definition.getLocation(); + String containerLocation = containerDefinition.getLocation(); String firstLocation = getWidgetDefinition(id).getLocation(); throw new DuplicateIdException( "Duplicate widget id \"" + id + "\" detected at " + duplicateLocation + ".\n" + - "Container widget \"" + definition.getId() + "\" at " + containerLocation + "\n" + + "Container widget \"" + containerDefinition.getId() + "\" at " + containerLocation + "\n" + "already contains a widget with id \"" + id + "\" at " + firstLocation + "."); } widgetDefinitionsById.put(widgetDefinition.getId(), widgetDefinition); @@ -84,7 +84,7 @@ if (!resolving) { resolving = true; this.definitionsIt = widgetDefinitions.listIterator(); - parents.add(definition); + parents.add(containerDefinition); while (this.definitionsIt.hasNext()) { WidgetDefinition widgetDefinition = (WidgetDefinition)this.definitionsIt.next(); // DefineMacroDefinition's get resolved by ExpandMacroDefinition rather than here. @@ -93,16 +93,16 @@ 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); + ((ExpandMacroDefinition)widgetDefinition).resolve(parents, containerDefinition); } 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); + ((NewDefinition)widgetDefinition).resolve(parents, containerDefinition); } else { if (widgetDefinition instanceof ContainerDefinition) - ((ContainerDefinition)widgetDefinition).resolve(parents, definition); + ((ContainerDefinition)widgetDefinition).resolve(parents, containerDefinition); else if (widgetDefinition instanceof ImportDefinition) - ((ImportDefinition)widgetDefinition).resolve(parents, definition); + ((ImportDefinition)widgetDefinition).resolve(parents, containerDefinition); } } } @@ -117,8 +117,8 @@ WidgetDefinition widgetDefinition = (WidgetDefinition)parentsIt.previous(); if (widgetDefinition instanceof UnionDefinition) break; if (widgetDefinition instanceof RepeaterDefinition) break; - if (widgetDefinition == definition) { - String location = definition.getLocation(); + if (widgetDefinition == containerDefinition) { + String location = containerDefinition.getLocation(); if (parent instanceof FormDefinition) { throw new Exception("Container: Non-terminating recursion detected in form definition (" + location + ")"); } else { @@ -134,8 +134,8 @@ public void createWidget(Widget parent, String id) { WidgetDefinition widgetDefinition = (WidgetDefinition)widgetDefinitionsById.get(id); if (widgetDefinition == null) { - throw new RuntimeException(definition.getId() + ": WidgetDefinition \"" + id + - "\" does not exist (" + definition.getLocation() + ")"); + throw new RuntimeException(containerDefinition.getId() + ": WidgetDefinition \"" + id + + "\" does not exist (" + containerDefinition.getLocation() + ")"); } Widget widget = widgetDefinition.createInstance(); if (widget != null) Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetState.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetState.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetState.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/formmodel/WidgetState.java Fri Mar 4 07:47:41 2005 @@ -27,9 +27,11 @@ */ public class WidgetState extends ValuedEnum { - private static final int ACTIVE_VALUE = 3; + private static final int ACTIVE_VALUE = 4; + + private static final int DISABLED_VALUE = 3; - private static final int DISABLED_VALUE = 2; + private static final int OUTPUT_VALUE = 2; private static final int INVISIBLE_VALUE = 1; @@ -40,9 +42,16 @@ public static final WidgetState ACTIVE = new WidgetState("active", ACTIVE_VALUE); /** - * Disabled state. Values are displayed, but user input is ignored. + * Disabled state, value is displayed but user input is ignored. The widget should be + * rendered in a manner that indicates that this widget could be active, but is currently not. */ public static final WidgetState DISABLED = new WidgetState("disabled", DISABLED_VALUE); + + /** + * Output state, value is displayed but user input is ignored. The widget should be rendered + * as plain text, giving no indication that it could be input. + */ + public static final WidgetState OUTPUT = new WidgetState("output", OUTPUT_VALUE); /** * Invisible state. Values are not displayed and user input is ignored. Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/generation/jx-macros.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/generation/jx-macros.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/generation/jx-macros.xml (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/generation/jx-macros.xml Fri Mar 4 07:47:41 2005 @@ -100,9 +100,10 @@ <jx:set var="widget" value="${cformsHelper.getWidget(widget, id)}"/> <jx:if test="${cformsHelper.isVisible(widget)}"> - <fi:group id="${widget.getRequestParameterName()}"> + <!--FIXME(SW): revisit fi:group + <fi:group id="${widget.getRequestParameterName()}"--> <jx:evalBody/> - </fi:group> + <!--/fi:group--> </jx:if> </jx:macro> Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectPipe.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectPipe.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectPipe.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectPipe.java Fri Mar 4 07:47:41 2005 @@ -59,7 +59,7 @@ protected static final int EVENT_END_CDATA =17; protected static final int EVENT_COMMENT =18; - protected class Element { + protected static class Element { public final String prefix; public final String uri; public final String loc; 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&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java Fri Mar 4 07:47:41 2005 @@ -657,13 +657,19 @@ if (isVisible(widget)) { contextWidgets.addFirst(contextWidget); contextWidget = widget; - return this; + //Don't output fi:struct + // out.element(Constants.INSTANCE_PREFIX, Constants.INSTANCE_NS, "union"); + // out.attributes(); + // out.startElement(); + return this; } else { return nullHandler; } case EVENT_ELEMENT: return nestedTemplate(); case EVENT_END_ELEMENT: + // don't output fi:struct + // out.endElement(); contextWidget = (Widget)contextWidgets.removeFirst(); return this; default: @@ -1078,7 +1084,7 @@ case EVENT_START_ELEMENT: // Insert the continuation id // FIXME(SW) we could avoid costly JXPath evaluation if we had the objectmodel here. - Object idObj = pipeContext.evaluateExpression("$continuation/id"); + Object idObj = pipeContext.evaluateExpression("$cocoon/continuation/id"); if (idObj == null) { throwSAXException("No continuation found"); } 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&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/transformation/FormsPipelineConfig.java Fri Mar 4 07:47:41 2005 @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 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. @@ -17,6 +17,7 @@ import java.io.IOException; import java.io.StringReader; +import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -131,13 +132,21 @@ Object flowContext = FlowHelper.getContextObject(objectModel); WebContinuation wk = FlowHelper.getWebContinuation(objectModel); JXPathContext jxpc = JXPathContext.newContext(flowContext); - Variables vars = jxpc.getVariables(); - vars.declareVariable("continuation", wk); + // We manually create a cocoon object here to provide the same way + // of accessing things as in the jxtg + // as soon as we have our unified om, we should use that Request request = ObjectModelHelper.getRequest(objectModel); - vars.declareVariable("request", request); Session session = request.getSession(false); - vars.declareVariable("session", session); - vars.declareVariable("parameters", parameters); + final Map cocoonOM = new HashMap(); + cocoonOM.put("continuation", wk); + cocoonOM.put("request", request); + if ( session != null ) { + cocoonOM.put("session", session); + } + cocoonOM.put("parameters", parameters); + + Variables vars = jxpc.getVariables(); + vars.declareVariable("cocoon", cocoonOM); Locale localeParameter = null; String localeStr = parameters.getParameter("locale", null); Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/DomHelper.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/DomHelper.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/DomHelper.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/DomHelper.java Fri Mar 4 07:47:41 2005 @@ -17,6 +17,11 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; @@ -33,9 +38,11 @@ import org.apache.xerces.xni.XMLAttributes; import org.apache.xerces.xni.XMLLocator; import org.apache.xerces.xni.XNIException; +import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; @@ -58,6 +65,8 @@ */ public class DomHelper { + public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/"; + /** * Retrieves the location of an element node in the source file from which * the Document was created. This will only work for Document's created @@ -118,8 +127,7 @@ * Returns all Element children of an Element that belong to the given * namespace. */ - public static Element[] getChildElements(Element element, - String namespace) { + public static Element[] getChildElements(Element element, String namespace) { ArrayList elements = new ArrayList(); NodeList nodeList = element.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { @@ -128,7 +136,7 @@ && namespace.equals(node.getNamespaceURI())) elements.add(node); } - return (Element[])elements.toArray(new Element[0]); + return (Element[])elements.toArray(new Element[elements.size()]); } /** @@ -147,7 +155,7 @@ elements.add(node); } } - return (Element[])elements.toArray(new Element[0]); + return (Element[])elements.toArray(new Element[elements.size()]); } /** @@ -390,5 +398,54 @@ node.setUserData("location", location, null); } } + } + + public static Map getLocalNSDeclarations(Element elm) + { + return addLocalNSDeclarations(elm, null); + } + + private static Map addLocalNSDeclarations(Element elm, Map nsDeclarations) + { + NamedNodeMap atts = elm.getAttributes(); + int attsSize = atts.getLength(); + + for (int i = 0; i < attsSize; i++) + { + Attr attr = (Attr)atts.item(i); + if (XMLNS_URI.equals(attr.getNamespaceURI())) + { + String nsUri = attr.getValue(); + String pfx = attr.getLocalName(); + if (nsDeclarations == null) + nsDeclarations = new HashMap(); + nsDeclarations.put(nsUri, pfx); + } + } + return nsDeclarations; } + + public static Map getInheritedNSDeclarations(Element elm) + { + List ancestorsAndSelf = new LinkedList(); + Element current = elm; + while (current != null) + { + ancestorsAndSelf.add(current); + Node parent = current.getParentNode(); + if (parent.getNodeType() == Node.ELEMENT_NODE) + current = (Element)parent; + else + current = null; + } + + Map nsDeclarations = null; + ListIterator iter = ancestorsAndSelf.listIterator(ancestorsAndSelf.size()); + while (iter.hasPrevious()) + { + Element element = (Element) iter.previous(); + nsDeclarations = addLocalNSDeclarations(element, nsDeclarations); + } + + return nsDeclarations; } } Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/JavaScriptHelper.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/JavaScriptHelper.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/JavaScriptHelper.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/JavaScriptHelper.java Fri Mar 4 07:47:41 2005 @@ -75,13 +75,14 @@ * Build a function with the content of a DOM element. * * @param element the element containing the function body + * @param name the name of the function * @param argumentNames names of the function arguments * @return the compiled function * @throws IOException */ - public static Function buildFunction(Element element, String[] argumentNames) throws IOException { + public static Function buildFunction(Element element, String name, String[] argumentNames) throws IOException { // Enclose the script text with a function declaration - StringBuffer buffer = new StringBuffer("function foo("); + StringBuffer buffer = new StringBuffer("function ").append(name).append("("); for (int i = 0; i < argumentNames.length; i++) { if (i > 0) { buffer.append(','); Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/XMLAdapter.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/XMLAdapter.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/XMLAdapter.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/util/XMLAdapter.java Fri Mar 4 07:47:41 2005 @@ -307,7 +307,7 @@ // FIXME: BooleanField should implement DataWidget, which // would make this case unnecessary if (widget.getValue() != null) { - data((Boolean)widget.getValue() == Boolean.TRUE ? "true" : "false"); + data(widget.getValue().toString()); } } else if (widget instanceof MultiValueField) { Datatype datatype = ((MultiValueField)widget).getDatatype(); Modified: cocoon/whiteboard/forms/java/org/apache/cocoon/forms/validation/impl/JavaScriptValidatorBuilder.java URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/java/org/apache/cocoon/forms/validation/impl/JavaScriptValidatorBuilder.java?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/java/org/apache/cocoon/forms/validation/impl/JavaScriptValidatorBuilder.java (original) +++ cocoon/whiteboard/forms/java/org/apache/cocoon/forms/validation/impl/JavaScriptValidatorBuilder.java Fri Mar 4 07:47:41 2005 @@ -50,7 +50,7 @@ * @see org.apache.cocoon.forms.validation.ValidatorBuilder#build(org.apache.cocoon.forms.formmodel.WidgetDefinition, org.w3c.dom.Element) */ public WidgetValidator build(Element element, WidgetDefinition definition) throws Exception { - Function function = JavaScriptHelper.buildFunction(element, ARG_NAMES); + Function function = JavaScriptHelper.buildFunction(element, "validate", ARG_NAMES); return new JavaScriptValidator(this.avalonContext, function); } Modified: cocoon/whiteboard/forms/samples/dreamteam/content/teamTemplate.jx URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/dreamteam/content/teamTemplate.jx?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/dreamteam/content/teamTemplate.jx (original) +++ cocoon/whiteboard/forms/samples/dreamteam/content/teamTemplate.jx Fri Mar 4 07:47:41 2005 @@ -55,7 +55,7 @@ </tr> </table> </div> - <ft:form-template action="#{$continuation/id}.continue" method="POST"> + <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST"> <jx:choose> <jx:when test="${form.getChild('teammembers').getSize() == 0}"> <p> Modified: cocoon/whiteboard/forms/samples/dreamteam/sitemap.xmap URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/dreamteam/sitemap.xmap?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/dreamteam/sitemap.xmap (original) +++ cocoon/whiteboard/forms/samples/dreamteam/sitemap.xmap Fri Mar 4 07:47:41 2005 @@ -126,7 +126,7 @@ <!-- images --> <!-- ========================================= --> <map:match pattern="resources/*.gif"> - <map:read mime-type="images/gif" src="../resources/{1}.gif"/> + <map:read mime-type="images/gif" src="resource://org/apache/cocoon/forms/resources/{1}.gif"/> </map:match> <map:match pattern="flags/*.gif"> <map:read mime-type="images/gif" src="resources/flags/{1}.gif"/> @@ -137,11 +137,11 @@ <map:match pattern="local-resources/*.css"> <map:read mime-type="text/css" src="resources/styles/{1}.css"/> </map:match> - <map:match pattern="resources/*.css"> - <map:read mime-type="text/css" src="../resources/styles/{1}.css"/> + <map:match pattern="resources/**.css"> + <map:read mime-type="text/css" src="resource://org/apache/cocoon/forms/resources/styles/{1}.css"/> </map:match> - <map:match pattern="resources/*.js"> - <map:read src="../resources/{1}.js"/> + <map:match pattern="resources/**.js"> + <map:read src="resource://org/apache/cocoon/forms/resources/{1}.js"/> </map:match> </map:pipeline> </map:pipelines> Modified: cocoon/whiteboard/forms/samples/forms/carselector_form.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/forms/carselector_form.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/forms/carselector_form.xml (original) +++ cocoon/whiteboard/forms/samples/forms/carselector_form.xml Fri Mar 4 07:47:41 2005 @@ -17,7 +17,8 @@ <!-- form used to illustrate programmatic changing of listbox content. --> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" - xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> + xmlns:i18n="http://apache.org/cocoon/i18n/2.1" + id="carselector"> <fd:widgets> <fd:field id="make" required="true"> Modified: cocoon/whiteboard/forms/samples/forms/datasource_chooser.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/forms/datasource_chooser.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/forms/datasource_chooser.xml (original) +++ cocoon/whiteboard/forms/samples/forms/datasource_chooser.xml Fri Mar 4 07:47:41 2005 @@ -30,6 +30,8 @@ <!-- The datasource type. This is the union's "case" widget --> <fd:field id="sourcetype"> <fd:datatype base="string"/> + <!-- The union will initially be showing the "SQL" choice --> + <fd:initial-value>SQL</fd:initial-value> <fd:selection-list> <fd:item value=""/> <fd:item value="SQL"/> @@ -42,35 +44,38 @@ <fd:widgets> <!-- data for an SQL datasource --> - <fd:struct id="SQL"> + <fd:group id="SQL"> <fd:widgets> <fd:field id="jdbc-url"> <fd:label>JDBC URL</fd:label> <fd:datatype base="string"/> + <!-- pre-fill with the sample values in cocoon.xconf --> + <fd:initial-value>jdbc:hsqldb:hsql://localhost:9002</fd:initial-value> </fd:field> <fd:field id="login"> <fd:label>Login</fd:label> <fd:datatype base="string"/> + <fd:initial-value>sa</fd:initial-value> </fd:field> <fd:field id="password"> <fd:label>Password</fd:label> <fd:datatype base="string"/> </fd:field> </fd:widgets> - </fd:struct> + </fd:group> <!-- data for a file datasource --> - <fd:struct id="file"> + <fd:group id="file"> <fd:widgets> <fd:field id="filename"> <fd:datatype base="string"/> </fd:field> </fd:widgets> - </fd:struct> + </fd:group> </fd:widgets> </fd:union> - <fd:submit id="ok" action-command="foo"> + <fd:submit id="ok"> <fd:label>OK</fd:label> </fd:submit> Modified: cocoon/whiteboard/forms/samples/forms/datasource_chooser_binding.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/forms/datasource_chooser_binding.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/forms/datasource_chooser_binding.xml (original) +++ cocoon/whiteboard/forms/samples/forms/datasource_chooser_binding.xml Fri Mar 4 07:47:41 2005 @@ -30,16 +30,16 @@ <fb:union id="datasource" path="."> <fb:case id="SQL" path="."> - <fb:struct id="SQL" path="."> + <fb:group id="SQL" path="."> <fb:value id="jdbc-url" path="URL"/> <fb:value id="login" path="login"/> <fb:value id="password" path="password"/> - </fb:struct> + </fb:group> </fb:case> <fb:case id="file" path="."> - <fb:struct id="file" path="."> + <fb:group id="file" path="."> <fb:value id="filename" path="file/@path"/> - </fb:struct> + </fb:group> </fb:case> </fb:union> </fb:context> Modified: cocoon/whiteboard/forms/samples/forms/datasource_chooser_template.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/forms/datasource_chooser_template.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/forms/datasource_chooser_template.xml (original) +++ cocoon/whiteboard/forms/samples/forms/datasource_chooser_template.xml Fri Mar 4 07:47:41 2005 @@ -23,7 +23,7 @@ <title>Datasource chooser</title> <content> - <ft:form-template action="#{$continuation/id}.continue" method="POST"> + <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST"> <p>Datasource name: <ft:widget id="name"/></p> <fieldset> @@ -35,7 +35,7 @@ Please choose a datasource type. </ft:case> <ft:case id="SQL"> - <ft:struct id="SQL"> + <ft:group id="SQL"> <fi:group> <fi:styling layout="columns"/> <fi:items> @@ -44,12 +44,12 @@ <ft:widget id="password"><fi:styling type="password"/></ft:widget> </fi:items> </fi:group> - </ft:struct> + </ft:group> </ft:case> <ft:case id="file"> - <ft:struct id="file"> + <ft:group id="file"> File name: <ft:widget id="filename"/> - </ft:struct> + </ft:group> </ft:case> </ft:union> </fieldset> Modified: cocoon/whiteboard/forms/samples/forms/dynamicrepeater.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/forms/dynamicrepeater.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/forms/dynamicrepeater.xml (original) +++ cocoon/whiteboard/forms/samples/forms/dynamicrepeater.xml Fri Mar 4 07:47:41 2005 @@ -44,9 +44,9 @@ <fd:datatype base="string"/> </fd:field> - <fd:row-action id="up" action-command="move-up"/> + <fd:row-action id="up" command="move-up"/> - <fd:row-action id="down" action-command="move-down"/> + <fd:row-action id="down" command="move-down"/> <fd:booleanfield id="select"> <fd:label>Select</fd:label> @@ -55,7 +55,7 @@ </fd:widgets> </fd:repeater> - <fd:repeater-action id="addcontact" action-command="add-row" repeater="contacts"> + <fd:repeater-action id="addcontact" command="add-row" repeater="contacts"> <fd:label>Add contact</fd:label> <fd:on-action> <fd:javascript> @@ -72,11 +72,11 @@ </fd:on-action> </fd:repeater-action> - <fd:repeater-action id="removecontacts" action-command="delete-rows" repeater="contacts" select="select"> + <fd:repeater-action id="removecontacts" command="delete-rows" repeater="contacts" select="select"> <fd:label>Remove selected contacts</fd:label> </fd:repeater-action> - <fd:submit id="submit" action-command="foo" > + <fd:submit id="submit"> <fd:label>Submit</fd:label> </fd:submit> </fd:widgets> Modified: cocoon/whiteboard/forms/samples/forms/dynamicrepeater_template.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/forms/dynamicrepeater_template.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/forms/dynamicrepeater_template.xml (original) +++ cocoon/whiteboard/forms/samples/forms/dynamicrepeater_template.xml Fri Mar 4 07:47:41 2005 @@ -38,7 +38,7 @@ </style> <content> - <ft:form-template action="#{$continuation/id}.continue" method="POST"> + <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST"> <p>This is an example of how dynamic templates (using the JX macros) allow to change the page structure depending on the form contents. By adding or removing rows in the repeater Modified: cocoon/whiteboard/forms/samples/forms/form1.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/forms/form1.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/forms/form1.xml (original) +++ cocoon/whiteboard/forms/samples/forms/form1.xml Fri Mar 4 07:47:41 2005 @@ -327,11 +327,11 @@ </fd:widgets> </fd:repeater> - <fd:repeater-action id="addcontact" action-command="add-row" repeater="contacts"> + <fd:repeater-action id="addcontact" command="add-row" repeater="contacts"> <fd:label>Add contact</fd:label> </fd:repeater-action> - <fd:repeater-action id="removecontacts" action-command="delete-rows" repeater="contacts" select="select"> + <fd:repeater-action id="removecontacts" command="delete-rows" repeater="contacts" select="select"> <fd:label>Remove selected contacts</fd:label> </fd:repeater-action> </fd:widgets> Modified: cocoon/whiteboard/forms/samples/forms/form1_template.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/forms/form1_template.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/forms/form1_template.xml (original) +++ cocoon/whiteboard/forms/samples/forms/form1_template.xml Fri Mar 4 07:47:41 2005 @@ -26,7 +26,7 @@ <title>Sample form</title> <content> - <ft:form-template action="#{$continuation/id}.continue" method="POST"> + <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST"> <div style="width: 90%; margin: 10px 50px 50px 50px;"> <!-- group with tabs. Each of the children of <items> will constitute a tab --> <fi:group> Modified: cocoon/whiteboard/forms/samples/forms/form2_model.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/forms/form2_model.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/forms/form2_model.xml (original) +++ cocoon/whiteboard/forms/samples/forms/form2_model.xml Fri Mar 4 07:47:41 2005 @@ -150,11 +150,11 @@ </fd:widgets> </fd:repeater> - <fd:repeater-action id="addcontact" action-command="add-row" repeater="contacts"> + <fd:repeater-action id="addcontact" command="add-row" repeater="contacts"> <fd:label>Add contact</fd:label> </fd:repeater-action> - <fd:repeater-action id="removecontacts" action-command="delete-rows" repeater="contacts" select="select"> + <fd:repeater-action id="removecontacts" command="delete-rows" repeater="contacts" select="select"> <fd:label>Remove selected contacts</fd:label> </fd:repeater-action> </fd:widgets> Modified: cocoon/whiteboard/forms/samples/forms/form2_template.xml URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/forms/samples/forms/form2_template.xml?view=diff&r1=156170&r2=156171 ============================================================================== --- cocoon/whiteboard/forms/samples/forms/form2_template.xml (original) +++ cocoon/whiteboard/forms/samples/forms/form2_template.xml Fri Mar 4 07:47:41 2005 @@ -36,7 +36,7 @@ <p>If you're running the bean-binding demo, then after successful submit you'll be shown a page that uses the JXTemplateGenerator to extract data from the bean (to show that the bean really has been updated).</p> - <ft:form-template action="#{$continuation/id}.continue" method="POST"> + <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST"> <table border="1"> <tr> <td valign="top"><ft:widget-label id="email"/></td>
