Browse Source

Switched from handleAttrs() to more intuitive processNode() and (for FO namespace) addProperties() methods.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197613 13f79535-47bb-0310-9956-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
Glen Mazza 20 years ago
parent
commit
579ea70d54
39 changed files with 262 additions and 326 deletions
  1. 4
    3
      examples/mathml/src/org/apache/fop/mathml/MathMLElement.java
  2. 4
    3
      examples/plan/src/org/apache/fop/plan/PlanElement.java
  3. 0
    2
      src/java/org/apache/fop/apps/Driver.java
  4. 14
    23
      src/java/org/apache/fop/fo/FONode.java
  5. 35
    55
      src/java/org/apache/fop/fo/FOTreeBuilder.java
  6. 36
    21
      src/java/org/apache/fop/fo/FObj.java
  7. 5
    6
      src/java/org/apache/fop/fo/XMLElement.java
  8. 5
    11
      src/java/org/apache/fop/fo/XMLObj.java
  9. 3
    4
      src/java/org/apache/fop/fo/extensions/Outline.java
  10. 5
    5
      src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
  11. 8
    9
      src/java/org/apache/fop/fo/flow/BasicLink.java
  12. 3
    3
      src/java/org/apache/fop/fo/flow/Block.java
  13. 3
    3
      src/java/org/apache/fop/fo/flow/BlockContainer.java
  14. 8
    8
      src/java/org/apache/fop/fo/flow/ExternalGraphic.java
  15. 8
    10
      src/java/org/apache/fop/fo/flow/Footnote.java
  16. 7
    8
      src/java/org/apache/fop/fo/flow/FootnoteBody.java
  17. 3
    3
      src/java/org/apache/fop/fo/flow/Inline.java
  18. 3
    3
      src/java/org/apache/fop/fo/flow/InlineContainer.java
  19. 8
    9
      src/java/org/apache/fop/fo/flow/ListBlock.java
  20. 8
    10
      src/java/org/apache/fop/fo/flow/ListItem.java
  21. 8
    9
      src/java/org/apache/fop/fo/flow/ListItemLabel.java
  22. 3
    9
      src/java/org/apache/fop/fo/flow/Marker.java
  23. 9
    11
      src/java/org/apache/fop/fo/flow/PageNumber.java
  24. 3
    5
      src/java/org/apache/fop/fo/flow/RetrieveMarker.java
  25. 9
    11
      src/java/org/apache/fop/fo/flow/Table.java
  26. 9
    11
      src/java/org/apache/fop/fo/flow/TableBody.java
  27. 3
    6
      src/java/org/apache/fop/fo/flow/TableCell.java
  28. 9
    12
      src/java/org/apache/fop/fo/flow/TableColumn.java
  29. 9
    11
      src/java/org/apache/fop/fo/flow/TableRow.java
  30. 3
    3
      src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
  31. 3
    5
      src/java/org/apache/fop/fo/pagination/Flow.java
  32. 3
    3
      src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
  33. 3
    3
      src/java/org/apache/fop/fo/pagination/PageMasterReference.java
  34. 3
    9
      src/java/org/apache/fop/fo/pagination/PageSequence.java
  35. 3
    5
      src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
  36. 3
    3
      src/java/org/apache/fop/fo/pagination/Region.java
  37. 3
    4
      src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
  38. 3
    4
      src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
  39. 3
    3
      src/java/org/apache/fop/fo/pagination/SimplePageMaster.java

+ 4
- 3
examples/mathml/src/org/apache/fop/mathml/MathMLElement.java View File

@@ -56,10 +56,11 @@ public class MathMLElement extends MathMLObj {
}

