You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/07/11 10:06:50 UTC
svn commit: r210082 - in /cocoon:
blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/ trunk/
Author: cziegeler
Date: Mon Jul 11 01:06:48 2005
New Revision: 210082
URL: http://svn.apache.org/viewcvs?rev=210082&view=rev
Log:
CForms block: Add isValid() method to a Widget.
Some code formatting
Modified:
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Action.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AggregateField.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Field.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Form.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Messages.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/MultiValueField.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Output.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Repeater.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Union.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Upload.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Widget.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetList.java
cocoon/trunk/status.xml
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java?rev=210082&r1=210081&r2=210082&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java Mon Jul 11 01:06:48 2005
@@ -109,12 +109,14 @@
* extra validation rules on this containment level are ok.
*/
public boolean validate() {
- if (!getCombinedState().isValidatingValues())
+ if (!getCombinedState().isValidatingValues()) {
+ this.wasValid = true;
return true;
-
+ }
// Validate children first, then always validate self. Return combined result.
final boolean valid = widgets.validate();
- return super.validate() && valid;
+ this.wasValid = super.validate() && valid;
+ return this.wasValid;
}
/**
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=210082&r1=210081&r2=210082&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 Mon Jul 11 01:06:48 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,6 +65,11 @@
*/
private Map attributes;
+ /**
+ * The result of the last call to {@link #validate()}.
+ */
+ protected boolean wasValid = true;
+
protected AbstractWidget(AbstractWidgetDefinition definition) {
this.state = definition.getState();
}
@@ -308,35 +313,49 @@
return false;
}
+ /**
+ * @see org.apache.cocoon.forms.formmodel.Widget#validate()
+ */
public boolean validate() {
// Consider widget valid if it is not validating values.
if (!getCombinedState().isValidatingValues()) {
+ this.wasValid = true;
return true;
}
// Test validators from the widget definition
if (!getDefinition().validate(this)) {
// Failed
+ this.wasValid = false;
return false;
}
// Definition successful, test local validators
if (this.validators == null) {
// No local validators
+ this.wasValid = true;
return true;
}
-
+
// Iterate on local validators
Iterator iter = this.validators.iterator();
while(iter.hasNext()) {
WidgetValidator validator = (WidgetValidator)iter.next();
if (!validator.validate(this)) {
+ this.wasValid = false;
return false;
}
}
-
+
// All local iterators successful
+ this.wasValid = true;
return true;
+ }
+ /**
+ * @see org.apache.cocoon.forms.formmodel.Widget#isValid()
+ */
+ public boolean isValid() {
+ return this.wasValid;
}
/**
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Action.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Action.java?rev=210082&r1=210081&r2=210082&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Action.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Action.java Mon Jul 11 01:06:48 2005
@@ -96,6 +96,13 @@
return true;
}
+ /**
+ * @see org.apache.cocoon.forms.formmodel.Widget#isValid()
+ */
+ public boolean isValid() {
+ return true;
+ }
+
private static final String ACTION_EL = "action";
/**
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=210082&r1=210081&r2=210082&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 Mon Jul 11 01:06:48 2005
@@ -194,9 +194,10 @@
}
public boolean validate() {
- if (!getCombinedState().isValidatingValues())
+ if (!getCombinedState().isValidatingValues()) {
+ this.wasValid = true;
return true;
-
+ }
if (enteredValue != null && !fieldsHaveValues()) {
XMLizable failMessage = getAggregateFieldDefinition().getSplitFailMessage();
if (failMessage != null) {
@@ -207,6 +208,7 @@
Constants.I18N_CATALOGUE));
}
valueState = VALUE_DISPLAY_VALIDATION;
+ this.wasValid = false;
return false;
}
@@ -221,6 +223,7 @@
}
if (!valid) {
valueState = VALUE_DISPLAY_VALIDATION;
+ this.wasValid = false;
return false;
}
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=210082&r1=210081&r2=210082&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 Mon Jul 11 01:06:48 2005
@@ -273,8 +273,10 @@
}
public boolean validate() {
- if (!getCombinedState().isValidatingValues())
+ if (!getCombinedState().isValidatingValues()) {
+ this.wasValid = true;
return true;
+ }
if (this.valueState == VALUE_UNPARSED) {
doParse();
@@ -296,6 +298,7 @@
getForm().addWidgetUpdate(this);
}
+ this.wasValid = this.validationError == null;
return this.validationError == null;
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Form.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Form.java?rev=210082&r1=210081&r2=210082&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Form.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Form.java Mon Jul 11 01:06:48 2005
@@ -15,7 +15,6 @@
*/
package org.apache.cocoon.forms.formmodel;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
@@ -355,7 +354,7 @@
* Set a validation error on this field. This allows the form to be externally marked as invalid by
* application logic.
*
- * @param error the validation error
+ * @return the validation error
*/
public ValidationError getValidationError() {
return this.validationError;
@@ -378,7 +377,8 @@
// FIXME: Is this check needed, before invoking the listener?
if (this.endProcessing != null) {
- return this.endProcessing.booleanValue();
+ this.wasValid = this.endProcessing.booleanValue();
+ return this.wasValid;
}
// Notify the end of the current phase
@@ -389,10 +389,11 @@
// De-validate the form if one of the listeners asked to end the processing
// This allows for additional application-level validation.
this.isValid = false;
- return this.endProcessing.booleanValue();
+ this.wasValid = this.endProcessing.booleanValue();
+ return this.wasValid;
}
-
- return this.isValid && this.validationError == null;
+ this.wasValid = this.isValid && this.validationError == null;
+ return this.wasValid;
}
private static final String FORM_EL = "form";
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=210082&r1=210081&r2=210082&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 Mon Jul 11 01:06:48 2005
@@ -60,9 +60,11 @@
public boolean validate() {
if (!getCombinedState().isValidatingValues()) {
+ this.wasValid = true;
return true;
}
- return messages.size() == 0;
+ this.wasValid = messages.size() == 0;
+ return this.wasValid;
}
/**
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=210082&r1=210081&r2=210082&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 Mon Jul 11 01:06:48 2005
@@ -114,8 +114,10 @@
}
public boolean validate() {
- if (!getCombinedState().isValidatingValues())
+ if (!getCombinedState().isValidatingValues()) {
+ this.wasValid = true;
return true;
+ }
if (values != null) {
validationError = definition.getDatatype().validate(values, new ExpressionContextImpl(this));
@@ -123,7 +125,8 @@
else {
validationError = new ValidationError(new I18nMessage("multivaluefield.conversionfailed", Constants.I18N_CATALOGUE));
}
- return validationError == null ? super.validate() : false;
+ this.wasValid = validationError == null ? super.validate() : false;
+ return this.wasValid;
}
/**
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=210082&r1=210081&r2=210082&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 Mon Jul 11 01:06:48 2005
@@ -59,7 +59,17 @@
// do nothing
}
+ /**
+ * @see org.apache.cocoon.forms.formmodel.Widget#validate()
+ */
public boolean validate() {
+ return true;
+ }
+
+ /**
+ * @see org.apache.cocoon.forms.formmodel.Widget#isValid()
+ */
+ public boolean isValid() {
return true;
}
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=210082&r1=210081&r2=210082&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 Mon Jul 11 01:06:48 2005
@@ -248,17 +248,22 @@
}
}
+ /**
+ * @see org.apache.cocoon.forms.formmodel.Widget#validate()
+ */
public boolean validate() {
- if (!getCombinedState().isValidatingValues())
+ if (!getCombinedState().isValidatingValues()) {
+ this.wasValid = true;
return true;
-
+ }
boolean valid = true;
Iterator rowIt = rows.iterator();
while (rowIt.hasNext()) {
RepeaterRow row = (RepeaterRow)rowIt.next();
valid = valid & row.validate();
}
- return (valid ? super.validate() : false) && this.validationError == null;
+ this.wasValid = (valid ? super.validate() : false) && this.validationError == null;
+ return this.wasValid;
}
@@ -341,7 +346,7 @@
* Set a validation error on this field. This allows repeaters be externally marked as invalid by
* application logic.
*
- * @param error the validation error
+ * @return the validation error
*/
public ValidationError getValidationError() {
return this.validationError;
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Union.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Union.java?rev=210082&r1=210081&r2=210082&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Union.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Union.java Mon Jul 11 01:06:48 2005
@@ -120,16 +120,20 @@
// TODO: Simplify this logic.
public boolean validate() {
- if (!getCombinedState().isValidatingValues())
+ if (!getCombinedState().isValidatingValues()) {
+ this.wasValid = true;
return true;
-
+ }
Widget widget;
boolean valid = true;
// Read current case from request
String value = (String)getValue();
- if (value != null && !value.equals(""))
- if ((widget = getChild(value)) != null)
+ if (value != null && !value.equals("")) {
+ if ((widget = getChild(value)) != null) {
valid = valid & widget.validate();
+ }
+ }
+ this.wasValid = valid;
return valid;
}
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=210082&r1=210081&r2=210082&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 Mon Jul 11 01:06:48 2005
@@ -110,9 +110,10 @@
}
public boolean validate() {
- if (!getCombinedState().isValidatingValues())
+ if (!getCombinedState().isValidatingValues()) {
+ this.wasValid = true;
return true;
-
+ }
ValidationError newError = null;
if (this.part == null) {
@@ -143,8 +144,8 @@
if (!ObjectUtils.equals(this.validationError, newError)) {
setValidationError(newError);
}
-
- return validationError == null ? super.validate() : false;
+ this.wasValid = validationError == null ? super.validate() : false;
+ return this.wasValid;
}
/**
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Widget.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Widget.java?rev=210082&r1=210081&r2=210082&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Widget.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Widget.java Mon Jul 11 01:06:48 2005
@@ -1,12 +1,12 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.
@@ -48,7 +48,7 @@
* WidgetDefinition holds the data that is static accross all widgets. This
* keeps the Widgets small and light to create. This mechanism is similar to
* classes and objects in Java.
- *
+ *
* @version $Id$
*/
public interface Widget {
@@ -57,57 +57,57 @@
* Widget-Separator used in path-like notations
* @see #lookupWidget(String)
*/
- public static final char PATH_SEPARATOR = '/';
+ char PATH_SEPARATOR = '/';
/**
* Called after widget's environment has been setup,
* to allow for any contextual initalization such as
* looking up case widgets for union widgets.
*/
- public void initialize();
+ void initialize();
/**
* @return the source location of this widget.
*/
- public String getLocation();
-
+ String getLocation();
+
/**
* @return the name of this widget. This should never be <code>null</code>
* Top-level container widgets (like 'form') should return <code>""</code>
*/
- public String getName();
+ String getName();
/**
* @return the id of this widget. This should never be <code>null</code>
* Top-level container widgets (like 'form') should return <code>""</code>
*/
- public String getId();
+ String getId();
/**
* @return the parent of this widget. If this widget is the root widget,
* this method returns null.
*/
- public Widget getParent();
+ Widget getParent();
/**
* This method is called on a widget when it is added to a container.
* You shouldn't call this method unless youre implementing a widget yourself (in
* which case it should be called when a widget is added as child of your widget).
*/
- public void setParent(Widget widget);
+ void setParent(Widget widget);
/**
* @return the {@link Form} to which this widget belongs. The form is the top-most ancestor
* of the widget.
*/
- public Form getForm();
+ Form getForm();
/**
* Get this widget's definition.
- *
+ *
* @return the widget's definition
*/
- public WidgetDefinition getDefinition();
+ WidgetDefinition getDefinition();
/**
* Get the widget's own state. Note that this state is <em>not</em> the one actually considered
@@ -116,7 +116,7 @@
* @see #getCombinedState()
* @return the widget's own state
*/
- public WidgetState getState();
+ WidgetState getState();
/**
* Set the widget's own state. This may change its combined state, and those of its
@@ -124,131 +124,141 @@
*
* @param state the new wiget state
*/
- public void setState(WidgetState state);
+ 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
* parameters should be considered and if some output must be produced.
- *
+ *
* @see WidgetState#strictest(WidgetState, WidgetState)
* @return the combined state
*/
- public WidgetState getCombinedState();
+ WidgetState getCombinedState();
/**
* @return the name prefixed with the namespace, this name should be unique
* accross all widgets on the form.
*/
- public String getFullName();
+ String getFullName();
/**
* @return the id prefixed with the namespace, this name should be unique
* accross all widgets on the form.
*/
- public String getRequestParameterName();
+ String getRequestParameterName();
/**
* @deprecated getWidget got removed, use lookupWidget or getChild instead.
- * @throws UnsupportedOperationException indicating this method has been
- * deprecated from the API, and will be removed from future releases.
+ * @throws UnsupportedOperationException indicating this method has been
+ * deprecated from the API, and will be removed from future releases.
*/
- public Widget getWidget(String id);
+ Widget getWidget(String id);
/**
* Finds a widget relative to this one based on a path-like
* string (/-delimted) into the widget-tree structure.
- * This supports '../' and '/' to point to
+ * This supports '../' and '/' to point to
* @return the found widget or <code>null</code> if allong the traversal
- * of the path an invalid section was encountered.
+ * of the path an invalid section was encountered.
*/
- public Widget lookupWidget(String path);
+ 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
* is not a string), but it should not yet generate any validation errors.
*/
- public void readFromRequest(FormContext formContext);
+ void readFromRequest(FormContext formContext);
/**
* Validates this widget and returns the outcome. Possible error messages are
* remembered by the widget itself and will be part of the XML produced by
* this widget in its {@link #generateSaxFragment(ContentHandler, Locale)} method.
- *
- * @return <code>true</code> to indicate all validations were ok,
+ *
+ * @return <code>true</code> to indicate all validations were ok,
* <code>false</code> otherwise
*/
- public boolean validate();
+ boolean validate();
+
+ void addValidator(WidgetValidator validator);
- public void addValidator(WidgetValidator validator);
+ boolean removeValidator(WidgetValidator validator);
- public boolean removeValidator(WidgetValidator validator);
+ /**
+ * Return the current validation state.
+ * This method delivers the same result as the last call to {@link #validate()}.
+ * The validation process is not started again. If the value of this widget has
+ * changed since the latest call to {@link #validate()}, the result of this method
+ * is out of date.
+ * @return The result of the last call to {@link #validate()}.
+ */
+ boolean isValid();
/**
* 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
* mentioned in Constants.FI_PREFIX is already declared (by the caller or otherwise).
*/
- public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException;
+ void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException;
/**
* Generates SAX events for the label of this widget. The label will not be wrapped
* inside another element.
*/
- public void generateLabel(ContentHandler contentHandler) throws SAXException;
+ void generateLabel(ContentHandler contentHandler) throws SAXException;
/**
* Get the value of a widget.
* <p>
* Not all widgets do have a value (notably {@link ContainerWidget}s,
* but this method is provided here as a convenience to ease writing and avoiding casts.
- *
+ *
* @return the value of the widget.
* @throws UnsupportedOperationException if this widget doesn't have a value.
*/
- public Object getValue() throws UnsupportedOperationException;
+ Object getValue() throws UnsupportedOperationException;
/**
* Sets the value of this widget.
* <p>
* Not all widgets do have a value (notably {@link ContainerWidget}s,
* but this method is provided here as a convenience to ease writing and avoiding casts.
- *
+ *
* @param value the new widget's value.
* @throws UnsupportedOperationException if this widget doesn't have a value.
*/
- public void setValue(Object value) throws UnsupportedOperationException;
+ void setValue(Object value) throws UnsupportedOperationException;
/**
- * @return whether this widget is required to be filled in. As with {@link #getValue()},
+ * @return whether this widget is required to be filled in. As with {@link #getValue()},
* for some widgets this may not make sense, those should return false here.
*/
- public boolean isRequired();
+ boolean isRequired();
/**
* Broadcast an event previously queued by this widget to its event listeners.
*/
- public void broadcastEvent(WidgetEvent event);
+ void broadcastEvent(WidgetEvent event);
/**
- * Retrieves an attribute on this widget
- *
+ * Retrieves an attribute on this widget.
+ *
* @param name of the attribute to lookup
* @return the found attribute or <code>null</code> if none was found with that name.
*/
- public Object getAttribute(String name);
+ Object getAttribute(String name);
/**
* Sets an attribute on this widget. This can be used to store custom
* data with each widget.
*/
- public void setAttribute(String name, Object value);
+ void setAttribute(String name, Object value);
/**
* Removes the named attribute from this widget.
- *
+ *
* @param name of the attribute
*/
- public void removeAttribute(String name);
+ void removeAttribute(String name);
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java?rev=210082&r1=210081&r2=210082&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java Mon Jul 11 01:06:48 2005
@@ -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.
@@ -23,7 +23,7 @@
* function is a lot like that of the class in Java. Users of the Cocoon Forms framework
* usually won't have to bother with the WidgetDefinition's, but will rather use
* the Widget's themselves.
- *
+ *
* @version $Id$
*/
public interface WidgetDefinition {
@@ -31,58 +31,57 @@
/**
* Gets the {@link FormDefinition}.
*/
- public FormDefinition getFormDefinition();
+ FormDefinition getFormDefinition();
/**
- * Sets the parent of this definition
+ * Sets the parent of this definition.
*/
- public void setParent(WidgetDefinition definition);
+ void setParent(WidgetDefinition definition);
/**
* Gets source location of this widget definition.
*/
- public String getLocation();
+ String getLocation();
/**
* Gets id of this widget definition.
*/
- public String getId();
-
+ String getId();
+
/**
- * Gets an attribute that has been defined on the widget's definition
- *
+ * Gets an attribute that has been defined on the widget's definition.
+ *
* @param name the attribute name
* @return the attribute value, or null if it doesn't exist
*/
- public Object getAttribute(String name);
-
+ Object getAttribute(String name);
+
/**
* Validate a widget using the validators that were defined in its definition. If validation
* fails, the validator has set a validation error on the widget or one of its children.
- *
+ *
* @param widget the widget
* @return <code>true</code> if validation was successful.
*/
- public boolean validate(Widget widget);
-
+ boolean validate(Widget widget);
/**
* Creates and returns a widget based on this widget definition.
*/
- public Widget createInstance();
+ Widget createInstance();
/**
* Generates SAX events for named display data.
*/
- public void generateDisplayData(String name, ContentHandler contentHandler) throws SAXException;
+ void generateDisplayData(String name, ContentHandler contentHandler) throws SAXException;
/**
* Generates SAX events for display data.
*/
- public void generateDisplayData(ContentHandler contentHandler) throws SAXException;
+ void generateDisplayData(ContentHandler contentHandler) throws SAXException;
/**
* Generates SAX events for the label of this widget.
*/
- public void generateLabel(ContentHandler contentHandler) throws SAXException;
+ void generateLabel(ContentHandler contentHandler) throws SAXException;
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java?rev=210082&r1=210081&r2=210082&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java Mon Jul 11 01:06:48 2005
@@ -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.
@@ -25,11 +25,11 @@
*
* <p>Implementations may implement Avalon's Serviceable interface to gain access
* to other components.
- *
+ *
* @version $Id$
*/
public interface WidgetDefinitionBuilder {
- public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception;
+ WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception;
}
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java?rev=210082&r1=210081&r2=210082&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java Mon Jul 11 01:06:48 2005
@@ -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.
@@ -26,10 +26,11 @@
/**
* Helper class for the Definition implementation of widgets containing
* other widgets.
- *
+ *
* @version $Id$
*/
public class WidgetDefinitionList {
+
private List widgetDefinitions = new ArrayList();
private Map widgetDefinitionsById = new HashMap();
private WidgetDefinition containerDefinition;
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=210082&r1=210081&r2=210082&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 Mon Jul 11 01:06:48 2005
@@ -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.
@@ -32,7 +32,7 @@
* Helper class for the implementation of widgets containing other widgets.
* This implements a type-aware List of Widgets that automatically can distribute
* the common Widget operations over the contained Widgets.
- *
+ *
* @version $Id$
*/
public class WidgetList {
Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?rev=210082&r1=210081&r2=210082&view=diff
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Mon Jul 11 01:06:48 2005
@@ -480,6 +480,9 @@
</action>
</release>
<release version="2.1.8" date="TBD">
+ <action dev="CZ" type="add">
+ CForms block: Add isValid() method to a Widget.
+ </action>
<action dev="VG" type="add" fixes-bug="29817" due-to="Patrick Herber" due-to-email="patrick@arpage.ch">
POI Block: Added HSSFGenerator.
</action>