Author: jeremias
Date: Wed Mar  5 06:32:07 2008
New Revision: 633858

URL: http://svn.apache.org/viewvc?rev=633858&view=rev
Log:
Instead of always decentrally checking whether strict validation is enabled or 
not, this is now done in a special event listener. The event producer method 
caller simply indicates whether it can recover from the error condition and 
continue.
Started switching to event production in table FOs.

Added:
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java
   (with props)
Modified:
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.xml
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FONode.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOTreeBuilder.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOValidationEventProducer.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FObj.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/PropertyList.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/destination/Destination.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/Table.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableBody.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/test/java/org/apache/fop/events/BasicEventTestCase.java

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.xml?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.xml
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventFormatter.xml
 Wed Mar  5 06:32:07 2008
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?><!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
     Licensed to the Apache Software Foundation (ASF) under one or more
     contributor license agreements.  See the NOTICE file distributed with
     this work for additional information regarding copyright ownership.
@@ -22,12 +23,14 @@
     <message 
key="org.apache.fop.fo.FOValidationEventProducer.missingChildElement">"{elementName}"
 is missing child elements.
 Required content model: {contentModel}[ See position {loc}.]</message>
     <message 
key="org.apache.fop.fo.FOValidationEventProducer.missingProperty">Element 
"{elementName}" is missing required property "{propertyName}"![ See position 
{loc}.]</message>
-    <message 
key="org.apache.fop.fo.FOValidationEventProducer.idNotUnique">Property ID 
"{id}" (found on "{elementName}") previously used; ID values must be unique 
within a document![ See position {loc}.]</message>
-    <message 
key="org.apache.fop.fo.FOValidationEventProducer.idNotUniqueWarning">Found 
non-unique ID "{id}" on "{elementName}".
-Any reference to it will be considered a reference to the first occurrence in 
the document.[ See position {loc}.]</message>
+    <message 
key="org.apache.fop.fo.FOValidationEventProducer.idNotUnique">Property ID 
"{id}" (found on "{elementName}") previously used; ID values must be unique 
within a document!{severity,equals,EventSeverity:FATAL,,
+Any reference to it will be considered a reference to the first occurrence in 
the document.}[ See position {loc}.]</message>
     <message 
key="org.apache.fop.fo.FOValidationEventProducer.markerNotInitialChild">fo:marker
 must be an initial child: {mcname}[ (See position {loc}.)]</message>
     <message 
key="org.apache.fop.fo.FOValidationEventProducer.markerNotUniqueForSameParent">fo:marker
 "marker-class-name" must be unique for same parent: {mcname}[ (See position 
{loc}.)]</message>
     <message 
key="org.apache.fop.fo.FOValidationEventProducer.invalidProperty">Invalid 
property encountered on "{elementName}": {attr}[ (See position 
{loc}.)]</message>
-    <message 
key="org.apache.fop.fo.FOValidationEventProducer.invalidPropertyWarning">Invalid
 property ignored on "{elementName}": {attr}[ (See position {loc}.)]</message>
