Author: tim Date: Tue Nov 2 09:41:12 2004 New Revision: 56392 Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertor.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertorBuilder.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDecimalConvertor.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AggregateField.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/DeleteRowsActionDefinition.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/JXMacrosHelper.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/jx-macros.xml cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/carselector_template.xml cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/countryselector_template.xml cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/form2_bind_xml.xml cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/htmlarea_template.xml cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/registration_template.xml cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/upload_template.xml cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/resources/forms-field-styling.xsl cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap Log: Whitespace
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java Tue Nov 2 09:41:12 2004 @@ -32,7 +32,7 @@ * Builds a [EMAIL PROTECTED] Binding} based on two JavaScript snippets, respectively for loading and saving the form. * This binding also optionally accepts named child bindings, which are useful when the bound widget is a container. * <p> - * The syntax for this binding is as follows : + * The syntax for this binding is as follows: * <pre> * <fb:javascript id="foo" path="@foo"> * <fb:load-form> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertor.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertor.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertor.java Tue Nov 2 09:41:12 2004 @@ -96,11 +96,11 @@ DateFormat dateFormat = null; if (this.variant.equals(DATE)) { - dateFormat = I18nSupport.getInstance().getDateFormat(style, locale); + dateFormat = I18nSupport.getInstance().getDateFormat(style, locale); } else if (this.variant.equals(TIME)) { - dateFormat = I18nSupport.getInstance().getTimeFormat(style, locale); + dateFormat = I18nSupport.getInstance().getTimeFormat(style, locale); } else if (this.variant.equals(DATE_TIME)) { - dateFormat = I18nSupport.getInstance().getDateTimeFormat(style, style, locale); + dateFormat = I18nSupport.getInstance().getDateTimeFormat(style, style, locale); } String pattern = (String)localizedPatterns.get(locale); Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertorBuilder.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertorBuilder.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertorBuilder.java Tue Nov 2 09:41:12 2004 @@ -57,7 +57,7 @@ convertor.setVariant(variant); } else { throw new Exception("Invalid value \"" + variant + "\" for variant attribute at " + DomHelper.getLocation(configElement)); - } + } } Element patternsEl = DomHelper.getChildElement(configElement, Constants.DEFINITION_NS, "patterns", false); Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDecimalConvertor.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDecimalConvertor.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDecimalConvertor.java Tue Nov 2 09:41:12 2004 @@ -78,17 +78,17 @@ if (decimalValue instanceof BigDecimal) { // no need for conversion } else if (decimalValue instanceof Integer) { - decimalValue = new BigDecimal(decimalValue .intValue()); + decimalValue = new BigDecimal(decimalValue.intValue()); } else if (decimalValue instanceof Long) { - decimalValue = new BigDecimal(decimalValue.longValue()); + decimalValue = new BigDecimal(decimalValue.longValue()); } else if (decimalValue instanceof Double) { - decimalValue = new BigDecimal(decimalValue.doubleValue()); + decimalValue = new BigDecimal(decimalValue.doubleValue()); } else if (decimalValue instanceof BigInteger) { - decimalValue = new BigDecimal((BigInteger)decimalValue); + decimalValue = new BigDecimal((BigInteger)decimalValue); } else { - return ConversionResult.create("decimal"); + return ConversionResult.create("decimal"); } - return new ConversionResult(decimalValue); + return new ConversionResult(decimalValue); } public String convertToString(Object value, Locale locale, Convertor.FormatCache formatCache) { Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js Tue Nov 2 09:41:12 2004 @@ -1,12 +1,12 @@ /* * 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. @@ -43,7 +43,7 @@ this.avalonContext = formMgr.getAvalonContext(); // TODO : do we keep this ? this.formWidget = new Widget(this.form); - + } finally { cocoon.releaseComponent(formMgr); if (src != null) resolver.release(src); @@ -61,9 +61,9 @@ */ Form.prototype.getWidget = function(name) { if (name != undefined) { - throw "getWidget(id) has been deprecated.\n" + - "Consider using getChild(id) or lookupWidget(path) instead." - } + throw "getWidget(id) has been deprecated.\n" + + "Consider using getChild(id) or lookupWidget(path) instead." + } return this.form; } @@ -103,7 +103,7 @@ if (this.locale == null) this.locale = java.util.Locale.getDefault(); bizData["locale"] = this.locale; - + // Keep the first continuation that will be created as the result of this function var result = null; @@ -118,7 +118,7 @@ do { var k = cocoon.sendPageAndWait(uri, bizData); if (result == null) result = k; - + var formContext = new Packages.org.apache.cocoon.forms.FormContext(cocoon.request, this.locale); // Prematurely add the bizData as in the object model so that event listeners can use it @@ -131,17 +131,17 @@ if (finished) { this.isValid = this.form.isValid(); } - + // FIXME: Theoretically, we should clone the form widget (this.form) to ensure it keeps its // value with the continuation. We don't do it since there should me not much pratical consequences // except a sudden change of repeaters whose size changed from a continuation to another. - + } while(!finished); var widget = this.form.getSubmitWidget(); // Can be null on "normal" submit - this.submitId = widget == null ? null : widget.getId(); - + this.submitId = widget == null ? null : widget.getId(); + return result; } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java Tue Nov 2 09:41:12 2004 @@ -281,21 +281,21 @@ public WidgetState jsGet_state() { return delegate.getState(); } - + public void jsSet_state(Object stateObj) { Object obj = unwrap(stateObj); WidgetState state = null; - + if (obj instanceof String) { state = WidgetState.stateForName((String)obj); } else if (obj instanceof WidgetState) { state = (WidgetState)obj; } - + if (state == null) { throw new IllegalArgumentException("Invalid value for widgetState " + stateObj); } - + delegate.setState(state); } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java Tue Nov 2 09:41:12 2004 @@ -462,25 +462,25 @@ public String jsFunction_getId() { return delegate.getId(); } - + public WidgetState jsGet_state() { return delegate.getState(); } - + public void jsSet_state(Object stateObj) { Object obj = unwrap(stateObj); WidgetState state = null; - + if (obj instanceof String) { state = WidgetState.stateForName((String)obj); } else if (obj instanceof WidgetState) { state = (WidgetState)obj; } - + if (state == null) { throw new IllegalArgumentException("Invalid value for widgetState " + stateObj); } - + delegate.setState(state); } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java Tue Nov 2 09:41:12 2004 @@ -456,21 +456,21 @@ public WidgetState jsGet_state() { return delegate.getState(); } - + public void jsSet_state(Object stateObj) { Object obj = unwrap(stateObj); WidgetState state = null; - + if (obj instanceof String) { state = WidgetState.stateForName((String)obj); } else if (obj instanceof WidgetState) { state = (WidgetState)obj; } - + if (state == null) { throw new IllegalArgumentException("Invalid value for widgetState " + stateObj); } - + delegate.setState(state); } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java Tue Nov 2 09:41:12 2004 @@ -1,12 +1,12 @@ /* * 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. @@ -28,13 +28,13 @@ * @version $Id$ */ public abstract class AbstractContainerWidget extends AbstractWidget implements ContainerWidget { - + /** * List of contained widgets. */ protected WidgetList widgets; - /** + /** * Constructs AbstractContainerWidget */ public AbstractContainerWidget(AbstractWidgetDefinition definition) { @@ -54,20 +54,20 @@ public Widget getChild(String id) { return widgets.getWidget(id); } - + public Iterator getChildren() { return widgets.iterator(); } /** * Delegates the readFromRequest() down to the contained child-widgets. - * - * When overriding one should call <code>super.readFromRequest()</code> - * to allow child-widgets to process the request. - * - * Overide only to add possible request-reading statements on the containment level. - * - * @param formContext to be passed to the [EMAIL PROTECTED] Widget#readFromRequest(FormContext)} + * + * When overriding one should call <code>super.readFromRequest()</code> + * to allow child-widgets to process the request. + * + * Overide only to add possible request-reading statements on the containment level. + * + * @param formContext to be passed to the [EMAIL PROTECTED] Widget#readFromRequest(FormContext)} * of the contained widgets. */ public void readFromRequest(FormContext formContext) { @@ -80,27 +80,26 @@ * Delegates the <code>validate()</code> down to the contained child-widgets, * and validates the extra rules on this containment level regardless of * children widget's validities. - * + * * <p>When overriding one should call <code>super.validate()</code> as the first * statement to keep in sync with this behaviour.</p> - * - * @return <code>true</code> only if all contained widgets are valid and the + * + * @return <code>true</code> only if all contained widgets are valid and the * extra validation rules on this containment level are ok. */ public boolean validate() { if (!getCombinedState().isAcceptingInputs()) return true; - + // Validate children first, then always validate self. Return combined result. final boolean valid = widgets.validate(); return super.validate() && valid; } - /** - * Subclass container widgets can call this super.generateItemSaxFragment(..) - * to just insert the child-widget content wrapped in a @lt;fi:[EMAIL PROTECTED]; - * + * Subclass container widgets can call this super.generateItemSaxFragment(..) + * to just insert the child-widget content wrapped in a @lt;fi:[EMAIL PROTECTED]; + * * @param contentHandler where the SAX is sent to via [EMAIL PROTECTED] Widget#generateSaxFragment(ContentHandler, Locale)} * @param locale * @throws SAXException Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java Tue Nov 2 09:41:12 2004 @@ -36,24 +36,24 @@ * @version $Id$ */ public abstract class AbstractWidget implements Widget { - + /** * Containing parent-widget to this widget. * NOTE: avoid directly accessing this member since subclasses can mask this * property through own implemented getParent() */ private Widget parent; - + /** * The widget's own state */ private WidgetState state = WidgetState.ACTIVE; - + /** * Lazy loaded reference to the top-level form. */ private Form form; - + /** * Validation-rules local to the widget instance */ @@ -63,18 +63,18 @@ * Storage for the widget allocated attributes */ private Map attributes; - + protected AbstractWidget(AbstractWidgetDefinition definition) { this.state = definition.getState(); } - + /** * Gets the id of this widget. */ public String getId() { return getDefinition().getId(); } - + /** * Concrete subclasses should allow access to their underlaying Definition * through this method. @@ -88,7 +88,7 @@ * (@link WidgetDefinition#createInstance()} */ protected abstract WidgetDefinition getDefinition(); - + /** * @return the location-information (file, line and column) where this widget was * configured. @@ -135,14 +135,14 @@ public WidgetState getState() { return this.state; } - + public void setState(WidgetState state) { if (state == null) { throw new IllegalArgumentException("A widget state cannot be set to null"); } this.state = state; } - + public WidgetState getCombinedState() { if (parent == null) { return this.state; @@ -163,11 +163,11 @@ return getId(); } - public Widget lookupWidget(String path) { - + public Widget lookupWidget(String path) { + if (path == null && path.equals("")) return this; - + Widget relativeWidget; String relativePath = null; int sepPosition = path.indexOf("" + Widget.PATH_SEPARATOR); @@ -178,7 +178,7 @@ return getChild(path); } else if (sepPosition == 0) { //absolute path - relativeWidget = getForm(); + relativeWidget = getForm(); relativePath = path.substring(1); } else { if (path.startsWith(".." + Widget.PATH_SEPARATOR)) { @@ -190,11 +190,11 @@ relativePath = path.substring(sepPosition+1); } } - + if (relativeWidget == null) return null; return relativeWidget.lookupWidget(relativePath); - } - + } + /** * Concrete widgets that contain actual child widgets should override to * return the actual child-widget. @@ -205,12 +205,12 @@ protected Widget getChild(String id) { return null; } - + public Widget getWidget(String id) { throw new UnsupportedOperationException("getWidget(id) got deprecated from the API. \n" + "Consider using getChild(id) or even lookupWidget(path) instead."); } - + public Object getValue() { return null; } @@ -232,7 +232,7 @@ public void broadcastEvent(WidgetEvent event) { throw new UnsupportedOperationException("Widget " + this.getRequestParameterName() + " doesn't handle events."); } - + /** * Add a validator to this widget instance. * @@ -244,7 +244,7 @@ } this.validators.add(validator); } - + /** * Remove a validator from this widget instance * @@ -258,14 +258,14 @@ return false; } } - + public boolean validate() { - + // Consider widget valid if it doesn't accept user inputs - if (!getCombinedState().isAcceptingInputs()) { + if (!getCombinedState().isAcceptingInputs()) { return true; } - + // Test validators from the widget definition if (!getDefinition().validate(this)) { // Failed @@ -308,7 +308,6 @@ } } - /** * Generates nested additional content nested inside the main element for this * widget which is generated by [EMAIL PROTECTED] #generateSaxFragment(ContentHandler, Locale)} @@ -353,7 +352,7 @@ if (getId().length() != 0) { attrs.addCDATAAttribute("id", getRequestParameterName()); } - + // Add the "state" attribute is different from active (the default state) WidgetState state = getCombinedState(); if (state != WidgetState.ACTIVE) { @@ -402,15 +401,15 @@ public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException { if (getCombinedState().isDisplayingValues()) { - - String element = this.getXMLElementName(); + + String element = this.getXMLElementName(); AttributesImpl attrs = getXMLElementAttributes(); contentHandler.startElement(Constants.INSTANCE_NS, element, Constants.INSTANCE_PREFIX_COLON + element, attrs); - + generateDisplayData(contentHandler); - + generateItemSaxFragment(contentHandler, locale); - + contentHandler.endElement(Constants.INSTANCE_NS, element, Constants.INSTANCE_PREFIX_COLON + element); } } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java Tue Nov 2 09:41:12 2004 @@ -38,7 +38,7 @@ public abstract class AbstractWidgetDefinition implements WidgetDefinition { private FormDefinition formDefinition; protected WidgetDefinition parent; - + //TODO consider final on these private String location = null; private String id; @@ -67,7 +67,7 @@ public void setParent(WidgetDefinition definition) { this.parent = definition; } - + /** * Gets the parent of this definition. * This method returns null for the root definition. @@ -75,7 +75,7 @@ public WidgetDefinition getParent() { return this.parent; } - + public WidgetState getState() { return this.state; } @@ -83,7 +83,7 @@ public void setState(WidgetState state) { this.state = state; } - + protected void setLocation(String location) { this.location = location; } @@ -99,7 +99,7 @@ protected void setId(String id) { this.id = id; } - + protected void setAttributes(Map attributes) { this.attributes = attributes; } @@ -113,12 +113,12 @@ } protected void addCreateListener(CreateListener listener) { - this.createListener = WidgetEventMulticaster.add(this.createListener, listener); + this.createListener = WidgetEventMulticaster.add(this.createListener, listener); } - + public void fireCreateEvent(CreateEvent event) { if (this.createListener != null) { - this.createListener.widgetCreated(event); + this.createListener.widgetCreated(event); } } @@ -136,15 +136,15 @@ public void setDisplayData(Map displayData) { this.displayData = displayData; } - + public void addValidator(WidgetValidator validator) { if (this.validators == null) { this.validators = new ArrayList(); } - + this.validators.add(validator); } - + public void generateDisplayData(String name, ContentHandler contentHandler) throws SAXException { Object data = this.displayData.get(name); if (data != null) { @@ -153,7 +153,7 @@ throw new IllegalArgumentException("Unknown display data name '" + name + "'"); } } - + public void generateDisplayData(ContentHandler contentHandler) throws SAXException { // Output all non-null display data Iterator iter = this.displayData.entrySet().iterator(); @@ -161,7 +161,7 @@ Map.Entry entry = (Map.Entry)iter.next(); if (entry.getValue() != null) { String name = (String)entry.getKey(); - + // Enclose the data into a "wi:{name}" element contentHandler.startElement(Constants.INSTANCE_NS, name, Constants.INSTANCE_PREFIX_COLON + name, XMLUtils.EMPTY_ATTRIBUTES); @@ -171,12 +171,12 @@ } } } - + public boolean validate(Widget widget) { if (this.validators == null) { // No validators return true; - + } else { Iterator iter = this.validators.iterator(); while(iter.hasNext()) { Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java Tue Nov 2 09:41:12 2004 @@ -67,7 +67,7 @@ protected void setCommonProperties(Element widgetElement, AbstractWidgetDefinition widgetDefinition) throws Exception { // location widgetDefinition.setLocation(DomHelper.getLocation(widgetElement)); - + // id if (widgetDefinition instanceof FormDefinition) { // FormDefinition is the *only* kind of widget that has an optional id @@ -80,7 +80,7 @@ } widgetDefinition.setId(id); } - + // state String stateValue = DomHelper.getAttribute(widgetElement, "state", null); if (stateValue != null) { @@ -91,7 +91,7 @@ } widgetDefinition.setState(state); } - + // attributes Element attrContainer = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "attributes", false); if (attrContainer != null) { Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java Tue Nov 2 09:41:12 2004 @@ -43,21 +43,21 @@ protected WidgetDefinition getDefinition() { return this.definition; } - + public void readFromRequest(final FormContext formContext) { if (!getCombinedState().isAcceptingInputs()) return; - + Form form = getForm(); - + // Set the submit widget if we can determine it from the request String fullId = getRequestParameterName(); Request request = formContext.getRequest(); - + String value = request.getParameter(fullId); if (value != null && value.length() > 0) { form.setSubmitWidget(this); - + } else { // Special workaround an IE bug for <input type="image" name="foo"> : // in that case, IE only sends "foo.x" and "foo.y" and not "foo" whereas @@ -70,14 +70,14 @@ form.setSubmitWidget(this); } } - + if (form.getSubmitWidget() == this) { form.addWidgetEvent(new ActionEvent(this, definition.getActionCommand())); - + handleActivate(); } } - + /** * Handle the fact that this action was activated. The default here is to end the * current form processing and redisplay the form, which means that actual behaviour @@ -97,14 +97,14 @@ } private static final String ACTION_EL = "action"; - + /** * @return "action" */ public String getXMLElementName() { return ACTION_EL; } - + /** * Adds a ActionListener to this widget instance. Listeners defined * on the widget instance will be executed in addtion to any listeners @@ -123,6 +123,7 @@ this.listener.actionPerformed(event); } } + public void broadcastEvent(WidgetEvent event) { this.definition.fireActionEvent((ActionEvent)event); fireActionEvent((ActionEvent)event); Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AggregateField.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AggregateField.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AggregateField.java Tue Nov 2 09:41:12 2004 @@ -1,12 +1,12 @@ /* * 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. @@ -77,8 +77,8 @@ throw new IllegalArgumentException("AggregateField can only contain fields."); } addField((Field)widget); - } - + } + protected void addField(Field field) { field.setParent(this); fields.add(field); @@ -112,7 +112,7 @@ field.readFromRequest(formContext); if (field.valueState == VALUE_UNPARSED) { this.valueState = VALUE_UNPARSED; - } + } } if (this.valueState == VALUE_UNPARSED) { combineFields(); @@ -217,7 +217,7 @@ } if (!valid) { valueState = VALUE_DISPLAY_VALIDATION; - return false; + return false; } return super.validate(); @@ -228,10 +228,10 @@ /** * @return "aggregatefield" */ - public String getXMLElementName() { + public String getXMLElementName() { return AGGREGATEFIELD_EL; } - + public Widget getChild(String id) { return (Widget)fieldsById.get(id); } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java Tue Nov 2 09:41:12 2004 @@ -26,8 +26,6 @@ import org.apache.cocoon.forms.validation.ValidationErrorAware; import org.apache.cocoon.forms.validation.ValidationError; - - /** * A widget to select a boolean value. Usually rendered as a checkbox. * @@ -70,7 +68,7 @@ value = Boolean.TRUE; else value = Boolean.FALSE; - + if (value != oldValue) { getForm().addWidgetEvent(new ValueChangedEvent(this, oldValue, value)); } @@ -87,7 +85,6 @@ return super.validate(); } - /** * Returns the validation error, if any. There will always be a validation error in case the * [EMAIL PROTECTED] #validate()} method returned false. @@ -106,11 +103,10 @@ this.validationError = error; } - private static final String BOOLEAN_FIELD_EL = "booleanfield"; private static final String VALUE_EL = "value"; private static final String VALIDATION_MSG_EL = "validation-message"; - + /** * @return "booleanfield" */ @@ -155,7 +151,7 @@ getForm().addWidgetEvent(new ValueChangedEvent(this, oldValue, value)); } } - + /** * Adds a ValueChangedListener to this widget instance. Listeners defined * on the widget instance will be executed in addtion to any listeners Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/DeleteRowsActionDefinition.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/DeleteRowsActionDefinition.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/DeleteRowsActionDefinition.java Tue Nov 2 09:41:12 2004 @@ -22,28 +22,28 @@ * <p> * The action listeners attached to this action, if any, are called <em>before</em> the rows * are actually removed - * + * * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a> * @version CVS $Id$ */ public 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--) { Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java Tue Nov 2 09:41:12 2004 @@ -202,9 +202,9 @@ this.valueState = VALUE_UNPARSED; if (hasValueChangedListeners()) { - // Throw an event that will parse the value only if needed. - getForm().addWidgetEvent(new DeferredValueChangedEvent(this, value)); - } + // Throw an event that will parse the value only if needed. + getForm().addWidgetEvent(new DeferredValueChangedEvent(this, value)); + } } } @@ -226,7 +226,7 @@ this.valueState = VALUE_DISPLAY_VALIDATION; } else if (this.valueState == VALUE_PARSE_ERROR) { this.valueState = VALUE_DISPLAY_PARSE_ERROR; - } + } return this.validationError == null; } @@ -324,7 +324,6 @@ private static final String FIELD_EL = "field"; private static final String VALUE_EL = "value"; private static final String VALIDATION_MSG_EL = "validation-message"; - /** * @return "field" Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java Tue Nov 2 09:41:12 2004 @@ -1,12 +1,12 @@ /* * 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. @@ -30,15 +30,15 @@ /** * A widget that serves as a container for other widgets, the top-level widget in * a form description file. - * + * * @author Bruno Dumon * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a> * @version CVS $Id$ */ public class Form extends AbstractContainerWidget { - + private final FormDefinition definition; - + private Boolean endProcessing; private Locale locale = Locale.getDefault(); private FormHandler formHandler; @@ -60,20 +60,20 @@ protected WidgetDefinition getDefinition() { return this.definition; } - + /** * Events produced by child widgets should not be fired immediately, but queued in order to ensure * an overall consistency of the widget tree before being handled. - * + * * @param event the event to queue */ public void addWidgetEvent(WidgetEvent event) { - + if (this.bufferEvents) { if (this.events == null) { this.events = new CursorableLinkedList(); } - + // FIXME: limit the number of events to detect recursive event loops ? this.events.add(event); } else { @@ -81,7 +81,7 @@ event.getSourceWidget().broadcastEvent(event); } } - + /** * Fire the widget events that have been queued. Note that event handling can fire new * events. @@ -96,14 +96,14 @@ formHandler.handleEvent(event); } cursor.close(); - + this.events.clear(); } } /** * Get the locale to be used to process this form. - * + * * @return the form's locale. */ public Locale getLocale() { @@ -113,16 +113,16 @@ /** * Get the widget that triggered the current processing. Note that it can be any widget, and * not necessarily an action or a submit. - * + * * @return the widget that submitted this form. */ public Widget getSubmitWidget() { return this.submitWidget; } - + /** * Set the widget that triggered the current form processing. - * + * * @param widget the widget */ public void setSubmitWidget(Widget widget) { @@ -152,7 +152,7 @@ // if (this.phase != ProcessingPhase.VALIDATE) { // throw new IllegalStateException("Cannot save model in phase " + this.phase); // } -// +// // if (!isValid()) { // throw new IllegalStateException("Cannot save an invalid form."); // } @@ -163,7 +163,7 @@ public void addProcessingPhaseListener(ProcessingPhaseListener listener) { this.listener = WidgetEventMulticaster.add(this.listener, listener); } - + public void removeProcessingPhaseListener(ProcessingPhaseListener listener) { this.listener = WidgetEventMulticaster.remove(this.listener, listener); } @@ -185,21 +185,21 @@ * [EMAIL PROTECTED] #endProcessing(boolean)}. */ public boolean process(FormContext formContext) { - + // Fire the binding phase events fireWidgetEvents(); - + // setup processing this.submitWidget = null; this.locale = formContext.getLocale(); this.endProcessing = null; this.isValid = false; - + // Notify the end of the current phase if (this.listener != null) { this.listener.phaseEnded(new ProcessingPhaseEvent(this, this.phase)); } - + this.phase = ProcessingPhase.READ_FROM_REQUEST; // Find the submit widget, if not an action this.submitWidget = null; @@ -213,16 +213,16 @@ throw new IllegalArgumentException("Invalid submit id (no such widget): " + submitId); } } - + setSubmitWidget(submit); } - + try { // Start buffering events this.bufferEvents = true; - + doReadFromRequest(formContext); - + // Fire events, still buffering them: this ensures they will be handled in the same // order as they were added. fireWidgetEvents(); @@ -230,7 +230,7 @@ // No need for buffering in the following phases this.bufferEvents = false; } - + // Notify the end of the current phase if (this.listener != null) { this.listener.phaseEnded(new ProcessingPhaseEvent(this, this.phase)); @@ -241,19 +241,19 @@ return validate(); } - + /** * End the current form processing after the current phase. - * + * * @param redisplayForm indicates if the form should be redisplayed to the user. */ public void endProcessing(boolean redisplayForm) { this.endProcessing = new Boolean(!redisplayForm); } - + /** * Was form validation successful ? - * + * * @return <code>true</code> if the form was successfully validated. */ public boolean isValid() { @@ -266,7 +266,7 @@ private void doReadFromRequest(FormContext formContext) { // let all individual widgets read their value from the request object - super.readFromRequest(formContext); + super.readFromRequest(formContext); } /** @@ -291,7 +291,7 @@ // This allows for additional application-level validation. this.isValid = false; return this.endProcessing.booleanValue(); - } + } return this.isValid; } @@ -300,5 +300,5 @@ public String getXMLElementName() { return FORM_EL; - } + } } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java Tue Nov 2 09:41:12 2004 @@ -69,7 +69,7 @@ public void readFromRequest(FormContext formContext) { if (!getCombinedState().isAcceptingInputs()) return; - + enteredValues = formContext.getRequest().getParameterValues(getRequestParameterName()); validationError = null; values = null; @@ -118,7 +118,6 @@ private static final String VALUES_EL = "values"; private static final String VALUE_EL = "value"; private static final String VALIDATION_MSG_EL = "validation-message"; - /** * @return "multivaluefield" Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java Tue Nov 2 09:41:12 2004 @@ -221,7 +221,7 @@ public boolean validate() { if (!getCombinedState().isAcceptingInputs()) return true; - + boolean valid = true; Iterator rowIt = rows.iterator(); while (rowIt.hasNext()) { Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java Tue Nov 2 09:41:12 2004 @@ -27,13 +27,14 @@ * @version $Id$ */ public class Union extends AbstractContainerWidget { - + //Note: union instances behave like simple "field" instance with respect to // XSLT post-processing, the choice of element-name reflects this. private static final String UNION_EL = "field"; + private Widget caseWidget; private String caseValue; - + private final UnionDefinition definition; public Union(UnionDefinition definition) { @@ -42,7 +43,7 @@ // TODO: Remove after moving logic to Field. //item.enteredValue = (String)definition.getDefaultValue(); } - + protected WidgetDefinition getDefinition() { return definition; } @@ -80,12 +81,12 @@ // Ensure the case widget has read its value caseWidget.readFromRequest(formContext); - + Widget widget; // Read current case from request String newValue = (String)getValue(); if (newValue != null && !newValue.equals("")) { - + if (getForm().getSubmitWidget() == caseWidget && !newValue.equals(caseValue)) { // If submitted by the case widget and its value has changed, read the values // for the previous case values. This allows to keep any entered values @@ -95,7 +96,7 @@ // Get the corresponding widget (will create it if needed) widget = getChild(newValue); } - + if (widget != null) { widget.readFromRequest(formContext); } @@ -124,7 +125,6 @@ return super.getChild(id); } - //TODO: check further: cause the claim in the accompanied comment doesn't seem // to be completely correct Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java Tue Nov 2 09:41:12 2004 @@ -72,7 +72,7 @@ return; Object obj = formContext.getRequest().get(getRequestParameterName()); - + // If the request object is a Part, keep it if (obj instanceof Part) { Part requestPart = (Part)obj; @@ -80,12 +80,12 @@ // Replace the current part this.part.dispose(); } - + // Keep the request part requestPart.setDisposeWithRequest(false); this.part = requestPart; this.validationError = null; - + // If it's not a part and not null, clear any existing value // We also check if we're the submit widget, as a result of clicking the "..." button } else if (obj != null || getForm().getSubmitWidget() == this){ @@ -96,7 +96,7 @@ } this.validationError = null; } - + // And keep the current state if the parameter doesn't exist or is null } @@ -123,7 +123,7 @@ this.validationError = null; } } - + return validationError == null ? super.validate() : false; } @@ -134,7 +134,7 @@ public ValidationError getValidationError() { return validationError; } - + /** * Set a validation error on this field. This allows fields to be externally marked as invalid by * application logic. @@ -145,33 +145,30 @@ this.validationError = error; } - private static final String UPLOAD_EL = "upload"; private static final String VALUE_EL = "value"; private static final String VALIDATION_MSG_EL = "validation-message"; - + /** * @return "upload" */ public String getXMLElementName() { return UPLOAD_EL; } - - - /** - * Adds attributes @required, @mime-types - */ - public AttributesImpl getXMLElementAttributes() { - AttributesImpl attrs = super.getXMLElementAttributes(); + /** + * Adds attributes @required, @mime-types + */ + public AttributesImpl getXMLElementAttributes() { + AttributesImpl attrs = super.getXMLElementAttributes(); attrs.addCDATAAttribute("id", getRequestParameterName()); attrs.addCDATAAttribute("required", String.valueOf(uploadDefinition.isRequired())); if (uploadDefinition.getMimeTypes() != null) { attrs.addCDATAAttribute("mime-types", uploadDefinition.getMimeTypes()); } - return attrs; - } - + return attrs; + } + public void generateItemSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException { if (this.part != null) { String name = (String)this.part.getHeaders().get("filename"); Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java Tue Nov 2 09:41:12 2004 @@ -52,7 +52,7 @@ * @version CVS $Id$ */ public interface Widget { - + /** * Widget-Separator used in path-like notations * @see #lookupWidget(String) @@ -82,30 +82,30 @@ * which case it should be called when a widget is added as child of your widget). */ public void setParent(Widget widget); - + /** * @return the [EMAIL PROTECTED] Form} to which this widget belongs. The form is the top-most ancestor * of the widget. */ public Form getForm(); - + /** * 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. - * + * * @see #getCombinedState() * @return the widget's own state */ public WidgetState getState(); - + /** * Set the widget's own state. This may change its combined state, and those of its * children, if any. - * + * * @param state the new wiget state */ public void setState(WidgetState state); - + /** * Get the widget's combined state, which is the strictest of its own state and parent state. * This combined state is the one that will be used by the widget to know if request @@ -115,7 +115,7 @@ * @return the combined state */ public WidgetState getCombinedState(); - + /** * @return the id prefixed with the namespace, this name should be unique * accross all widgets on the form. @@ -128,7 +128,7 @@ * deprecated from the API, and will be removed from future releases. */ public Widget getWidget(String id); - + /** * Finds a widget relative to this one based on a path-like * string (/-delimted) into the widget-tree structure. @@ -137,7 +137,7 @@ * of the path an invalid section was encountered. */ public Widget lookupWidget(String path); - + /** * 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 @@ -158,7 +158,7 @@ public void addValidator(WidgetValidator validator); public boolean removeValidator(WidgetValidator validator); - + /** * Generates an XML representation of this widget. The startDocument and endDocument * SAX events will not be called. It is assumed that the prefix for the CForms namespace @@ -177,7 +177,7 @@ * this may not make sense, those should then simply return null here. */ public Object getValue(); - + /** * 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. @@ -189,7 +189,7 @@ * for some widgets this may not make sense, those should return false here. */ public boolean isRequired(); - + /** * Broadcast an event previously queued by this widget to its event listeners. */ Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/JXMacrosHelper.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/JXMacrosHelper.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/JXMacrosHelper.java Tue Nov 2 09:41:12 2004 @@ -188,7 +188,7 @@ String value = (String)unionWidget.getValue(); return caseValue.equals(value != null ? value : ""); } - + public boolean isVisible(Widget widget) { return widget.getCombinedState().isDisplayingValues(); } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/jx-macros.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/jx-macros.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/generation/jx-macros.xml Tue Nov 2 09:41:12 2004 @@ -8,7 +8,7 @@ <jx:macro name="form-template" targetNamespace="http://apache.org/cocoon/forms/1.0#template"> <jx:set var="cformsHelper" value="${Packages.org.apache.cocoon.forms.generation.JXMacrosHelper.createHelper(cocoon.consumer)}"/> <jx:set var="form" value="${CocoonFormsInstance}"/> - <jx:if test="${cformsHelper.isVisible(form)}"> + <jx:if test="${cformsHelper.isVisible(form)}"> <jx:set var="cformsDummy" value="${cformsHelper.startForm(form, macro.arguments)}"/> <!-- the form is also the current widget --> <jx:set var="widget" value="${form}"/> @@ -26,7 +26,7 @@ <jx:set var="widget" value="${cformsHelper.getWidget(widget, id)}"/> <jx:if test="${cformsHelper.isVisible(widget)}"> <jx:set var="cformsDummy" value="${cformsHelper.generateWidget(widget, locale)}"/> - <jx:evalBody/> + <jx:evalBody/> <jx:set var="cformsDummy" value="${cformsHelper.flushRoot(widget)}"/> </jx:if> </jx:macro> @@ -67,10 +67,10 @@ <jx:set var="repeater" value="${cformsHelper.getRepeater(widget, id)}"/> <jx:if test="${cformsHelper.isVisible(repeater)}"> - <jx:forEach varStatus="repeaterLoop" begin="0" end="${repeater.getSize() - 1}"> + <jx:forEach varStatus="repeaterLoop" begin="0" end="${repeater.getSize() - 1}"> <jx:set var="widget" value="${repeater.getRow(repeaterLoop.index)}"/> <jx:if test="${cformsHelper.isVisible(widget)}"> - <jx:evalBody/> + <jx:evalBody/> </jx:if> </jx:forEach> </jx:if> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java Tue Nov 2 09:41:12 2004 @@ -289,7 +289,7 @@ input.removeAttribute(LOCATION); } contextWidget = pipeContext.findForm(formJXPath); - + if (!isVisible(contextWidget)) { // Skip widget and its content return nullHandler; @@ -382,7 +382,7 @@ case EVENT_START_ELEMENT: widgetId = getWidgetId(input.attrs); widget = getWidget(widgetId); - + if (isVisible(widget)) { gotStylingElement = false; out.bufferInit(); @@ -502,7 +502,7 @@ if (!(widget instanceof AggregateField)) { throwWrongWidgetType("AggregateWidgetHandler", input.loc, "aggregate"); } - + if (isVisible(widget)) { contextWidgets.addFirst(contextWidget); contextWidget = widget; Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/carselector_template.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/carselector_template.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/carselector_template.xml Tue Nov 2 09:41:12 2004 @@ -37,17 +37,17 @@ <fi:group> <fi:styling layout="columns"/> <fi:items> - <ft:widget id="make"> - <fi:styling submit-on-change="true"/> - </ft:widget> - <ft:widget id="type"> - <fi:styling submit-on-change="true"/> - </ft:widget> - <ft:widget id="model"> - <fi:styling submit-on-change="true"/> - </ft:widget> - <ft:widget id="message"/> - <input type="submit" value="Buy it!"/> + <ft:widget id="make"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="type"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="model"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="message"/> + <input type="submit" value="Buy it!"/> </fi:items> </fi:group> </ft:form-template> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/countryselector_template.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/countryselector_template.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/countryselector_template.xml Tue Nov 2 09:41:12 2004 @@ -37,14 +37,14 @@ <fi:group> <fi:styling layout="columns"/> <fi:items> - <ft:widget id="us-nonus"> - <fi:styling submit-on-change="true"/> - </ft:widget> - <ft:widget id="country"> - <fi:styling submit-on-change="true"/> - </ft:widget> - <ft:widget id="message"/> - <input type="submit"/> + <ft:widget id="us-nonus"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="country"> + <fi:styling submit-on-change="true"/> + </ft:widget> + <ft:widget id="message"/> + <input type="submit"/> </fi:items> </fi:group> </ft:form-template> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/form2_bind_xml.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/form2_bind_xml.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/form2_bind_xml.xml Tue Nov 2 09:41:12 2004 @@ -89,7 +89,7 @@ </fb:identity> <fb:on-bind> - <!-- executed on updates AND right after the insert --> + <!-- executed on updates AND right after the insert --> <fb:javascript id="id" path="@id" direction="save"> <fb:save-form> var appValue = jxpathPointer.getValue(); @@ -107,8 +107,8 @@ </fb:on-bind> <fb:on-delete-row> - <!-- chose on of these to test --> - <!-- + <!-- chose on of these to test --> + <!-- <fb:set-attribute name="row-state" value="deleted" /> --> <fb:delete-node /> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/htmlarea_template.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/htmlarea_template.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/htmlarea_template.xml Tue Nov 2 09:41:12 2004 @@ -15,17 +15,17 @@ 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"> + xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"> <title>HTMLArea</title> <content> <ft:form-template action="#{$continuation/id}.continue" method="POST"> <div> - <ft:widget-label id="data"/><br/> - <ft:widget id="data"> + <ft:widget-label id="data"/><br/> + <ft:widget id="data"> <fi:styling type="htmlarea" style="width: 100%;" rows="20" cols="80"/> - </ft:widget> - <br/> - <input type="submit"/> + </ft:widget> + <br/> + <input type="submit"/> </div> </ft:form-template> </content> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/registration_template.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/registration_template.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/registration_template.xml Tue Nov 2 09:41:12 2004 @@ -22,17 +22,17 @@ <fi:group> <fi:styling layout="columns"/> <fi:items> - <ft:widget id="name"/> - <ft:widget id="email"/> - <ft:widget id="age"/> - <ft:widget id="password"> - <fi:styling type="password"/> - </ft:widget> - <ft:widget id="confirmPassword"> - <fi:styling type="password"/> - </ft:widget> - <ft:widget id="spam"/> - <input type="submit"/> + <ft:widget id="name"/> + <ft:widget id="email"/> + <ft:widget id="age"/> + <ft:widget id="password"> + <fi:styling type="password"/> + </ft:widget> + <ft:widget id="confirmPassword"> + <fi:styling type="password"/> + </ft:widget> + <ft:widget id="spam"/> + <input type="submit"/> </fi:items> </fi:group> </ft:form-template> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/upload_template.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/upload_template.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/upload_template.xml Tue Nov 2 09:41:12 2004 @@ -27,7 +27,7 @@ <fi:items> <ft:widget id="user"/> <ft:widget id="upload"/> - <input type="submit"/> + <input type="submit"/> </fi:items> </fi:group> </ft:form-template> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/resources/forms-field-styling.xsl ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/resources/forms-field-styling.xsl (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/resources/forms-field-styling.xsl Tue Nov 2 09:41:12 2004 @@ -65,7 +65,7 @@ +--> <xsl:template match="fi:*" mode="styling"> <xsl:apply-templates select="fi:styling/@*" mode="styling"/> - + <xsl:if test="@state = 'disabled'"> <xsl:attribute name="disabled">disabled</xsl:attribute> </xsl:if> @@ -323,7 +323,7 @@ <xsl:if test="not(@name)">continuation-id</xsl:if> </xsl:variable> <div style="display: none;"> - <input name="{$name}" type="hidden" value="{.}"/> + <input name="{$name}" type="hidden" value="{.}"/> </div> </xsl:template> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap Tue Nov 2 09:41:12 2004 @@ -160,7 +160,7 @@ <map:match pattern="*.continue"> <map:call continuation="{1}"/> </map:match> - + <!-- | Show a form, using the forms transformer -->