You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ti...@apache.org on 2004/09/09 20:55:27 UTC
svn commit: rev 43623 - cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel
Author: tim
Date: Thu Sep 9 11:55:26 2004
New Revision: 43623
Modified:
cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java
cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java
cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java
cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java
cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java
Log:
Fix some spaces, tabs, and blank lines.
Add "this." to some variable references.
Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java Thu Sep 9 11:55:26 2004
@@ -104,7 +104,6 @@
return super.validate() && valid;
}
-
/**
* Subclass container widgets can call this super.generateItemSaxFragment(..)
* to just insert the child-widget content wrapped in a @lt;fi:widgets@gt;
Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java Thu Sep 9 11:55:26 2004
@@ -36,7 +36,7 @@
* @version $Id$
*/
public abstract class AbstractWidget implements Widget {
-
+
/**
* Containing parent-widget to this widget.
* NOTE: avoid directly accessing this member since subclasses can mask this
@@ -53,7 +53,7 @@
* Lazy loaded reference to the top-level form.
*/
private Form form;
-
+
/**
* Validation-rules local to the widget instance
*/
@@ -79,7 +79,7 @@
public String getId() {
return getDefinition().getId();
}
-
+
/**
* Concrete subclasses should allow access to their underlaying Definition
* through this method.
@@ -93,7 +93,7 @@
* (@link WidgetDefinition#createInstance()}
*/
protected abstract WidgetDefinition getDefinition();
-
+
/**
* @return the location-information (file, line and column) where this widget was
* configured.
@@ -106,7 +106,7 @@
* @return The parent-widget of this widget.
*/
public Widget getParent() {
- return parent;
+ return this.parent;
}
/**
@@ -163,11 +163,11 @@
return getChild(path);
} else if (sepPosition == 0) {
//absolute path
- relativeWidget = getForm();
+ relativeWidget = getForm();
relativePath = path.substring(1);
} else {
- if (path.startsWith(".." + Widget.PATH_SEPARATOR)) {
- relativeWidget = getParent();
+ if (path.startsWith(".." + Widget.PATH_SEPARATOR)) {
+ relativeWidget = getParent();
relativePath = path.substring(3);
} else {
String childId = path.substring(0, sepPosition );
@@ -175,11 +175,11 @@
relativePath = path.substring(sepPosition+1);
}
}
-
+
if (relativeWidget == null) return null;
return relativeWidget.lookupWidget(relativePath);
- }
-
+ }
+
/**
* Concrete widgets that contain actual child widgets should override to
* return the actual child-widget.
@@ -190,12 +190,12 @@
protected Widget getChild(String id) {
return null;
}
-
+
public Widget getWidget(String id) {
throw new UnsupportedOperationException("getWidget(id) got deprecated from the API. \n" +
"Consider using getChild(id) or even lookupWidget(path) instead.");
}
-
+
public Object getValue() {
return null;
}
@@ -233,7 +233,7 @@
public void broadcastEvent(WidgetEvent event) {
throw new UnsupportedOperationException("Widget " + this.getRequestParameterName() + " doesn't handle events.");
}
-
+
/**
* Add a validator to this widget instance.
*
@@ -245,7 +245,7 @@
}
this.validators.add(validator);
}
-
+
/**
* Remove a validator from this widget instance
*
@@ -259,8 +259,8 @@
return false;
}
}
-
-
+
+
public boolean validate() {
// Test validators from the widget definition
if (!getDefinition().validate(this)) {
@@ -302,7 +302,6 @@
getDefinition().generateDisplayData("label", contentHandler);
}
-
/**
* Generates nested additional content nested inside the main element for this
* widget which is generated by {@link #generateSaxFragment(ContentHandler, Locale)}
@@ -400,7 +399,7 @@
contentHandler.endElement(Constants.INSTANCE_NS, element, Constants.INSTANCE_PREFIX_COLON + element);
}
- public Object getAttribute(String name) {
+ public Object getAttribute(String name) {
if (this.attributes != null){
return this.attributes.get(name);
} else{
Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java Thu Sep 9 11:55:26 2004
@@ -95,14 +95,14 @@
}
private static final String ACTION_EL = "action";
-
+
/**
* @return "action"
*/
public String getXMLElementName() {
return ACTION_EL;
}
-
+
/**
* Adds a ActionListener to this widget instance. Listeners defined
* on the widget instance will be executed in addtion to any listeners
@@ -121,6 +121,7 @@
this.listener.actionPerformed(event);
}
}
+
public void broadcastEvent(WidgetEvent event) {
this.definition.fireActionEvent((ActionEvent)event);
fireActionEvent((ActionEvent)event);
Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java Thu Sep 9 11:55:26 2004
@@ -26,8 +26,6 @@
import org.apache.cocoon.forms.validation.ValidationErrorAware;
import org.apache.cocoon.forms.validation.ValidationError;
-
-
/**
* A widget to select a boolean value. Usually rendered as a checkbox.
*
@@ -90,7 +88,6 @@
return super.validate();
}
-
/**
* Returns the validation error, if any. There will always be a validation error in case the
* {@link #validate()} method returned false.
@@ -153,7 +150,7 @@
getForm().addWidgetEvent(new ValueChangedEvent(this, oldValue, value));
}
}
-
+
/**
* Adds a ValueChangedListener to this widget instance. Listeners defined
* on the widget instance will be executed in addtion to any listeners
Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java Thu Sep 9 11:55:26 2004
@@ -27,14 +27,14 @@
* @version $Id$
*/
public class Union extends AbstractContainerWidget {
-
+
//Note: union instances behave like simple "field" instance with respect to
// XSLT post-processing, the choice of element-name reflects this.
private static final String UNION_EL = "field";
private Widget caseWidget;
private String caseValue;
-
+
private final UnionDefinition definition;
public Union(UnionDefinition definition) {
@@ -42,7 +42,7 @@
// TODO: Remove after moving logic to Field.
//item.enteredValue = (String)definition.getDefaultValue();
}
-
+
protected WidgetDefinition getDefinition() {
return definition;
}
@@ -69,24 +69,24 @@
}
public Object getValue() {
- return caseWidget.getValue();
+ return this.caseWidget.getValue();
}
public void readFromRequest(FormContext formContext) {
if(getProcessRequests() == true) {
// Ensure the case widget has read its value
- caseWidget.readFromRequest(formContext);
+ this.caseWidget.readFromRequest(formContext);
Widget widget;
// Read current case from request
String newValue = (String)getValue();
if (newValue != null && !newValue.equals("")) {
- if (getForm().getSubmitWidget() == caseWidget && !newValue.equals(caseValue)) {
+ if (getForm().getSubmitWidget() == this.caseWidget && !newValue.equals(this.caseValue)) {
// If submitted by the case widget and its value has changed, read the values
// for the previous case values. This allows to keep any entered values
// despite the case change.
- widget = getChild(caseValue);
+ widget = getChild(this.caseValue);
} else {
// Get the corresponding widget (will create it if needed)
widget = getChild(newValue);
@@ -96,7 +96,7 @@
widget.readFromRequest(formContext);
}
}
- caseValue = newValue;
+ this.caseValue = newValue;
}
}
@@ -118,11 +118,10 @@
Widget child = super.getChild(id);
child.initialize();
return child;
- }
+ }
return super.getChild(id);
}
-
//TODO: check further: cause the claim in the accompanied comment doesn't seem
// to be completely correct
Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java Thu Sep 9 11:55:26 2004
@@ -122,7 +122,7 @@
this.validationError = null;
}
}
-
+
return validationError == null ? super.validate() : false;
}
@@ -133,7 +133,7 @@
public ValidationError getValidationError() {
return validationError;
}
-
+
/**
* Set a validation error on this field. This allows fields to be externally marked as invalid by
* application logic.
@@ -150,22 +150,20 @@
public String getXMLElementName() {
return UPLOAD_EL;
}
-
-
- /**
- * Adds attributes @required, @mime-types
- */
- public AttributesImpl getXMLElementAttributes() {
- AttributesImpl attrs = super.getXMLElementAttributes();
+ /**
+ * Adds attributes @required, @mime-types
+ */
+ public AttributesImpl getXMLElementAttributes() {
+ AttributesImpl attrs = super.getXMLElementAttributes();
attrs.addCDATAAttribute("id", getRequestParameterName());
attrs.addCDATAAttribute("required", String.valueOf(uploadDefinition.isRequired()));
if (uploadDefinition.getMimeTypes() != null) {
attrs.addCDATAAttribute("mime-types", uploadDefinition.getMimeTypes());
}
- return attrs;
- }
-
+ return attrs;
+ }
+
public void generateItemSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
if (this.part != null) {
String name = (String)this.part.getHeaders().get("filename");
Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java Thu Sep 9 11:55:26 2004
@@ -52,7 +52,7 @@
* @version CVS $Id$
*/
public interface Widget {
-
+
/**
* Widget-Separator used in path-like notations
* @see #lookupWidget(String)
@@ -89,7 +89,7 @@
* which case it should be called when a widget is added as child of your widget).
*/
public void setParent(Widget widget);
-
+
/**
* @return the {@link Form} to which this widget belongs. The form is the top-most ancestor
* of the widget.
@@ -108,7 +108,7 @@
* deprecated from the API, and will be removed from future releases.
*/
public Widget getWidget(String id);
-
+
/**
* Finds a widget relative to this one based on a path-like
* string (/-delimted) into the widget-tree structure.
@@ -150,7 +150,7 @@
public void addValidator(WidgetValidator validator);
public boolean removeValidator(WidgetValidator validator);
-
+
/**
* Generates an XML representation of this widget. The startDocument and endDocument
* SAX events will not be called. It is assumed that the prefix for the CForms namespace
@@ -169,7 +169,7 @@
* this may not make sense, those should then simply return null here.
*/
public Object getValue();
-
+
/**
* Sets the value of this widget to the given object. Some widgets may not support this
* method, those should throw an runtime exception if you try to set their value anyway.
@@ -181,7 +181,7 @@
* for some widgets this may not make sense, those should return false here.
*/
public boolean isRequired();
-
+
/**
* Broadcast an event previously queued by this widget to its event listeners.
*/