You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/10/19 16:07:40 UTC
svn commit: r326567 - in
/xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table:
TableCellLayoutManager.java TableLayoutManager.java
Author: jeremias
Date: Wed Oct 19 07:07:35 2005
New Revision: 326567
URL: http://svn.apache.org/viewcvs?rev=326567&view=rev
Log:
More code cleanup. Removing the duplicate fobj variables.
Modified:
xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
Modified: xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=326567&r1=326566&r2=326567&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Wed Oct 19 07:07:35 2005
@@ -48,7 +48,6 @@
public class TableCellLayoutManager extends BlockStackingLayoutManager
implements BlockLevelLayoutManager {
- private TableCell fobj;
private PrimaryGridUnit gridUnit;
private Block curBlockArea;
@@ -78,24 +77,26 @@
/** @return the table-cell FO */
public TableCell getTableCell() {
- return this.fobj;
+ return (TableCell)this.fobj;
}
private boolean isSeparateBorderModel() {
- return fobj.isSeparateBorderModel();
+ return getTableCell().isSeparateBorderModel();
}
/** @see org.apache.fop.layoutmgr.LayoutManager#initialize() */
public void initialize() {
borderAndPaddingBPD = 0;
- borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
- borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderAfterWidth(false);
+ borderAndPaddingBPD += getTableCell()
+ .getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
+ borderAndPaddingBPD += getTableCell()
+ .getCommonBorderPaddingBackground().getBorderAfterWidth(false);
if (!isSeparateBorderModel()) {
borderAndPaddingBPD /= 2;
}
- borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground()
+ borderAndPaddingBPD += getTableCell().getCommonBorderPaddingBackground()
.getPaddingBefore(false, this);
- borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground()
+ borderAndPaddingBPD += getTableCell().getCommonBorderPaddingBackground()
.getPaddingAfter(false, this);
}
@@ -121,8 +122,8 @@
if (!isSeparateBorderModel()) {
iIndents /= 2;
}
- iIndents += fobj.getCommonBorderPaddingBackground().getPaddingStart(false, this);
- iIndents += fobj.getCommonBorderPaddingBackground().getPaddingEnd(false, this);
+ iIndents += getTableCell().getCommonBorderPaddingBackground().getPaddingStart(false, this);
+ iIndents += getTableCell().getCommonBorderPaddingBackground().getPaddingEnd(false, this);
return iIndents;
}
@@ -136,7 +137,7 @@
cellIPD = referenceIPD;
cellIPD -= getIPIndents();
if (isSeparateBorderModel()) {
- int borderSep = fobj.getBorderSeparation().getLengthPair()
+ int borderSep = getTableCell().getBorderSeparation().getLengthPair()
.getIPD().getLength().getValue(this);
cellIPD -= borderSep;
}
@@ -330,11 +331,12 @@
LayoutContext layoutContext) {
getParentArea(null);
- getPSLM().addIDToPage(fobj.getId());
+ getPSLM().addIDToPage(getTableCell().getId());
if (isSeparateBorderModel()) {
- if (!emptyCell || fobj.showEmptyCells()) {
- TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground(), this);
+ if (!emptyCell || getTableCell().showEmptyCells()) {
+ TraitSetter.addBorders(curBlockArea,
+ getTableCell().getCommonBorderPaddingBackground(), this);
}
} else {
boolean[] outer = new boolean[] {
@@ -400,11 +402,11 @@
//Handle display-align
int contentBPD = getContentHeight(rowHeight, gridUnit);
if (usedBPD < contentBPD) {
- if (fobj.getDisplayAlign() == EN_CENTER) {
+ if (getTableCell().getDisplayAlign() == EN_CENTER) {
Block space = new Block();
space.setBPD((contentBPD - usedBPD) / 2);
curBlockArea.addBlock(space);
- } else if (fobj.getDisplayAlign() == EN_AFTER) {
+ } else if (getTableCell().getDisplayAlign() == EN_AFTER) {
Block space = new Block();
space.setBPD((contentBPD - usedBPD));
curBlockArea.addBlock(space);
@@ -417,15 +419,15 @@
// Add background after we know the BPD
if (isSeparateBorderModel()) {
- if (!emptyCell || fobj.showEmptyCells()) {
+ if (!emptyCell || getTableCell().showEmptyCells()) {
TraitSetter.addBackground(curBlockArea,
- fobj.getCommonBorderPaddingBackground(),
- this);
+ getTableCell().getCommonBorderPaddingBackground(),
+ this);
}
} else {
TraitSetter.addBackground(curBlockArea,
- fobj.getCommonBorderPaddingBackground(),
- this);
+ getTableCell().getCommonBorderPaddingBackground(),
+ this);
}
flush();
@@ -450,18 +452,19 @@
if (curBlockArea == null) {
curBlockArea = new Block();
curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
- TraitSetter.setProducerID(curBlockArea, fobj.getId());
+ TraitSetter.setProducerID(curBlockArea, getTableCell().getId());
curBlockArea.setPositioning(Block.ABSOLUTE);
int indent = 0;
indent += startBorderWidth;
if (!isSeparateBorderModel()) {
indent /= 2;
}
- indent += fobj.getCommonBorderPaddingBackground().getPaddingStart(false, this);
+ indent += getTableCell()
+ .getCommonBorderPaddingBackground().getPaddingStart(false, this);
// set position
int halfBorderSep = 0;
if (isSeparateBorderModel()) {
- halfBorderSep = fobj.getBorderSeparation().getLengthPair()
+ halfBorderSep = getTableCell().getBorderSeparation().getLengthPair()
.getIPD().getLength().getValue(this) / 2;
}
int borderAdjust = 0;
Modified: xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?rev=326567&r1=326566&r2=326567&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_SpaceResolution/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java Wed Oct 19 07:07:35 2005
@@ -54,8 +54,6 @@
public class TableLayoutManager extends BlockStackingLayoutManager
implements ConditionalElementListener {
- private Table fobj;
-
private TableContentLayoutManager contentLM;
private ColumnSetup columns = null;
@@ -79,13 +77,12 @@
*/
public TableLayoutManager(Table node) {
super(node);
- fobj = node;
this.columns = new ColumnSetup(node);
}
/** @return the table FO */
public Table getTable() {
- return this.fobj;
+ return (Table)this.fobj;
}
/**
@@ -97,11 +94,14 @@
/** @see org.apache.fop.layoutmgr.LayoutManager#initialize() */
public void initialize() {
- foSpaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore, this).getSpace();
- foSpaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter, this).getSpace();
+ foSpaceBefore = new SpaceVal(
+ getTable().getCommonMarginBlock().spaceBefore, this).getSpace();
+ foSpaceAfter = new SpaceVal(
+ getTable().getCommonMarginBlock().spaceAfter, this).getSpace();
- if (!fobj.isAutoLayout()
- && fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
+ if (!getTable().isAutoLayout()
+ && getTable().getInlineProgressionDimension().getOptimum(this).getEnum()
+ != EN_AUTO) {
autoLayout = false;
}
}
@@ -117,8 +117,8 @@
private int getIPIndents() {
int iIndents = 0;
- iIndents += fobj.getCommonMarginBlock().startIndent.getValue(this);
- iIndents += fobj.getCommonMarginBlock().endIndent.getValue(this);
+ iIndents += getTable().getCommonMarginBlock().startIndent.getValue(this);
+ iIndents += getTable().getCommonMarginBlock().endIndent.getValue(this);
return iIndents;
}
@@ -140,12 +140,12 @@
referenceBPD = context.getStackLimit().opt;
referenceIPD = context.getRefIPD();
- if (fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
- referenceIPD = fobj.getInlineProgressionDimension().getOptimum(this)
+ if (getTable().getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
+ referenceIPD = getTable().getInlineProgressionDimension().getOptimum(this)
.getLength().getValue(this);
contentIPD = referenceIPD;
} else {
- if (!fobj.isAutoLayout()) {
+ if (!getTable().isAutoLayout()) {
log.info("table-layout=\"fixed\" and width=\"auto\", "
+ "but auto-layout not supported "
+ "=> assuming width=\"100%\"");
@@ -180,7 +180,7 @@
addKnuthElementsForSpaceBefore(returnList, alignment);
- if (fobj.isSeparateBorderModel()) {
+ if (getTable().isSeparateBorderModel()) {
addKnuthElementsForBorderPaddingBefore(returnList);
}
@@ -282,7 +282,7 @@
}
}
wrapPositionElements(contentList, returnList);
- if (fobj.isSeparateBorderModel()) {
+ if (getTable().isSeparateBorderModel()) {
addKnuthElementsForBorderPaddingAfter(returnList);
}
addKnuthElementsForSpaceAfter(returnList, alignment);
@@ -302,9 +302,9 @@
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
getParentArea(null);
- getPSLM().addIDToPage(fobj.getId());
+ getPSLM().addIDToPage(getTable().getId());
- int startXOffset = fobj.getCommonMarginBlock().startIndent.getValue(this);
+ int startXOffset = getTable().getCommonMarginBlock().startIndent.getValue(this);
// add column, body then row areas
@@ -320,7 +320,7 @@
curBlockArea.setBPD(tableHeight);
- if (fobj.isSeparateBorderModel()) {
+ if (getTable().isSeparateBorderModel()) {
TraitSetter.addBorders(curBlockArea,
getTable().getCommonBorderPaddingBackground(),
discardBorderBefore, discardBorderAfter, false, false, this);
@@ -329,14 +329,14 @@
discardPaddingBefore, discardPaddingAfter, false, false, this);
}
TraitSetter.addBackground(curBlockArea,
- fobj.getCommonBorderPaddingBackground(),
+ getTable().getCommonBorderPaddingBackground(),
this);
TraitSetter.addMargins(curBlockArea,
- fobj.getCommonBorderPaddingBackground(),
- fobj.getCommonMarginBlock(),
+ getTable().getCommonBorderPaddingBackground(),
+ getTable().getCommonMarginBlock(),
this);
TraitSetter.addBreaks(curBlockArea,
- fobj.getBreakBefore(), fobj.getBreakAfter());
+ getTable().getBreakBefore(), getTable().getBreakAfter());
TraitSetter.addSpaceBeforeAfter(curBlockArea, layoutContext.getSpaceAdjust(),
effSpaceBefore, effSpaceAfter);
@@ -415,24 +415,24 @@
public boolean mustKeepTogether() {
//TODO Keeps will have to be more sophisticated sooner or later
return ((BlockLevelLayoutManager)getParent()).mustKeepTogether()
- || !fobj.getKeepTogether().getWithinPage().isAuto()
- || !fobj.getKeepTogether().getWithinColumn().isAuto();
+ || !getTable().getKeepTogether().getWithinPage().isAuto()
+ || !getTable().getKeepTogether().getWithinColumn().isAuto();
}
/**
* @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#mustKeepWithPrevious()
*/
public boolean mustKeepWithPrevious() {
- return !fobj.getKeepWithPrevious().getWithinPage().isAuto()
- || !fobj.getKeepWithPrevious().getWithinColumn().isAuto();
+ return !getTable().getKeepWithPrevious().getWithinPage().isAuto()
+ || !getTable().getKeepWithPrevious().getWithinColumn().isAuto();
}
/**
* @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#mustKeepWithNext()
*/
public boolean mustKeepWithNext() {
- return !fobj.getKeepWithNext().getWithinPage().isAuto()
- || !fobj.getKeepWithNext().getWithinColumn().isAuto();
+ return !getTable().getKeepWithNext().getWithinPage().isAuto()
+ || !getTable().getKeepWithNext().getWithinColumn().isAuto();
}
// --------- Property Resolution related functions --------- //
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org