import java.io.Serializable;
+import java.util.Map;
import java.util.HashMap;
// If the area appears more than once in the output
*
* @return the map of traits
*/
- public HashMap getTraits() {
+ public Map getTraits() {
return this.props;
}
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.HashMap;
+import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
private AreaTreeModel model;
// hashmap of arraylists containing pages with id area
- private HashMap idLocations = new HashMap();
+ private Map idLocations = new HashMap();
// list of id's yet to be resolved and arraylists of pages
- private HashMap resolve = new HashMap();
- private ArrayList treeExtensions = new ArrayList();
+ private Map resolve = new HashMap();
+ private List treeExtensions = new ArrayList();
/**
* Create a render pages area tree model.
}
list.add(pv);
- HashSet todo = (HashSet)resolve.get(id);
+ Set todo = (Set)resolve.get(id);
if (todo != null) {
for (Iterator iter = todo.iterator(); iter.hasNext();) {
Resolveable res = (Resolveable)iter.next();
* @param res the Resolveable object to resolve
*/
public void addUnresolvedID(String id, Resolveable res) {
- HashSet todo = (HashSet)resolve.get(id);
+ Set todo = (Set)resolve.get(id);
if (todo == null) {
todo = new HashSet();
resolve.put(id, todo);
String[] ids = res.getIDs();
for (int count = 0; count < ids.length; count++) {
if (idLocations.containsKey(ids[count])) {
- res.resolve(ids[count], (ArrayList)idLocations.get(ids[count]));
+ res.resolve(ids[count], (List)idLocations.get(ids[count]));
} else {
- HashSet todo = (HashSet)resolve.get(ids[count]);
+ Set todo = (Set)resolve.get(ids[count]);
if (todo == null) {
todo = new HashSet();
resolve.put(ids[count], todo);
public void endDocument() {
for (Iterator iter = resolve.keySet().iterator(); iter.hasNext();) {
String id = (String)iter.next();
- HashSet list = (HashSet)resolve.get(id);
+ Set list = (Set)resolve.get(id);
for (Iterator resIter = list.iterator(); resIter.hasNext();) {
Resolveable res = (Resolveable)resIter.next();
if (!res.isResolved()) {
* The pages are stored and can be retrieved in any order.
*/
public static class StorePagesModel extends AreaTreeModel {
- private ArrayList pageSequence = null;
- private ArrayList titles = new ArrayList();
- private ArrayList currSequence;
- private ArrayList extensions = new ArrayList();
+ private List pageSequence = null;
+ private List titles = new ArrayList();
+ private List currSequence;
+ private List extensions = new ArrayList();
/**
* Create a new store pages model
* @return returns the number of pages in a page sequence
*/
public int getPageCount(int seq) {
- ArrayList sequence = (ArrayList) pageSequence.get(seq);
+ List sequence = (List) pageSequence.get(seq);
return sequence.size();
}
* @return the PageViewport for the particular page
*/
public PageViewport getPage(int seq, int count) {
- ArrayList sequence = (ArrayList) pageSequence.get(seq);
+ List sequence = (List) pageSequence.get(seq);
return (PageViewport) sequence.get(count);
}
/**
* Pages that have been prepared but not rendered yet.
*/
- protected ArrayList prepared = new ArrayList();
- private ArrayList pendingExt = new ArrayList();
- private ArrayList endDocExt = new ArrayList();
+ protected List prepared = new ArrayList();
+ private List pendingExt = new ArrayList();
+ private List endDocExt = new ArrayList();
/**
* Create a new render pages model with the given renderer.
}
}
- private void renderExtensions(ArrayList list) {
+ private void renderExtensions(List list) {
for (int count = 0; count < list.size(); count++) {
TreeExt ext = (TreeExt)list.get(count);
renderer.renderExtension(ext);
/**
* The children of this block parent area.
*/
- protected ArrayList children = null;
+ protected List children = null;
// orientation if reference area
private int orientation = ORIENT_0;
import org.apache.fop.render.Renderer;
+import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
* the contents a reloaded.
*/
public class CachedRenderPagesModel extends AreaTree.RenderPagesModel {
- private HashMap pageMap = new HashMap();
+ private Map pageMap = new HashMap();
/**
* Create a new render pages model with the given renderer.
// this class can contain the dominant char styling info
// this means that many renderers can optimise a bit
- private ArrayList inlineAreas = new ArrayList();
+ private List inlineAreas = new ArrayList();
/**
* Set the height of this line area.
package org.apache.fop.area;
import java.io.Serializable;
+import java.util.Map;
import java.util.HashMap;
/**
// hashmap of markers for this page
// start and end are added by the fo that contains the markers
- private HashMap markerStart = null;
- private HashMap markerEnd = null;
+ private Map markerStart = null;
+ private Map markerEnd = null;
// temporary map of unresolved objects used when serializing the page
- private HashMap unresolved = null;
+ private Map unresolved = null;
/**
* Set the region on this page.
*
* @param unres the map of unresolved objects
*/
- public void setUnresolvedReferences(HashMap unres) {
+ public void setUnresolvedReferences(Map unres) {
unresolved = unres;
}
*
* @return the de-serialized map of unresolved objects
*/
- public HashMap getUnresolvedReferences() {
+ public Map getUnresolvedReferences() {
return unresolved;
}
}
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
private String pageNumber = null;
// list of id references and the rectangle on the page
- private HashMap idReferences = null;
+ private Map idReferences = null;
// this keeps a list of currently unresolved areas or extensions
// once the thing is resolved it is removed
// when this is empty the page can be rendered
- private HashMap unresolved = null;
+ private Map unresolved = null;
- private HashMap pendingResolved = null;
+ private Map pendingResolved = null;
/**
* Create a page viewport.
private int regionClass = BEFORE;
private CTM ctm;
// the list of block areas from the static flow
- private ArrayList blocks = new ArrayList();
+ private List blocks = new ArrayList();
/**
* Create a new region reference area.
package org.apache.fop.area;
+import java.util.List;
import java.util.ArrayList;
// this is a reference area block area with 0 border and padding
public class Span extends Area {
// the list of flow reference areas in this span area
- private ArrayList flowAreas;
+ private List flowAreas;
private int height;
public Span(int cols) {
*/
public class Title extends LineArea {
}
+
public static final Integer LINETHROUGH = new Integer(12);
/**
- *
+ * Shadow offset.
*/
public static final Integer OFFSET = new Integer(13);
* The border start.
*/
public static final Integer BORDER_START = new Integer(15);
+
+ /**
+ * The border end.
+ */
public static final Integer BORDER_END = new Integer(16);
+
+ /**
+ * The border before.
+ */
public static final Integer BORDER_BEFORE = new Integer(17);
+
+ /**
+ * The border after.
+ */
public static final Integer BORDER_AFTER = new Integer(18);
+
+ /**
+ * The padding start.
+ */
public static final Integer PADDING_START = new Integer(19);
+
+ /**
+ * The padding end.
+ */
public static final Integer PADDING_END = new Integer(20);
+
+ /**
+ * The padding before.
+ */
public static final Integer PADDING_BEFORE = new Integer(21);
+
+ /**
+ * The padding after.
+ */
public static final Integer PADDING_AFTER = new Integer(22);
- static HashMap shmTraitInfo;
+ private static final Map shmTraitInfo = new HashMap();
private static class TraitInfo {
String sName;
static {
// Create a hashmap mapping trait code to name for external representation
- shmTraitInfo = new HashMap();
shmTraitInfo.put(ID_LINK, new TraitInfo("id-link", String.class));
shmTraitInfo.put(INTERNAL_LINK,
new TraitInfo("internal-link", String.class));
new TraitInfo("padding-after", Integer.class));
}
+ /**
+ * Get the trait name for a trait code.
+ *
+ * @param traitCode the trait code to get the name for
+ * @return the trait name
+ */
public static String getTraitName(Object traitCode) {
Object obj = shmTraitInfo.get(traitCode);
if (obj != null) {
}
}
+ /**
+ * Get the trait code for a trait name.
+ *
+ * @param sTraitName the name of the trait to find
+ * @return the trait code object
+ */
public static Object getTraitCode(String sTraitName) {
Iterator iter = shmTraitInfo.entrySet().iterator();
while (iter.hasNext()) {
return null;
}
+ /**
+ * Get the data storage class for the trait.
+ *
+ * @param oTraitCode the trait code to lookup
+ * @return the class type for the trait
+ */
private static Class getTraitClass(Object oTraitCode) {
TraitInfo ti = (TraitInfo) shmTraitInfo.get(oTraitCode);
return (ti != null ? ti.sClass : null);
}
+ /**
+ * The type of trait for an area.
+ */
public Object propType;
+
+ /**
+ * The data value of the trait.
+ */
public Object data;
+ /**
+ * Create a new emty trait.
+ */
public Trait() {
this.propType = null;
this.data = null;
}
+ /**
+ * Create a trait with the value and type.
+ *
+ * @param propType the type of trait
+ * @param data the data value
+ */
public Trait(Object propType, Object data) {
this.propType = propType;
this.data = data;
}
+ /**
+ * Return the string for debugging.
+ *
+ * @param the string from the data value
+ */
public String toString() {
return data.toString();
}
+ /**
+ * Make a trait value.
+ *
+ * @param oCode
+ */
public static Object makeTraitValue(Object oCode, String sTraitValue) {
// Get the code from the name
// See what type of object it is
return null;
}
+ /**
+ * Background trait structure.
+ * Used for storing back trait information which are related.
+ */
public static class Background implements Serializable {
+ /**
+ * The background color if any.
+ */
public ColorType color = null;
+
+ /**
+ * The background image url if any.
+ */
public String url = null;
+
+ /**
+ * Background repeat enum for images.
+ */
public int repeat;
+
+ /**
+ * Background horizontal offset for images.
+ */
public int horiz;
+
+ /**
+ * Background vertical offset for images.
+ */
public int vertical;
}
// has reference to associated footnote or float out-of-line area
}
+
/**
* Single character inline area.
- * This inline area holds a single characater.
+ * This inline area holds a single character.
*/
public class Character extends InlineArea {
private char character;
character = ch;
}
- // character info: font, char spacing, colour, baseline
-
/**
* Render this inline area.
*
public char getChar() {
return character;
}
-
}
+
import java.util.List;
import java.util.ArrayList;
-// this is an inline area that can have blocks as children
+/**
+ * Container area for inline container.
+ * This area should be placed in a viewport as a result of the
+ * inline container formatting object.
+ * This allows an inline area to have blocks as children.
+ */
public class Container extends Area {
- ArrayList blocks = new ArrayList();
- int width;
+ /**
+ * The list of block areas stacked inside this container
+ */
+ protected List blocks = new ArrayList();
- public Container() {
- }
+ /**
+ * The width of this container
+ */
+ protected int width;
- public void render(Renderer renderer) {
- renderer.renderContainer(this);
+ /**
+ * Create a new container area
+ */
+ public Container() {
}
+ /**
+ * Add the block to this area.
+ *
+ * @param block the block area to add
+ */
public void addBlock(Block block) {
blocks.add(block);
}
+ /**
+ * Get the block areas stacked inside this container area.
+ *
+ * @return the list of block areas
+ */
public List getBlocks() {
return blocks;
}
+ /**
+ * Get the width of this container area.
+ *
+ * @return the width
+ */
public int getWidth() {
return width;
}
-
}
+
*/
public List getChildAreas() {
int units = (int)(getWidth() / unitWidth);
- ArrayList newList = new ArrayList();
+ List newList = new ArrayList();
for (int count = 0; count < units; count++) {
newList.addAll(inlines);
}
public String getURL() {
return url;
}
-
}
+
import org.apache.fop.render.Renderer;
import org.apache.fop.traits.BorderProps;
-import java.util.ArrayList;
-
/**
* Inline Area
* This area is for all inline areas that can be placed
// offset position from top of parent area
int verticalPosition = 0;
- // store properties in array list, need better solution
- private ArrayList props = null;
-
/**
* Render this inline area.
* Inline areas that extend this class are expected
public void render(Renderer renderer) {
}
+ /**
+ * Set the width of this inline area.
+ * Currently sets the ipd.
+ *
+ * @param w the width
+ */
public void setWidth(int w) {
contentIPD = w;
}
+ /**
+ * Get the width of this inline area.
+ * Currently gets the ipd.
+ *
+ * @return the width
+ */
public int getWidth() {
return contentIPD;
}
return iBP;
}
+ /**
+ * Set the offset of this inline area.
+ * This is used to set the offset of the inline area
+ * which is normally relative to the top of the line
+ * or the baseline.
+ *
+ * @param v the offset
+ */
public void setOffset(int v) {
verticalPosition = v;
}
+ /**
+ * Get the offset of this inline area.
+ * This returns the offset of the inline area
+ * which is normally relative to the top of the line
+ * or the baseline.
+ *
+ * @return the offset
+ */
public int getOffset() {
return verticalPosition;
}
/**
* The list of inline areas added to this inline parent.
*/
- protected ArrayList inlines = new ArrayList();
+ protected List inlines = new ArrayList();
/**
* An inline parent is a reference area somay have clipping
*/
public class Leader extends InlineArea {
- // pattern, length min opt max
-
// in the case of use content or dots this is replaced
// with the set of inline areas
// if space replaced with a space
renderer.renderLeader(this);
}
}
+
out.writeFloat((float) contentPosition.getHeight());
}
out.writeBoolean(clip);
- //out.writeObject(props);
+ out.writeObject(props);
out.writeObject(content);
}
in.readFloat());
}
clip = in.readBoolean();
- //props = (HashMap) in.readObject();
+ props = (HashMap) in.readObject();
content = (Area) in.readObject();
}
import org.apache.fop.render.Renderer;
public class Word extends InlineArea {
- // character info: font, char spacing, colour, baseline
/**
* The word for this word area.
*/
protected String word;
private int iWSadjust = 0;
+ /**
+ * Create a word area.
+ */
+ public Word() {
+ }
+
+ /**
+ * Render the word to the renderer.
+ *
+ * @param renderer the renderer to render this word
+ */
public void render(Renderer renderer) {
renderer.renderWord(this);
}
+ /**
+ * Set the word.
+ *
+ * @param w the word string
+ */
public void setWord(String w) {
word = w;
}
+ /**
+ * Get the word string.
+ *
+ * @return the word string
+ */
public String getWord() {
return word;
}
+ /**
+ * Get word space adjust.
+ *
+ * @return the word space adjustment
+ */
public int getWSadjust() {
return iWSadjust;
}
+ /**
+ * Set word space adjust.
+ *
+ * @param iWSadjust the word space adjustment
+ */
public void setWSadjust(int iWSadjust) {
this.iWSadjust = iWSadjust;
}