aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-02-08 15:42:03 +0000
committerJeremias Maerki <jeremias@apache.org>2006-02-08 15:42:03 +0000
commit3606df4b663e7b7189a625efeec89974eed5c41d (patch)
tree5499b0e48df7522aed1446436db5c27f96e73ca9 /src/java/org/apache/fop
parenteba245a39c726af49a85cd16f876ae6c63bd2e7e (diff)
downloadxmlgraphics-fop-3606df4b663e7b7189a625efeec89974eed5c41d.tar.gz
xmlgraphics-fop-3606df4b663e7b7189a625efeec89974eed5c41d.zip
Added missing values in area tree XML for PageViewport (simple-page-master-name and blank).
Performance improvement of about 10% for a simple document inside the AreaTreeParser (Hotspot: setTraits()) Changed the way that trait info lookup is done in Trait.java. Should be just a little faster now. Unused traits disabled. Commented unused methods. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@375983 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/area/AreaTreeParser.java221
-rw-r--r--src/java/org/apache/fop/area/PageViewport.java11
-rw-r--r--src/java/org/apache/fop/area/Trait.java135
-rw-r--r--src/java/org/apache/fop/layoutmgr/TraitSetter.java2
-rw-r--r--src/java/org/apache/fop/render/xml/XMLRenderer.java4
5 files changed, 210 insertions, 163 deletions
diff --git a/src/java/org/apache/fop/area/AreaTreeParser.java b/src/java/org/apache/fop/area/AreaTreeParser.java
index a05b83f05..e82fec5db 100644
--- a/src/java/org/apache/fop/area/AreaTreeParser.java
+++ b/src/java/org/apache/fop/area/AreaTreeParser.java
@@ -220,7 +220,11 @@ public class AreaTreeParser {
Rectangle2D viewArea = parseRect(attributes.getValue("bounds"));
int pageNumber = getAttributeAsInteger(attributes, "nr", -1);
String pageNumberString = attributes.getValue("formatted-nr");
- currentPageViewport = new PageViewport(viewArea, pageNumber, pageNumberString);
+ String pageMaster = attributes.getValue("simple-page-master-name");
+ boolean blank = getAttributeAsBoolean(attributes, "blank", false);
+ currentPageViewport = new PageViewport(viewArea,
+ pageNumber, pageNumberString,
+ pageMaster, blank);
} else if ("page".equals(localName)) {
Page p = new Page();
currentPageViewport.setPage(p);
@@ -233,7 +237,9 @@ public class AreaTreeParser {
rv = new RegionViewport(viewArea);
rv.setClip(getAttributeAsBoolean(attributes, "clipped", false));
setAreaAttributes(attributes, rv);
- setTraits(attributes, rv);
+ setTraits(attributes, rv, SUBSET_COMMON);
+ setTraits(attributes, rv, SUBSET_BOX);
+ setTraits(attributes, rv, SUBSET_COLOR);
areaStack.push(rv);
} else if ("regionBefore".equals(localName)) {
pushNewRegionReference(attributes, Constants.FO_REGION_BEFORE);
@@ -321,7 +327,9 @@ public class AreaTreeParser {
block.setYOffset(getAttributeAsInteger(attributes, "top-offset", 0));
}
setAreaAttributes(attributes, block);
- setTraits(attributes, block);
+ setTraits(attributes, block, SUBSET_COMMON);
+ setTraits(attributes, block, SUBSET_BOX);
+ setTraits(attributes, block, SUBSET_COLOR);
Area parent = (Area)areaStack.peek();
//BlockParent parent = getCurrentBlockParent();
parent.addChildArea(block);
@@ -329,7 +337,9 @@ public class AreaTreeParser {
} else if ("lineArea".equals(localName)) {
LineArea line = new LineArea();
setAreaAttributes(attributes, line);
- setTraits(attributes, line);
+ setTraits(attributes, line, SUBSET_COMMON);
+ setTraits(attributes, line, SUBSET_BOX);
+ setTraits(attributes, line, SUBSET_COLOR);
BlockParent parent = getCurrentBlockParent();
parent.addChildArea(line);
areaStack.push(line);
@@ -337,7 +347,10 @@ public class AreaTreeParser {
InlineParent ip = new InlineParent();
ip.setOffset(getAttributeAsInteger(attributes, "offset", 0));
setAreaAttributes(attributes, ip);
- setTraits(attributes, ip);
+ setTraits(attributes, ip, SUBSET_COMMON);
+ setTraits(attributes, ip, SUBSET_BOX);
+ setTraits(attributes, ip, SUBSET_COLOR);
+ setTraits(attributes, ip, SUBSET_LINK);
Area parent = (Area)areaStack.peek();
parent.addChildArea(ip);
areaStack.push(ip);
@@ -345,7 +358,9 @@ public class AreaTreeParser {
InlineBlockParent ibp = new InlineBlockParent();
ibp.setOffset(getAttributeAsInteger(attributes, "offset", 0));
setAreaAttributes(attributes, ibp);
- setTraits(attributes, ibp);
+ setTraits(attributes, ibp, SUBSET_COMMON);
+ setTraits(attributes, ibp, SUBSET_BOX);
+ setTraits(attributes, ibp, SUBSET_COLOR);
Area parent = (Area)areaStack.peek();
parent.addChildArea(ibp);
areaStack.push(ibp);
@@ -355,8 +370,12 @@ public class AreaTreeParser {
}
TextArea text = new TextArea();
setAreaAttributes(attributes, text);
- setTraits(attributes, text);
+ setTraits(attributes, text, SUBSET_COMMON);
+ setTraits(attributes, text, SUBSET_BOX);
+ setTraits(attributes, text, SUBSET_COLOR);
+ setTraits(attributes, text, SUBSET_FONT);
text.setBaselineOffset(getAttributeAsInteger(attributes, "baseline", 0));
+ text.setOffset(getAttributeAsInteger(attributes, "offset", 0));
text.setTextLetterSpaceAdjust(getAttributeAsInteger(attributes,
"tlsadjust", 0));
text.setTextWordSpaceAdjust(getAttributeAsInteger(attributes,
@@ -373,7 +392,10 @@ public class AreaTreeParser {
} else if ("leader".equals(localName)) {
Leader leader = new Leader();
setAreaAttributes(attributes, leader);
- setTraits(attributes, leader);
+ setTraits(attributes, leader, SUBSET_COMMON);
+ setTraits(attributes, leader, SUBSET_BOX);
+ setTraits(attributes, leader, SUBSET_COLOR);
+ setTraits(attributes, leader, SUBSET_FONT);
leader.setOffset(getAttributeAsInteger(attributes, "offset", 0));
String ruleStyle = attributes.getValue("ruleStyle");
if (ruleStyle != null) {
@@ -386,7 +408,9 @@ public class AreaTreeParser {
} else if ("viewport".equals(localName)) {
Viewport viewport = new Viewport(null);
setAreaAttributes(attributes, viewport);
- setTraits(attributes, viewport);
+ setTraits(attributes, viewport, SUBSET_COMMON);
+ setTraits(attributes, viewport, SUBSET_BOX);
+ setTraits(attributes, viewport, SUBSET_COLOR);
viewport.setContentPosition(getAttributeAsRectangle2D(attributes, "pos"));
viewport.setClip(getAttributeAsBoolean(attributes, "clip", false));
viewport.setOffset(getAttributeAsInteger(attributes, "offset", 0));
@@ -397,7 +421,7 @@ public class AreaTreeParser {
String url = attributes.getValue("url");
Image image = new Image(url);
setAreaAttributes(attributes, image);
- setTraits(attributes, image);
+ setTraits(attributes, image, SUBSET_COMMON);
getCurrentViewport().setContent(image);
} else if ("foreignObject".equals(localName)) {
String ns = attributes.getValue("ns");
@@ -409,7 +433,7 @@ public class AreaTreeParser {
}
ForeignObject foreign = new ForeignObject(ns);
setAreaAttributes(attributes, foreign);
- setTraits(attributes, foreign);
+ setTraits(attributes, foreign, SUBSET_COMMON);
getCurrentViewport().setContent(foreign);
areaStack.push(foreign);
} else if ("extension-attachments".equals(localName)) {
@@ -549,8 +573,10 @@ public class AreaTreeParser {
} else {
Space space = new Space();
setAreaAttributes(lastAttributes, space);
- setTraits(lastAttributes, space);
- space.setOffset(getAttributeAsInteger(lastAttributes, "offset", 0));
+ setTraits(lastAttributes, space, SUBSET_COMMON);
+ setTraits(lastAttributes, space, SUBSET_BOX);
+ setTraits(lastAttributes, space, SUBSET_COLOR);
+ space.setOffset(offset);
Area parent = (Area)areaStack.peek();
parent.addChildArea(space);
}
@@ -558,7 +584,10 @@ public class AreaTreeParser {
String txt = content.toString();
Character ch = new Character(txt.charAt(0));
setAreaAttributes(lastAttributes, ch);
- setTraits(lastAttributes, ch);
+ setTraits(lastAttributes, ch, SUBSET_COMMON);
+ setTraits(lastAttributes, ch, SUBSET_BOX);
+ setTraits(lastAttributes, ch, SUBSET_COLOR);
+ setTraits(lastAttributes, ch, SUBSET_FONT);
ch.setOffset(getAttributeAsInteger(lastAttributes, "offset", 0));
ch.setBaselineOffset(getAttributeAsInteger(lastAttributes, "baseline", 0));
Area parent = (Area)areaStack.peek();
@@ -579,80 +608,104 @@ public class AreaTreeParser {
area.setIPD(Integer.parseInt(attributes.getValue("ipd")));
area.setBPD(Integer.parseInt(attributes.getValue("bpd")));
}
+
+ private static final Object[] SUBSET_COMMON = new Object[] {
+ Trait.PROD_ID};
+ private static final Object[] SUBSET_LINK = new Object[] {
+ Trait.INTERNAL_LINK, Trait.EXTERNAL_LINK};
+ private static final Object[] SUBSET_COLOR = new Object[] {
+ Trait.BACKGROUND, Trait.COLOR};
+ private static final Object[] SUBSET_FONT = new Object[] {
+ Trait.FONT, Trait.FONT_SIZE, Trait.BLINK,
+ Trait.OVERLINE, Trait.OVERLINE_COLOR,
+ Trait.LINETHROUGH, Trait.LINETHROUGH_COLOR,
+ Trait.UNDERLINE, Trait.UNDERLINE_COLOR};
+ private static final Object[] SUBSET_BOX = new Object[] {
+ Trait.BORDER_BEFORE, Trait.BORDER_AFTER, Trait.BORDER_START, Trait.BORDER_END,
+ Trait.SPACE_BEFORE, Trait.SPACE_AFTER, Trait.SPACE_START, Trait.SPACE_END,
+ Trait.PADDING_BEFORE, Trait.PADDING_AFTER, Trait.PADDING_START, Trait.PADDING_END,
+ Trait.START_INDENT, Trait.END_INDENT,
+ Trait.IS_REFERENCE_AREA, Trait.IS_VIEWPORT_AREA};
- private void setTraits(Attributes attributes, Area area) {
- for (int i = 0, c = Trait.TRAIT_LIST.length; i < c; i++) {
- Object trait = Trait.TRAIT_LIST[i];
- Class cl = Trait.getTraitClass(trait);
- if (cl == Boolean.class) {
- String value = attributes.getValue(Trait.getTraitName(trait));
- if (value != null) {
- area.addTrait(trait, Boolean.valueOf(value));
- }
- } else if (cl == Integer.class) {
- String value = attributes.getValue(Trait.getTraitName(trait));
- if (value != null) {
- area.addTrait(trait, new Integer(value));
- }
- } else if (cl == String.class) {
- String value = attributes.getValue(Trait.getTraitName(trait));
- if (value != null) {
- area.addTrait(trait, value);
- }
- } else if (cl == FontTriplet.class) {
- String fontName = attributes.getValue("font-name");
- if (fontName != null) {
- String fontStyle = attributes.getValue("font-style");
- int fontWeight = getAttributeAsInteger(
- attributes, "font-weight", Font.NORMAL);
- area.addTrait(trait,
- new FontTriplet(fontName, fontStyle, fontWeight));
- }
- } else if (cl == Color.class) {
- String value = attributes.getValue(Trait.getTraitName(trait));
- if (value != null) {
- area.addTrait(trait, Color.valueOf(value));
- }
- } else if (cl == Background.class) {
- String value = attributes.getValue(Trait.getTraitName(trait));
- if (value != null) {
- Background bkg = new Background();
- Color col = Color.valueOf(attributes.getValue("bkg-color"));
- if (col != null) {
- bkg.setColor(col);
- }
- String url = attributes.getValue("bkg-img");
- if (url != null) {
- bkg.setURL(url);
-
- ImageFactory fact = ImageFactory.getInstance();
- FopImage img = fact.getImage(url, userAgent);
- if (img == null) {
- log.error("Background image not available: " + url);
- } else {
- // load dimensions
- if (!img.load(FopImage.DIMENSIONS)) {
- log.error("Cannot read background image dimensions: "
- + url);
- }
+ private void setTraits(Attributes attributes, Area area, Object[] traitSubset) {
+ for (int i = 0, c = traitSubset.length; i < c; i++) {
+ Object trait = traitSubset[i];
+ String traitName = Trait.getTraitName(trait);
+ String value = attributes.getValue(traitName);
+ if (value != null) {
+ Class cl = Trait.getTraitClass(trait);
+ if (cl == Integer.class) {
+ //if (value != null) {
+ area.addTrait(trait, new Integer(value));
+ //}
+ } else if (cl == Boolean.class) {
+ //String value = attributes.getValue(Trait.getTraitName(trait));
+ //if (value != null) {
+ area.addTrait(trait, Boolean.valueOf(value));
+ //}
+ } else if (cl == String.class) {
+ //String value = attributes.getValue(Trait.getTraitName(trait));
+ //if (value != null) {
+ area.addTrait(trait, value);
+ //}
+ } else if (cl == Color.class) {
+ //String value = attributes.getValue(Trait.getTraitName(trait));
+ //if (value != null) {
+ area.addTrait(trait, Color.valueOf(value));
+ //}
+ } else if (cl == Background.class) {
+ //String value = attributes.getValue(Trait.getTraitName(trait));
+ //if (value != null) {
+ Background bkg = new Background();
+ Color col = Color.valueOf(attributes.getValue("bkg-color"));
+ if (col != null) {
+ bkg.setColor(col);
}
- bkg.setFopImage(img);
-
- String repeat = attributes.getValue("bkg-repeat");
- if (repeat != null) {
- bkg.setRepeat(repeat);
+ String url = attributes.getValue("bkg-img");
+ if (url != null) {
+ bkg.setURL(url);
+
+ ImageFactory fact = ImageFactory.getInstance();
+ FopImage img = fact.getImage(url, userAgent);
+ if (img == null) {
+ log.error("Background image not available: " + url);
+ } else {
+ // load dimensions
+ if (!img.load(FopImage.DIMENSIONS)) {
+ log.error("Cannot read background image dimensions: "
+ + url);
+ }
+ }
+ bkg.setFopImage(img);
+
+ String repeat = attributes.getValue("bkg-repeat");
+ if (repeat != null) {
+ bkg.setRepeat(repeat);
+ }
+ bkg.setHoriz(getAttributeAsInteger(attributes,
+ "bkg-horz-offset", 0));
+ bkg.setVertical(getAttributeAsInteger(attributes,
+ "bkg-vert-offset", 0));
}
- bkg.setHoriz(getAttributeAsInteger(attributes,
- "bkg-horz-offset", 0));
- bkg.setVertical(getAttributeAsInteger(attributes,
- "bkg-vert-offset", 0));
- }
- area.addTrait(trait, bkg);
+ area.addTrait(trait, bkg);
+ //}
+ } else if (cl == BorderProps.class) {
+ //String value = attributes.getValue(Trait.getTraitName(trait));
+ //if (value != null) {
+ area.addTrait(trait, BorderProps.valueOf(value));
+ //}
}
- } else if (cl == BorderProps.class) {
- String value = attributes.getValue(Trait.getTraitName(trait));
- if (value != null) {
- area.addTrait(trait, BorderProps.valueOf(value));
+ } else {
+ Class cl = Trait.getTraitClass(trait);
+ if (cl == FontTriplet.class) {
+ String fontName = attributes.getValue("font-name");
+ if (fontName != null) {
+ String fontStyle = attributes.getValue("font-style");
+ int fontWeight = getAttributeAsInteger(
+ attributes, "font-weight", Font.NORMAL);
+ area.addTrait(trait,
+ new FontTriplet(fontName, fontStyle, fontWeight));
+ }
}
}
}
diff --git a/src/java/org/apache/fop/area/PageViewport.java b/src/java/org/apache/fop/area/PageViewport.java
index 88a52dc7a..f1c12495d 100644
--- a/src/java/org/apache/fop/area/PageViewport.java
+++ b/src/java/org/apache/fop/area/PageViewport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -112,6 +112,8 @@ public class PageViewport implements Resolvable, Cloneable {
this.pageNumberString = original.pageNumberString;
this.page = (Page)original.page.clone();
this.viewArea = (Rectangle2D)original.viewArea.clone();
+ this.simplePageMasterName = original.simplePageMasterName;
+ this.blank = original.blank;
}
/**
@@ -119,11 +121,16 @@ public class PageViewport implements Resolvable, Cloneable {
* @param viewArea the view area
* @param pageNumber the page number
* @param pageStr String representation of the page number
+ * @param simplePageMasterName name of the original simple-page-master that generated this page
+ * @param blank true if this is a blank page
*/
- public PageViewport(Rectangle2D viewArea, int pageNumber, String pageStr) {
+ public PageViewport(Rectangle2D viewArea, int pageNumber, String pageStr,
+ String simplePageMasterName, boolean blank) {
this.viewArea = viewArea;
this.pageNumber = pageNumber;
this.pageNumberString = pageStr;
+ this.simplePageMasterName = simplePageMasterName;
+ this.blank = blank;
}
/**
diff --git a/src/java/org/apache/fop/area/Trait.java b/src/java/org/apache/fop/area/Trait.java
index a58d527a9..f6f3bac60 100644
--- a/src/java/org/apache/fop/area/Trait.java
+++ b/src/java/org/apache/fop/area/Trait.java
@@ -18,9 +18,6 @@
package org.apache.fop.area;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.Constants;
import org.apache.fop.fonts.FontTriplet;
@@ -28,9 +25,6 @@ import org.apache.fop.image.FopImage;
import org.apache.fop.traits.BorderProps;
import java.io.Serializable;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
// properties should be serialized by the holder
/**
@@ -39,14 +33,11 @@ import java.util.Iterator;
*/
public class Trait implements Serializable {
- /** Logger instance */
- private static Log log = LogFactory.getLog(Trait.class);
-
/**
* Id reference line, not resolved.
* not sure if this is needed.
*/
- public static final Integer ID_LINK = new Integer(0);
+ //public static final Integer ID_LINK = new Integer(0);
/**
* Internal link trait.
@@ -102,12 +93,12 @@ public class Trait implements Serializable {
/**
* Shadow offset.
*/
- public static final Integer OFFSET = new Integer(13);
+ //public static final Integer OFFSET = new Integer(13);
/**
* The shadow for text.
*/
- public static final Integer SHADOW = new Integer(14);
+ //public static final Integer SHADOW = new Integer(14);
/**
* The border start.
@@ -162,12 +153,12 @@ public class Trait implements Serializable {
/**
* break before
*/
- public static final Integer BREAK_BEFORE = new Integer(25);
+ //public static final Integer BREAK_BEFORE = new Integer(25);
/**
* break after
*/
- public static final Integer BREAK_AFTER = new Integer(26);
+ //public static final Integer BREAK_AFTER = new Integer(26);
/**
* The start-indent trait.
@@ -201,11 +192,11 @@ public class Trait implements Serializable {
/** Trait for color of linethrough decorations when rendering inline parent. */
public static final Integer LINETHROUGH_COLOR = new Integer(36);
- private static final Map TRAIT_INFO = new HashMap();
+ /** Maximum value used by trait keys */
+ public static final int MAX_TRAIT_KEY = 36;
+
+ private static final TraitInfo[] TRAIT_INFO = new TraitInfo[MAX_TRAIT_KEY + 1];
- /** The list of simple traits in order to avoid iterators */
- public static final Object[] TRAIT_LIST;
-
private static class TraitInfo {
private String name;
private Class clazz; // Class of trait data
@@ -224,72 +215,66 @@ public class Trait implements Serializable {
}
}
+ private static void put(Integer key, TraitInfo info) {
+ TRAIT_INFO[key.intValue()] = info;
+ }
+
static {
// Create a hashmap mapping trait code to name for external representation
- TRAIT_INFO.put(ID_LINK, new TraitInfo("id-link", String.class));
- TRAIT_INFO.put(INTERNAL_LINK,
- new TraitInfo("internal-link", String.class));
- TRAIT_INFO.put(EXTERNAL_LINK,
- new TraitInfo("external-link", String.class));
- TRAIT_INFO.put(FONT,
- new TraitInfo("font", FontTriplet.class));
- TRAIT_INFO.put(FONT_SIZE,
- new TraitInfo("font-size", Integer.class));
- TRAIT_INFO.put(COLOR, new TraitInfo("color", Color.class));
- TRAIT_INFO.put(PROD_ID, new TraitInfo("prod-id", String.class));
- TRAIT_INFO.put(BACKGROUND,
- new TraitInfo("background", Background.class));
- TRAIT_INFO.put(UNDERLINE,
- new TraitInfo("underline-score", Boolean.class));
- TRAIT_INFO.put(UNDERLINE_COLOR, new TraitInfo("underline-score-color", Color.class));
- TRAIT_INFO.put(OVERLINE,
- new TraitInfo("overline-score", Boolean.class));
- TRAIT_INFO.put(OVERLINE_COLOR, new TraitInfo("overline-score-color", Color.class));
- TRAIT_INFO.put(LINETHROUGH,
- new TraitInfo("through-score", Boolean.class));
- TRAIT_INFO.put(LINETHROUGH_COLOR, new TraitInfo("through-score-color", Color.class));
- TRAIT_INFO.put(BLINK,
- new TraitInfo("blink", Boolean.class));
- TRAIT_INFO.put(OFFSET, new TraitInfo("offset", Integer.class));
- TRAIT_INFO.put(SHADOW, new TraitInfo("shadow", Integer.class));
- TRAIT_INFO.put(BORDER_START,
+ //put(ID_LINK, new TraitInfo("id-link", String.class));
+ put(INTERNAL_LINK, new TraitInfo("internal-link", String.class));
+ put(EXTERNAL_LINK, new TraitInfo("external-link", String.class));
+ put(FONT, new TraitInfo("font", FontTriplet.class));
+ put(FONT_SIZE, new TraitInfo("font-size", Integer.class));
+ put(COLOR, new TraitInfo("color", Color.class));
+ put(PROD_ID, new TraitInfo("prod-id", String.class));
+ put(BACKGROUND, new TraitInfo("background", Background.class));
+ put(UNDERLINE, new TraitInfo("underline-score", Boolean.class));
+ put(UNDERLINE_COLOR, new TraitInfo("underline-score-color", Color.class));
+ put(OVERLINE, new TraitInfo("overline-score", Boolean.class));
+ put(OVERLINE_COLOR, new TraitInfo("overline-score-color", Color.class));
+ put(LINETHROUGH, new TraitInfo("through-score", Boolean.class));
+ put(LINETHROUGH_COLOR, new TraitInfo("through-score-color", Color.class));
+ put(BLINK, new TraitInfo("blink", Boolean.class));
+ //put(OFFSET, new TraitInfo("offset", Integer.class));
+ //put(SHADOW, new TraitInfo("shadow", Integer.class));
+ put(BORDER_START,
new TraitInfo("border-start", BorderProps.class));
- TRAIT_INFO.put(BORDER_END,
+ put(BORDER_END,
new TraitInfo("border-end", BorderProps.class));
- TRAIT_INFO.put(BORDER_BEFORE,
+ put(BORDER_BEFORE,
new TraitInfo("border-before", BorderProps.class));
- TRAIT_INFO.put(BORDER_AFTER,
+ put(BORDER_AFTER,
new TraitInfo("border-after", BorderProps.class));
- TRAIT_INFO.put(PADDING_START,
+ put(PADDING_START,
new TraitInfo("padding-start", Integer.class));
- TRAIT_INFO.put(PADDING_END,
+ put(PADDING_END,
new TraitInfo("padding-end", Integer.class));
- TRAIT_INFO.put(PADDING_BEFORE,
+ put(PADDING_BEFORE,
new TraitInfo("padding-before", Integer.class));
- TRAIT_INFO.put(PADDING_AFTER,
+ put(PADDING_AFTER,
new TraitInfo("padding-after", Integer.class));
- TRAIT_INFO.put(SPACE_START,
+ put(SPACE_START,
new TraitInfo("space-start", Integer.class));
- TRAIT_INFO.put(SPACE_END,
+ put(SPACE_END,
new TraitInfo("space-end", Integer.class));
- TRAIT_INFO.put(BREAK_BEFORE,
- new TraitInfo("break-before", Integer.class));
- TRAIT_INFO.put(BREAK_AFTER,
- new TraitInfo("break-after", Integer.class));
- TRAIT_INFO.put(START_INDENT,
+ //put(BREAK_BEFORE,
+ // new TraitInfo("break-before", Integer.class));
+ //put(BREAK_AFTER,
+ // new TraitInfo("break-after", Integer.class));
+ put(START_INDENT,
new TraitInfo("start-indent", Integer.class));
- TRAIT_INFO.put(END_INDENT,
+ put(END_INDENT,
new TraitInfo("end-indent", Integer.class));
- TRAIT_INFO.put(SPACE_BEFORE,
+ put(SPACE_BEFORE,
new TraitInfo("space-before", Integer.class));
- TRAIT_INFO.put(SPACE_AFTER,
+ put(SPACE_AFTER,
new TraitInfo("space-after", Integer.class));
- TRAIT_INFO.put(IS_REFERENCE_AREA,
+ put(IS_REFERENCE_AREA,
new TraitInfo("is-reference-area", Boolean.class));
- TRAIT_INFO.put(IS_VIEWPORT_AREA,
+ put(IS_VIEWPORT_AREA,
new TraitInfo("is-viewport-area", Boolean.class));
- TRAIT_LIST = TRAIT_INFO.keySet().toArray();
}
/**
@@ -299,12 +284,7 @@ public class Trait implements Serializable {
* @return the trait name
*/
public static String getTraitName(Object traitCode) {
- Object obj = TRAIT_INFO.get(traitCode);
- if (obj != null) {
- return ((TraitInfo) obj).getName();
- } else {
- return "unknown-trait-" + traitCode.toString();
- }
+ return TRAIT_INFO[((Integer)traitCode).intValue()].getName();
}
/**
@@ -313,6 +293,7 @@ public class Trait implements Serializable {
* @param sTraitName the name of the trait to find
* @return the trait code object
*/
+ /*
public static Object getTraitCode(String sTraitName) {
Iterator iter = TRAIT_INFO.entrySet().iterator();
while (iter.hasNext()) {
@@ -323,17 +304,16 @@ public class Trait implements Serializable {
}
}
return null;
- }
+ }*/
/**
* Get the data storage class for the trait.
*
- * @param oTraitCode the trait code to lookup
+ * @param traitCode the trait code to lookup
* @return the class type for the trait
*/
- public static Class getTraitClass(Object oTraitCode) {
- TraitInfo ti = (TraitInfo) TRAIT_INFO.get(oTraitCode);
- return (ti != null ? ti.getClazz() : null);
+ public static Class getTraitClass(Object traitCode) {
+ return TRAIT_INFO[((Integer)traitCode).intValue()].getClazz();
}
/**
@@ -396,6 +376,7 @@ public class Trait implements Serializable {
* @param sTraitValue trait value as String
* @return the trait value as object
*/
+ /*
public static Object makeTraitValue(Object oCode, String sTraitValue) {
// Get the code from the name
// See what type of object it is
@@ -426,7 +407,7 @@ public class Trait implements Serializable {
return null;
- }
+ }*/
/**
* Serializable ColorType implementation for the area tree.
diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/java/org/apache/fop/layoutmgr/TraitSetter.java
index e8790173b..78d353093 100644
--- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java
+++ b/src/java/org/apache/fop/layoutmgr/TraitSetter.java
@@ -456,8 +456,10 @@ public class TraitSetter {
* @param breakAfter the value for break-after
*/
public static void addBreaks(Area area, int breakBefore, int breakAfter) {
+ /* Currently disabled as these traits are never used by the renderers
area.addTrait(Trait.BREAK_AFTER, new Integer(breakAfter));
area.addTrait(Trait.BREAK_BEFORE, new Integer(breakBefore));
+ */
}
/**
diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java
index 1e41defd8..9ef12c4c4 100644
--- a/src/java/org/apache/fop/render/xml/XMLRenderer.java
+++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java
@@ -454,6 +454,10 @@ public class XMLRenderer extends PrintRenderer {
addAttribute("bounds", page.getViewArea());
addAttribute("nr", page.getPageNumber());
addAttribute("formatted-nr", page.getPageNumberString());
+ addAttribute("simple-page-master-name", page.getSimplePageMasterName());
+ if (page.isBlank()) {
+ addAttribute("blank", "true");
+ }
startElement("pageViewport", atts);
startElement("page");