mpo 2004/04/22 01:05:27
Modified: src/blocks/forms/java/org/apache/cocoon/forms/formmodel
AbstractContainerWidget.java
Log:
Making better use of the base-class provided implementations.
Revision Changes Path
1.8 +5 -27
cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java
Index: AbstractContainerWidget.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AbstractContainerWidget.java 21 Apr 2004 20:30:49 -0000 1.7
+++ AbstractContainerWidget.java 22 Apr 2004 08:05:27 -0000 1.8
@@ -15,13 +15,10 @@
*/
package org.apache.cocoon.forms.formmodel;
-import java.util.Locale;
import java.util.Iterator;
+import java.util.Locale;
-import org.apache.cocoon.forms.Constants;
import org.apache.cocoon.forms.FormContext;
-import org.apache.cocoon.xml.AttributesImpl;
-import org.apache.cocoon.xml.XMLUtils;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
@@ -102,33 +99,14 @@
/**
- * Convenience method for subclasses that can just rely on the
generation of
- * some standard XML consisting of a simple wrapper element (name
provided by
- * [EMAIL PROTECTED] AbstractWidget#getXMLElementName()}) around the
nested elements generated by the
- * contained child-widgets.
- * The wrapper element will automatically have its @id set to the
- * [EMAIL PROTECTED] Widget#getFullyQualifiedId()} of this widget.
+ * Subclass container widgets can call this
super.generateItemSaxFragment(..)
+ * to just insert the child-widget content wrapped in a @lt;fi:[EMAIL
PROTECTED];
*
* @param contentHandler where the SAX is sent to via [EMAIL PROTECTED]
Widget#generateSaxFragment(ContentHandler, Locale)
* @param locale
* @throws SAXException
*/
- public void generateSaxFragment(ContentHandler contentHandler, Locale
locale) throws SAXException {
- String element = this.getXMLElementName();
-
- //TODO: check for which beasts it is allowed to be a
container-widget, but not have an id!
- // if no reason we could just do this with the
AbstractWidget#generateItemSaxFragment(ContentHandler, Locale)
- if (getId() == null || getId().equals("")) {
- contentHandler.startElement(Constants.INSTANCE_NS, element,
Constants.INSTANCE_PREFIX_COLON + element, XMLUtils.EMPTY_ATTRIBUTES);
- } else {
- AttributesImpl attrs = this.getXMLElementAttributes();
- contentHandler.startElement(Constants.INSTANCE_NS, element,
Constants.INSTANCE_PREFIX_COLON + element, attrs);
- }
- //TODO: check for which beasts it is allowed to have no definition!
- if (getDefinition() != null)
- getDefinition().generateDisplayData(contentHandler);
- // The child widgets
+ public void generateItemSaxFragment(ContentHandler contentHandler,
Locale locale) throws SAXException {
widgets.generateSaxFragment(contentHandler, locale);
- contentHandler.endElement(Constants.INSTANCE_NS, element,
Constants.INSTANCE_PREFIX_COLON + element);
}
}