-    <message 
key="org.apache.fop.fo.FOValidationEventProducer.invalidPropertyValue">Invalid 
property value encountered in {propName}="{propValue}": {e}[ (See position 
{loc}.)]</message>
+    <message 
key="org.apache.fop.fo.FOValidationEventProducer.invalidPropertyValue">Invalid 
property value encountered in {propName}="{propValue}"[: {e}][ (See position 
{loc}.)]</message>
+    <message 
key="org.apache.fop.fo.FOValidationEventProducer.unimplementedFeature">The 
following feature isn't implemented by Apache FOP, yet: {feature}[ (See 
position {loc}.)]</message>
+    <message 
key="org.apache.fop.fo.flow.table.TableEventProducer.nonAutoBPDOnTable">Only a 
value of "auto" for block-progression-dimension has a well-specified behavior 
on fo:table. Falling back to "auto".</message>
+    <message 
key="org.apache.fop.fo.flow.table.TableEventProducer.noTablePaddingWithCollapsingBorderModel">In
 collapsing border model a table does not have padding (see 
http://www.w3.org/TR/REC-CSS2/tables.html#collapsing-borders), but a non-zero 
value for padding was found. The padding will be ignored.</message>
+    <message 
key="org.apache.fop.fo.flow.table.TableEventProducer.noMixRowsAndCells">Either 
fo:table-rows or fo:table-cells may be children of an {elementName} but not 
both.[ (See position {loc}.)]</message>
 </catalogue>

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FONode.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FONode.java?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FONode.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FONode.java
 Wed Mar  5 06:32:07 2008
@@ -473,7 +473,22 @@
      */
     protected void missingChildElementError(String contentModel)
                 throws ValidationException {
-        getFOValidationEventProducer().missingChildElement(this, getName(), 
contentModel, locator);
+        getFOValidationEventProducer().missingChildElement(this, getName(),
+                contentModel, false, locator);
+    }
+
+    /**
+     * Helper function to throw an error caused by missing mandatory child 
elements.
+     * E.g., fo:layout-master-set not having any page-master child element.
+     * @param contentModel The XSL Content Model for the fo: object or a 
similar description 
+     *                     indicating the necessary child elements.
+     * @param canRecover indicates whether FOP can recover from this problem 
and continue working
+     * @throws ValidationException the validation error provoked by the method 
call
+     */
+    protected void missingChildElementError(String contentModel, boolean 
canRecover)
+                throws ValidationException {
+        getFOValidationEventProducer().missingChildElement(this, getName(),
+                contentModel, canRecover, locator);
     }
 
     /**

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOTreeBuilder.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOTreeBuilder.java?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOTreeBuilder.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOTreeBuilder.java
 Wed Mar  5 06:32:07 2008
@@ -153,7 +153,7 @@
         //Backwards-compatibility: Make sure at least the LoggingEventListener 
is plugged in
         //so no events are just silently swallowed.
         EventBroadcaster broadcaster = userAgent.getEventBroadcaster(); 
-        if (broadcaster.getListenerCount() == 0) {
+        if (!broadcaster.hasEventListeners()) {
             broadcaster.addEventListener(
                     new 
LoggingEventListener(LogFactory.getLog(FOUserAgent.class)));
         }

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOValidationEventProducer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOValidationEventProducer.java?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOValidationEventProducer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOValidationEventProducer.java
 Wed Mar  5 06:32:07 2008
@@ -89,10 +89,13 @@
      * @param source the event source
      * @param elementName the name of the context node
      * @param contentModel the expected content model
+     * @param canRecover indicates whether FOP can recover from this problem 
and continue working
      * @param loc the location of the error or null
      * @throws ValidationException the validation error provoked by the method 
call
+     * @event.severity FATAL
      */
-    void missingChildElement(Object source, String elementName, String 
contentModel,
+    void missingChildElement(Object source, String elementName,
+            String contentModel, boolean canRecover,
             Locator loc) throws ValidationException;
 
     /**
@@ -112,11 +115,12 @@
      * @param source the event source
      * @param elementName the name of the context node
      * @param id the id that was reused
+     * @param canRecover indicates whether FOP can recover from this problem 
and continue working
      * @param loc the location of the error or null
      * @throws ValidationException the validation error provoked by the method 
call
      * @event.severity FATAL
      */
-    void idNotUnique(Object source, String elementName, String id,
+    void idNotUnique(Object source, String elementName, String id, boolean 
canRecover,
             Locator loc) throws ValidationException;
 
     /**
@@ -126,8 +130,9 @@
      * @param id the id that was reused
      * @param loc the location of the error or null
      * @event.severity WARN
-     */
+     *//*
     void idNotUniqueWarning(Object source, String elementName, String id, 
Locator loc);
+    */
 
     /**
      * A marker is not an initial child on a node.
@@ -155,11 +160,12 @@
      * @param source the event source
      * @param elementName the name of the context node
      * @param attr the invalid attribute
+     * @param canRecover indicates whether FOP can recover from this problem 
and continue working
      * @param loc the location of the error or null
      * @throws ValidationException the validation error provoked by the method 
call
      * @event.severity FATAL
      */
-    void invalidProperty(Object source, String elementName, QName attr,
+    void invalidProperty(Object source, String elementName, QName attr, 
boolean canRecover,
             Locator loc) throws ValidationException;
 
     /**
@@ -169,9 +175,9 @@
      * @param attr the invalid attribute
      * @param loc the location of the error or null
      * @event.severity WARN
-     */
+     *//*
     void invalidPropertyWarning(Object source, String elementName, QName attr,
-            Locator loc);
+            Locator loc);*/
 
     /**
      * An invalid property value was encountered.
@@ -185,6 +191,17 @@
      */
     void invalidPropertyValue(Object source, String elementName,
             String propName, String propValue, PropertyException e,
+            Locator loc);
+
+    /**
+     * A feature is not supported, yet.
+     * @param source the event source
+     * @param elementName the name of the context node
+     * @param feature the unsupported feature
+     * @param loc the location of the error or null
+     * @event.severity WARN
+     */
+    void unimplementedFeature(Object source, String elementName, String 
feature,
             Locator loc);
 
 }

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FObj.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FObj.java?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FObj.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FObj.java
 Wed Mar  5 06:32:07 2008
@@ -173,11 +173,7 @@
             if (!idrefs.contains(id)) {
                 idrefs.add(id);
             } else {
-                if (getUserAgent().validateStrictly()) {
-                    getFOValidationEventProducer().idNotUnique(this, 
getName(), id, locator);
-                } else {
-                    getFOValidationEventProducer().idNotUniqueWarning(this, 
getName(), id, locator);
-                }
+                getFOValidationEventProducer().idNotUnique(this, getName(), 
id, true, locator);
             }
         }
     }
