You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2005/10/20 08:28:25 UTC
svn commit: r326838 [2/4] - in /cocoon/blocks:
ajax/trunk/java/org/apache/cocoon/ajax/
ajax/trunk/java/org/apache/cocoon/ajax/resources/js/
ajax/trunk/java/org/apache/cocoon/transformation/ ajax/trunk/samples/
forms/trunk/java/org/apache/cocoon/forms/ ...
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.datatype.validationruleimpl;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.datatype.ValidationRuleBuilder;
import org.apache.cocoon.forms.expression.ExpressionManager;
import org.apache.cocoon.forms.util.DomHelper;
@@ -53,7 +53,7 @@
* sets it one the ValidationRule.
*/
protected void buildFailMessage(Element validationRuleElement, AbstractValidationRule rule) {
- Element failMessageElement = DomHelper.getChildElement(validationRuleElement, Constants.DEFINITION_NS, "failmessage");
+ Element failMessageElement = DomHelper.getChildElement(validationRuleElement, FormsConstants.DEFINITION_NS, "failmessage");
if (failMessageElement != null) {
XMLizable failMessage = DomHelper.compileElementContent(failMessageElement);
rule.setFailMessage(failMessage);
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/EmailValidationRule.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/EmailValidationRule.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/EmailValidationRule.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/EmailValidationRule.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.datatype.validationruleimpl;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.util.I18nMessage;
import org.apache.cocoon.forms.validation.ValidationError;
import org.apache.oro.text.perl.Perl5Util;
@@ -51,7 +51,7 @@
if (isEmail(email))
return null;
else
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.invalidemail", Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.invalidemail", FormsConstants.I18N_CATALOGUE));
}
public boolean supportsType(Class clazz, boolean arrayType) {
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/LengthValidationRule.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/LengthValidationRule.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/LengthValidationRule.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/LengthValidationRule.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.datatype.validationruleimpl;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.formmodel.CannotYetResolveWarning;
import org.apache.cocoon.forms.util.I18nMessage;
import org.apache.cocoon.forms.validation.ValidationError;
@@ -66,7 +66,7 @@
}
int length = ((BigDecimal)result).intValue();
if (string.length() != length) {
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.exact-length", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.exact-length", new String[] {String.valueOf(length)}, FormsConstants.I18N_CATALOGUE));
}
return null;
} else if (minExpr != null && maxExpr != null) {
@@ -87,7 +87,7 @@
int maxLength = ((BigDecimal)result).intValue();
if (string.length() < minLength || string.length() > maxLength) {
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.range-length", new String[] {String.valueOf(minLength), String.valueOf(maxLength)}, Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.range-length", new String[] {String.valueOf(minLength), String.valueOf(maxLength)}, FormsConstants.I18N_CATALOGUE));
}
return null;
} else if (minExpr != null) {
@@ -99,7 +99,7 @@
}
int length = ((BigDecimal)result).intValue();
if (string.length() < length) {
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.min-length", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.min-length", new String[] {String.valueOf(length)}, FormsConstants.I18N_CATALOGUE));
}
return null;
} else if (maxExpr != null) {
@@ -111,7 +111,7 @@
}
int length = ((BigDecimal)result).intValue();
if (string.length() > length) {
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.max-length", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.max-length", new String[] {String.valueOf(length)}, FormsConstants.I18N_CATALOGUE));
}
return null;
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/Mod10ValidationRule.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/Mod10ValidationRule.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/Mod10ValidationRule.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/Mod10ValidationRule.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.datatype.validationruleimpl;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.util.I18nMessage;
import org.apache.cocoon.forms.validation.ValidationError;
import org.outerj.expression.ExpressionContext;
@@ -46,7 +46,7 @@
}
}
if(!((sum % 10) == 0))
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.mod10", Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.mod10", FormsConstants.I18N_CATALOGUE));
else
return null;
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/RangeValidationRule.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/RangeValidationRule.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/RangeValidationRule.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/RangeValidationRule.java Wed Oct 19 23:26:53 2005
@@ -17,7 +17,7 @@
import java.math.BigDecimal;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.formmodel.CannotYetResolveWarning;
import org.apache.cocoon.forms.util.I18nMessage;
import org.apache.cocoon.forms.validation.ValidationError;
@@ -96,7 +96,7 @@
if (decimal.compareTo(min) < 0 || decimal.compareTo(max) > 0) {
return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.numeric.range",
new String[]{min.toString(), max.toString()},
- Constants.I18N_CATALOGUE));
+ FormsConstants.I18N_CATALOGUE));
}
return null;
@@ -104,14 +104,14 @@
if (decimal.compareTo(min) < 0) {
return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.numeric.min",
new String[]{min.toString()},
- Constants.I18N_CATALOGUE));
+ FormsConstants.I18N_CATALOGUE));
}
return null;
} else if (max != null) {
if (decimal.compareTo(max) > 0) {
return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.numeric.max",
new String[]{max.toString()},
- Constants.I18N_CATALOGUE));
+ FormsConstants.I18N_CATALOGUE));
}
return null;
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/RegExpValidationRule.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/RegExpValidationRule.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/RegExpValidationRule.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/RegExpValidationRule.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.datatype.validationruleimpl;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.util.I18nMessage;
import org.apache.cocoon.forms.validation.ValidationError;
import org.apache.oro.text.regex.Pattern;
@@ -44,7 +44,7 @@
if(matchesRegExp(string))
return null;
else
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.regexp", new String[] {regexp}, Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.regexp", new String[] {regexp}, FormsConstants.I18N_CATALOGUE));
}
private boolean matchesRegExp(String string) {
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/ValueCountValidationRule.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/ValueCountValidationRule.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/ValueCountValidationRule.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/datatype/validationruleimpl/ValueCountValidationRule.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.datatype.validationruleimpl;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.formmodel.CannotYetResolveWarning;
import org.apache.cocoon.forms.util.I18nMessage;
import org.apache.cocoon.forms.validation.ValidationError;
@@ -68,7 +68,7 @@
}
int length = ((BigDecimal)result).intValue();
if (array.length != length) {
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.exact-valuecount", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.exact-valuecount", new String[] {String.valueOf(length)}, FormsConstants.I18N_CATALOGUE));
}
return null;
} else if (minExpr != null && maxExpr != null) {
@@ -89,7 +89,7 @@
int maxLength = ((BigDecimal)result).intValue();
if (array.length < minLength || array.length > maxLength) {
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.range-valuecount", new String[] {String.valueOf(minLength), String.valueOf(maxLength)}, Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.range-valuecount", new String[] {String.valueOf(minLength), String.valueOf(maxLength)}, FormsConstants.I18N_CATALOGUE));
}
return null;
} else if (minExpr != null) {
@@ -101,7 +101,7 @@
}
int length = ((BigDecimal)result).intValue();
if (array.length < length) {
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.min-valuecount", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.min-valuecount", new String[] {String.valueOf(length)}, FormsConstants.I18N_CATALOGUE));
}
return null;
} else if (maxExpr != null) {
@@ -113,7 +113,7 @@
}
int length = ((BigDecimal)result).intValue();
if (array.length > length) {
- return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.max-valuecount", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
+ return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.max-valuecount", new String[] {String.valueOf(length)}, FormsConstants.I18N_CATALOGUE));
}
return null;
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/flow/javascript/Form.js
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/flow/javascript/Form.js?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/flow/javascript/Form.js (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/flow/javascript/Form.js Wed Oct 19 23:26:53 2005
@@ -153,20 +153,21 @@
if (cocoon.request.getParameter("cocoon-ajax") != null) {
// Ask the client to issue a new request reloading the whole page.
- // As we have nothing special to send back, so a header is just what we need...
- cocoon.response.setHeader("X-Cocoon-Ajax", "continue");
- cocoon.sendStatus(200);
-
- // ...but Safari doesn't consider empty responses (with content-length=0) as
- // valid ones. So send a dummy response by using directly the HttpResponse's
+ // As we have nothing special to send back, so a header should be just what we need...
+ // e.g. cocoon.response.setHeader("X-Cocoon-Ajax", "continue");
+ // cocoon.sendStatus(200);
+ // ...but Safari doesn't consider empty responses (with content-length = 0) as
+ // valid ones. So send a continue response by using directly the HttpResponse's
// output stream. Avoiding this hack would require to put an additional pipeline
- // in the sitemap for just sending this dummy response, which isn't nice.
+ // in the sitemap for just sending constant response, which isn't nice.
+ cocoon.sendStatus(200);
var httpResponse = objectModel.get(org.apache.cocoon.environment.http.HttpEnvironment.HTTP_RESPONSE_OBJECT);
if (httpResponse) {
httpResponse.setContentType("text/xml");
var text = "<?xml version='1.0'?><bu:document xmlns:bu='" +
org.apache.cocoon.ajax.BrowserUpdateTransformer.BU_NSURI +
- "'></bu:document>";
+ "'><bu:continue/></bu:document>";
+ httpResponse.setContentLength(text.length);
httpResponse.writer.print(text);
} else {
// Empty response
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractContainerDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.formmodel;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.util.DomHelper;
import org.w3c.dom.Element;
@@ -29,14 +29,14 @@
protected void setupContainer(Element element, String widgetsElementName, AbstractContainerDefinition definition) throws Exception {
- Element widgetsElement = DomHelper.getChildElement(element, Constants.DEFINITION_NS, widgetsElementName, false);
+ Element widgetsElement = DomHelper.getChildElement(element, FormsConstants.DEFINITION_NS, widgetsElementName, false);
// if its not there, ignore it. Just means that there are no new widgets
if (widgetsElement == null)
return;
// All child elements of the widgets element are widgets
- Element[] widgetElements = DomHelper.getChildElements(widgetsElement, Constants.DEFINITION_NS);
+ Element[] widgetElements = DomHelper.getChildElements(widgetsElement, FormsConstants.DEFINITION_NS);
WidgetDefinitionBuilderContext oldContext = this.context;
for (int i = 0; i < widgetElements.length; i++) {
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -19,7 +19,7 @@
import java.util.Locale;
import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.datatype.Datatype;
import org.apache.cocoon.forms.datatype.SelectionList;
import org.apache.cocoon.forms.datatype.SelectionListBuilder;
@@ -48,13 +48,13 @@
}
//---- parse "datatype"
- Element datatypeElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "datatype");
+ Element datatypeElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "datatype");
if (datatypeElement != null) {
Datatype datatype = datatypeManager.createDatatype(datatypeElement, false);
// ---- parse "initial-value"
Object initialValue = null;
- Element initialValueElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "initial-value", false);
+ Element initialValueElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "initial-value", false);
if (initialValueElement != null) {
String localeValue = DomHelper.getAttribute(initialValueElement, "locale", null);
Locale locale = localeValue == null ? null : I18nUtils.parseLocale(localeValue);
@@ -84,7 +84,7 @@
protected SelectionList buildSelectionList(
Element widgetElement, AbstractDatatypeWidgetDefinition definition, String name) throws Exception {
- Element selectionListElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, name);
+ Element selectionListElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, name);
if(selectionListElement != null && definition.getDatatype() == null)
throw new Exception("A widget with a selection list always requires a datatype as well! (at "+DomHelper.getLocation(selectionListElement)+" )");
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java Wed Oct 19 23:26:53 2005
@@ -22,7 +22,7 @@
import java.util.Locale;
import java.util.Map;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.event.CreateEvent;
import org.apache.cocoon.forms.event.WidgetEvent;
import org.apache.cocoon.forms.validation.ValidationErrorAware;
@@ -480,7 +480,7 @@
// FIXME: we may want to strip out completely widgets that aren't updated when in AJAX mode
String element = this.getXMLElementName();
AttributesImpl attrs = getXMLElementAttributes();
- contentHandler.startElement(Constants.INSTANCE_NS, element, Constants.INSTANCE_PREFIX_COLON + element, attrs);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, element, FormsConstants.INSTANCE_PREFIX_COLON + element, attrs);
generateDisplayData(contentHandler);
@@ -490,14 +490,14 @@
generateItemSaxFragment(contentHandler, locale);
- contentHandler.endElement(Constants.INSTANCE_NS, element, Constants.INSTANCE_PREFIX_COLON + element);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, element, FormsConstants.INSTANCE_PREFIX_COLON + element);
} else {
// Generate a placeholder that can be used later by AJAX updates
AttributesImpl attrs = new AttributesImpl();
attrs.addCDATAAttribute("id", getRequestParameterName());
- contentHandler.startElement(Constants.INSTANCE_NS, "placeholder", Constants.INSTANCE_PREFIX_COLON + "placeholder", attrs);
- contentHandler.endElement(Constants.INSTANCE_NS, "placeholder", Constants.INSTANCE_PREFIX_COLON + "placeholder");
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, "placeholder", FormsConstants.INSTANCE_PREFIX_COLON + "placeholder", attrs);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, "placeholder", FormsConstants.INSTANCE_PREFIX_COLON + "placeholder");
}
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinition.java Wed Oct 19 23:26:53 2005
@@ -21,7 +21,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.event.CreateEvent;
import org.apache.cocoon.forms.event.CreateListener;
import org.apache.cocoon.forms.event.WidgetEventMulticaster;
@@ -294,11 +294,11 @@
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);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, name, FormsConstants.INSTANCE_PREFIX_COLON + name, XMLUtils.EMPTY_ATTRIBUTES);
((XMLizable)entry.getValue()).toSAX(contentHandler);
- contentHandler.endElement(Constants.INSTANCE_NS, name, Constants.INSTANCE_PREFIX_COLON + name);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, name, FormsConstants.INSTANCE_PREFIX_COLON + name);
}
}
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidgetDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -28,7 +28,7 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceSelector;
import org.apache.avalon.framework.service.Serviceable;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.datatype.DatatypeManager;
import org.apache.cocoon.forms.event.CreateListener;
import org.apache.cocoon.forms.event.WidgetListener;
@@ -108,6 +108,10 @@
throw new Exception("Missing id attribute on element '" + widgetElement.getTagName() + "' at " +
DomHelper.getLocation(widgetElement));
}
+ if (id.indexOf('/') != -1 || id.indexOf('.') != -1) {
+ throw new Exception("A widget name cannot contain '.' or '/' as this conflicts with widget paths, at " +
+ DomHelper.getLocation(widgetElement));
+ }
widgetDefinition.setId(id);
}
@@ -123,10 +127,10 @@
}
// attributes
- Element attrContainer = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "attributes", false);
+ Element attrContainer = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "attributes", false);
if (attrContainer != null) {
// There's a <fd:attributes> element. Get its <fd:attribute> children
- Element[] attrs = DomHelper.getChildElements(attrContainer, Constants.DEFINITION_NS, "attribute");
+ Element[] attrs = DomHelper.getChildElements(attrContainer, FormsConstants.DEFINITION_NS, "attribute");
if (attrs != null && attrs.length > 0) {
// We actually do have some
Map attrMap = new HashMap();
@@ -154,7 +158,7 @@
protected List buildEventListeners(Element widgetElement, String elementName, Class listenerClass) throws Exception {
List result = null;
- Element listenersElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, elementName);
+ Element listenersElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, elementName);
if (listenersElement != null) {
NodeList list = listenersElement.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
@@ -183,7 +187,7 @@
Map displayData = new HashMap(names.length);
for (int i = 0; i < names.length; i++) {
XMLizable data = null;
- Element dataElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, names[i]);
+ Element dataElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, names[i]);
if (dataElement != null) {
data = DomHelper.compileElementContent(dataElement);
}
@@ -197,7 +201,7 @@
}
private void setValidators(Element widgetElement, AbstractWidgetDefinition widgetDefinition) throws Exception {
- Element validatorElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "validation");
+ Element validatorElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "validation");
if (validatorElement != null) {
NodeList list = validatorElement.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AggregateField.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AggregateField.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AggregateField.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AggregateField.java Wed Oct 19 23:26:53 2005
@@ -21,7 +21,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.FormContext;
import org.apache.cocoon.forms.formmodel.AggregateFieldDefinition.SplitMapping;
import org.apache.cocoon.forms.util.I18nMessage;
@@ -209,7 +209,7 @@
} else {
validationError = new ValidationError(new I18nMessage("aggregatedfield.split-failed",
new String[] { getAggregateFieldDefinition().getSplitRegexp() },
- Constants.I18N_CATALOGUE));
+ FormsConstants.I18N_CATALOGUE));
}
valueState = VALUE_DISPLAY_VALIDATION;
this.wasValid = false;
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AggregateFieldDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AggregateFieldDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AggregateFieldDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AggregateFieldDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.formmodel;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.util.DomHelper;
import org.apache.excalibur.xml.sax.XMLizable;
import org.apache.oro.text.regex.MalformedPatternException;
@@ -44,15 +44,15 @@
super.setupDefinition(widgetElement, definition);
// make children fields
- Element widgetsElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "widgets", true);
- Element[] fieldElements = DomHelper.getChildElements(widgetsElement, Constants.DEFINITION_NS, "field");
+ Element widgetsElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "widgets", true);
+ Element[] fieldElements = DomHelper.getChildElements(widgetsElement, FormsConstants.DEFINITION_NS, "field");
for (int i = 0; i < fieldElements.length; i++) {
FieldDefinition fieldDefinition = (FieldDefinition)buildAnotherWidgetDefinition(fieldElements[i]);
definition.addWidgetDefinition(fieldDefinition);
}
// compile splitpattern
- Element splitElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "split", true);
+ Element splitElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "split", true);
if(splitElement!=null) {
String patternString = DomHelper.getAttribute(splitElement, "pattern");
Perl5Compiler compiler = new Perl5Compiler();
@@ -66,7 +66,7 @@
}
// read split mappings
- Element[] mapElements = DomHelper.getChildElements(splitElement, Constants.DEFINITION_NS, "map");
+ Element[] mapElements = DomHelper.getChildElements(splitElement, FormsConstants.DEFINITION_NS, "map");
for (int i = 0; i < mapElements.length; i++) {
int group = DomHelper.getAttributeAsInteger(mapElements[i], "group");
String field = DomHelper.getAttribute(mapElements[i], "field");
@@ -86,14 +86,14 @@
}
// read split fail message (if any)
- Element failMessageElement = DomHelper.getChildElement(splitElement, Constants.DEFINITION_NS, "failmessage");
+ Element failMessageElement = DomHelper.getChildElement(splitElement, FormsConstants.DEFINITION_NS, "failmessage");
if (failMessageElement != null) {
XMLizable failMessage = DomHelper.compileElementContent(failMessageElement);
definition.setSplitFailMessage(failMessage);
}
// compile combine expression
- Element combineElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "combine", true);
+ Element combineElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "combine", true);
if(combineElement!=null) {
String combineExprString = DomHelper.getAttribute(combineElement, "expression");
Expression combineExpr = null;
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanField.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanField.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanField.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanField.java Wed Oct 19 23:26:53 2005
@@ -17,7 +17,7 @@
import java.util.Locale;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.FormContext;
import org.apache.cocoon.forms.event.*;
import org.apache.cocoon.xml.AttributesImpl;
@@ -125,17 +125,17 @@
public void generateItemSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
// value element
- contentHandler.startElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
String stringValue = BooleanUtils.toBoolean(value) ? definition.getTrueParamValue() : "false";
contentHandler.characters(stringValue.toCharArray(), 0, stringValue.length());
- contentHandler.endElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL);
// validation message element: only present if the value is not valid
if (validationError != null) {
- contentHandler.startElement(Constants.INSTANCE_NS, VALIDATION_MSG_EL, Constants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALIDATION_MSG_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL, XMLUtils.EMPTY_ATTRIBUTES);
validationError.generateSaxFragment(contentHandler);
- contentHandler.endElement(Constants.INSTANCE_NS, VALIDATION_MSG_EL, Constants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALIDATION_MSG_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL);
}
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanFieldDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanFieldDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanFieldDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanFieldDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -17,7 +17,7 @@
import java.util.Iterator;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.event.ValueChangedListener;
import org.apache.cocoon.forms.util.DomHelper;
import org.w3c.dom.Element;
@@ -40,14 +40,14 @@
}
// Initial value
- Element initialValueElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "initial-value", false);
+ Element initialValueElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "initial-value", false);
if (initialValueElement != null) {
Boolean initialValue = Boolean.valueOf(DomHelper.getElementText(initialValueElement));
definition.setInitialValue(initialValue);
}
// Parameter value for true
- Element trueParamElement = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "true-param-value", false);
+ Element trueParamElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "true-param-value", false);
if (trueParamElement != null) {
definition.setTrueParamValue(DomHelper.getElementText(trueParamElement));
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/CaptchaField.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/CaptchaField.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/CaptchaField.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/CaptchaField.java Wed Oct 19 23:26:53 2005
@@ -25,7 +25,7 @@
import org.apache.cocoon.components.ContextHelper;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Session;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.xml.AttributesImpl;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
@@ -113,7 +113,7 @@
this.setAttribute("secret", secret);
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "id", "id", "PCDATA", id);
- contentHandler.startElement(Constants.INSTANCE_NS, IMAGE_EL, Constants.INSTANCE_PREFIX_COLON + IMAGE_EL, attrs);
- contentHandler.endElement(Constants.INSTANCE_NS, IMAGE_EL, Constants.INSTANCE_PREFIX_COLON + IMAGE_EL);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, IMAGE_EL, FormsConstants.INSTANCE_PREFIX_COLON + IMAGE_EL, attrs);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, IMAGE_EL, FormsConstants.INSTANCE_PREFIX_COLON + IMAGE_EL);
}
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Field.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Field.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Field.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Field.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.formmodel;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.FormContext;
import org.apache.cocoon.forms.datatype.Datatype;
import org.apache.cocoon.forms.datatype.SelectionList;
@@ -361,7 +361,7 @@
try {
if (this.value == null && getFieldDefinition().isRequired()) {
// Field is required
- this.validationError = new ValidationError(new I18nMessage("general.field-required", Constants.I18N_CATALOGUE));
+ this.validationError = new ValidationError(new I18nMessage("general.field-required", FormsConstants.I18N_CATALOGUE));
} else if (!super.validate()) {
// New-style validators failed.
} else if (this.value != null) {
@@ -428,7 +428,7 @@
}
if (enteredValue != null || value != null) {
- contentHandler.startElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
String stringValue;
if (value != null) {
stringValue = getDatatype().convertToString(value, locale);
@@ -436,14 +436,14 @@
stringValue = enteredValue;
}
contentHandler.characters(stringValue.toCharArray(), 0, stringValue.length());
- contentHandler.endElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL);
}
// validation message element: only present if the value is not valid
if (validationError != null && (this.valueState == VALUE_DISPLAY_VALIDATION || this.valueState == VALUE_DISPLAY_PARSE_ERROR)) {
- contentHandler.startElement(Constants.INSTANCE_NS, VALIDATION_MSG_EL, Constants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALIDATION_MSG_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL, XMLUtils.EMPTY_ATTRIBUTES);
validationError.generateSaxFragment(contentHandler);
- contentHandler.endElement(Constants.INSTANCE_NS, VALIDATION_MSG_EL, Constants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALIDATION_MSG_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL);
}
// generate selection list, if any
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/FieldDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/FieldDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/FieldDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/FieldDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.formmodel;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.datatype.SelectionList;
import org.apache.cocoon.forms.util.DomHelper;
import org.w3c.dom.Element;
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/ImageMapDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/ImageMapDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/ImageMapDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/ImageMapDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -17,7 +17,7 @@
import java.util.Iterator;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.event.ActionListener;
import org.apache.cocoon.forms.util.DomHelper;
import org.w3c.dom.Element;
@@ -51,7 +51,7 @@
}
// Sets image map source
- Element imageURIEl= DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, ImageMap.VALUE_EL);
+ Element imageURIEl= DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, ImageMap.VALUE_EL);
if ( imageURIEl != null ) {
definition.setImageURI(DomHelper.getElementText(imageURIEl));
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Messages.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Messages.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Messages.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Messages.java Wed Oct 19 23:26:53 2005
@@ -15,7 +15,7 @@
*/
package org.apache.cocoon.forms.formmodel;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.FormContext;
import org.apache.cocoon.forms.util.StringMessage;
import org.apache.cocoon.xml.XMLUtils;
@@ -98,9 +98,9 @@
Iterator messagesIt = messages.iterator();
while (messagesIt.hasNext()) {
XMLizable message = (XMLizable)messagesIt.next();
- contentHandler.startElement(Constants.INSTANCE_NS, MESSAGE_EL, Constants.INSTANCE_PREFIX_COLON + MESSAGE_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, MESSAGE_EL, FormsConstants.INSTANCE_PREFIX_COLON + MESSAGE_EL, XMLUtils.EMPTY_ATTRIBUTES);
message.toSAX(contentHandler);
- contentHandler.endElement(Constants.INSTANCE_NS, MESSAGE_EL, Constants.INSTANCE_PREFIX_COLON + MESSAGE_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, MESSAGE_EL, FormsConstants.INSTANCE_PREFIX_COLON + MESSAGE_EL);
}
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/MultiValueField.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/MultiValueField.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/MultiValueField.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/MultiValueField.java Wed Oct 19 23:26:53 2005
@@ -18,7 +18,7 @@
import java.lang.reflect.Array;
import java.util.Locale;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.FormContext;
import org.apache.cocoon.forms.datatype.Datatype;
import org.apache.cocoon.forms.datatype.SelectionList;
@@ -124,7 +124,7 @@
if (values != null) {
validationError = definition.getDatatype().validate(values, new ExpressionContextImpl(this));
} else {
- validationError = new ValidationError(new I18nMessage("multivaluefield.conversionfailed", Constants.I18N_CATALOGUE));
+ validationError = new ValidationError(new I18nMessage("multivaluefield.conversionfailed", FormsConstants.I18N_CATALOGUE));
}
this.wasValid = validationError == null ? super.validate() : false;
@@ -139,36 +139,36 @@
}
public void generateItemSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
- contentHandler.startElement(Constants.INSTANCE_NS, VALUES_EL, Constants.INSTANCE_PREFIX_COLON + VALUES_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALUES_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUES_EL, XMLUtils.EMPTY_ATTRIBUTES);
Convertor convertor = definition.getDatatype().getPlainConvertor();
if (convertor == null) {
convertor = definition.getDatatype().getConvertor();
}
if (values != null) {
for (int i = 0; i < values.length; i++) {
- contentHandler.startElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
String value = convertor.convertToString(values[i], locale, null);
contentHandler.characters(value.toCharArray(), 0, value.length());
- contentHandler.endElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL);
}
} else if (enteredValues != null) {
for (int i = 0; i < enteredValues.length; i++) {
- contentHandler.startElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
String value = convertor.convertToString(enteredValues[i], locale, null);
contentHandler.characters(value.toCharArray(), 0, value.length());
- contentHandler.endElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL);
}
}
- contentHandler.endElement(Constants.INSTANCE_NS, VALUES_EL, Constants.INSTANCE_PREFIX_COLON + VALUES_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALUES_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUES_EL);
// the selection list (a MultiValueField has per definition always a SelectionList)
this.selectionList.generateSaxFragment(contentHandler, locale);
// validation message element
if (validationError != null) {
- contentHandler.startElement(Constants.INSTANCE_NS, VALIDATION_MSG_EL, Constants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALIDATION_MSG_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL, XMLUtils.EMPTY_ATTRIBUTES);
validationError.generateSaxFragment(contentHandler);
- contentHandler.endElement(Constants.INSTANCE_NS, VALIDATION_MSG_EL, Constants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALIDATION_MSG_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL);
}
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Output.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Output.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Output.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Output.java Wed Oct 19 23:26:53 2005
@@ -17,7 +17,7 @@
import java.util.Locale;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.FormContext;
import org.apache.cocoon.forms.datatype.Datatype;
import org.apache.cocoon.xml.XMLUtils;
@@ -87,11 +87,11 @@
protected void generateItemSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
// the value
if (value != null) {
- contentHandler.startElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
String stringValue;
stringValue = definition.getDatatype().convertToString(value, locale);
contentHandler.characters(stringValue.toCharArray(), 0, stringValue.length());
- contentHandler.endElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL);
}
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Repeater.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Repeater.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Repeater.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Repeater.java Wed Oct 19 23:26:53 2005
@@ -20,7 +20,7 @@
import java.util.List;
import java.util.Locale;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.FormContext;
import org.apache.cocoon.forms.util.I18nMessage;
import org.apache.cocoon.forms.event.WidgetEvent;
@@ -174,6 +174,39 @@
getForm().addWidgetUpdate(this);
}
+ /**
+ * Move a row from one place to another
+ * @param from the existing row position
+ * @param to the target position. The "from" item will be moved before that position.
+ */
+ public void moveRow(int from, int to) {
+ int size = this.rows.size();
+
+ if (from < 0 || from >= size || to < 0 || to > size) {
+ throw new IllegalArgumentException("Cannot move from " + from + " to " + to +
+ " on repeater with " + size + " rows");
+ }
+
+ if (from == to) {
+ return;
+ }
+
+ Object fromRow = this.rows.remove(from);
+ if (to == size) {
+ // Move at the end
+ this.rows.add(fromRow);
+
+ } else if (to > from) {
+ // Index of "to" was moved by removing
+ this.rows.add(to - 1, fromRow);
+
+ } else {
+ this.rows.add(to, fromRow);
+ }
+
+ getForm().addWidgetUpdate(this);
+ }
+
public void moveRowLeft(int index) {
if (index == 0 || index >= this.rows.size()) {
// do nothing
@@ -288,7 +321,7 @@
String [] boundaries = new String[2];
boundaries[0] = String.valueOf(getMinSize());
boundaries[1] = String.valueOf(getMaxSize());
- this.validationError = new ValidationError(new I18nMessage("repeater.cardinality", boundaries, Constants.I18N_CATALOGUE));
+ this.validationError = new ValidationError(new I18nMessage("repeater.cardinality", boundaries, FormsConstants.I18N_CATALOGUE));
valid=false;
}
@@ -334,20 +367,20 @@
public void generateDisplayData(ContentHandler contentHandler)
throws SAXException {
// the repeater's label
- contentHandler.startElement(Constants.INSTANCE_NS, LABEL_EL, Constants.INSTANCE_PREFIX_COLON + LABEL_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, LABEL_EL, FormsConstants.INSTANCE_PREFIX_COLON + LABEL_EL, XMLUtils.EMPTY_ATTRIBUTES);
generateLabel(contentHandler);
- contentHandler.endElement(Constants.INSTANCE_NS, LABEL_EL, Constants.INSTANCE_PREFIX_COLON + LABEL_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, LABEL_EL, FormsConstants.INSTANCE_PREFIX_COLON + LABEL_EL);
// heading element -- currently contains the labels of each widget in the repeater
- contentHandler.startElement(Constants.INSTANCE_NS, HEADINGS_EL, Constants.INSTANCE_PREFIX_COLON + HEADINGS_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, HEADINGS_EL, FormsConstants.INSTANCE_PREFIX_COLON + HEADINGS_EL, XMLUtils.EMPTY_ATTRIBUTES);
Iterator widgetDefinitionIt = definition.getWidgetDefinitions().iterator();
while (widgetDefinitionIt.hasNext()) {
WidgetDefinition widgetDefinition = (WidgetDefinition)widgetDefinitionIt.next();
- contentHandler.startElement(Constants.INSTANCE_NS, HEADING_EL, Constants.INSTANCE_PREFIX_COLON + HEADING_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, HEADING_EL, FormsConstants.INSTANCE_PREFIX_COLON + HEADING_EL, XMLUtils.EMPTY_ATTRIBUTES);
widgetDefinition.generateLabel(contentHandler);
- contentHandler.endElement(Constants.INSTANCE_NS, HEADING_EL, Constants.INSTANCE_PREFIX_COLON + HEADING_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, HEADING_EL, FormsConstants.INSTANCE_PREFIX_COLON + HEADING_EL);
}
- contentHandler.endElement(Constants.INSTANCE_NS, HEADINGS_EL, Constants.INSTANCE_PREFIX_COLON + HEADINGS_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, HEADINGS_EL, FormsConstants.INSTANCE_PREFIX_COLON + HEADINGS_EL);
}
@@ -376,8 +409,8 @@
*/
public void generateSize(ContentHandler contentHandler) throws SAXException {
AttributesImpl attrs = getXMLElementAttributes();
- contentHandler.startElement(Constants.INSTANCE_NS, REPEATER_SIZE_EL, Constants.INSTANCE_PREFIX_COLON + REPEATER_SIZE_EL, attrs);
- contentHandler.endElement(Constants.INSTANCE_NS, REPEATER_SIZE_EL, Constants.INSTANCE_PREFIX_COLON + REPEATER_SIZE_EL);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, REPEATER_SIZE_EL, FormsConstants.INSTANCE_PREFIX_COLON + REPEATER_SIZE_EL, attrs);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, REPEATER_SIZE_EL, FormsConstants.INSTANCE_PREFIX_COLON + REPEATER_SIZE_EL);
}
/**
@@ -474,4 +507,5 @@
throw new UnsupportedOperationException("Widget " + this.getRequestParameterName() + " doesn't handle events.");
}
}
+
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterAction.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterAction.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterAction.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterAction.java Wed Oct 19 23:26:53 2005
@@ -15,6 +15,8 @@
*/
package org.apache.cocoon.forms.formmodel;
+import org.apache.cocoon.forms.FormContext;
+
/**
* An action that acts on a repeater.
*
@@ -57,4 +59,34 @@
return this.repeater;
}
+
+ public static class Move extends RepeaterAction {
+ private int from;
+ private int to;
+
+ public Move(RepeaterActionDefinition definition) {
+ super(definition);
+ }
+
+ public void readFromRequest(FormContext formContext) {
+ String fullName = getFullName();
+ String fromStr = formContext.getRequest().getParameter(fullName + ".from");
+ if (fromStr != null) {
+ from = Integer.parseInt(fromStr);
+ to = Integer.parseInt(formContext.getRequest().getParameter(fullName + ".to"));
+ } else {
+ from = -1;
+ to = -1;
+ }
+ super.readFromRequest(formContext);
+ }
+
+ public int getFrom() {
+ return from;
+ }
+
+ public int getTo() {
+ return to;
+ }
+ };
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java Wed Oct 19 23:26:53 2005
@@ -15,6 +15,7 @@
*/
package org.apache.cocoon.forms.formmodel;
+import org.apache.cocoon.forms.FormContext;
import org.apache.cocoon.forms.event.ActionEvent;
import org.apache.cocoon.forms.event.ActionListener;
@@ -197,6 +198,23 @@
}
}
});
+ }
+ }
+
+ public static class MoveRowActionDefinition extends RepeaterActionDefinition {
+
+ public MoveRowActionDefinition(String repeaterName) {
+ super(repeaterName);
+ this.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ RepeaterAction.Move move = (RepeaterAction.Move)event.getSource();
+ Repeater repeater = move.getRepeater();
+ repeater.moveRow(move.getFrom(), move.getTo());
+ };
+ });
+ }
+ public Widget createInstance() {
+ return new RepeaterAction.Move(this);
}
}
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -17,7 +17,7 @@
import java.util.Iterator;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.event.ActionListener;
import org.apache.cocoon.forms.util.DomHelper;
import org.apache.cocoon.util.Deprecation;
@@ -78,7 +78,7 @@
definition.setActionCommand(actionCommand);
// Warn of the mis-named 'on-action' that existed initially
- Element buggyOnActivate = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "on-activate", false);
+ Element buggyOnActivate = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "on-activate", false);
if (buggyOnActivate != null) {
throw new Exception("Use 'on-action' instead of 'on-activate' on row-action at " +
DomHelper.getLocation(buggyOnActivate));
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/RowActionDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -17,7 +17,7 @@
import java.util.Iterator;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.event.ActionListener;
import org.apache.cocoon.forms.util.DomHelper;
import org.apache.cocoon.util.Deprecation;
@@ -54,7 +54,7 @@
definition.setActionCommand(actionCommand);
// Warn of the mis-named 'on-action' that existed initially
- Element buggyOnActivate = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "on-activate", false);
+ Element buggyOnActivate = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "on-activate", false);
if (buggyOnActivate != null) {
throw new Exception("Use 'on-action' instead of 'on-activate' on row-action at " +
DomHelper.getLocation(buggyOnActivate));
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Upload.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Upload.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Upload.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Upload.java Wed Oct 19 23:26:53 2005
@@ -18,7 +18,7 @@
import java.util.Locale;
import java.util.StringTokenizer;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.FormContext;
import org.apache.cocoon.forms.util.I18nMessage;
import org.apache.cocoon.forms.validation.ValidationError;
@@ -132,7 +132,7 @@
}
I18nMessage message = new I18nMessage("upload.invalid-type",
new String[] {contentType},
- Constants.I18N_CATALOGUE);
+ FormsConstants.I18N_CATALOGUE);
setValidationError(new ValidationError(message));
return false;
}
@@ -154,7 +154,7 @@
int size = (rjp.getContentLength() + 512) / 1024;
int maxSize = (rjp.getMaxContentLength() + 512) / 1024;
String[] i18nParams = new String[] { String.valueOf(size), String.valueOf(maxSize) };
- I18nMessage i18nMessage = new I18nMessage("upload.rejected", i18nParams, Constants.I18N_CATALOGUE);
+ I18nMessage i18nMessage = new I18nMessage("upload.rejected", i18nParams, FormsConstants.I18N_CATALOGUE);
setValidationError(new ValidationError(i18nMessage));
return false;
}
@@ -167,7 +167,7 @@
if (this.part == null) {
if (this.uploadDefinition.isRequired()) {
- I18nMessage i18nMessage = new I18nMessage("general.field-required", Constants.I18N_CATALOGUE);
+ I18nMessage i18nMessage = new I18nMessage("general.field-required", FormsConstants.I18N_CATALOGUE);
setValidationError(new ValidationError(i18nMessage));
}
} else if (validateOversize() && validateMimeType()) {
@@ -222,16 +222,16 @@
public void generateItemSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
if (this.part != null) {
String name = (String)this.part.getHeaders().get("filename");
- contentHandler.startElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL, XMLUtils.EMPTY_ATTRIBUTES);
contentHandler.characters(name.toCharArray(), 0, name.length());
- contentHandler.endElement(Constants.INSTANCE_NS, VALUE_EL, Constants.INSTANCE_PREFIX_COLON + VALUE_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALUE_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALUE_EL);
}
// validation message element: only present if the value is not valid
if (this.validationError != null) {
- contentHandler.startElement(Constants.INSTANCE_NS, VALIDATION_MSG_EL, Constants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, VALIDATION_MSG_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL, XMLUtils.EMPTY_ATTRIBUTES);
this.validationError.generateSaxFragment(contentHandler);
- contentHandler.endElement(Constants.INSTANCE_NS, VALIDATION_MSG_EL, Constants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, VALIDATION_MSG_EL, FormsConstants.INSTANCE_PREFIX_COLON + VALIDATION_MSG_EL);
}
}
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetList.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetList.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetList.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetList.java Wed Oct 19 23:26:53 2005
@@ -23,7 +23,7 @@
import java.util.Locale;
import java.util.Map;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.FormContext;
import org.apache.cocoon.xml.XMLUtils;
import org.xml.sax.ContentHandler;
@@ -174,13 +174,13 @@
* @see Widget#generateSaxFragment(ContentHandler, Locale)
*/
public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
- contentHandler.startElement(Constants.INSTANCE_NS, WIDGETS_EL, Constants.INSTANCE_PREFIX_COLON + WIDGETS_EL, XMLUtils.EMPTY_ATTRIBUTES);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, WIDGETS_EL, FormsConstants.INSTANCE_PREFIX_COLON + WIDGETS_EL, XMLUtils.EMPTY_ATTRIBUTES);
Iterator widgetIt = widgets.iterator();
while (widgetIt.hasNext()) {
Widget widget = (Widget)widgetIt.next();
widget.generateSaxFragment(contentHandler, locale);
}
- contentHandler.endElement(Constants.INSTANCE_NS, WIDGETS_EL, Constants.INSTANCE_PREFIX_COLON + WIDGETS_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, WIDGETS_EL, FormsConstants.INSTANCE_PREFIX_COLON + WIDGETS_EL);
}
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/library/Library.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/library/Library.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/library/Library.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/library/Library.java Wed Oct 19 23:26:53 2005
@@ -22,7 +22,7 @@
import org.apache.avalon.framework.CascadingException;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.formmodel.WidgetDefinition;
import org.apache.cocoon.forms.formmodel.WidgetDefinitionBuilder;
import org.apache.cocoon.forms.formmodel.WidgetDefinitionBuilderContext;
@@ -141,9 +141,9 @@
public void buildLibrary(Element libraryElement) throws Exception {
sourceURI = LocationAttributes.getURI(libraryElement);
- Element widgetsElement = DomHelper.getChildElement(libraryElement, Constants.DEFINITION_NS, "widgets", true);
+ Element widgetsElement = DomHelper.getChildElement(libraryElement, FormsConstants.DEFINITION_NS, "widgets", true);
// All child elements of the widgets element are widgets
- Element[] widgetElements = DomHelper.getChildElements(widgetsElement, Constants.DEFINITION_NS);
+ Element[] widgetElements = DomHelper.getChildElements(widgetsElement, FormsConstants.DEFINITION_NS);
for (int i = 0; i < widgetElements.length; i++) {
Element widgetElement = widgetElements[i];
WidgetDefinition widgetDefinition = buildWidgetDefinition(widgetElement);
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/TreePath.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/TreePath.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/TreePath.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/TreePath.java Wed Oct 19 23:26:53 2005
@@ -49,11 +49,6 @@
/**
* Constructs a TreePath containing only a single element. This is usually
* used to construct a TreePath for the the root of the TreeModel.
- * <p>
- *
- * @param singlePath
- * an Object representing the path to a node
- * @see #TreePath(Object[])
*/
public TreePath(String key) {
if (key == null || key.length() == 0) {
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/builder/SourceTreeModelDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/builder/SourceTreeModelDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/builder/SourceTreeModelDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/builder/SourceTreeModelDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -19,7 +19,7 @@
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.formmodel.tree.SourceTreeModelDefinition;
import org.apache.cocoon.forms.formmodel.tree.TreeModelDefinition;
import org.apache.cocoon.forms.util.DomHelper;
@@ -47,13 +47,13 @@
definition.setURL(DomHelper.getAttribute(modelElt, "src"));
- Element fileSet = DomHelper.getChildElement(modelElt, Constants.DEFINITION_NS, "fileset");
+ Element fileSet = DomHelper.getChildElement(modelElt, FormsConstants.DEFINITION_NS, "fileset");
if (fileSet != null) {
definition.setFilePatterns(getPatterns(fileSet, "include"),
getPatterns(fileSet, "exclude"));
}
- Element dirSet = DomHelper.getChildElement(modelElt, Constants.DEFINITION_NS, "dirset");
+ Element dirSet = DomHelper.getChildElement(modelElt, FormsConstants.DEFINITION_NS, "dirset");
if (dirSet != null) {
definition.setDirectoryPatterns(getPatterns(dirSet, "include"),
getPatterns(dirSet, "exclude"));
@@ -65,7 +65,7 @@
}
int[][] getPatterns(Element parent, String name) throws Exception {
- Element[] children = DomHelper.getChildElements(parent, Constants.DEFINITION_NS, name);
+ Element[] children = DomHelper.getChildElements(parent, FormsConstants.DEFINITION_NS, name);
if (children.length == 0) {
return null;
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/builder/TreeDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/builder/TreeDefinitionBuilder.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/builder/TreeDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/tree/builder/TreeDefinitionBuilder.java Wed Oct 19 23:26:53 2005
@@ -18,7 +18,7 @@
import java.util.Iterator;
import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.event.ValueChangedListener;
import org.apache.cocoon.forms.formmodel.AbstractWidgetDefinitionBuilder;
import org.apache.cocoon.forms.formmodel.WidgetDefinition;
@@ -62,7 +62,7 @@
}
// Get the model optional element
- Element modelElt = DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, "tree-model", false);
+ Element modelElt = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "tree-model", false);
if (modelElt != null) {
String type = DomHelper.getAttribute(modelElt, "type");
ServiceSelector selector =
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/generation/FormsGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/generation/FormsGenerator.java?rev=326838&r1=326837&r2=326838&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/generation/FormsGenerator.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/generation/FormsGenerator.java Wed Oct 19 23:26:53 2005
@@ -22,7 +22,7 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.FormsConstants;
import org.apache.cocoon.forms.formmodel.Form;
import org.apache.cocoon.forms.transformation.FormsPipelineConfig;
import org.apache.cocoon.generation.AbstractGenerator;
@@ -68,15 +68,15 @@
public void generate() throws IOException, SAXException, ProcessingException {
contentHandler.startDocument();
- contentHandler.startPrefixMapping(Constants.INSTANCE_PREFIX, Constants.INSTANCE_NS);
+ contentHandler.startPrefixMapping(FormsConstants.INSTANCE_PREFIX, FormsConstants.INSTANCE_NS);
Attributes formAtts = this.config.getFormAttributes();
- contentHandler.startElement(Constants.INSTANCE_NS, FORM_GENERATED_EL, Constants.INSTANCE_PREFIX_COLON +FORM_GENERATED_EL, formAtts);
+ contentHandler.startElement(FormsConstants.INSTANCE_NS, FORM_GENERATED_EL, FormsConstants.INSTANCE_PREFIX_COLON +FORM_GENERATED_EL, formAtts);
Form form = config.findForm();
form.generateSaxFragment(contentHandler, Locale.US);
- contentHandler.endElement(Constants.INSTANCE_NS, FORM_GENERATED_EL, Constants.INSTANCE_PREFIX_COLON +FORM_GENERATED_EL);
+ contentHandler.endElement(FormsConstants.INSTANCE_NS, FORM_GENERATED_EL, FormsConstants.INSTANCE_PREFIX_COLON +FORM_GENERATED_EL);
- contentHandler.endPrefixMapping(Constants.INSTANCE_PREFIX);
+ contentHandler.endPrefixMapping(FormsConstants.INSTANCE_PREFIX);
contentHandler.endDocument();
}
}