aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-02-15 19:30:51 +0000
committerJeremias Maerki <jeremias@apache.org>2005-02-15 19:30:51 +0000
commit64679953e000d40e4006698cdfe3da49c730ca04 (patch)
tree5960eee72ded477c5427e7c2b3eb088e20703b88 /src/java
parentf8539053bb5582ea2fcba5a355524b0941d3bfe4 (diff)
downloadxmlgraphics-fop-64679953e000d40e4006698cdfe3da49c730ca04.tar.gz
xmlgraphics-fop-64679953e000d40e4006698cdfe3da49c730ca04.zip
Set border traits for fo:table only if border-collapse="separate".
Some clean-up. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198430 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/fo/flow/Table.java10
-rw-r--r--src/java/org/apache/fop/fo/flow/TableCell.java19
-rw-r--r--src/java/org/apache/fop/fo/flow/TableRow.java1
-rwxr-xr-xsrc/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/Cell.java12
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java4
6 files changed, 42 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java
index 15b402fa6..78272973e 100644
--- a/src/java/org/apache/fop/fo/flow/Table.java
+++ b/src/java/org/apache/fop/fo/flow/Table.java
@@ -122,6 +122,11 @@ public class Table extends FObj {
PropertyList colPList = new StaticPropertyList(defaultColumn, pList);
colPList.setWritingMode();
defaultColumn.bind(colPList);
+
+ if (borderCollapse != EN_SEPARATE && commonBorderPaddingBackground.hasPadding()) {
+ //See "17.6.2 The collapsing border model" in CSS2
+ getLogger().error("Table may not have padding when using the collapsing border model.");
+ }
}
/**
@@ -237,6 +242,11 @@ public class Table extends FObj {
return borderCollapse;
}
+ /** @return true if the separate border model is active */
+ public boolean isSeparateBorderModel() {
+ return (getBorderCollapse() == EN_SEPARATE);
+ }
+
/** @return the "border-separation" property. */
public LengthPairProperty getBorderSeparation() {
return borderSeparation;
diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java
index 9853a54ff..6466da453 100644
--- a/src/java/org/apache/fop/fo/flow/TableCell.java
+++ b/src/java/org/apache/fop/fo/flow/TableCell.java
@@ -49,8 +49,8 @@ public class TableCell extends FObj {
// private ToBeImplementedProperty borderEndPrecedence;
// private ToBeImplementedProperty borderStartPrecedence;
private LengthRangeProperty blockProgressionDimension;
- private int borderCollapse;
- private LengthPairProperty borderSeparation;
+ private int borderCollapse; //inherited from fo:table
+ private LengthPairProperty borderSeparation; //inherited from fo:table
private Numeric columnNumber;
private int displayAlign;
private int relativeAlign;
@@ -303,6 +303,21 @@ public class TableCell extends FObj {
return (this.emptyCells == EN_SHOW);
}
+ /** @return the "border-collapse" property (inherited from fo:table). */
+ public int getBorderCollapse() {
+ return borderCollapse;
+ }
+
+ /** @return true if the separate border model is active */
+ public boolean isSeparateBorderModel() {
+ return (getBorderCollapse() == EN_SEPARATE);
+ }
+
+ /** @return the "border-separation" property (inherited from fo:table). */
+ public LengthPairProperty getBorderSeparation() {
+ return borderSeparation;
+ }
+
/**
* @return the "id" property.
*/
diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java
index 573bc5594..0e484ebf3 100644
--- a/src/java/org/apache/fop/fo/flow/TableRow.java
+++ b/src/java/org/apache/fop/fo/flow/TableRow.java
@@ -25,7 +25,6 @@ import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.StaticPropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
diff --git a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
index 03cf70c2d..dbb090fe8 100755
--- a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
+++ b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
@@ -279,4 +279,10 @@ public class CommonBorderPaddingBackground implements Cloneable {
public boolean hasBackground() {
return ((backgroundColor != null || getFopImage() != null));
}
+
+ /** @return true if padding is non-zero. */
+ public boolean hasPadding() {
+ return ((getPaddingBefore(false) + getPaddingAfter(false)
+ + getPaddingStart(false) + getPaddingEnd(false)) > 0);
+ }
}
diff --git a/src/java/org/apache/fop/layoutmgr/table/Cell.java b/src/java/org/apache/fop/layoutmgr/table/Cell.java
index 3d2ed3747..c5b0b0892 100644
--- a/src/java/org/apache/fop/layoutmgr/table/Cell.java
+++ b/src/java/org/apache/fop/layoutmgr/table/Cell.java
@@ -115,8 +115,8 @@ public class Cell extends BlockStackingLayoutManager {
referenceIPD = context.getRefIPD();
cellIPD = referenceIPD;
cellIPD -= getIPIndents();
- if (getTable().getBorderCollapse() == EN_SEPARATE) {
- int borderSep = getTable().getBorderSeparation().getLengthPair()
+ if (fobj.isSeparateBorderModel()) {
+ int borderSep = fobj.getBorderSeparation().getLengthPair()
.getIPD().getLength().getValue();
cellIPD -= borderSep;
}
@@ -252,8 +252,8 @@ public class Cell extends BlockStackingLayoutManager {
addID(fobj.getId());
}
- if (!emptyCell || (getTable().getBorderCollapse() == EN_SEPARATE
- && fobj.showEmptyCells())) {
+ if (!emptyCell
+ || (fobj.isSeparateBorderModel() && fobj.showEmptyCells())) {
TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
}
@@ -320,8 +320,8 @@ public class Cell extends BlockStackingLayoutManager {
indent += fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
// set position
int halfBorderSep = 0;
- if (getTable().getBorderCollapse() == EN_SEPARATE) {
- halfBorderSep = getTable().getBorderSeparation().getLengthPair()
+ if (fobj.isSeparateBorderModel()) {
+ halfBorderSep = fobj.getBorderSeparation().getLengthPair()
.getIPD().getLength().getValue() / 2;
}
curBlockArea.setXOffset(xoffset + inRowIPDOffset + halfBorderSep + indent);
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
index c2778fce7..5a1ee47d2 100644
--- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
@@ -387,7 +387,9 @@ public class TableLayoutManager extends BlockStackingLayoutManager {
curBlockArea.setBPD(tableHeight);
- TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ if (fobj.isSeparateBorderModel()) {
+ TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ }
TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
TraitSetter.addMargins(curBlockArea,
fobj.getCommonBorderPaddingBackground(),