Author: vhennebert
Date: Fri Oct 16 15:53:13 2009
New Revision: 825964
URL: http://svn.apache.org/viewvc?rev=825964&view=rev
Log:
Route message for missing alt-text property through event notification system
Modified:
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java
Modified:
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml?rev=825964&r1=825963&r2=825964&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml
(original)
+++
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/events/EventFormatter.xml
Fri Oct 16 15:53:13 2009
@@ -105,4 +105,5 @@
<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>
Modified:
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java?rev=825964&r1=825963&r2=825964&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java
(original)
+++
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/FOValidationEventProducer.java
Fri Oct 16 15:53:13 2009
@@ -36,7 +36,9 @@
/**
* Provider class for the event producer.
*/
- class Provider {
+ final class Provider {
+
+ private Provider() { }
/**
* Returns an event producer.
@@ -354,4 +356,13 @@
void unknownFormattingObject(Object source, String elementName,
QName offendingNode, Locator loc);
+ /**
+ * Alternate text is missing for a graphic element.
+ *
+ * @param source the event source
+ * @param foElement name of the element (external-graphic or
instream-foreign-object)
+ * @param loc the location of the error or null
+ * @event.severity WARN
+ */
+ void altTextMissing(Object source, String foElement, Locator loc);
}
Modified:
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java?rev=825964&r1=825963&r2=825964&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
(original)
+++
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
Fri Oct 16 15:53:13 2009
@@ -47,7 +47,7 @@
propertyAttributes.add("internal-destination");
propertyAttributes.add("disable-column-balancing");
//These are FOP's extension properties for accessibility
- propertyAttributes.add("alt");
+ propertyAttributes.add("alt-text");
}
/**
Modified:
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java?rev=825964&r1=825963&r2=825964&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
(original)
+++
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
Fri Oct 16 15:53:13 2009
@@ -106,6 +106,12 @@
scaling = pList.get(PR_SCALING).getEnum();
textAlign = pList.get(PR_TEXT_ALIGN).getEnum();
width = pList.get(PR_WIDTH).getLength();
+ if (getUserAgent().isAccessibilityEnabled()) {
+ String altText = pList.get(PR_X_ALT_TEXT).getString();
+ if (altText.equals("")) {
+ getFOValidationEventProducer().altTextMissing(this,
getLocalName(), getLocator());
+ }
+ }
}
/**
Modified:
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java?rev=825964&r1=825963&r2=825964&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java
(original)
+++
xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java
Fri Oct 16 15:53:13 2009
@@ -163,9 +163,6 @@
if (altTextNode != null) {
structElem.put("Alt", altTextNode.getNodeValue());
} else {
- // TODO route that to event notification system
-// log.warn("fo:" + s
-// + " requires an alternative text attribute fox:alt-text for
accessibility");
structElem.put("Alt", "No alternate text specified");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]