From: Vincent Hennebert Date: Fri, 9 Apr 2010 16:09:57 +0000 (+0000) Subject: Split catch-all EventFormatter.xml message file into individual files for each EventP... X-Git-Tag: fop-1_0~45 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8f6b532710381d795a1cb84d0a2af7b447db74f4;p=xmlgraphics-fop.git Split catch-all EventFormatter.xml message file into individual files for each EventProducer. There is no longer a default EventModelFactory Added test case for font event git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@932481 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/build.xml b/build.xml index c0bde2d3f..df76aaa90 100644 --- a/build.xml +++ b/build.xml @@ -360,16 +360,63 @@ list of possible build targets. + + + + + + translationfile="${src.java.dir}/org/apache/fop/events/ResourceEventProducer.xml"> - - - - + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + diff --git a/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java b/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java index 2e008a130..5cefc1d4a 100644 --- a/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java +++ b/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java @@ -42,7 +42,7 @@ import com.thoughtworks.qdox.model.Type; /** * Finds EventProducer interfaces and builds the event model for them. */ -public class EventProducerCollector { +class EventProducerCollector { private static final String CLASSNAME_EVENT_PRODUCER = EventProducer.class.getName(); private static final Map PRIMITIVE_MAP; @@ -66,7 +66,7 @@ public class EventProducerCollector { /** * Creates a new EventProducerCollector. */ - public EventProducerCollector() { + EventProducerCollector() { this.tagFactory = createDocletTagFactory(); } diff --git a/src/java/META-INF/services/org.apache.fop.events.model.EventModelFactory b/src/java/META-INF/services/org.apache.fop.events.model.EventModelFactory index f5c2aab75..13b8eb399 100644 --- a/src/java/META-INF/services/org.apache.fop.events.model.EventModelFactory +++ b/src/java/META-INF/services/org.apache.fop.events.model.EventModelFactory @@ -1,4 +1,3 @@ -org.apache.fop.events.FOPEventModelFactory org.apache.fop.afp.AFPEventProducer$EventModelFactory org.apache.fop.render.bitmap.BitmapRendererEventProducer$EventModelFactory org.apache.fop.render.pcl.PCLEventProducer$EventModelFactory @@ -6,3 +5,12 @@ org.apache.fop.render.pdf.PDFEventProducer$EventModelFactory org.apache.fop.render.ps.PSEventProducer$EventModelFactory org.apache.fop.render.rtf.RTFEventProducer$EventModelFactory org.apache.fop.accessibility.AccessibilityEventProducer$EventModelFactory +org.apache.fop.area.AreaEventProducer$EventModelFactory +org.apache.fop.events.ResourceEventProducer$EventModelFactory +org.apache.fop.fo.FOValidationEventProducer$EventModelFactory +org.apache.fop.fo.flow.table.TableEventProducer$EventModelFactory +org.apache.fop.layoutmgr.BlockLevelEventProducer$EventModelFactory +org.apache.fop.layoutmgr.inline.InlineLevelEventProducer$EventModelFactory +org.apache.fop.render.RendererEventProducer$EventModelFactory +org.apache.fop.svg.SVGEventProducer$EventModelFactory +org.apache.fop.fonts.FontEventProducer$EventModelFactory diff --git a/src/java/org/apache/fop/area/AreaEventProducer.java b/src/java/org/apache/fop/area/AreaEventProducer.java index 325367199..69fb8ba24 100644 --- a/src/java/org/apache/fop/area/AreaEventProducer.java +++ b/src/java/org/apache/fop/area/AreaEventProducer.java @@ -21,6 +21,8 @@ package org.apache.fop.area; import org.apache.fop.events.EventBroadcaster; import org.apache.fop.events.EventProducer; +import org.apache.fop.events.model.AbstractEventModelFactory; +import org.apache.fop.events.model.EventModel; /** * Event producer interface for events related to the area tree. @@ -43,6 +45,16 @@ public interface AreaEventProducer extends EventProducer { } } + /** Event model factory for Accessibility. */ + public static class EventModelFactory extends AbstractEventModelFactory { + + /** {@inheritDoc} */ + public EventModel createEventModel() { + return loadModel(getClass(), "event-model.xml"); + } + + } + /** * An unresolved ID reference was encountered. * @param source the event source diff --git a/src/java/org/apache/fop/area/AreaEventProducer.xml b/src/java/org/apache/fop/area/AreaEventProducer.xml new file mode 100644 index 000000000..7fe7e2d8c --- /dev/null +++ b/src/java/org/apache/fop/area/AreaEventProducer.xml @@ -0,0 +1,25 @@ + + + + + {type}: Unresolved ID reference "{id}" found. + Page {page}: Unresolved ID reference "{id}" found. + Error while deserializing page {page}.[ Reason: {e}] + Error while serializing page {page}.[ Reason: {e}] + Error while rendering page {page}.[ Reason: {e}] + diff --git a/src/java/org/apache/fop/events/EventFormatter.java b/src/java/org/apache/fop/events/EventFormatter.java index fc779eb18..631c8a89d 100644 --- a/src/java/org/apache/fop/events/EventFormatter.java +++ b/src/java/org/apache/fop/events/EventFormatter.java @@ -41,9 +41,6 @@ public final class EventFormatter { private static final Pattern INCLUDES_PATTERN = Pattern.compile("\\{\\{.+\\}\\}"); - private static ResourceBundle defaultBundle = XMLResourceBundle.getXMLBundle( - EventFormatter.class.getName(), EventFormatter.class.getClassLoader()); - private static Log log = LogFactory.getLog(EventFormatter.class); private EventFormatter() { @@ -64,14 +61,10 @@ public final class EventFormatter { groupID, EventFormatter.class.getClassLoader()); } catch (MissingResourceException mre) { - if (log.isTraceEnabled()) { - log.trace("No XMLResourceBundle for " + groupID + " available."); - } + throw new IllegalStateException("No XMLResourceBundle for " + groupID + + " available."); } } - if (bundle == null) { - bundle = defaultBundle; - } return format(event, bundle); } @@ -164,7 +157,8 @@ public final class EventFormatter { } public void write(StringBuffer sb, Map params) { - sb.append(defaultBundle.getString(getKey(params))); + // TODO there's no defaultBundle anymore +// sb.append(defaultBundle.getString(getKey(params))); } private String getKey(Map params) { diff --git a/src/java/org/apache/fop/events/EventFormatter.xml b/src/java/org/apache/fop/events/EventFormatter.xml deleted file mode 100644 index c56a74e0f..000000000 --- a/src/java/org/apache/fop/events/EventFormatter.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - [ (See position {loc})| (See {#gatherContextInfo})| (No context info available)] - An fo:marker is permitted only as the descendant of an fo:flow. - An fo:retrieve-marker is permitted only as the descendant of an fo:static-content. - An fo:retrieve-table-marker is permitted only as the descendant of an fo:table-header or an fo:table-footer. - An fo:bidi-override that is a descendant of an fo:leader or of the fo:inline child of an fo:footnote may not have block-level children, unless it has a nearer ancestor that is an fo:inline-container. - An fo:inline that is a descendant of an fo:leader or fo:footnote may not have block-level children, unless it has a nearer ancestor that is an fo:inline-container. - The element must be a child of fo:simple-page-master. - The element must be a child of fo:declarations. - The element must be a child of fo:declarations or fo:simple-page-master. - The element must be a child of fo:instream-foreign-object or fo:external-graphic. - The element must be a child of fo:page-sequence. - The element must be a child of fo:page-sequence or fo:simple-page-master. - An fo:wrapper is only permitted to have children that would be permitted for its parent. - For "{elementName}", only one "{offendingNode}" may be declared.{{locator}} - For "{elementName}", "{tooLateNode}" must be declared before "{tooEarlyNode}"!{{locator}} - "{offendingNode}" is not a valid child of "{elementName}"![ {ruleViolated,lookup}]{{locator}} - "{elementName}" is missing child elements.[ -Required content model: {contentModel}]{{locator}} - Element "{elementName}" is missing required property "{propertyName}"!{{locator}} - 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.}{{locator}} - Only an fo:block-container that does not generate absolutely positioned areas may have one or more fo:markers as its initial children.{{locator}} - fo:marker must be an initial child: {mcname}{{locator}} - fo:marker "marker-class-name" must be unique for same parent: {mcname}{{locator}} - Invalid property encountered on "{elementName}": {attr}{{locator}} - Invalid property value encountered in {propName}="{propValue}"[: {e}]{{locator}} - The following feature isn't implemented by Apache FOP, yet: {feature} (on {elementName}){{locator}} - Missing attribute on {elementName}: Either external-destination or internal-destination must be specified.{{locator}} - Unable to clone subtree of fo:marker (marker-class-name="{markerClassName}") for fo:retrieve-marker.{{locator}} - Duplicate color profile profile name: {name}{{locator}} - Region-name ("{regionName}") is being mapped to multiple region-classes ({defaultRegionClass1} and {defaultRegionClass2}).{{locator}} - The page master name ("{name}") must be unique across page-masters and page-sequence-masters.{{locator}} - Duplicate flow-name "{flowName}" found within {elementName}.{{locator}} - The flow-name "{flowName}" on {elementName} could not be mapped to a region-name in the layout-master-set.{{locator}} - The master-reference "{masterReference}" on {elementName} matches no simple-page-master or page-sequence-master.{{locator}} - The region-name "{regionName}" for {elementName} is not permitted.{{locator}} - Border and padding for {elementName} "{regionName}" should be '0' (See 6.4.14 in XSL 1.1); non-standard values are allowed if relaxed validation is enabled. {{locator}} - If overflow property is set to "scroll" on {elementName}, a column-count other than "1" may not be specified.{{locator}} - First element must be the fo:root formatting object. Found {elementName} instead. Please make sure you're producing a valid XSL-FO document. - Document is empty (something might be wrong with your XSLT stylesheet). - Unknown formatting object "{offendingNode}" encountered (a child of {elementName}}.{{locator}} - Only a value of "auto" for block-progression-dimension has a well-specified behavior on fo:table. Falling back to "auto".{{locator}} - 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.{{locator}} - Either fo:table-rows or fo:table-cells may be children of an {elementName} but not both.{{locator}} - This table uses the collapsing border model. In order to resolve borders in an efficient way the table-footer must be known before any table-body is parsed. Either put the footer at the correct place or switch to the separate border model.{{locator}} - starts-row/ends-row for fo:table-cells non-applicable for children of an fo:table-row.{{locator}} - The column-number or number of cells in the row overflows the number of fo:table-columns specified for the table.{{locator}} - {propName} must be 1 or bigger, but got {actualValue}{{locator}} - table-layout=\"fixed\" and column-width unspecified => falling back to proportional-column-width(1){{locator}} - padding-* properties are not applicable to {elementName}, but a non-zero value for padding was found.{{locator}} - {elementName} overlaps in column {column}. - Negative value {propValue} of property column-number of element {elementName} forced into the next available column number {columnNumber}.{{locator}} - {breakBefore,if,break-before,break-after} ignored on {elementName} because of row spanning in progress (See XSL 1.1, {breakBefore,if,7.20.2,7.20.1}){{locator}} - Image not found.[ URI: {uri}.]{{locator}} - Image not available.[ URI: {uri}.] Reason:[ {reason}][ {e}]{{locator}} - I/O error while loading image.[ URI: {uri}.][ Reason: {ioe}]{{locator}} - The intrinsic dimensions of an instream-foreign-object could not be determined.{{locator}} - Error while handling URI: {uri}. Reason: {e}{{locator}} - Some XML content will be ignored. Could not render XML in namespace "{namespaceURI}".[ Reason: {e}] - Some XML content will be ignored. No handler defined for XML with namespace "{namespaceURI}". - Error while writing an image to the target file.[ Reason: {e}] - Temporary file could not be deleted: {tempFile} - Catalog resolver not found along the classpath - Error creating the catalog resolver: {message} - fo:leader is set to "use-content" but has no content.{{locator}} - Line {line} of a paragraph overflows the available area by {overflowLength,choice,50000#{overflowLength} millipoints|50000<more than 50 points}.{{locator}} - The contents of table-row {row} are taller than they should be (there is a block-progression-dimension or height constraint on the indicated row). Due to its contents the row grows to {effCellBPD} millipoints, but the row shouldn't get any taller than {maxCellBPD} millipoints.{{locator}} - table-layout="fixed" and width="auto", but auto-layout not supported => assuming width="100%".{{locator}} - The extent in inline-progression-direction (width) of a {elementName} is bigger than the available space ({effIPD}mpt > {maxIPD}mpt).{{locator}} - An {elementName} {{locator}} is wider than the available room in inline-progression-dimension. Adjusting end-indent based on overconstrained geometry rules (XSL 1.1, ch. 5.3.4) - Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}} - Content overflows the viewport of the {elementName} on page {page} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}} - Flow "{flowName}" does not map to the region-body in page-master "{masterName}". FOP presently does not support this.{{locator}} - Subsequences exhausted in page-sequence-master "{pageSequenceMasterName}", {canRecover,if,using previous subsequence,cannot recover}.{{locator}} - No subsequences in page-sequence-master "{pageSequenceMasterName}".{{locator}} - No simple-page-master matching "{pageMasterName}" in page-sequence-master "{pageSequenceMasterName}".{{locator}} - Content that cannot handle IPD changes is flowing to a narrower page. Part of it may be clipped by the page border. - SVG error: {message} - SVG alert: {message} - SVG info: {message} - SVG graphic could not be built. Reason: {e} - SVG graphic could not be rendered. Reason: {e} - I/O error while writing to target file.[ Reason: {ioe}] - {type}: Unresolved ID reference "{id}" found. - Page {page}: Unresolved ID reference "{id}" found. - Error while deserializing page {page}.[ Reason: {e}] - Error while serializing page {page}.[ Reason: {e}] - Error while rendering page {page}.[ Reason: {e}] - Font "{requested}" not found. Substituting with "{effective}". - Unable to load font file: {fontURL}.[ Reason: {e}] - Glyph "{ch}" (0x{ch,hex}[, {ch,glyph-name}]) not available in font "{fontName}". - Alternate text is missing on {foElement}.{{locator}} - diff --git a/src/java/org/apache/fop/events/EventFormatter_de.xml b/src/java/org/apache/fop/events/EventFormatter_de.xml deleted file mode 100644 index 0e2bd5c44..000000000 --- a/src/java/org/apache/fop/events/EventFormatter_de.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - [ (Siehe Position {loc})| (Siehe {#gatherContextInfo})| (Keine Kontextinformationen verfügbar)] - In "{elementName}" darf nur ein einziges "{offendingNode}" vorkommen!{{locator}} - Dem Element "{elementName}" fehlt ein verlangtes Property "{propertyName}"!{{locator}} - diff --git a/src/java/org/apache/fop/events/FOPEventModelFactory.java b/src/java/org/apache/fop/events/FOPEventModelFactory.java deleted file mode 100644 index 5a75042fa..000000000 --- a/src/java/org/apache/fop/events/FOPEventModelFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.events; - -import org.apache.fop.events.model.AbstractEventModelFactory; -import org.apache.fop.events.model.EventModel; - -/** - * Factory for FOP's main event model. - */ -public class FOPEventModelFactory extends AbstractEventModelFactory { - - private static final String EVENT_MODEL_FILENAME = "event-model.xml"; - - /** {@inheritDoc} */ - public EventModel createEventModel() { - return loadModel(getClass(), EVENT_MODEL_FILENAME); - } - -} diff --git a/src/java/org/apache/fop/events/ResourceEventProducer.java b/src/java/org/apache/fop/events/ResourceEventProducer.java index 3753e83da..2d92012e5 100644 --- a/src/java/org/apache/fop/events/ResourceEventProducer.java +++ b/src/java/org/apache/fop/events/ResourceEventProducer.java @@ -24,11 +24,13 @@ import java.io.FileNotFoundException; import java.io.IOException; import org.w3c.dom.Document; - import org.xml.sax.Locator; import org.apache.xmlgraphics.image.loader.ImageException; +import org.apache.fop.events.model.AbstractEventModelFactory; +import org.apache.fop.events.model.EventModel; + /** * Event producer interface for resource events (missing images, fonts etc.). */ @@ -50,6 +52,16 @@ public interface ResourceEventProducer extends EventProducer { } } + /** Event model factory for Accessibility. */ + public static class EventModelFactory extends AbstractEventModelFactory { + + /** {@inheritDoc} */ + public EventModel createEventModel() { + return loadModel(getClass(), "event-model.xml"); + } + + } + /** * Image not found. * @param source the event source diff --git a/src/java/org/apache/fop/events/ResourceEventProducer.xml b/src/java/org/apache/fop/events/ResourceEventProducer.xml new file mode 100644 index 000000000..bc8810099 --- /dev/null +++ b/src/java/org/apache/fop/events/ResourceEventProducer.xml @@ -0,0 +1,32 @@ + + + + + [ (See position {loc})| (See {#gatherContextInfo})| (No context info available)] + Image not found.[ URI: {uri}.]{{locator}} + Image not available.[ URI: {uri}.] Reason:[ {reason}][ {e}]{{locator}} + I/O error while loading image.[ URI: {uri}.][ Reason: {ioe}]{{locator}} + The intrinsic dimensions of an instream-foreign-object could not be determined.{{locator}} + Error while handling URI: {uri}. Reason: {e}{{locator}} + Some XML content will be ignored. Could not render XML in namespace "{namespaceURI}".[ Reason: {e}] + Some XML content will be ignored. No handler defined for XML with namespace "{namespaceURI}". + Error while writing an image to the target file.[ Reason: {e}] + Temporary file could not be deleted: {tempFile} + Catalog resolver not found along the classpath + Error creating the catalog resolver: {message} + diff --git a/src/java/org/apache/fop/fo/FOValidationEventProducer.java b/src/java/org/apache/fop/fo/FOValidationEventProducer.java index ff005b1b4..ae4157f3d 100644 --- a/src/java/org/apache/fop/fo/FOValidationEventProducer.java +++ b/src/java/org/apache/fop/fo/FOValidationEventProducer.java @@ -26,6 +26,8 @@ import org.apache.xmlgraphics.util.QName; import org.apache.fop.apps.FOPException; import org.apache.fop.events.EventBroadcaster; import org.apache.fop.events.EventProducer; +import org.apache.fop.events.model.AbstractEventModelFactory; +import org.apache.fop.events.model.EventModel; import org.apache.fop.fo.expr.PropertyException; /** @@ -51,6 +53,16 @@ public interface FOValidationEventProducer extends EventProducer { } } + /** Event model factory for Accessibility. */ + public static class EventModelFactory extends AbstractEventModelFactory { + + /** {@inheritDoc} */ + public EventModel createEventModel() { + return loadModel(getClass(), "event-model.xml"); + } + + } + /** * Too many child nodes. * @param source the event source diff --git a/src/java/org/apache/fop/fo/FOValidationEventProducer.xml b/src/java/org/apache/fop/fo/FOValidationEventProducer.xml new file mode 100644 index 000000000..851c6740f --- /dev/null +++ b/src/java/org/apache/fop/fo/FOValidationEventProducer.xml @@ -0,0 +1,43 @@ + + + [ (See position {loc})| (See {#gatherContextInfo})| (No context info available)] + An fo:marker is permitted only as the descendant of an fo:flow. + An fo:retrieve-marker is permitted only as the descendant of an fo:static-content. + An fo:retrieve-table-marker is permitted only as the descendant of an fo:table-header or an fo:table-footer. + An fo:bidi-override that is a descendant of an fo:leader or of the fo:inline child of an fo:footnote may not have block-level children, unless it has a nearer ancestor that is an fo:inline-container. + An fo:inline that is a descendant of an fo:leader or fo:footnote may not have block-level children, unless it has a nearer ancestor that is an fo:inline-container. + The element must be a child of fo:simple-page-master. + The element must be a child of fo:declarations. + The element must be a child of fo:declarations or fo:simple-page-master. + The element must be a child of fo:instream-foreign-object or fo:external-graphic. + The element must be a child of fo:page-sequence. + The element must be a child of fo:page-sequence or fo:simple-page-master. + An fo:wrapper is only permitted to have children that would be permitted for its parent. + For "{elementName}", only one "{offendingNode}" may be declared.{{locator}} + For "{elementName}", "{tooLateNode}" must be declared before "{tooEarlyNode}"!{{locator}} + "{offendingNode}" is not a valid child of "{elementName}"![ {ruleViolated,lookup}]{{locator}} + "{elementName}" is missing child elements.[ Required content model: {contentModel}]{{locator}} + Element "{elementName}" is missing required property "{propertyName}"!{{locator}} + 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.}{{locator}} + Only an fo:block-container that does not generate absolutely positioned areas may have one or more fo:markers as its initial children.{{locator}} + fo:marker must be an initial child: {mcname}{{locator}} + fo:marker "marker-class-name" must be unique for same parent: {mcname}{{locator}} + Invalid property encountered on "{elementName}": {attr}{{locator}} + Invalid property value encountered in {propName}="{propValue}"[: {e}]{{locator}} + The following feature isn't implemented by Apache FOP, yet: {feature} (on {elementName}){{locator}} + Missing attribute on {elementName}: Either external-destination or internal-destination must be specified.{{locator}} + Unable to clone subtree of fo:marker (marker-class-name="{markerClassName}") for fo:retrieve-marker.{{locator}} + Duplicate color profile profile name: {name}{{locator}} + Region-name ("{regionName}") is being mapped to multiple region-classes ({defaultRegionClass1} and {defaultRegionClass2}).{{locator}} + The page master name ("{name}") must be unique across page-masters and page-sequence-masters.{{locator}} + Duplicate flow-name "{flowName}" found within {elementName}.{{locator}} + The flow-name "{flowName}" on {elementName} could not be mapped to a region-name in the layout-master-set.{{locator}} + The master-reference "{masterReference}" on {elementName} matches no simple-page-master or page-sequence-master.{{locator}} + The region-name "{regionName}" for {elementName} is not permitted.{{locator}} + Border and padding for {elementName} "{regionName}" should be '0' (See 6.4.14 in XSL 1.1); non-standard values are allowed if relaxed validation is enabled. {{locator}} + If overflow property is set to "scroll" on {elementName}, a column-count other than "1" may not be specified.{{locator}} + First element must be the fo:root formatting object. Found {elementName} instead. Please make sure you're producing a valid XSL-FO document. + Document is empty (something might be wrong with your XSLT stylesheet). + Unknown formatting object "{offendingNode}" encountered (a child of {elementName}}.{{locator}} + Alternate text is missing on {foElement}.{{locator}} + diff --git a/src/java/org/apache/fop/fo/FOValidationEventProducer_de.xml b/src/java/org/apache/fop/fo/FOValidationEventProducer_de.xml new file mode 100644 index 000000000..0e2bd5c44 --- /dev/null +++ b/src/java/org/apache/fop/fo/FOValidationEventProducer_de.xml @@ -0,0 +1,23 @@ + + + + + [ (Siehe Position {loc})| (Siehe {#gatherContextInfo})| (Keine Kontextinformationen verfügbar)] + In "{elementName}" darf nur ein einziges "{offendingNode}" vorkommen!{{locator}} + Dem Element "{elementName}" fehlt ein verlangtes Property "{propertyName}"!{{locator}} + diff --git a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java b/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java index d6abf609e..5c9f88367 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java +++ b/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java @@ -23,6 +23,8 @@ import org.xml.sax.Locator; import org.apache.fop.events.EventBroadcaster; import org.apache.fop.events.EventProducer; +import org.apache.fop.events.model.AbstractEventModelFactory; +import org.apache.fop.events.model.EventModel; import org.apache.fop.fo.ValidationException; import org.apache.fop.fo.expr.PropertyException; @@ -45,6 +47,16 @@ public interface TableEventProducer extends EventProducer { } } + /** Event model factory for Accessibility. */ + public static class EventModelFactory extends AbstractEventModelFactory { + + /** {@inheritDoc} */ + public EventModel createEventModel() { + return loadModel(getClass(), "event-model.xml"); + } + + } + /** * A value other than "auto" has been specified on fo:table. * @param source the event source diff --git a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.xml b/src/java/org/apache/fop/fo/flow/table/TableEventProducer.xml new file mode 100644 index 000000000..73a73b426 --- /dev/null +++ b/src/java/org/apache/fop/fo/flow/table/TableEventProducer.xml @@ -0,0 +1,33 @@ + + + + + [ (See position {loc})| (See {#gatherContextInfo})| (No context info available)] + Only a value of "auto" for block-progression-dimension has a well-specified behavior on fo:table. Falling back to "auto".{{locator}} + 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.{{locator}} + Either fo:table-rows or fo:table-cells may be children of an {elementName} but not both.{{locator}} + This table uses the collapsing border model. In order to resolve borders in an efficient way the table-footer must be known before any table-body is parsed. Either put the footer at the correct place or switch to the separate border model.{{locator}} + starts-row/ends-row for fo:table-cells non-applicable for children of an fo:table-row.{{locator}} + The column-number or number of cells in the row overflows the number of fo:table-columns specified for the table.{{locator}} + {propName} must be 1 or bigger, but got {actualValue}{{locator}} + table-layout=\"fixed\" and column-width unspecified => falling back to proportional-column-width(1){{locator}} + padding-* properties are not applicable to {elementName}, but a non-zero value for padding was found.{{locator}} + {elementName} overlaps in column {column}. + Negative value {propValue} of property column-number of element {elementName} forced into the next available column number {columnNumber}.{{locator}} + {breakBefore,if,break-before,break-after} ignored on {elementName} because of row spanning in progress (See XSL 1.1, {breakBefore,if,7.20.2,7.20.1}){{locator}} + diff --git a/src/java/org/apache/fop/fonts/FontEventAdapter.java b/src/java/org/apache/fop/fonts/FontEventAdapter.java index 195d5d4f4..77846ee77 100644 --- a/src/java/org/apache/fop/fonts/FontEventAdapter.java +++ b/src/java/org/apache/fop/fonts/FontEventAdapter.java @@ -19,11 +19,7 @@ package org.apache.fop.fonts; -import java.util.Map; - -import org.apache.fop.events.Event; import org.apache.fop.events.EventBroadcaster; -import org.apache.fop.events.model.EventSeverity; /** * Event listener interface for font-related events. This interface extends FontEventListener @@ -31,7 +27,9 @@ import org.apache.fop.events.model.EventSeverity; */ public class FontEventAdapter implements FontEventListener { - private EventBroadcaster eventBroadcaster; + private final EventBroadcaster eventBroadcaster; + + private FontEventProducer eventProducer; /** * Creates a new FontEventAdapter. @@ -41,42 +39,26 @@ public class FontEventAdapter implements FontEventListener { this.eventBroadcaster = broadcaster; } - /** - * Returns the event group ID. - * @return the event group ID - */ - protected String getEventGroupID() { - return getClass().getName(); + private FontEventProducer getEventProducer() { + if (eventProducer == null) { + eventProducer = FontEventProducer.Provider.get(eventBroadcaster); + } + return eventProducer; } /** {@inheritDoc} */ public void fontSubstituted(Object source, FontTriplet requested, FontTriplet effective) { - Map params = new java.util.HashMap(); - params.put("requested", requested); - params.put("effective", effective); - Event ev = new Event(source, getEventGroupID() + ".fontSubstituted", - EventSeverity.WARN, params); - this.eventBroadcaster.broadcastEvent(ev); + getEventProducer().fontSubstituted(source, requested, effective); } /** {@inheritDoc} */ public void fontLoadingErrorAtAutoDetection(Object source, String fontURL, Exception e) { - Map params = new java.util.HashMap(); - params.put("fontURL", fontURL); - params.put("e", e); - Event ev = new Event(source, getEventGroupID() + ".fontLoadingErrorAtAutoDetection", - EventSeverity.WARN, params); - this.eventBroadcaster.broadcastEvent(ev); + getEventProducer().fontLoadingErrorAtAutoDetection(source, fontURL, e); } /** {@inheritDoc} */ public void glyphNotAvailable(Object source, char ch, String fontName) { - Map params = new java.util.HashMap(); - params.put("ch", new Character(ch)); - params.put("fontName", fontName); - Event ev = new Event(source, getEventGroupID() + ".glyphNotAvailable", - EventSeverity.WARN, params); - this.eventBroadcaster.broadcastEvent(ev); + getEventProducer().glyphNotAvailable(source, ch, fontName); } } diff --git a/src/java/org/apache/fop/fonts/FontEventProducer.java b/src/java/org/apache/fop/fonts/FontEventProducer.java new file mode 100644 index 000000000..719c598ee --- /dev/null +++ b/src/java/org/apache/fop/fonts/FontEventProducer.java @@ -0,0 +1,86 @@ +/* + * 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.fonts; + +import org.apache.fop.events.EventBroadcaster; +import org.apache.fop.events.EventProducer; +import org.apache.fop.events.model.AbstractEventModelFactory; +import org.apache.fop.events.model.EventModel; + +/** + * Event producer for fonts-related events. + */ +public interface FontEventProducer extends EventProducer { + + /** + * Provider class for the event producer. + */ + final class Provider { + + private Provider() { } + + /** + * Returns an event producer. + * @param broadcaster the event broadcaster to use + * @return the event producer + */ + public static FontEventProducer get(EventBroadcaster broadcaster) { + return (FontEventProducer) broadcaster.getEventProducerFor(FontEventProducer.class); + } + } + + /** Event model factory for Accessibility. */ + public static class EventModelFactory extends AbstractEventModelFactory { + + /** {@inheritDoc} */ + public EventModel createEventModel() { + return loadModel(getClass(), "event-model.xml"); + } + + } + + /** + * Notifies about a font being substituted as the requested one isn't available. + * @param source the event source + * @param requested the requested font triplet + * @param effective the effective font triplet + * @event.severity WARN + */ + void fontSubstituted(Object source, FontTriplet requested, FontTriplet effective); + + /** + * An error occurred while loading a font for auto-detection. + * @param source the event source + * @param fontURL the font URL + * @param e the original exception + * @event.severity WARN + */ + void fontLoadingErrorAtAutoDetection(Object source, String fontURL, Exception e); + + /** + * A glyph has been requested that is not available in the font. + * @param source the event source + * @param ch the character for which the glyph isn't available + * @param fontName the name of the font + * @event.severity WARN + */ + void glyphNotAvailable(Object source, char ch, String fontName); + +} diff --git a/src/java/org/apache/fop/fonts/FontEventProducer.xml b/src/java/org/apache/fop/fonts/FontEventProducer.xml new file mode 100644 index 000000000..5e7191500 --- /dev/null +++ b/src/java/org/apache/fop/fonts/FontEventProducer.xml @@ -0,0 +1,23 @@ + + + + + Font "{requested}" not found. Substituting with "{effective}". + Unable to load font file: {fontURL}.[ Reason: {e}] + Glyph "{ch}" (0x{ch,hex}[, {ch,glyph-name}]) not available in font "{fontName}". + diff --git a/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java b/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java index 7d3964181..ea81d0686 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java @@ -23,6 +23,8 @@ import org.xml.sax.Locator; import org.apache.fop.events.EventBroadcaster; import org.apache.fop.events.EventProducer; +import org.apache.fop.events.model.AbstractEventModelFactory; +import org.apache.fop.events.model.EventModel; import org.apache.fop.fo.pagination.PageProductionException; /** @@ -48,6 +50,16 @@ public interface BlockLevelEventProducer extends EventProducer { } } + /** Event model factory for Accessibility. */ + public static class EventModelFactory extends AbstractEventModelFactory { + + /** {@inheritDoc} */ + public EventModel createEventModel() { + return loadModel(getClass(), "event-model.xml"); + } + + } + /** * The contents of a table-row are too big to fit in the constraints. * @param source the event source diff --git a/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml b/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml new file mode 100644 index 000000000..a800a99a9 --- /dev/null +++ b/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml @@ -0,0 +1,32 @@ + + + + + [ (See position {loc})| (See {#gatherContextInfo})| (No context info available)] + The contents of table-row {row} are taller than they should be (there is a block-progression-dimension or height constraint on the indicated row). Due to its contents the row grows to {effCellBPD} millipoints, but the row shouldn't get any taller than {maxCellBPD} millipoints.{{locator}} + table-layout="fixed" and width="auto", but auto-layout not supported => assuming width="100%".{{locator}} + The extent in inline-progression-direction (width) of a {elementName} is bigger than the available space ({effIPD}mpt > {maxIPD}mpt).{{locator}} + An {elementName} {{locator}} is wider than the available room in inline-progression-dimension. Adjusting end-indent based on overconstrained geometry rules (XSL 1.1, ch. 5.3.4) + Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}} + Content overflows the viewport of the {elementName} on page {page} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}} + Flow "{flowName}" does not map to the region-body in page-master "{masterName}". FOP presently does not support this.{{locator}} + Subsequences exhausted in page-sequence-master "{pageSequenceMasterName}", {canRecover,if,using previous subsequence,cannot recover}.{{locator}} + No subsequences in page-sequence-master "{pageSequenceMasterName}".{{locator}} + No simple-page-master matching "{pageMasterName}" in page-sequence-master "{pageSequenceMasterName}".{{locator}} + Content that cannot handle IPD changes is flowing to a narrower page. Part of it may be clipped by the page border. + diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java index c9c65e769..88e8d7b04 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java @@ -23,6 +23,8 @@ import org.xml.sax.Locator; import org.apache.fop.events.EventBroadcaster; import org.apache.fop.events.EventProducer; +import org.apache.fop.events.model.AbstractEventModelFactory; +import org.apache.fop.events.model.EventModel; /** * Event producer interface for inline-level layout managers. @@ -45,6 +47,16 @@ public interface InlineLevelEventProducer extends EventProducer { } } + /** Event model factory for Accessibility. */ + public static class EventModelFactory extends AbstractEventModelFactory { + + /** {@inheritDoc} */ + public EventModel createEventModel() { + return loadModel(getClass(), "event-model.xml"); + } + + } + /** * fo:leader with "use-content" but without children. * @param source the event source diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml new file mode 100644 index 000000000..dea56a6d6 --- /dev/null +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml @@ -0,0 +1,23 @@ + + + + + [ (See position {loc})| (See {#gatherContextInfo})| (No context info available)] + fo:leader is set to "use-content" but has no content.{{locator}} + Line {line} of a paragraph overflows the available area by {overflowLength,choice,50000#{overflowLength} millipoints|50000<more than 50 points}.{{locator}} + diff --git a/src/java/org/apache/fop/render/RendererEventProducer.java b/src/java/org/apache/fop/render/RendererEventProducer.java index c61e4a8ee..3eb85be81 100644 --- a/src/java/org/apache/fop/render/RendererEventProducer.java +++ b/src/java/org/apache/fop/render/RendererEventProducer.java @@ -23,6 +23,8 @@ import java.io.IOException; import org.apache.fop.events.EventBroadcaster; import org.apache.fop.events.EventProducer; +import org.apache.fop.events.model.AbstractEventModelFactory; +import org.apache.fop.events.model.EventModel; /** * Event producer interface for rendering-specific events. @@ -43,6 +45,16 @@ public interface RendererEventProducer extends EventProducer { } } + /** Event model factory for Accessibility. */ + public static class EventModelFactory extends AbstractEventModelFactory { + + /** {@inheritDoc} */ + public EventModel createEventModel() { + return loadModel(getClass(), "event-model.xml"); + } + + } + /** * I/O error while writing target file. * @param source the event source diff --git a/src/java/org/apache/fop/render/RendererEventProducer.xml b/src/java/org/apache/fop/render/RendererEventProducer.xml new file mode 100644 index 000000000..34a7be4a9 --- /dev/null +++ b/src/java/org/apache/fop/render/RendererEventProducer.xml @@ -0,0 +1,21 @@ + + + + + I/O error while writing to target file.[ Reason: {ioe}] + diff --git a/src/java/org/apache/fop/svg/SVGEventProducer.java b/src/java/org/apache/fop/svg/SVGEventProducer.java index 27d7da215..cdff24a36 100644 --- a/src/java/org/apache/fop/svg/SVGEventProducer.java +++ b/src/java/org/apache/fop/svg/SVGEventProducer.java @@ -21,6 +21,8 @@ package org.apache.fop.svg; import org.apache.fop.events.EventBroadcaster; import org.apache.fop.events.EventProducer; +import org.apache.fop.events.model.AbstractEventModelFactory; +import org.apache.fop.events.model.EventModel; /** * Event producer interface for SVG-related events. @@ -43,6 +45,16 @@ public interface SVGEventProducer extends EventProducer { } } + /** Event model factory for Accessibility. */ + public static class EventModelFactory extends AbstractEventModelFactory { + + /** {@inheritDoc} */ + public EventModel createEventModel() { + return loadModel(getClass(), "event-model.xml"); + } + + } + /** * Error during SVG processing. Either message or e must be set. * @param source the event source diff --git a/src/java/org/apache/fop/svg/SVGEventProducer.xml b/src/java/org/apache/fop/svg/SVGEventProducer.xml new file mode 100644 index 000000000..c85a6cd15 --- /dev/null +++ b/src/java/org/apache/fop/svg/SVGEventProducer.xml @@ -0,0 +1,25 @@ + + + + + SVG error: {message} + SVG alert: {message} + SVG info: {message} + SVG graphic could not be built. Reason: {e} + SVG graphic could not be rendered. Reason: {e} + diff --git a/test/events/font.fo b/test/events/font.fo new file mode 100644 index 000000000..551527522 --- /dev/null +++ b/test/events/font.fo @@ -0,0 +1,14 @@ + + + + + + + + + + This block uses an unknown font. + + + diff --git a/test/java/org/apache/fop/events/EventProcessingTestCase.java b/test/java/org/apache/fop/events/EventProcessingTestCase.java index cf23c1dab..c1fc757a8 100644 --- a/test/java/org/apache/fop/events/EventProcessingTestCase.java +++ b/test/java/org/apache/fop/events/EventProcessingTestCase.java @@ -43,6 +43,7 @@ import org.apache.fop.apps.FopFactory; import org.apache.fop.area.AreaEventProducer; import org.apache.fop.fo.FOValidationEventProducer; import org.apache.fop.fo.flow.table.TableEventProducer; +import org.apache.fop.fonts.FontEventProducer; import org.apache.fop.layoutmgr.BlockLevelEventProducer; import org.apache.fop.layoutmgr.inline.InlineLevelEventProducer; @@ -109,6 +110,12 @@ public class EventProcessingTestCase extends TestCase { InlineLevelEventProducer.class.getName() + ".lineOverflows"); } + public void testFont() throws FOPException, TransformerException { + doTest("font.fo", + FontEventProducer.class.getName() + ".fontSubstituted"); + } + + public static Test suite() { TestSuite suite = new TestSuite(); suite.addTestSuite(EventProcessingTestCase.class);