Quellcode durchsuchen

1.) validateChildNode() added for fo:marker.

2.) new getPropString() convenience method added to FObj, will reduce
need for many individual methods on each FO.

3.) fo:float disconnected from ToBeImplementedElement in favor of a
class-specific warning.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197883 13f79535-47bb-0310-9956-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
Glen Mazza vor 20 Jahren
Ursprung
Commit
9729fe17d6

+ 1
- 1
src/java/org/apache/fop/area/AreaTreeHandler.java Datei anzeigen

@@ -436,7 +436,7 @@ public class AreaTreeHandler extends FOInputHandler {
// to the Title.
InlineStackingLayoutManager lm;
lm = new InlineStackingLayoutManager(foTitle);
lm.setLMiter(new LMiter(lm, foTitle.childNodes.listIterator()));
lm.setLMiter(new LMiter(lm, foTitle.getChildNodes()));
lm.initialize();

// get breaks then add areas to title

+ 13
- 2
src/java/org/apache/fop/fo/FObj.java Datei anzeigen

@@ -180,13 +180,24 @@ public class FObj extends FONode implements Constants {
/**
* Helper method to quickly obtain the value of a property
* for this FO, without querying for the propertyList first.
* @param name - the name of the desired property to obtain
* @param propId - the Constants ID of the desired property to obtain
* @return the property
*/
public Property getProperty(int propId) {
return propertyList.get(propId);
}

/**
* Helper method to quickly obtain the String value of a property
* for this FO, without querying for the propertyList first.
* Meaningful only for properties having a string representation
* @param propId - the Constants ID of the desired property to obtain
* @return the String value of the property value
*/
public String getPropString(int propId) {
return propertyList.get(propId).getString();
}

/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
@@ -378,7 +389,7 @@ public class FObj extends FONode implements Constants {
* @param marker Marker to add.
*/
protected void addMarker(Marker marker) {
String mcname = marker.getMarkerClassName();
String mcname = marker.getPropString(PR_MARKER_CLASS_NAME);
if (childNodes != null) {
// check for empty childNodes
for (Iterator iter = childNodes.iterator(); iter.hasNext();) {

+ 9
- 2
src/java/org/apache/fop/fo/flow/Float.java Datei anzeigen

@@ -25,18 +25,25 @@ import org.xml.sax.SAXParseException;

// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.ToBeImplementedElement;
import org.apache.fop.fo.FObj;

/**
* fo:float element.
*/
public class Float extends ToBeImplementedElement {
public class Float extends FObj {

static boolean notImplementedWarningGiven = false;
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public Float(FONode parent) {
super(parent);
if (!notImplementedWarningGiven) {
getLogger().warn("fo:float is not yet implemented.");
notImplementedWarningGiven = true;
}
}

/**

+ 15
- 12
src/java/org/apache/fop/fo/flow/Marker.java Datei anzeigen

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

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

// FOP
@@ -28,16 +29,11 @@ import org.apache.fop.fo.FObjMixed;

/**
* Marker formatting object.
* This is the marker formatting object that handles merkers.
* This attempts to add itself to the parent formatting object.
*/
public class Marker extends FObjMixed {

private String markerClassName;

/**
* Create a marker fo.
*
* @param parent the parent fo node
*/
public Marker(FONode parent) {
@@ -49,19 +45,26 @@ public class Marker extends FObjMixed {
*/
protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.markerClassName =
this.propertyList.get(PR_MARKER_CLASS_NAME).getString();
}

/**
* Get the marker class name for this marker.
*
* @return the marker class name
* @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
* XSL Content Model: (#PCDATA|%inline;|%block;)*
* Additionally: "An fo:marker may contain any formatting objects that
* are permitted as a replacement of any fo:retrieve-marker that retrieves
* the fo:marker's children."
* @todo implement "additional" constraint, possibly within fo:retrieve-marker
*/
public String getMarkerClassName() {
return markerClassName;
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws SAXParseException {
if (!isBlockOrInlineItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
}

/**
* @see org.apache.fop.fo.FObj#getName()
*/
public String getName() {
return "fo:marker";
}

+ 3
- 1
src/java/org/apache/fop/fo/flow/Table.java Datei anzeigen

@@ -168,7 +168,6 @@ public class Table extends FObj {
}

public Column getTableColumnLayoutManager(TableColumn node) {
node.initialize();
Column clm = new Column(node);
return clm;
}
@@ -178,6 +177,9 @@ public class Table extends FObj {
return blm;
}

/**
* @see org.apache.fop.fo.FObj#getName()
*/
public String getName() {
return "fo:table";
}

+ 16
- 26
src/java/org/apache/fop/fo/flow/TableColumn.java Datei anzeigen

@@ -36,14 +36,11 @@ import org.apache.fop.fo.FObj;
public class TableColumn extends FObj {

private ColorType backgroundColor;

private Length columnWidth;
private int columnOffset;
private int numColumnsRepeated;
private int iColumnNumber;

private boolean initialized = false;

/**
* @param parent FONode that is the parent of this object
*/
@@ -61,14 +58,28 @@ public class TableColumn extends FObj {
}

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

iColumnNumber = propertyList.get(PR_COLUMN_NUMBER).getNumber().intValue();
numColumnsRepeated =
propertyList.get(PR_NUMBER_COLUMNS_REPEATED).getNumber().intValue();
this.backgroundColor =
this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
columnWidth = this.propertyList.get(PR_COLUMN_WIDTH).getLength();

getFOInputHandler().startColumn(this);
}

/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
protected void endOfNode() throws SAXParseException {
getFOInputHandler().endColumn(this);
}

/**
* @return Length object containing column width
*/
@@ -90,27 +101,6 @@ public class TableColumn extends FObj {
return numColumnsRepeated;
}

/**
* @todo convert to addProperties()
*/
public void initialize() {
iColumnNumber = propertyList.get(PR_COLUMN_NUMBER).getNumber().intValue();

numColumnsRepeated =
propertyList.get(PR_NUMBER_COLUMNS_REPEATED).getNumber().intValue();

this.backgroundColor =
this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();

columnWidth = this.propertyList.get(PR_COLUMN_WIDTH).getLength();

initialized = true;
}

protected void endOfNode() throws SAXParseException {
getFOInputHandler().endColumn(this);
}
public String getName() {
return "fo:table-column";
}

Laden…
Abbrechen
Speichern