You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2003/12/31 11:27:18 UTC
cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel AggregateField.java
antonio 2003/12/31 02:27:18
Modified: src/blocks/woody/java/org/apache/cocoon/woody/util
DomHelper.java I18nMessage.java
src/blocks/woody/java/org/apache/cocoon/woody/formmodel
AggregateField.java
Log:
Formatting code
Revision Changes Path
1.11 +2 -0 cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/DomHelper.java
Index: DomHelper.java
===================================================================
RCS file: /home/cvs//cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/DomHelper.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DomHelper.java 31 Dec 2003 02:33:09 -0000 1.10
+++ DomHelper.java 31 Dec 2003 10:27:18 -0000 1.11
@@ -82,6 +82,8 @@
*
* <p>This class depends specifically on the Xerces DOM implementation to be able to provide
* information about the location of elements in their source XML file. See the {@link #getLocation} method.
+ *
+ * @version CVS $Id$
*/
public class DomHelper {
1.3 +2 -0 cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/I18nMessage.java
Index: I18nMessage.java
===================================================================
RCS file: /home/cvs//cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/I18nMessage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- I18nMessage.java 31 Dec 2003 03:17:41 -0000 1.2
+++ I18nMessage.java 31 Dec 2003 10:27:18 -0000 1.3
@@ -64,6 +64,8 @@
*
* <p>This generates an autonomous SAX-blurb, i.e. all necessary namespace
* declarations will be made, and no start/endDocument events will be generated.
+ *
+ * @version CVS $Id$
*/
public class I18nMessage implements XMLizable {
private String key;
1.13 +24 -18 cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AggregateField.java
Index: AggregateField.java
===================================================================
RCS file: /home/cvs//cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AggregateField.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AggregateField.java 19 Dec 2003 21:28:39 -0000 1.12
+++ AggregateField.java 31 Dec 2003 10:27:18 -0000 1.13
@@ -50,22 +50,27 @@
*/
package org.apache.cocoon.woody.formmodel;
-import org.apache.cocoon.woody.FormContext;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
import org.apache.cocoon.woody.Constants;
-import org.apache.cocoon.woody.util.I18nMessage;
+import org.apache.cocoon.woody.FormContext;
import org.apache.cocoon.woody.datatype.ValidationError;
import org.apache.cocoon.woody.datatype.ValidationRule;
import org.apache.cocoon.woody.formmodel.AggregateFieldDefinition.SplitMapping;
+import org.apache.cocoon.woody.util.I18nMessage;
import org.apache.cocoon.xml.AttributesImpl;
+import org.apache.excalibur.xml.sax.XMLizable;
+import org.apache.oro.text.regex.MatchResult;
import org.apache.oro.text.regex.PatternMatcher;
import org.apache.oro.text.regex.Perl5Matcher;
-import org.apache.oro.text.regex.MatchResult;
-import org.apache.excalibur.xml.sax.XMLizable;
+import org.outerj.expression.ExpressionException;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
-import org.outerj.expression.ExpressionException;
-
-import java.util.*;
/**
* An aggregatedfield allows to edit the content of multiple fields through 1 textbox.
@@ -83,6 +88,8 @@
* using an expression.
*
* <p>Currently the child widgets should always be field widgets whose datatype is string.
+ *
+ * @version CVS $Id$
*
*/
public class AggregateField extends AbstractWidget {
@@ -114,7 +121,6 @@
if (newEnteredValue != null) {
// TODO make whitespace behaviour configurable !!
newEnteredValue.trim();
-
if (newEnteredValue.length() == 0) {
newEnteredValue = null;
}
@@ -190,17 +196,19 @@
// valid unless proven otherwise
validationError = null;
- if (enteredValue == null && isRequired()) {
- validationError = new ValidationError(new I18nMessage("general.field-required", Constants.I18N_CATALOGUE));
- return false;
- } else if (enteredValue == null)
+ if (enteredValue == null) {
+ if (isRequired()) {
+ validationError = new ValidationError(new I18nMessage("general.field-required", Constants.I18N_CATALOGUE));
+ return false;
+ }
return true;
- else if (!fieldsHaveValues()) {
+ } else if (!fieldsHaveValues()) {
XMLizable splitFailMessage = definition.getSplitFailMessage();
- if (splitFailMessage != null)
+ if (splitFailMessage != null) {
validationError = new ValidationError(splitFailMessage);
- else
+ } else {
validationError = new ValidationError(new I18nMessage("aggregatedfield.split-failed", new String[] { definition.getSplitRegexp()}, Constants.I18N_CATALOGUE));
+ }
return false;
} else {
// validate my child fields
@@ -244,8 +252,7 @@
String value = (String)getValue();
if (value != null) {
contentHandler.startElement(Constants.WI_NS, VALUE_EL, Constants.WI_PREFIX_COLON + VALUE_EL, Constants.EMPTY_ATTRS);
- String stringValue; stringValue = value;
- contentHandler.characters(stringValue.toCharArray(), 0, stringValue.length());
+ contentHandler.characters(value.toCharArray(), 0, value.length());
contentHandler.endElement(Constants.WI_NS, VALUE_EL, Constants.WI_PREFIX_COLON + VALUE_EL);
}
@@ -258,7 +265,6 @@
// generate label, help, hint, etc.
definition.generateDisplayData(contentHandler);
-
contentHandler.endElement(Constants.WI_NS, AGGREGATEFIELD_EL, Constants.WI_PREFIX_COLON + AGGREGATEFIELD_EL);
}