/**
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FONode#processNode
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
public void processNode(String elementName, Locator locator,
Attributes attlist) throws FOPException {
super.processNode(elementName, locator, attlist);
createBasicDocument();
}


+ 4
- 3
examples/plan/src/org/apache/fop/plan/PlanElement.java View File

@@ -44,10 +44,11 @@ public class PlanElement extends PlanObj {
}

/**
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FONode#processNode
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
public void processNode(String elementName, Locator locator,
Attributes attlist) throws FOPException {
super.processNode(elementName, locator, attlist);
createBasicDocument();
}


+ 0
- 2
src/java/org/apache/fop/apps/Driver.java View File

@@ -229,7 +229,6 @@ public class Driver {
throw new IllegalStateException("Driver already initialized");
}
treeBuilder = new FOTreeBuilder();
treeBuilder.setUserAgent(getUserAgent());
}

/**
@@ -511,7 +510,6 @@ public class Driver {

foInputHandler.setLogger(getLogger());

treeBuilder.setUserAgent(getUserAgent());
treeBuilder.setFOInputHandler(foInputHandler);
treeBuilder.setFOTreeControl(currentDocument);


+ 14
- 23
src/java/org/apache/fop/fo/FONode.java View File

@@ -37,8 +37,10 @@ import org.apache.fop.apps.FOUserAgent;
*
*/
public abstract class FONode {

/** Parent FO node */
protected FONode parent;

/** Name of the node */
protected String name;

@@ -51,21 +53,13 @@ public abstract class FONode {
}

/**
* Sets the name of the node.
* @param str the name
* Returns the user agent for the node.
* @return FOUserAgent
*/
public void setName(String str) {
name = str;
public FOUserAgent getUserAgent() {
return getFOTreeControl().getDriver().getUserAgent();
}

/**
* Sets the name of the node.
* @param str the name
*/
public void setLocation(Locator locator) {
// do nothing by default
}
/**
* Returns the logger for the node.
* @return the logger
@@ -75,19 +69,16 @@ public abstract class FONode {
}

/**
* Returns the user agent for the node.
* @return FOUserAgent
*/
public FOUserAgent getUserAgent() {
return getFOTreeControl().getDriver().getUserAgent();
}

/**
* Do something with the attributes for this element
* Initialize the node with its name, location information, and attributes
* The attributes must be used immediately as the sax attributes
* will be altered for the next element.
* @param elementName element name (e.g., "fo:block")
* @param locator Locator object (ignored by default)
* @param attlist Collection of attributes passed to us from the parser.
* @throws FOPException for errors or inconsistencies in the attributes
*/
public void handleAttrs(Attributes attlist) throws FOPException {
*/
public void processNode(String elementName, Locator locator, Attributes attlist) throws FOPException {
this.name = elementName;
}

/**

+ 35
- 55
src/java/org/apache/fop/fo/FOTreeBuilder.java View File

@@ -32,7 +32,6 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.ElementMapping.Maker;
import org.apache.fop.fo.pagination.Root;
import org.xml.sax.Attributes;
@@ -65,14 +64,14 @@ public class FOTreeBuilder extends DefaultHandler {
protected Set namespaces = new java.util.HashSet();

/**
* Current formatting object being handled
* The root of the formatting object tree
*/
protected FONode currentFObj = null;
protected Root rootFObj = null;

/**
* The root of the formatting object tree
* Current formatting object being handled
*/
protected Root rootFObj = null;
protected FONode currentFObj = null;

/**
* The class that handles formatting and rendering to a stream
@@ -80,12 +79,10 @@ public class FOTreeBuilder extends DefaultHandler {
*/
private FOInputHandler foInputHandler;

private FOUserAgent userAgent;

/** The FOTreeControl object managing the FO Tree that is being built */
private FOTreeControl foTreeControl;

/** The SAX locator object maneging the line and column counters */
/** The SAX locator object managing the line and column counters */
private Locator locator;
/**
@@ -95,22 +92,6 @@ public class FOTreeBuilder extends DefaultHandler {
setupDefaultMappings();
}

private Log getLogger() {
return log;
}

/**
* Sets the user agent
* @param ua the user agent
*/
public void setUserAgent(FOUserAgent ua) {
userAgent = ua;
}

private FOUserAgent getUserAgent() {
return userAgent;
}

/**
* Sets the FO Tree Control for this object
* @param fotc FOTreeControl instance
@@ -146,7 +127,7 @@ public class FOTreeBuilder extends DefaultHandler {
try {
addElementMapping(str);
} catch (IllegalArgumentException e) {
getLogger().warn("Error while adding element mapping", e);
log.warn("Error while adding element mapping", e);
}

}
@@ -208,24 +189,14 @@ public class FOTreeBuilder extends DefaultHandler {
}
}

/**
* SAX Handler for the end of an element
* @see org.xml.sax.ContentHandler#endElement(String, String, String)
*/
public void endElement(String uri, String localName, String rawName)
throws SAXException {
currentFObj.end();
currentFObj = currentFObj.getParent();
}

/**
* SAX Handler for the start of the document
* @see org.xml.sax.ContentHandler#startDocument()
*/
public void startDocument() throws SAXException {
rootFObj = null; // allows FOTreeBuilder to be reused
if (getLogger().isDebugEnabled()) {
getLogger().debug("Building formatting object tree");
if (log.isDebugEnabled()) {
log.debug("Building formatting object tree");
}
foInputHandler.startDocument();
}
@@ -237,8 +208,8 @@ public class FOTreeBuilder extends DefaultHandler {
public void endDocument() throws SAXException {
rootFObj = null;
currentFObj = null;
if (getLogger().isDebugEnabled()) {
getLogger().debug("Parsing of document complete");
if (log.isDebugEnabled()) {
log.debug("Parsing of document complete");
}
foInputHandler.endDocument();
}
@@ -249,8 +220,9 @@ public class FOTreeBuilder extends DefaultHandler {
*/
public void startElement(String namespaceURI, String localName, String rawName,
Attributes attlist) throws SAXException {
/* the formatting object started */
FONode fobj;

/* the node found in the FO document */
FONode foNode;

/* the maker for the formatting object started */
ElementMapping.Maker fobjMaker = findFOMaker(namespaceURI, localName);
@@ -258,27 +230,35 @@ public class FOTreeBuilder extends DefaultHandler {
// System.out.println("found a " + fobjMaker.toString());

try {
fobj = fobjMaker.make(currentFObj);
fobj.setName(localName);
fobj.setLocation(locator);
fobj.handleAttrs(attlist);
foNode = fobjMaker.make(currentFObj);
foNode.processNode(localName, locator, attlist);
} catch (FOPException e) {
throw new SAXException(e);
}

if (rootFObj == null) {
if (!fobj.getName().equals("fo:root")) {
if (!foNode.getName().equals("fo:root")) {
throw new SAXException(new FOPException("Root element must"
+ " be fo:root, not "
+ fobj.getName()));
+ foNode.getName()));
}
rootFObj = (Root)fobj;
rootFObj = (Root) foNode;
rootFObj.setFOTreeControl(foTreeControl);
} else {
currentFObj.addChild(fobj);
currentFObj.addChild(foNode);
}

currentFObj = fobj;
currentFObj = foNode;
}

/**
* SAX Handler for the end of an element
* @see org.xml.sax.ContentHandler#endElement(String, String, String)
*/
public void endElement(String uri, String localName, String rawName)
throws SAXException {
currentFObj.end();
currentFObj = currentFObj.getParent();
}

/**
@@ -299,8 +279,8 @@ public class FOTreeBuilder extends DefaultHandler {
}

if (fobjMaker == null) {
if (getLogger().isWarnEnabled()) {
getLogger().warn("Unknown formatting object " + namespaceURI + "^" + localName);
if (log.isWarnEnabled()) {
log.warn("Unknown formatting object " + namespaceURI + "^" + localName);
}
if (namespaces.contains(namespaceURI.intern())) {
// fall back
@@ -350,7 +330,7 @@ class Service {
}
String serviceFile = "META-INF/services/" + cls.getName();

// getLogger().debug("File: " + serviceFile);
// log.debug("File: " + serviceFile);

List lst = (List)providerMap.get(serviceFile);
if (lst != null) {
@@ -370,7 +350,7 @@ class Service {
while (e.hasMoreElements()) {
try {
java.net.URL u = (java.net.URL)e.nextElement();
//getLogger().debug("URL: " + u);
//log.debug("URL: " + u);

InputStream is = u.openStream();
Reader r = new InputStreamReader(is, "UTF-8");
@@ -393,7 +373,7 @@ class Service {
line = br.readLine();
continue;
}
// getLogger().debug("Line: " + line);
// log.debug("Line: " + line);

// Try and load the class
// Object obj = cl.loadClass(line).newInstance();

+ 36
- 21
src/java/org/apache/fop/fo/FObj.java View File

@@ -69,6 +69,15 @@ public class FObj extends FONode implements Constants {
*/
protected Map layoutDimension = null;

/** Marks input file containing this object **/
public String systemId;

/** Marks line number of this object in the input file **/
public int line;

/** Marks column number of this object in the input file **/
public int column;

/**
* Create a new formatting object.
* All formatting object classes extend this class.
@@ -88,39 +97,27 @@ public class FObj extends FONode implements Constants {
}
}

/** Marks input file containing this object **/
public String systemId;
/** Marks line number of this object in the input file **/
public int line;
/** Marks column number of this object in the input file **/
public int column;

/**
* Set the name of this element.
* The prepends "fo:" to the name to indicate it is in the fo namespace.
*
* @param str the xml element name
* @see org.apache.fop.fo.FONode#processNode
*/
public void setName(String str) {
name = "fo:" + str;
}
public void processNode(String elementName, Locator locator,
Attributes attlist) throws FOPException {
name = "fo:" + elementName;

public void setLocation(Locator locator) {
if (locator != null) {
line = locator.getLineNumber();
column = locator.getColumnNumber();
systemId = locator.getSystemId();
}

addProperties(attlist);
}
/**
* Handle the attributes for this element.
* The attributes must be used immediately as the sax attributes
* will be altered for the next element.
* Set properties for this FO based on node attributes
* @param attlist Collection of attributes passed to us from the parser.
* @throws FOPException for invalid FO data
*/
public void handleAttrs(Attributes attlist) throws FOPException {
protected void addProperties(Attributes attlist) throws FOPException {
FObj parentFO = findNearestAncestorFObj();
PropertyList parentPropertyList = null;
if (parentFO != null) {
@@ -135,6 +132,24 @@ public class FObj extends FONode implements Constants {
}

/**
* Set the name of this element.
* The prepends "fo:" to the name to indicate it is in the fo namespace.
*
* @param str the xml element name
*/
public void setName(String str) {
name = "fo:" + str;
}

public void setLocation(Locator locator) {
if (locator != null) {
line = locator.getLineNumber();
column = locator.getColumnNumber();
systemId = locator.getSystemId();
}
}

/**
* Find the nearest parent, grandparent, etc. FONode that is also an FObj
* @return FObj the nearest ancestor FONode that is an FObj
*/

+ 5
- 6
src/java/org/apache/fop/fo/XMLElement.java View File

@@ -20,6 +20,7 @@ package org.apache.fop.fo;

// XML
import org.xml.sax.Attributes;
import org.xml.sax.Locator;

// FOP
import org.apache.fop.apps.FOPException;
@@ -41,13 +42,11 @@ public class XMLElement extends XMLObj {
}

/**
* Process the attributes for this element.
* @param attlist the attribute list for this element returned by the SAX
* parser
* @throws FOPException for invalid attributes
* @see org.apache.fop.fo.FONode#processNode
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
public void processNode(String elementName, Locator locator,
Attributes attlist) throws FOPException {
super.processNode(elementName, locator, attlist);
init();
}


+ 5
- 11
src/java/org/apache/fop/fo/XMLObj.java View File

@@ -39,8 +39,10 @@ public abstract class XMLObj extends FONode {

// temp reference for attributes
private Attributes attr = null;

/** DOM element representing this node */
protected Element element;

/** DOM document containing this node */
protected Document doc;

@@ -53,18 +55,10 @@ public abstract class XMLObj extends FONode {
}

/**
* @param str name of the element
*/
public void setName(String str) {
name = str;
}

/**
* Store the attributes for this element
* @param attlist Collection of attributes passed to us from the parser.
* @throws FOPException for errors in the attributes
* @see org.apache.fop.fo.FONode#processNode
*/
public void handleAttrs(Attributes attlist) throws FOPException {
public void processNode(String elementName, Locator locator, Attributes attlist) throws FOPException {
name = elementName;
attr = attlist;
}


+ 3
- 4
src/java/org/apache/fop/fo/extensions/Outline.java View File

@@ -48,13 +48,12 @@ public class Outline extends ExtensionObj {
}

/**
* The attribues on the outline object are the internal and external
* The attributes on the outline object are the internal and external
* destination. One of these is required.
*
* @param attlist the attribute list
* @throws FOPException a fop exception if there is an error
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
protected void addProperties(Attributes attlist) throws FOPException {
internalDestination =
attlist.getValue("internal-destination");
externalDestination =

+ 5
- 5
src/java/org/apache/fop/fo/extensions/svg/SVGElement.java View File

@@ -30,6 +30,7 @@ import org.apache.batik.dom.util.XMLSupport;
import org.w3c.dom.Element;
import org.w3c.dom.svg.SVGDocument;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.apache.batik.bridge.UnitProcessor;
import org.apache.batik.util.SVGConstants;

@@ -58,12 +59,11 @@ public class SVGElement extends SVGObj {
}

/**
* Handle the xml attributes from SAX.
* @param attlist the attribute list
* @throws FOPException not thrown from here
* @see org.apache.fop.fo.FONode#processNode
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
public void processNode(String elementName, Locator locator,
Attributes attlist) throws FOPException {
super.processNode(elementName, locator, attlist);
init();
}


+ 8
- 9
src/java/org/apache/fop/fo/flow/BasicLink.java View File

@@ -49,6 +49,14 @@ public class BasicLink extends Inline {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
getFOTreeControl().getFOInputHandler().startLink(this);
}

public void setup() {
String destination;
int linkType;
@@ -129,15 +137,6 @@ public class BasicLink extends Inline {
fotv.serveBasicLink(this);
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

getFOTreeControl().getFOInputHandler().startLink(this);
}
/**
* @see org.apache.fop.fo.FONode#end
*/

+ 3
- 3
src/java/org/apache/fop/fo/flow/Block.java View File

@@ -96,10 +96,10 @@ public class Block extends FObjMixed {
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
this.span = this.propertyList.get(PR_SPAN).getEnum();
this.wsTreatment =
this.propertyList.get(PR_WHITE_SPACE_TREATMENT).getEnum();

+ 3
- 3
src/java/org/apache/fop/fo/flow/BlockContainer.java View File

@@ -57,10 +57,10 @@ public class BlockContainer extends FObj {
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
this.span = this.propertyList.get(PR_SPAN).getEnum();
setupID();
}

+ 8
- 8
src/java/org/apache/fop/fo/flow/ExternalGraphic.java View File

@@ -58,6 +58,14 @@ public class ExternalGraphic extends FObj {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
getFOTreeControl().getFOInputHandler().image(this);
}

/**
* Setup this image.
* This gets the sizes for the image and the dimensions and clipping.
@@ -234,12 +242,4 @@ public class ExternalGraphic extends FObj {
return placement;
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

getFOTreeControl().getFOInputHandler().image(this);
}
}

+ 8
- 10
src/java/org/apache/fop/fo/flow/Footnote.java View File

@@ -43,6 +43,14 @@ public class Footnote extends FObj {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
getFOTreeControl().getFOInputHandler().startFootnote(this);
}

/**
* @param child child FONode to be added to this object
*/
@@ -69,18 +77,8 @@ public class Footnote extends FObj {
fotv.serveFootnote(this);
}
/**
* @see org.apache.fop.fo.FObj#handleAttrs
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

getFOTreeControl().getFOInputHandler().startFootnote(this);
}

protected void end() {
super.end();
getFOTreeControl().getFOInputHandler().endFootnote(this);
}
}

+ 7
- 8
src/java/org/apache/fop/fo/flow/FootnoteBody.java View File

@@ -47,19 +47,18 @@ public class FootnoteBody extends FObj {
super(parent);
}

public void acceptVisitor(FOTreeVisitor fotv) {
fotv.serveFootnoteBody(this);
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
getFOTreeControl().getFOInputHandler().startFootnoteBody(this);
}

public void acceptVisitor(FOTreeVisitor fotv) {
fotv.serveFootnoteBody(this);
}

protected void end() {
super.end();

+ 3
- 3
src/java/org/apache/fop/fo/flow/Inline.java View File

@@ -56,10 +56,10 @@ public class Inline extends FObjMixed {
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);

if (parent.getName().equals("fo:flow")) {
throw new FOPException("inline formatting objects cannot"

+ 3
- 3
src/java/org/apache/fop/fo/flow/InlineContainer.java View File

@@ -45,10 +45,10 @@ public class InlineContainer extends FObj {
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
// Common Border, Padding, and Background Properties
CommonBorderAndPadding bap = propMgr.getBorderAndPadding();
CommonBackground bProps = propMgr.getBackgroundProps();

+ 8
- 9
src/java/org/apache/fop/fo/flow/ListBlock.java View File

@@ -59,6 +59,14 @@ public class ListBlock extends FObj {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
getFOTreeControl().getFOInputHandler().startList(this);
}

private void setup() throws FOPException {

// Common Accessibility Properties
@@ -128,15 +136,6 @@ public class ListBlock extends FObj {
fotv.serveListBlock(this);
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

getFOTreeControl().getFOInputHandler().startList(this);
}
protected void end() {
super.end();

+ 8
- 10
src/java/org/apache/fop/fo/flow/ListItem.java View File

@@ -59,6 +59,14 @@ public class ListItem extends FObj {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
getFOTreeControl().getFOInputHandler().startListItem(this);
}

private void setup() {

// Common Accessibility Properties
@@ -138,18 +146,8 @@ public class ListItem extends FObj {
fotv.serveListItem(this);
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

getFOTreeControl().getFOInputHandler().startListItem(this);
}
protected void end() {
super.end();
getFOTreeControl().getFOInputHandler().endListItem(this);
}
}

+ 8
- 9
src/java/org/apache/fop/fo/flow/ListItemLabel.java View File

@@ -41,6 +41,14 @@ public class ListItemLabel extends FObj {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
getFOTreeControl().getFOInputHandler().startListLabel();
}

private void setup() {

// Common Accessibility Properties
@@ -75,15 +83,6 @@ public class ListItemLabel extends FObj {
fotv.serveListItemLabel(this);
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

getFOTreeControl().getFOInputHandler().startListLabel();
}
protected void end() {
super.end();

+ 3
- 9
src/java/org/apache/fop/fo/flow/Marker.java View File

@@ -46,16 +46,10 @@ public class Marker extends FObjMixed {
}

/**
* Handle the attributes for this marker.
* This gets the marker-class-name and attempts to add itself
* to the parent formatting object.
*
* @param attlist the attribute list
* @throws FOPException if there is an exception
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
this.markerClassName =
this.propertyList.get(PR_MARKER_CLASS_NAME).getString();
}

+ 9
- 11
src/java/org/apache/fop/fo/flow/PageNumber.java View File

@@ -55,6 +55,15 @@ public class PageNumber extends FObj {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
setup();
getFOTreeControl().getFOInputHandler().startPageNumber(this);
}

public void setup() {

// Common Accessibility Properties
@@ -119,17 +128,6 @@ public class PageNumber extends FObj {
fotv.servePageNumber(this);
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

setup();

getFOTreeControl().getFOInputHandler().startPageNumber(this);
}

protected void end() {
getFOTreeControl().getFOInputHandler().endPageNumber(this);
}

+ 3
- 5
src/java/org/apache/fop/fo/flow/RetrieveMarker.java View File

@@ -46,12 +46,10 @@ public class RetrieveMarker extends FObjMixed {
}

/**
* Handle the attributes for the retrieve-marker.
*
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
this.retrieveClassName =
this.propertyList.get(PR_RETRIEVE_CLASS_NAME).getString();
this.retrievePosition =

+ 9
- 11
src/java/org/apache/fop/fo/flow/Table.java View File

@@ -75,6 +75,15 @@ public class Table extends FObj {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
setupID();
getFOTreeControl().getFOInputHandler().startTable(this);
}

/**
* Overrides FObj.
* @param child FONode child object to be added
@@ -193,17 +202,6 @@ public class Table extends FObj {
fotv.serveTable(this);
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

setupID();

getFOTreeControl().getFOInputHandler().startTable(this);
}

protected void end() {
getFOTreeControl().getFOInputHandler().endTable(this);
}

+ 9
- 11
src/java/org/apache/fop/fo/flow/TableBody.java View File

@@ -51,6 +51,15 @@ public class TableBody extends FObj {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
setupID();
getFOTreeControl().getFOInputHandler().startBody(this);
}

private void setup() throws FOPException {
// Common Accessibility Properties
CommonAccessibility mAccProps = propMgr.getAccessibilityProps();
@@ -94,17 +103,6 @@ public class TableBody extends FObj {
fotv.serveTableBody(this);
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

setupID();

getFOTreeControl().getFOInputHandler().startBody(this);
}

protected void end() {
getFOTreeControl().getFOInputHandler().endBody(this);
}

+ 3
- 6
src/java/org/apache/fop/fo/flow/TableCell.java View File

@@ -118,14 +118,11 @@ public class TableCell extends FObj {
}

/**
* Overriden from FObj.
* @param attlist Collection of attributes passed to us from the parser.
* @throws FOPException for FO errors
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
doSetup(); // init some basic property values

getFOTreeControl().getFOInputHandler().startCell(this);
}


+ 9
- 12
src/java/org/apache/fop/fo/flow/TableColumn.java View File

@@ -54,6 +54,15 @@ public class TableColumn extends FObj {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
initialize(); // init some basic property values
getFOTreeControl().getFOInputHandler().startColumn(this);
}

/**
* @return Length object containing column width
*/
@@ -114,18 +123,6 @@ public class TableColumn extends FObj {
fotv.serveTableColumn(this);
}

/**
* Overriden from FObj.
* @param attlist Collection of attributes passed to us from the parser.
* @throws FOPException for FO errors
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
initialize(); // init some basic property values

getFOTreeControl().getFOInputHandler().startColumn(this);
}

protected void end() {
getFOTreeControl().getFOInputHandler().endColumn(this);
}

+ 9
- 11
src/java/org/apache/fop/fo/flow/TableRow.java View File

@@ -62,6 +62,15 @@ public class TableRow extends FObj {
super(parent);
}

/**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
setupID();
getFOTreeControl().getFOInputHandler().startRow(this);
}

/**
* @return keepWithPrevious
*/
@@ -135,17 +144,6 @@ public class TableRow extends FObj {
fotv.serveTableRow(this);
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

setupID();

getFOTreeControl().getFOInputHandler().startRow(this);
}

protected void end() {
getFOTreeControl().getFOInputHandler().endRow(this);
}

+ 3
- 3
src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java View File

@@ -53,10 +53,10 @@ public class ConditionalPageMasterReference extends FObj {
}

/**
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
if (getProperty(PR_MASTER_REFERENCE) != null) {
setMasterName(getProperty(PR_MASTER_REFERENCE).getString());
}

+ 3
- 5
src/java/org/apache/fop/fo/pagination/Flow.java View File

@@ -63,12 +63,10 @@ public class Flow extends FObj {
}

/**
* @see org.apache.fop.fo.FObj#handleAttrs
* @param attlist Collection of attributes passed to us from the parser.
* @throws FOPException if parent is not a page-sequence object
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
if (parent.getName().equals("fo:page-sequence")) {
this.pageSequence = (PageSequence) parent;
} else {

+ 3
- 3
src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java View File

@@ -53,10 +53,10 @@ public class LayoutMasterSet extends FObj {
}

/**
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);

if (parent.getName().equals("fo:root")) {
Root root = (Root)parent;

+ 3
- 3
src/java/org/apache/fop/fo/pagination/PageMasterReference.java View File

@@ -44,10 +44,10 @@ public abstract class PageMasterReference extends FObj
}

/**
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
if (getProperty(PR_MASTER_REFERENCE) != null) {
this.masterName = getProperty(PR_MASTER_REFERENCE).getString();
}

+ 3
- 9
src/java/org/apache/fop/fo/pagination/PageSequence.java View File

@@ -130,16 +130,10 @@ public class PageSequence extends FObj {
}

/**
* Handle the attributes for this xml element.
* For the page sequence this gets all the appropriate properties
* for dealing with the page sequence.
*
* @param attlist the attribute list
* @throws FOPException if there is an error with the properties
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
if (parent.getName().equals("fo:root")) {
this.root = (Root)parent;
// this.root.addPageSequence(this);

+ 3
- 5
src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java View File

@@ -59,13 +59,11 @@ public class PageSequenceMaster extends FObj {
}

/**
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
subSequenceSpecifiers = new java.util.ArrayList();

if (parent.getName().equals("fo:layout-master-set")) {
this.layoutMasterSet = (LayoutMasterSet)parent;
masterName = this.propertyList.get(Constants.PR_MASTER_NAME).getString();

+ 3
- 3
src/java/org/apache/fop/fo/pagination/Region.java View File

@@ -62,10 +62,10 @@ public abstract class Region extends FObj {
}

/**
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);

// regions may have name, or default
if (null == this.propertyList.get(PR_REGION_NAME)) {

+ 3
- 4
src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java View File

@@ -58,11 +58,10 @@ public class RepeatablePageMasterAlternatives extends FObj
}

/**
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
conditionalPageMasterRefs = new ArrayList();

if (parent.getName().equals("fo:page-sequence-master")) {

+ 3
- 4
src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java View File

@@ -49,11 +49,10 @@ public class RepeatablePageMasterReference extends PageMasterReference
}

/**
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);

protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);
String mr = getProperty(PR_MAXIMUM_REPEATS).getString();
if (mr.equals("no-limit")) {
this.maximumRepeats = INFINITE;

+ 3
- 3
src/java/org/apache/fop/fo/pagination/SimplePageMaster.java View File

@@ -53,10 +53,10 @@ public class SimplePageMaster extends FObj {
}

/**
* @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
* @see org.apache.fop.fo.FObj#addProperties
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
protected void addProperties(Attributes attlist) throws FOPException {
super.addProperties(attlist);

if (parent.getName().equals("fo:layout-master-set")) {
LayoutMasterSet layoutMasterSet = (LayoutMasterSet)parent;

Loading…
Cancel
Save