diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2011-10-24 16:29:56 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2011-10-24 16:29:56 +0000 |
commit | b073a605e44760bcb7add72968a3a2f78cf06d97 (patch) | |
tree | 50501d5167416c5a5a31f2319102efee829a8bd8 /src/java/org/apache/fop/fo/flow/table | |
parent | 29ecb2d96c4c4b75785e160a55c7dc436cfef860 (diff) | |
download | xmlgraphics-fop-b073a605e44760bcb7add72968a3a2f78cf06d97.tar.gz xmlgraphics-fop-b073a605e44760bcb7add72968a3a2f78cf06d97.zip |
Removed the FO document pre-processing step that was adding ptr and creating a reduced FO tree.
* Removed addPtr.xsl and reduceFOTree.xsl
* Implemented Common Accessibility properties on objects that support them
* Added a special implementation of FOEventHandler to build the structure tree
* Added mockito library and its dependencies
* Added mocks for some FO nodes and properties
* Removed FOTreeUnitTester and converted it into a re-usable FODocumentParser class
* Re-worked table FO test cases accordingly
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_ImproveAccessibility@1188205 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/flow/table')
6 files changed, 73 insertions, 11 deletions
diff --git a/src/java/org/apache/fop/fo/flow/table/Table.java b/src/java/org/apache/fop/fo/flow/table/Table.java index 86196cb29..ae7b8e4a1 100644 --- a/src/java/org/apache/fop/fo/flow/table/Table.java +++ b/src/java/org/apache/fop/fo/flow/table/Table.java @@ -32,6 +32,8 @@ import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.StaticPropertyList; import org.apache.fop.fo.ValidationException; import org.apache.fop.fo.properties.BreakPropertySet; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAccessibilityHolder; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; import org.apache.fop.fo.properties.CommonMarginBlock; import org.apache.fop.fo.properties.KeepProperty; @@ -43,9 +45,11 @@ import org.apache.fop.fo.properties.TableColLength; * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table"> * <code>fo:table</code></a> object. */ -public class Table extends TableFObj implements ColumnNumberManagerHolder, BreakPropertySet { +public class Table extends TableFObj implements ColumnNumberManagerHolder, BreakPropertySet, + CommonAccessibilityHolder { /** properties */ + private CommonAccessibility commonAccessibility; private CommonBorderPaddingBackground commonBorderPaddingBackground; private CommonMarginBlock commonMarginBlock; private LengthRangeProperty blockProgressionDimension; @@ -61,7 +65,6 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder, Break private int tableOmitFooterAtBreak; private int tableOmitHeaderAtBreak; // Unused but valid items, commented out for performance: - // private CommonAccessibility commonAccessibility; // private CommonAural commonAural; // private CommonRelativePosition commonRelativePosition; // private int intrusionDisplace; @@ -112,6 +115,7 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder, Break */ public void bind(PropertyList pList) throws FOPException { super.bind(pList); + commonAccessibility = CommonAccessibility.getInstance(pList); commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); commonMarginBlock = pList.getMarginBlockProps(); blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); @@ -301,6 +305,10 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder, Break } } + public CommonAccessibility getCommonAccessibility() { + return commonAccessibility; + } + /** {@inheritDoc} */ public Table getTable() { return this; diff --git a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java b/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java index 634460ec4..62acc579c 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java +++ b/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java @@ -25,17 +25,22 @@ import org.xml.sax.Locator; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAccessibilityHolder; /** * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-and-caption"> * <code>fo:table-and-caption</code></a> property. * TODO needs implementation */ -public class TableAndCaption extends FObj /*implements BreakPropertySet*/ { +public class TableAndCaption extends FObj implements CommonAccessibilityHolder { + + private CommonAccessibility commonAccessibility; + // The value of properties relevant for fo:table-and-caption. // Unused but valid items, commented out for performance: - // private CommonAccessibility commonAccessibility; // private CommonAural commonAural; // private CommonBorderPaddingBackground commonBorderPaddingBackground; // private CommonMarginBlock commonMarginBlock; @@ -50,7 +55,7 @@ public class TableAndCaption extends FObj /*implements BreakPropertySet*/ { // private int textAlign; // End of property values - private static boolean notImplementedWarningGiven = false; + static boolean notImplementedWarningGiven = false; // CSOK: VisibilityModifier /** used for FO validation */ private boolean tableCaptionFound = false; @@ -71,6 +76,12 @@ public class TableAndCaption extends FObj /*implements BreakPropertySet*/ { } } + @Override + public void bind(PropertyList pList) throws FOPException { + super.bind(pList); + commonAccessibility = CommonAccessibility.getInstance(pList); + } + /** * Make sure content model satisfied, if so then tell the * FOEventHandler that we are at the end of the flow. @@ -128,5 +139,10 @@ public class TableAndCaption extends FObj /*implements BreakPropertySet*/ { public int getNameId() { return FO_TABLE_AND_CAPTION; } + + public CommonAccessibility getCommonAccessibility() { + return commonAccessibility; + } + } diff --git a/src/java/org/apache/fop/fo/flow/table/TableCaption.java b/src/java/org/apache/fop/fo/flow/table/TableCaption.java index fc5d3d5b7..127c09802 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCaption.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCaption.java @@ -27,13 +27,18 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAccessibilityHolder; /** * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-caption"> * <code>fo:table-caption</code></a> object. */ -public class TableCaption extends FObj { +public class TableCaption extends FObj implements CommonAccessibilityHolder { + + private CommonAccessibility commonAccessibility; + // The value of properties relevant for fo:table-caption. // Unused but valid items, commented out for performance: // private CommonAural commonAural; @@ -49,7 +54,7 @@ public class TableCaption extends FObj { /** used for FO validation */ private boolean blockItemFound = false; - private static boolean notImplementedWarningGiven = false; + static boolean notImplementedWarningGiven = false; // CSOK: VisibilityModifier /** * Create a TableCaption instance with the given {@link FONode} @@ -69,6 +74,7 @@ public class TableCaption extends FObj { /** {@inheritDoc} */ public void bind(PropertyList pList) throws FOPException { super.bind(pList); + commonAccessibility = CommonAccessibility.getInstance(pList); } /** {@inheritDoc} */ @@ -109,5 +115,10 @@ public class TableCaption extends FObj { public int getNameId() { return FO_TABLE_CAPTION; } + + public CommonAccessibility getCommonAccessibility() { + return commonAccessibility; + } + } diff --git a/src/java/org/apache/fop/fo/flow/table/TableCell.java b/src/java/org/apache/fop/fo/flow/table/TableCell.java index 637ee2a9a..549377ffd 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCell.java @@ -26,6 +26,8 @@ import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAccessibilityHolder; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; import org.apache.fop.fo.properties.LengthRangeProperty; @@ -33,8 +35,9 @@ import org.apache.fop.fo.properties.LengthRangeProperty; * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-cell"> * <code>fo:table-cell</code></a> object. */ -public class TableCell extends TableFObj { +public class TableCell extends TableFObj implements CommonAccessibilityHolder { // The value of properties relevant for fo:table-cell. + private CommonAccessibility commonAccessibility; private CommonBorderPaddingBackground commonBorderPaddingBackground; private LengthRangeProperty blockProgressionDimension; private int columnNumber; @@ -46,7 +49,6 @@ public class TableCell extends TableFObj { private int startsRow; private Length width; // Unused but valid items, commented out for performance: - // private CommonAccessibility commonAccessibility; // private CommonAural commonAural; // private CommonRelativePosition commonRelativePosition; // private int relativeAlign; @@ -74,6 +76,7 @@ public class TableCell extends TableFObj { */ public void bind(PropertyList pList) throws FOPException { super.bind(pList); + commonAccessibility = CommonAccessibility.getInstance(pList); commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum(); @@ -145,6 +148,10 @@ public class TableCell extends TableFObj { return true; } + public CommonAccessibility getCommonAccessibility() { + return commonAccessibility; + } + /** * Get the {@link CommonBorderPaddingBackground} instance * attached to this TableCell. diff --git a/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java b/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java index 41eab578f..4b2a5101f 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java @@ -24,11 +24,17 @@ import java.util.List; import org.apache.fop.apps.FOPException; import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAccessibilityHolder; /** * A common class for fo:table-body and fo:table-row which both can contain fo:table-cell. */ -public abstract class TableCellContainer extends TableFObj implements ColumnNumberManagerHolder { +public abstract class TableCellContainer extends TableFObj + implements ColumnNumberManagerHolder, CommonAccessibilityHolder { + + private CommonAccessibility commonAccessibility; /** list of pending spans */ protected List pendingSpans; @@ -44,6 +50,12 @@ public abstract class TableCellContainer extends TableFObj implements ColumnNumb super(parent); } + @Override + public void bind(PropertyList pList) throws FOPException { + super.bind(pList); + commonAccessibility = CommonAccessibility.getInstance(pList); + } + /** * Add cell to current row. * @param cell a table cell to add @@ -116,4 +128,8 @@ public abstract class TableCellContainer extends TableFObj implements ColumnNumb return columnNumberManager; } + public CommonAccessibility getCommonAccessibility() { + return commonAccessibility; + } + } diff --git a/src/java/org/apache/fop/fo/flow/table/TableFObj.java b/src/java/org/apache/fop/fo/flow/table/TableFObj.java index fce82dcff..0da7b9458 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableFObj.java +++ b/src/java/org/apache/fop/fo/flow/table/TableFObj.java @@ -74,7 +74,6 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE).getNumeric(); borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE).getNumeric(); borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE).getNumeric(); - ptr = pList.get(PR_X_PTR).getString(); if (getNameId() != FO_TABLE //Separate check for fo:table in Table.java && getNameId() != FO_TABLE_CELL && getCommonBorderPaddingBackground().hasPadding( @@ -241,6 +240,11 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty } } + @Override + public void setPtr(String ptr) { + this.ptr = ptr; + } + /** {@inheritDoc} */ public String getPtr() { return ptr; |