diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2010-04-09 16:09:57 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2010-04-09 16:09:57 +0000 |
commit | 8f6b532710381d795a1cb84d0a2af7b447db74f4 (patch) | |
tree | b7ea4324bfddd198a36a813d7015a33c0b7fbe1f | |
parent | 83f36b614c3f1f1a866ff70fe9363cd5be31e986 (diff) | |
download | xmlgraphics-fop-8f6b532710381d795a1cb84d0a2af7b447db74f4.tar.gz xmlgraphics-fop-8f6b532710381d795a1cb84d0a2af7b447db74f4.zip |
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
28 files changed, 540 insertions, 198 deletions
@@ -360,16 +360,63 @@ list of possible build targets. <pathelement location="${build.codegen-classes.dir}"/> </classpath> </taskdef> + <eventResourceGenerator modelfile="${build.gensrc.dir}/org/apache/fop/area/event-model.xml" + translationfile="${src.java.dir}/org/apache/fop/area/AreaEventProducer.xml"> + <fileset dir="${src.java.dir}"> + <include name="org/apache/fop/area/AreaEventProducer.java"/> + </fileset> + </eventResourceGenerator> <eventResourceGenerator modelfile="${build.gensrc.dir}/org/apache/fop/events/event-model.xml" - translationfile="${src.java.dir}/org/apache/fop/events/EventFormatter.xml"> + translationfile="${src.java.dir}/org/apache/fop/events/ResourceEventProducer.xml"> <fileset dir="${src.java.dir}"> - <include name="**/*.java"/> - <exclude name="org/apache/fop/render/*/**/*.java"/> - <exclude name="org/apache/fop/afp/**/*.java"/> - <exclude name="org/apache/fop/accessibility/**/*.java"/> + <include name="org/apache/fop/events/ResourceEventProducer.java"/> + </fileset> + </eventResourceGenerator> + <eventResourceGenerator + modelfile="${build.gensrc.dir}/org/apache/fop/fo/flow/table/event-model.xml" + translationfile="${src.java.dir}/org/apache/fop/fo/flow/table/TableEventProducer.xml"> + <fileset dir="${src.java.dir}"> + <include name="org/apache/fop/fo/flow/table/TableEventProducer.java"/> + </fileset> + </eventResourceGenerator> + <eventResourceGenerator modelfile="${build.gensrc.dir}/org/apache/fop/fo/event-model.xml" + translationfile="${src.java.dir}/org/apache/fop/fo/FOValidationEventProducer.xml"> + <fileset dir="${src.java.dir}"> + <include name="org/apache/fop/fo/FOValidationEventProducer.java"/> + </fileset> + </eventResourceGenerator> + <eventResourceGenerator modelfile="${build.gensrc.dir}/org/apache/fop/layoutmgr/event-model.xml" + translationfile="${src.java.dir}/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml"> + <fileset dir="${src.java.dir}"> + <include name="org/apache/fop/layoutmgr/BlockLevelEventProducer.java"/> </fileset> </eventResourceGenerator> - <fixcrlf file="${src.java.dir}/org/apache/fop/events/EventFormatter.xml" tab="remove" tablength="2"/> + <eventResourceGenerator + modelfile="${build.gensrc.dir}/org/apache/fop/layoutmgr/inline/event-model.xml" + translationfile="${src.java.dir}/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml"> + <fileset dir="${src.java.dir}"> + <include name="org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java"/> + </fileset> + </eventResourceGenerator> + <eventResourceGenerator modelfile="${build.gensrc.dir}/org/apache/fop/render/event-model.xml" + translationfile="${src.java.dir}/org/apache/fop/render/RendererEventProducer.xml"> + <fileset dir="${src.java.dir}"> + <include name="org/apache/fop/render/RendererEventProducer.java"/> + </fileset> + </eventResourceGenerator> + <eventResourceGenerator modelfile="${build.gensrc.dir}/org/apache/fop/svg/event-model.xml" + translationfile="${src.java.dir}/org/apache/fop/svg/SVGEventProducer.xml"> + <fileset dir="${src.java.dir}"> + <include name="org/apache/fop/svg/SVGEventProducer.java"/> + </fileset> + </eventResourceGenerator> + <eventResourceGenerator modelfile="${build.gensrc.dir}/org/apache/fop/fonts/event-model.xml" + translationfile="${src.java.dir}/org/apache/fop/fonts/FontEventProducer.xml"> + <fileset dir="${src.java.dir}"> + <include name="org/apache/fop/fonts/FontEventProducer.java"/> + </fileset> + </eventResourceGenerator> + <eventResourceGenerator modelfile="${build.gensrc.dir}/org/apache/fop/accessibility/event-model.xml" translationfile="${src.java.dir}/org/apache/fop/accessibility/AccessibilityEventProducer.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 @@ +<?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. + 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$ --> +<catalogue xml:lang="en"> + <message key="org.apache.fop.area.AreaEventProducer.unresolvedIDReference">{type}: Unresolved ID reference "{id}" found.</message> + <message key="org.apache.fop.area.AreaEventProducer.unresolvedIDReferenceOnPage">Page {page}: Unresolved ID reference "{id}" found.</message> + <message key="org.apache.fop.area.AreaEventProducer.pageLoadError">Error while deserializing page {page}.[ Reason: {e}]</message> + <message key="org.apache.fop.area.AreaEventProducer.pageSaveError">Error while serializing page {page}.[ Reason: {e}]</message> + <message key="org.apache.fop.area.AreaEventProducer.pageRenderingError">Error while rendering page {page}.[ Reason: {e}]</message> +</catalogue> 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 @@ -<?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. - 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$ --> -<catalogue xml:lang="en"> - <message key="locator">[ (See position {loc})| (See {#gatherContextInfo})| (No context info available)]</message> - <message key="rule.markerDescendantOfFlow">An fo:marker is permitted only as the descendant of an fo:flow.</message> - <message key="rule.retrieveMarkerDescendantOfStaticContent">An fo:retrieve-marker is permitted only as the descendant of an fo:static-content.</message> - <message key="rule.retrieveTableMarkerDescendantOfHeaderOrFooter">An fo:retrieve-table-marker is permitted only as the descendant of an fo:table-header or an fo:table-footer.</message> - <message key="rule.bidiOverrideContent">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.</message> - <message key="rule.inlineContent">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.</message> - <message key="rule.childOfSPM">The element must be a child of fo:simple-page-master.</message> - <message key="rule.childOfDeclarations">The element must be a child of fo:declarations.</message> - <message key="rule.childOfSPMorDeclarations">The element must be a child of fo:declarations or fo:simple-page-master.</message> - <message key="rule.childOfInstreamForeignObjectorExternalGraphic">The element must be a child of fo:instream-foreign-object or fo:external-graphic.</message> - <message key="rule.childOfPageSequence">The element must be a child of fo:page-sequence.</message> - <message key="rule.childOfPageSequenceOrSPM">The element must be a child of fo:page-sequence or fo:simple-page-master.</message> - <message key="rule.wrapperInvalidChildForParent">An fo:wrapper is only permitted to have children that would be permitted for its parent.</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.tooManyNodes">For "{elementName}", only one "{offendingNode}" may be declared.{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.nodeOutOfOrder">For "{elementName}", "{tooLateNode}" must be declared before "{tooEarlyNode}"!{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.invalidChild">"{offendingNode}" is not a valid child of "{elementName}"![ {ruleViolated,lookup}]{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.missingChildElement">"{elementName}" is missing child elements.[ -Required content model: {contentModel}]{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.missingProperty">Element "{elementName}" is missing required property "{propertyName}"!{{locator}}</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.}{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.markerBlockContainerAbsolutePosition">Only an fo:block-container that does not generate absolutely positioned areas may have one or more fo:markers as its initial children.{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.markerNotInitialChild">fo:marker must be an initial child: {mcname}{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.markerNotUniqueForSameParent">fo:marker "marker-class-name" must be unique for same parent: {mcname}{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.invalidProperty">Invalid property encountered on "{elementName}": {attr}{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.invalidPropertyValue">Invalid property value encountered in {propName}="{propValue}"[: {e}]{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.unimplementedFeature">The following feature isn't implemented by Apache FOP, yet: {feature} (on {elementName}){{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.missingLinkDestination">Missing attribute on {elementName}: Either external-destination or internal-destination must be specified.{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.markerCloningFailed">Unable to clone subtree of fo:marker (marker-class-name="{markerClassName}") for fo:retrieve-marker.{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.colorProfileNameNotUnique">Duplicate color profile profile name: {name}{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.regionNameMappedToMultipleRegionClasses">Region-name ("{regionName}") is being mapped to multiple region-classes ({defaultRegionClass1} and {defaultRegionClass2}).{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.masterNameNotUnique">The page master name ("{name}") must be unique across page-masters and page-sequence-masters.{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.duplicateFlowNameInPageSequence">Duplicate flow-name "{flowName}" found within {elementName}.{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.flowNameNotMapped">The flow-name "{flowName}" on {elementName} could not be mapped to a region-name in the layout-master-set.{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.masterNotFound">The master-reference "{masterReference}" on {elementName} matches no simple-page-master or page-sequence-master.{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.illegalRegionName">The region-name "{regionName}" for {elementName} is not permitted.{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.nonZeroBorderPaddingOnRegion">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}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.columnCountErrorOnRegionBodyOverflowScroll">If overflow property is set to "scroll" on {elementName}, a column-count other than "1" may not be specified.{{locator}}</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.invalidFORoot">First element must be the fo:root formatting object. Found {elementName} instead. Please make sure you're producing a valid XSL-FO document.</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.emptyDocument">Document is empty (something might be wrong with your XSLT stylesheet).</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.unknownFormattingObject">Unknown formatting object "{offendingNode}" encountered (a child of {elementName}}.{{locator}}</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".{{locator}}</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.{{locator}}</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.{{locator}}</message> - <message key="org.apache.fop.fo.flow.table.TableEventProducer.footerOrderCannotRecover">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}}</message> - <message key="org.apache.fop.fo.flow.table.TableEventProducer.startEndRowUnderTableRowWarning">starts-row/ends-row for fo:table-cells non-applicable for children of an fo:table-row.{{locator}}</message> - <message key="org.apache.fop.fo.flow.table.TableEventProducer.tooManyCells">The column-number or number of cells in the row overflows the number of fo:table-columns specified for the table.{{locator}}</message> - <message key="org.apache.fop.fo.flow.table.TableEventProducer.valueMustBeBiggerGtEqOne">{propName} must be 1 or bigger, but got {actualValue}{{locator}}</message> - <message key="org.apache.fop.fo.flow.table.TableEventProducer.warnImplicitColumns">table-layout=\"fixed\" and column-width unspecified => falling back to proportional-column-width(1){{locator}}</message> - <message key="org.apache.fop.fo.flow.table.TableEventProducer.paddingNotApplicable">padding-* properties are not applicable to {elementName}, but a non-zero value for padding was found.{{locator}}</message> - <message key="org.apache.fop.fo.flow.table.TableEventProducer.cellOverlap">{elementName} overlaps in column {column}.<!-- no locator here, exception will be wrapped --></message> - <message key="org.apache.fop.fo.flow.table.TableEventProducer.forceNextColumnNumber">Negative value {propValue} of property column-number of element {elementName} forced into the next available column number {columnNumber}.{{locator}}</message> - <message key="org.apache.fop.fo.flow.table.TableEventProducer.breakIgnoredDueToRowSpanning">{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}}</message> - <message key="org.apache.fop.events.ResourceEventProducer.imageNotFound">Image not found.[ URI: {uri}.]{{locator}}</message> - <message key="org.apache.fop.events.ResourceEventProducer.imageError">Image not available.[ URI: {uri}.] Reason:[ {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.ifoNoIntrinsicSize">The intrinsic dimensions of an instream-foreign-object could not be determined.{{locator}}</message> - <message key="org.apache.fop.events.ResourceEventProducer.uriError">Error while handling URI: {uri}. Reason: {e}{{locator}}</message> - <message key="org.apache.fop.events.ResourceEventProducer.foreignXMLProcessingError">Some XML content will be ignored. Could not render XML in namespace "{namespaceURI}".[ Reason: {e}]</message> - <message key="org.apache.fop.events.ResourceEventProducer.foreignXMLNoHandler">Some XML content will be ignored. No handler defined for XML with namespace "{namespaceURI}".</message> - <message key="org.apache.fop.events.ResourceEventProducer.imageWritingError">Error while writing an image to the target file.[ Reason: {e}]</message> - <message key="org.apache.fop.events.ResourceEventProducer.cannotDeleteTempFile">Temporary file could not be deleted: {tempFile}</message> - <message key="org.apache.fop.events.ResourceEventProducer.catalogResolverNotFound">Catalog resolver not found along the classpath</message> - <message key="org.apache.fop.events.ResourceEventProducer.catalogResolverNotCreated">Error creating the catalog resolver: {message}</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<more than 50 points}.{{locator}}</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.rowTooTall">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}}</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.tableFixedAutoWidthNotSupported">table-layout="fixed" and width="auto", but auto-layout not supported => assuming width="100%".{{locator}}</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.objectTooWide">The extent in inline-progression-direction (width) of a {elementName} is bigger than the available space ({effIPD}mpt > {maxIPD}mpt).{{locator}}</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.overconstrainedAdjustEndIndent">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)</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.viewportOverflow">Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.regionOverflow">Content overflows the viewport of the {elementName} on page {page} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.flowNotMappingToRegionBody">Flow "{flowName}" does not map to the region-body in page-master "{masterName}". FOP presently does not support this.{{locator}}</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.pageSequenceMasterExhausted">Subsequences exhausted in page-sequence-master "{pageSequenceMasterName}", {canRecover,if,using previous subsequence,cannot recover}.{{locator}}</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.missingSubsequencesInPageSequenceMaster">No subsequences in page-sequence-master "{pageSequenceMasterName}".{{locator}}</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.noMatchingPageMaster">No simple-page-master matching "{pageMasterName}" in page-sequence-master "{pageSequenceMasterName}".{{locator}}</message> - <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.nonRestartableContentFlowingToNarrowerPage">Content that cannot handle IPD changes is flowing to a narrower page. Part of it may be clipped by the page border.</message> - <message key="org.apache.fop.svg.SVGEventProducer.error">SVG error: {message}</message> - <message key="org.apache.fop.svg.SVGEventProducer.alert">SVG alert: {message}</message> - <message key="org.apache.fop.svg.SVGEventProducer.info">SVG info: {message}</message> - <message key="org.apache.fop.svg.SVGEventProducer.svgNotBuilt">SVG graphic could not be built. Reason: {e}</message> - <message key="org.apache.fop.svg.SVGEventProducer.svgRenderingError">SVG graphic could not be rendered. Reason: {e}</message> - <message key="org.apache.fop.render.RendererEventProducer.ioError">I/O error while writing to target file.[ Reason: {ioe}]</message> - <message key="org.apache.fop.area.AreaEventProducer.unresolvedIDReference">{type}: Unresolved ID reference "{id}" found.</message> - <message key="org.apache.fop.area.AreaEventProducer.unresolvedIDReferenceOnPage">Page {page}: Unresolved ID reference "{id}" found.</message> - <message key="org.apache.fop.area.AreaEventProducer.pageLoadError">Error while deserializing page {page}.[ Reason: {e}]</message> - <message key="org.apache.fop.area.AreaEventProducer.pageSaveError">Error while serializing page {page}.[ Reason: {e}]</message> - <message key="org.apache.fop.area.AreaEventProducer.pageRenderingError">Error while rendering page {page}.[ Reason: {e}]</message> - <message key="org.apache.fop.fonts.FontEventAdapter.fontSubstituted">Font "{requested}" not found. Substituting with "{effective}".</message> - <message key="org.apache.fop.fonts.FontEventAdapter.fontLoadingErrorAtAutoDetection">Unable to load font file: {fontURL}.[ Reason: {e}]</message> - <message key="org.apache.fop.fonts.FontEventAdapter.glyphNotAvailable">Glyph "{ch}" (0x{ch,hex}[, {ch,glyph-name}]) not available in font "{fontName}".</message> - <message key="org.apache.fop.fo.FOValidationEventProducer.altTextMissing">Alternate text is missing on {foElement}.{{locator}}</message> -</catalogue> 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 @@ +<?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. + 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$ --> +<catalogue xml:lang="en"> + <message key="locator">[ (See position {loc})| (See {#gatherContextInfo})| (No context info available)]</message> + <message key="org.apache.fop.events.ResourceEventProducer.imageNotFound">Image not found.[ URI: {uri}.]{{locator}}</message> + <message key="org.apache.fop.events.ResourceEventProducer.imageError">Image not available.[ URI: {uri}.] Reason:[ {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.ifoNoIntrinsicSize">The intrinsic dimensions of an instream-foreign-object could not be determined.{{locator}}</message> + <message key="org.apache.fop.events.ResourceEventProducer.uriError">Error while handling URI: {uri}. Reason: {e}{{locator}}</message> + <message key="org.apache.fop.events.ResourceEventProducer.foreignXMLProcessingError">Some XML content will be ignored. Could not render XML in namespace "{namespaceURI}".[ Reason: {e}]</message> + <message key="org.apache.fop.events.ResourceEventProducer.foreignXMLNoHandler">Some XML content will be ignored. No handler defined for XML with namespace "{namespaceURI}".</message> + <message key="org.apache.fop.events.ResourceEventProducer.imageWritingError">Error while writing an image to the target file.[ Reason: {e}]</message> + <message key="org.apache.fop.events.ResourceEventProducer.cannotDeleteTempFile">Temporary file could not be deleted: {tempFile}</message> + <message key="org.apache.fop.events.ResourceEventProducer.catalogResolverNotFound">Catalog resolver not found along the classpath</message> + <message key="org.apache.fop.events.ResourceEventProducer.catalogResolverNotCreated">Error creating the catalog resolver: {message}</message> +</catalogue> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<catalogue xml:lang="en"> + <message key="locator">[ (See position {loc})| (See {#gatherContextInfo})| (No context info available)]</message> + <message key="rule.markerDescendantOfFlow">An fo:marker is permitted only as the descendant of an fo:flow.</message> + <message key="rule.retrieveMarkerDescendantOfStaticContent">An fo:retrieve-marker is permitted only as the descendant of an fo:static-content.</message> + <message key="rule.retrieveTableMarkerDescendantOfHeaderOrFooter">An fo:retrieve-table-marker is permitted only as the descendant of an fo:table-header or an fo:table-footer.</message> + <message key="rule.bidiOverrideContent">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.</message> + <message key="rule.inlineContent">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.</message> + <message key="rule.childOfSPM">The element must be a child of fo:simple-page-master.</message> + <message key="rule.childOfDeclarations">The element must be a child of fo:declarations.</message> + <message key="rule.childOfSPMorDeclarations">The element must be a child of fo:declarations or fo:simple-page-master.</message> + <message key="rule.childOfInstreamForeignObjectorExternalGraphic">The element must be a child of fo:instream-foreign-object or fo:external-graphic.</message> + <message key="rule.childOfPageSequence">The element must be a child of fo:page-sequence.</message> + <message key="rule.childOfPageSequenceOrSPM">The element must be a child of fo:page-sequence or fo:simple-page-master.</message> + <message key="rule.wrapperInvalidChildForParent">An fo:wrapper is only permitted to have children that would be permitted for its parent.</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.tooManyNodes">For "{elementName}", only one "{offendingNode}" may be declared.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.nodeOutOfOrder">For "{elementName}", "{tooLateNode}" must be declared before "{tooEarlyNode}"!{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.invalidChild">"{offendingNode}" is not a valid child of "{elementName}"![ {ruleViolated,lookup}]{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.missingChildElement">"{elementName}" is missing child elements.[ Required content model: {contentModel}]{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.missingProperty">Element "{elementName}" is missing required property "{propertyName}"!{{locator}}</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.}{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.markerBlockContainerAbsolutePosition">Only an fo:block-container that does not generate absolutely positioned areas may have one or more fo:markers as its initial children.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.markerNotInitialChild">fo:marker must be an initial child: {mcname}{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.markerNotUniqueForSameParent">fo:marker "marker-class-name" must be unique for same parent: {mcname}{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.invalidProperty">Invalid property encountered on "{elementName}": {attr}{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.invalidPropertyValue">Invalid property value encountered in {propName}="{propValue}"[: {e}]{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.unimplementedFeature">The following feature isn't implemented by Apache FOP, yet: {feature} (on {elementName}){{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.missingLinkDestination">Missing attribute on {elementName}: Either external-destination or internal-destination must be specified.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.markerCloningFailed">Unable to clone subtree of fo:marker (marker-class-name="{markerClassName}") for fo:retrieve-marker.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.colorProfileNameNotUnique">Duplicate color profile profile name: {name}{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.regionNameMappedToMultipleRegionClasses">Region-name ("{regionName}") is being mapped to multiple region-classes ({defaultRegionClass1} and {defaultRegionClass2}).{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.masterNameNotUnique">The page master name ("{name}") must be unique across page-masters and page-sequence-masters.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.duplicateFlowNameInPageSequence">Duplicate flow-name "{flowName}" found within {elementName}.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.flowNameNotMapped">The flow-name "{flowName}" on {elementName} could not be mapped to a region-name in the layout-master-set.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.masterNotFound">The master-reference "{masterReference}" on {elementName} matches no simple-page-master or page-sequence-master.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.illegalRegionName">The region-name "{regionName}" for {elementName} is not permitted.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.nonZeroBorderPaddingOnRegion">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}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.columnCountErrorOnRegionBodyOverflowScroll">If overflow property is set to "scroll" on {elementName}, a column-count other than "1" may not be specified.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.invalidFORoot">First element must be the fo:root formatting object. Found {elementName} instead. Please make sure you're producing a valid XSL-FO document.</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.emptyDocument">Document is empty (something might be wrong with your XSLT stylesheet).</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.unknownFormattingObject">Unknown formatting object "{offendingNode}" encountered (a child of {elementName}}.{{locator}}</message> + <message key="org.apache.fop.fo.FOValidationEventProducer.altTextMissing">Alternate text is missing on {foElement}.{{locator}}</message> +</catalogue> diff --git a/src/java/org/apache/fop/events/EventFormatter_de.xml b/src/java/org/apache/fop/fo/FOValidationEventProducer_de.xml index 0e2bd5c44..0e2bd5c44 100644 --- a/src/java/org/apache/fop/events/EventFormatter_de.xml +++ b/src/java/org/apache/fop/fo/FOValidationEventProducer_de.xml 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 @@ +<?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. + 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$ --> +<catalogue xml:lang="en"> + <message key="locator">[ (See position {loc})| (See {#gatherContextInfo})| (No context info available)]</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".{{locator}}</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.{{locator}}</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.{{locator}}</message> + <message key="org.apache.fop.fo.flow.table.TableEventProducer.footerOrderCannotRecover">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}}</message> + <message key="org.apache.fop.fo.flow.table.TableEventProducer.startEndRowUnderTableRowWarning">starts-row/ends-row for fo:table-cells non-applicable for children of an fo:table-row.{{locator}}</message> + <message key="org.apache.fop.fo.flow.table.TableEventProducer.tooManyCells">The column-number or number of cells in the row overflows the number of fo:table-columns specified for the table.{{locator}}</message> + <message key="org.apache.fop.fo.flow.table.TableEventProducer.valueMustBeBiggerGtEqOne">{propName} must be 1 or bigger, but got {actualValue}{{locator}}</message> + <message key="org.apache.fop.fo.flow.table.TableEventProducer.warnImplicitColumns">table-layout=\"fixed\" and column-width unspecified => falling back to proportional-column-width(1){{locator}}</message> + <message key="org.apache.fop.fo.flow.table.TableEventProducer.paddingNotApplicable">padding-* properties are not applicable to {elementName}, but a non-zero value for padding was found.{{locator}}</message> + <message key="org.apache.fop.fo.flow.table.TableEventProducer.cellOverlap">{elementName} overlaps in column {column}.<!-- no locator here, exception will be wrapped --></message> + <message key="org.apache.fop.fo.flow.table.TableEventProducer.forceNextColumnNumber">Negative value {propValue} of property column-number of element {elementName} forced into the next available column number {columnNumber}.{{locator}}</message> + <message key="org.apache.fop.fo.flow.table.TableEventProducer.breakIgnoredDueToRowSpanning">{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}}</message> +</catalogue> 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 @@ +<?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. + 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$ --> +<catalogue xml:lang="en"> + <message key="org.apache.fop.fonts.FontEventProducer.fontSubstituted">Font "{requested}" not found. Substituting with "{effective}".</message> + <message key="org.apache.fop.fonts.FontEventProducer.fontLoadingErrorAtAutoDetection">Unable to load font file: {fontURL}.[ Reason: {e}]</message> + <message key="org.apache.fop.fonts.FontEventProducer.glyphNotAvailable">Glyph "{ch}" (0x{ch,hex}[, {ch,glyph-name}]) not available in font "{fontName}".</message> +</catalogue> 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 @@ +<?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. + 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$ --> +<catalogue xml:lang="en"> + <message key="locator">[ (See position {loc})| (See {#gatherContextInfo})| (No context info available)]</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.rowTooTall">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}}</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.tableFixedAutoWidthNotSupported">table-layout="fixed" and width="auto", but auto-layout not supported => assuming width="100%".{{locator}}</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.objectTooWide">The extent in inline-progression-direction (width) of a {elementName} is bigger than the available space ({effIPD}mpt > {maxIPD}mpt).{{locator}}</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.overconstrainedAdjustEndIndent">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)</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.viewportOverflow">Content overflows the viewport of an {elementName} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.regionOverflow">Content overflows the viewport of the {elementName} on page {page} in block-progression direction by {amount} millipoints.{clip,if, Content will be clipped.}{{locator}}</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.flowNotMappingToRegionBody">Flow "{flowName}" does not map to the region-body in page-master "{masterName}". FOP presently does not support this.{{locator}}</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.pageSequenceMasterExhausted">Subsequences exhausted in page-sequence-master "{pageSequenceMasterName}", {canRecover,if,using previous subsequence,cannot recover}.{{locator}}</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.missingSubsequencesInPageSequenceMaster">No subsequences in page-sequence-master "{pageSequenceMasterName}".{{locator}}</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.noMatchingPageMaster">No simple-page-master matching "{pageMasterName}" in page-sequence-master "{pageSequenceMasterName}".{{locator}}</message> + <message key="org.apache.fop.layoutmgr.BlockLevelEventProducer.nonRestartableContentFlowingToNarrowerPage">Content that cannot handle IPD changes is flowing to a narrower page. Part of it may be clipped by the page border.</message> +</catalogue> 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 @@ +<?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. + 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$ --> +<catalogue xml:lang="en"> + <message key="locator">[ (See position {loc})| (See {#gatherContextInfo})| (No context info available)]</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<more than 50 points}.{{locator}}</message> +</catalogue> 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 @@ +<?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. + 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$ --> +<catalogue xml:lang="en"> + <message key="org.apache.fop.render.RendererEventProducer.ioError">I/O error while writing to target file.[ Reason: {ioe}]</message> +</catalogue> 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 @@ +<?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. + 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$ --> +<catalogue xml:lang="en"> + <message key="org.apache.fop.svg.SVGEventProducer.error">SVG error: {message}</message> + <message key="org.apache.fop.svg.SVGEventProducer.alert">SVG alert: {message}</message> + <message key="org.apache.fop.svg.SVGEventProducer.info">SVG info: {message}</message> + <message key="org.apache.fop.svg.SVGEventProducer.svgNotBuilt">SVG graphic could not be built. Reason: {e}</message> + <message key="org.apache.fop.svg.SVGEventProducer.svgRenderingError">SVG graphic could not be rendered. Reason: {e}</message> +</catalogue> 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 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="420pt" page-width="320pt" margin="10pt"> + <fo:region-body background-color="#F0F0F0"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block font-family="blah">This block uses an unknown font.</fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> 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); |