@@ -271,16 +267,22 @@
         return false;
     }
 
-    /**
-     * [EMAIL PROTECTED]
-     */
+    /** [EMAIL PROTECTED] */
     public FONodeIterator getChildNodes() {
-        if (firstChild != null) {
+        if (hasChildren()) {
             return new FObjIterator(this);
         }
         return null;
     }
 
+    /**
+     * Indicates whether this formatting object has children.
+     * @return true if there are children
+     */
+    public boolean hasChildren() {
+        return this.firstChild != null;
+    }
+    
     /**
      * Return an iterator over the object's childNodes starting
      * at the passed-in node (= first call to iterator.next() will

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/PropertyList.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/PropertyList.java?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/PropertyList.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/PropertyList.java
 Wed Mar  5 06:32:07 2008
@@ -461,13 +461,8 @@
     protected void handleInvalidProperty(QName attr) 
                     throws ValidationException {
         if (!attr.getQName().startsWith("xmlns")) {
-            if (fobj.getUserAgent().validateStrictly()) {
-                fobj.getFOValidationEventProducer().invalidProperty(this, 
fobj.getName(),
-                        attr, fobj.locator);
-            } else {
-                
fobj.getFOValidationEventProducer().invalidPropertyWarning(this, fobj.getName(),
-                        attr, fobj.locator);
-            }
+            fobj.getFOValidationEventProducer().invalidProperty(this, 
fobj.getName(),
+                    attr, true, fobj.locator);
         }
     }
 

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/destination/Destination.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/destination/Destination.java?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/destination/Destination.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/destination/Destination.java
 Wed Mar  5 06:32:07 2008
@@ -19,15 +19,15 @@
 
 package org.apache.fop.fo.extensions.destination;
 
-import org.apache.fop.fo.ValidationException;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
 import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.pagination.Root;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
 import org.apache.fop.fo.extensions.ExtensionElementMapping;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
+import org.apache.fop.fo.pagination.Root;
 
 /**
  * Class for named destinations in PDF.
@@ -54,7 +54,7 @@
             Attributes attlist, PropertyList pList) throws FOPException {
         internalDestination = attlist.getValue("internal-destination");
         if (internalDestination == null || internalDestination.length() == 0) {
-            attributeError("Missing attribute:  internal-destination must be 
specified.");
+            missingPropertyError("internal-destination");
         }
     }
     

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/Table.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/Table.java?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/Table.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/Table.java
 Wed Mar  5 06:32:07 2008
@@ -22,6 +22,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.xml.sax.Locator;
+
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.ValidationPercentBaseContext;
@@ -35,7 +37,6 @@
 import org.apache.fop.fo.properties.LengthPairProperty;
 import org.apache.fop.fo.properties.LengthRangeProperty;
 import org.apache.fop.fo.properties.TableColLength;
-import org.xml.sax.Locator;
 
 /**
  * Class modelling the fo:table object.
@@ -126,20 +127,22 @@
         orphanContentLimit = pList.get(PR_X_ORPHAN_CONTENT_LIMIT).getLength();
 
         if (!blockProgressionDimension.getOptimum(null).isAuto()) {
-            attributeWarning("only a value of \"auto\" for 
block-progression-dimension has a well-specified"
-                    + " behavior on fo:table. Falling back to \"auto\"");
+            TableEventProducer eventProducer = 
TableEventProducer.Factory.create(
+                    getUserAgent().getEventBroadcaster());
+            eventProducer.nonAutoBPDOnTable(this, getLocator());
             // Anyway, the bpd of a table is not used by the layout code
         }
         if (tableLayout == EN_AUTO) {
-            attributeWarning("table-layout=\"auto\" is currently not supported 
by FOP");
+            getFOValidationEventProducer().unimplementedFeature(this, 
getName(),
+                    "table-layout=\"auto\"", getLocator());
         }
         if (!isSeparateBorderModel()
                 && getCommonBorderPaddingBackground().hasPadding(
                         ValidationPercentBaseContext.getPseudoContext())) {
             //See "17.6.2 The collapsing border model" in CSS2
-            attributeWarning("In collapsing border model a table does not have 
padding"
-                    + " (see 
http://www.w3.org/TR/REC-CSS2/tables.html#collapsing-borders)"
-                    + ", but a non-zero value for padding was found. The 
padding will be ignored.");
+            TableEventProducer eventProducer = 
TableEventProducer.Factory.create(
+                    getUserAgent().getEventBroadcaster());
+            eventProducer.noTablePaddingWithCollapsingBorderModel(this, 
getLocator());
         }
 
         /* Store reference to the property list, so
@@ -224,6 +227,10 @@
            missingChildElementError(
                    "(marker*,table-column*,table-header?,table-footer?"
                        + ",table-body+)");
+        }
+        if (!hasChildren()) {
+            getParent().removeChild(this);
+            return;
         }
         if (!inMarker()) {
             if (tableFooter != null) {

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java
 Wed Mar  5 06:32:07 2008
@@ -62,7 +62,8 @@
         super(parent);
 
         if (!notImplementedWarningGiven) {
-            log.warn("fo:table-and-caption is not yet implemented.");
+            getFOValidationEventProducer().unimplementedFeature(this, 
getName(),
+                    "fo:table-and-caption", getLocator());
             notImplementedWarningGiven = true;
         }
     }

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableBody.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableBody.java?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableBody.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableBody.java
 Wed Mar  5 06:32:07 2008
@@ -23,13 +23,14 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
 
 /**
  * Class modelling the fo:table-body object.
@@ -119,13 +120,8 @@
         getFOEventHandler().endBody(this);
 
         if (!(tableRowsFound || tableCellsFound)) {
-            if (getUserAgent().validateStrictly()) {
-                missingChildElementError("marker* (table-row+|table-cell+)");
-            } else {
-                log.error("fo:table-body must not be empty. "
-                        + "Expected: marker* (table-row+|table-cell+)");
-                getParent().removeChild(this);
-            }
+            missingChildElementError("marker* (table-row+|table-cell+)", true);
+            getParent().removeChild(this);
         } else {
             finishLastRowGroup();
         }
@@ -167,17 +163,16 @@
             } else if (localName.equals("table-row")) {
                 tableRowsFound = true;
                 if (tableCellsFound) {
-                    invalidChildError(loc, nsURI, localName, "Either 
fo:table-rows" +
-                      " or fo:table-cells may be children of an " + getName() +
-                      " but not both");
+                    TableEventProducer eventProducer = 
TableEventProducer.Factory.create(
+                            getUserAgent().getEventBroadcaster());
+                    eventProducer.noMixRowsAndCells(this, getName(), 
getLocator());
                 }
             } else if (localName.equals("table-cell")) {
                 tableCellsFound = true;
                 if (tableRowsFound) {
-                    invalidChildError(loc, nsURI, localName,
-                            "Either fo:table-rows or fo:table-cells "
-                            + "may be children of an "
-                            + getName() + " but not both");
+                    TableEventProducer eventProducer = 
TableEventProducer.Factory.create(
+                            getUserAgent().getEventBroadcaster());
+                    eventProducer.noMixRowsAndCells(this, getName(), 
getLocator());
                 }
             } else {
                 invalidChildError(loc, nsURI, localName);

Added: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java?rev=633858&view=auto
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java
 (added)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java
 Wed Mar  5 06:32:07 2008
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.fo.flow.table;
+
+import org.xml.sax.Locator;
+
+import org.apache.fop.events.EventBroadcaster;
+import org.apache.fop.events.EventProducer;
+import org.apache.fop.fo.ValidationException;
+
+/**
+ * Event producer interface for table-specific XSL-FO validation messages.
+ */
+public interface TableEventProducer extends EventProducer {
+
+    /**
+     * Factory class for the event producer.
+     */
+    class Factory {
+        
+        /**
+         * Creates a new event producer.
+         * @param broadcaster the event broadcaster to use
+         * @return the new event producer
+         */
+        public static TableEventProducer create(EventBroadcaster broadcaster) {
+            return (TableEventProducer)broadcaster.getEventProducerFor(
+                    TableEventProducer.class);
+        }
+    }
+
+    /**
+     * A value other than "auto" has been specified on fo:table.
+     * @param source the event source
+     * @param loc the location of the error or null
+     * @event.severity WARN
+     */
+    void nonAutoBPDOnTable(Object source, Locator loc);
+
+    /**
+     * Padding on fo:table is ignored if the collapsing border model is active.
+     * @param source the event source
+     * @param loc the location of the error or null
+     * @event.severity WARN
+     */
+    void noTablePaddingWithCollapsingBorderModel(Object source, Locator loc);
+
+    /**
+     * No mixing of table-rows and table-cells is allowed for direct children 
of table-body.
+     * @param source the event source
+     * @param elementName the name of the context node
+     * @param loc the location of the error or null
+     * @throws ValidationException the validation error provoked by the method 
call
+     * @event.severity FATAL
+     */
+    void noMixRowsAndCells(Object source, String elementName, Locator loc)
+            throws ValidationException;
+    
+}

Propchange: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/test/java/org/apache/fop/events/BasicEventTestCase.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/test/java/org/apache/fop/events/BasicEventTestCase.java?rev=633858&r1=633857&r2=633858&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/test/java/org/apache/fop/events/BasicEventTestCase.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/test/java/org/apache/fop/events/BasicEventTestCase.java
 Wed Mar  5 06:32:07 2008
@@ -36,7 +36,7 @@
 
         EventBroadcaster broadcaster = new DefaultEventBroadcaster();
         broadcaster.addEventListener(listener);
-        assertEquals(1, broadcaster.getListenerCount());
+        assertTrue(broadcaster.hasEventListeners());
         
         Event ev = new Event(this, "123", EventSeverity.INFO,
                 Event.paramsBuilder()
@@ -53,7 +53,7 @@
         assertEquals(new Integer(23), ev.getParam("blah"));
         
         broadcaster.removeEventListener(listener);
-        assertEquals(0, broadcaster.getListenerCount());
+        assertFalse(broadcaster.hasEventListeners());
 
         //Just check that there are no NPEs
         broadcaster.broadcastEvent(ev);
@@ -64,7 +64,7 @@
 
         EventBroadcaster broadcaster = new DefaultEventBroadcaster();
         broadcaster.addEventListener(listener);
-        assertEquals(1, broadcaster.getListenerCount());
+        assertTrue(broadcaster.hasEventListeners());
         
         
         TestEventProducer producer = 
TestEventProducer.Factory.create(broadcaster);
@@ -79,7 +79,7 @@
         assertEquals(new Integer(23), ev.getParam("blah"));
         
         broadcaster.removeEventListener(listener);
-        assertEquals(0, broadcaster.getListenerCount());
+        assertFalse(broadcaster.hasEventListeners());
 
         //Just check that there are no NPEs
         broadcaster.broadcastEvent(ev);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to