From 2a54372f5d918492115fa3e00285af19d6f67055 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Wed, 21 Oct 2009 14:57:54 +0000 Subject: Renamed some variables and methods for consistency. Improved javadocs. Code clean-up and simplification. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@828038 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/render/intermediate/IFSerializer.java | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/java/org/apache/fop/render/intermediate/IFSerializer.java') diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/java/org/apache/fop/render/intermediate/IFSerializer.java index b6136f036..2401b1202 100644 --- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java +++ b/src/java/org/apache/fop/render/intermediate/IFSerializer.java @@ -411,10 +411,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler addAttribute(atts, "width", Integer.toString(rect.width)); addAttribute(atts, "height", Integer.toString(rect.height)); addForeignAttributes(atts); - String ptr = getContext().getStructurePointer(); - if (ptr != null) { - addAttribute(atts, "ptr", ptr); // used for accessibility - } + addStructurePointerAttribute(atts); handler.element(EL_IMAGE, atts); } catch (SAXException e) { throw new IFException("SAX error in startGroup()", e); @@ -441,10 +438,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler addAttribute(atts, "width", Integer.toString(rect.width)); addAttribute(atts, "height", Integer.toString(rect.height)); addForeignAttributes(atts); - String ptr = getContext().getStructurePointer(); - if (ptr != null) { - addAttribute(atts, "ptr", ptr); // used for accessibility - } + addStructurePointerAttribute(atts); handler.startElement(EL_IMAGE, atts); new DOM2SAX(handler).writeDocument(doc, true); handler.endElement(EL_IMAGE); @@ -558,10 +552,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler if (dx != null) { addAttribute(atts, "dx", IFUtil.toString(dx)); } - String ptr = getContext().getStructurePointer(); - if (ptr != null) { - addAttribute(atts, "ptr", ptr); // used for accessibility - } + addStructurePointerAttribute(atts); handler.startElement(EL_TEXT, atts); char[] chars = text.toCharArray(); handler.characters(chars, 0, chars.length); @@ -657,6 +648,13 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler XMLUtil.addAttribute(atts, localName, value); } + private void addStructurePointerAttribute(AttributesImpl atts) { + String ptr = getContext().getStructurePointer(); + if (ptr != null) { + addAttribute(atts, "ptr", ptr); + } + } + // ---=== IFDocumentNavigationHandler ===--- private Map incompleteActions = new java.util.HashMap(); @@ -729,7 +727,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler atts.addAttribute(null, "rect", "rect", XMLConstants.CDATA, IFUtil.toString(link.getTargetRect())); if (getUserAgent().isAccessibilityEnabled()) { - addAttribute(atts, "ptr", link.getAction().getPtr()); + addAttribute(atts, "ptr", link.getAction().getStructurePointer()); } try { handler.startElement(DocumentNavigationExtensionConstants.LINK, atts); -- cgit v1.2.3