Author: jeremias
Date: Tue Mar 18 03:17:06 2008
New Revision: 638302

URL: http://svn.apache.org/viewvc?rev=638302&view=rev
Log:
Events for inline-level layout managers.

Added:
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.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/layoutmgr/inline/ContentLayoutManager.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
    
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.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=638302&r1=638301&r2=638302&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
 Tue Mar 18 03:17:06 2008
@@ -63,4 +63,6 @@
   <message key="org.apache.fop.events.ResourceEventProducer.imageError">Image 
not available. URI: {uri}. Reason: {e}{{locator}}</message>
   <message key="org.apache.fop.events.ResourceEventProducer.imageIOError">I/O 
error while loading image.  URI: {uri}. Reason: {ioe}{{locator}}</message>
   <message 
key="org.apache.fop.events.ResourceEventProducer.ifoNoIntrinsiceSize">The 
intrinsic dimensions of an instream-foreign-object could not be 
determined.{{locator}}</message>
+  <message 
key="org.apache.fop.layoutmgr.inline.InlineLevelEventProducer.leaderWithoutContent">fo:leader
 is set to "use-content" but has no content.{{locator}}</message>
+  <message 
key="org.apache.fop.layoutmgr.inline.InlineLevelEventProducer.lineOverflows">Line
 {line} of a paragraph overflows the available area by 
{overflowLength,choice,50000#{overflowLength} millipoints|50000&lt;more than 50 
points}.{{locator}}</message>
 </catalogue>

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java?rev=638302&r1=638301&r2=638302&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
 Tue Mar 18 03:17:06 2008
@@ -19,9 +19,19 @@
 
 package org.apache.fop.layoutmgr.inline;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.fop.apps.FOUserAgent;
+
+import org.apache.fop.area.Area;
+import org.apache.fop.area.Block;
+import org.apache.fop.area.LineArea;
+import org.apache.fop.area.inline.InlineArea;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.pagination.Title;
 import org.apache.fop.layoutmgr.AbstractBaseLayoutManager;
@@ -34,19 +44,8 @@
 import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.PositionIterator;
 import org.apache.fop.layoutmgr.SpaceSpecifier;
-import org.apache.fop.area.Area;
-import org.apache.fop.area.LineArea;
-import org.apache.fop.area.inline.InlineArea;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.ArrayList;
-import java.util.Iterator;
 import org.apache.fop.traits.MinOptMax;
 
-import org.apache.fop.area.Block;
-
 /**
  * Content Layout Manager.
  * For use with objects that contain inline areas such as
@@ -60,7 +59,6 @@
      */
     private static Log log = LogFactory.getLog(ContentLayoutManager.class);
 
-    private FOUserAgent userAgent;
     private Area holder;
     private int stackSize;
     private LayoutManager parentLM;

Added: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java?rev=638302&view=auto
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java
 (added)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java
 Tue Mar 18 03:17:06 2008
@@ -0,0 +1,66 @@
+/*
+ * 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.layoutmgr.inline;
+
+import org.xml.sax.Locator;
+
+import org.apache.fop.events.EventBroadcaster;
+import org.apache.fop.events.EventProducer;
+
+/**
+ * Event producer interface for inline-level layout managers.
+ */
+public interface InlineLevelEventProducer 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 InlineLevelEventProducer create(EventBroadcaster 
broadcaster) {
+            return (InlineLevelEventProducer)broadcaster.getEventProducerFor(
+                    InlineLevelEventProducer.class);
+        }
+    }
+
+    /**
+     * fo:leader with "use-content" but without children.
+     * @param source the event source
+     * @param loc the location of the error or null
+     * @event.severity ERROR
+     */
+    void leaderWithoutContent(Object source, Locator loc);
+    
+    /**
+     * A line overflows.
+     * @param source the event source
+     * @param line the number number
+     * @param overflowLength the length by which the content overflows the 
available space (in mpt)
+     * @param loc the location of the error or null
+     * @event.severity WARN
+     */
+    void lineOverflows(Object source, int line, int overflowLength, Locator 
loc);
+    
+}

Propchange: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java?rev=638302&r1=638301&r2=638302&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
 Tue Mar 18 03:17:06 2008
@@ -19,11 +19,15 @@
 
 package org.apache.fop.layoutmgr.inline;
 
+import java.util.LinkedList;
+import java.util.List;
+
 import org.apache.fop.area.Trait;
 import org.apache.fop.area.inline.FilledArea;
 import org.apache.fop.area.inline.InlineArea;
 import org.apache.fop.area.inline.Space;
 import org.apache.fop.area.inline.TextArea;
+import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.flow.Leader;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
@@ -41,10 +45,6 @@
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.traits.MinOptMax;
 
-import java.util.List;
-import java.util.LinkedList;
-import org.apache.fop.fo.FObj;
-
 /**
  * LayoutManager for the fo:leader formatting object
  */
@@ -159,7 +159,9 @@
             leaderArea = fa;
         } else if (fobj.getLeaderPattern() == EN_USECONTENT) {
             if (fobj.getChildNodes() == null) {
-                fobj.getLogger().error("Leader use-content with no content");
+                InlineLevelEventProducer eventProducer = 
InlineLevelEventProducer.Factory.create(
+                        getFObj().getUserAgent().getEventBroadcaster());
+                eventProducer.leaderWithoutContent(this, 
getFObj().getLocator());
                 return null;
             }
 
@@ -344,9 +346,7 @@
         getPSLM().addIDToPage(fobj.getId());
     }
 
-    /**
-     * [EMAIL PROTECTED] 
-     */
+    /** [EMAIL PROTECTED] */
     public int getBaseLength(int lengthBase, FObj fobj) {
         return getParent().getBaseLength(lengthBase, getParent().getFObj());
     }

Modified: 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=638302&r1=638301&r2=638302&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
 Tue Mar 18 03:17:06 2008
@@ -26,6 +26,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.area.Area;
 import org.apache.fop.area.LineArea;
 import org.apache.fop.area.Trait;
@@ -33,7 +34,6 @@
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.flow.Block;
 import org.apache.fop.fo.properties.CommonHyphenation;
 import org.apache.fop.fonts.Font;
@@ -383,11 +383,12 @@
             if (log.isWarnEnabled()) {
                 int lack = difference + bestActiveNode.availableShrink; 
                 if (lack < 0) {
+                    InlineLevelEventProducer eventProducer
+                        = InlineLevelEventProducer.Factory.create(
+                            getFObj().getUserAgent().getEventBroadcaster());
+                    eventProducer.lineOverflows(this, addedPositions + 1,
+                            -lack, getFObj().getLocator());
                     String textDiff = (lack < -50000 ? "more than 50 points" : 
(-lack) + "mpt");
-                    log.warn(FONode.decorateWithContextInfo(
-                            "Line " + (addedPositions + 1) 
-                            + " of a paragraph overflows the available area by 
"
-                            + textDiff + ".", getFObj()));
                 }
             }
             
@@ -1432,7 +1433,9 @@
                         auxCount++;
                     }
                 }
-                log.trace(" Word to hyphenate: " + sbChars.toString());
+                if (log.isTraceEnabled()) {
+                    log.trace(" Word to hyphenate: " + sbChars.toString());
+                }
                 // find hyphenation points
                 HyphContext hc = getHyphenContext(sbChars);
                 // ask each LM to hyphenate its word fragment



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

Reply via email to