From: Andreas L. Delmelle Date: Mon, 19 Sep 2005 21:11:20 +0000 (+0000) Subject: Correction of style violations X-Git-Tag: fop-0_90-alpha1~200 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=190be27913fd1c741f59c139669d06e2c9ace9a1;p=xmlgraphics-fop.git Correction of style violations git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@290268 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/flow/TableFObj.java b/src/java/org/apache/fop/fo/flow/TableFObj.java index 3592c006a..f042e0f96 100644 --- a/src/java/org/apache/fop/fo/flow/TableFObj.java +++ b/src/java/org/apache/fop/fo/flow/TableFObj.java @@ -1,3 +1,21 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + package org.apache.fop.fo.flow; import org.apache.fop.apps.FOPException; @@ -7,6 +25,10 @@ import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +/** + * Superclass for table-related FOs + * + */ public abstract class TableFObj extends FObj { @@ -14,25 +36,39 @@ public abstract class TableFObj extends FObj { private Numeric borderBeforePrecedence; private Numeric borderEndPrecedence; private Numeric borderStartPrecedence; - + + /** + * Used for determining initial values for column-numbers + * in case of row-spanning cells + * (for clarity) + * + */ protected static class PendingSpan { + protected int rowsLeft; - public PendingSpan( int rows ) { + /** + * Constructor + * + * @param rows number of rows spanned + */ + public PendingSpan(int rows) { rowsLeft = rows; - } - - public String toString() { - StringBuffer sb = new StringBuffer(); - sb.append("pending span: rowsLeft=").append(rowsLeft); - return sb.toString(); - } + } } + /** + * Main constructor + * + * @param parent the parent node + */ public TableFObj(FONode parent) { super(parent); } - + + /** + * @see FObj#bind(PropertyList) + */ public void bind(PropertyList pList) throws FOPException { borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE).getNumeric(); borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE).getNumeric(); @@ -59,20 +95,7 @@ public abstract class TableFObj extends FObj { return null; } } - - protected void setBorderPrecedence(int side, Numeric newPrecedence) { - switch( side ) { - case CommonBorderPaddingBackground.BEFORE: - borderBeforePrecedence = newPrecedence; - case CommonBorderPaddingBackground.AFTER: - borderAfterPrecedence = newPrecedence; - case CommonBorderPaddingBackground.START: - borderStartPrecedence = newPrecedence; - case CommonBorderPaddingBackground.END: - borderEndPrecedence = newPrecedence; - } - } - + /** * Returns the current column index of the given TableFObj * (overridden for Table, TableBody, TableRow) @@ -85,7 +108,11 @@ public abstract class TableFObj extends FObj { /** * Sets the current column index of the given TableFObj + * used when a value for column-number is explicitly + * specified on the child FO (TableCell or TableColumn) * (overridden for Table, TableBody, TableRow) + * + * @param newIndex new value for column index */ protected void setCurrentColumnIndex(int newIndex) { //do nothing by default diff --git a/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java b/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java index f4ab5c6cf..36742014e 100644 --- a/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java @@ -30,29 +30,31 @@ public class ColumnNumberPropertyMaker extends NumberProperty.Maker { public ColumnNumberPropertyMaker(int propId) { super(propId); } - + /** - * Set default column-number from parent's currentColumnIndex - * + * Set default column-number from parent's currentColumnIndex. + * + * @param propertyList * @return the default value for column-number + * @throws PropertyException */ public Property make(PropertyList propertyList) throws PropertyException { FObj fo = propertyList.getFObj(); - - if( fo.getNameId() == Constants.FO_TABLE_CELL - || fo.getNameId() == Constants.FO_TABLE_COLUMN ) { + + if (fo.getNameId() == Constants.FO_TABLE_CELL + || fo.getNameId() == Constants.FO_TABLE_COLUMN) { TableFObj parent = (TableFObj) propertyList.getParentFObj(); int columnIndex = parent.getCurrentColumnIndex(); - if( fo.getNameId() == Constants.FO_TABLE_CELL - && parent.getNameId() == Constants.FO_TABLE_BODY ) { + if (fo.getNameId() == Constants.FO_TABLE_CELL + && parent.getNameId() == Constants.FO_TABLE_BODY) { boolean startsRow = propertyList.get(Constants.PR_STARTS_ROW) .getEnum() == Constants.EN_TRUE; - - //cell w/ starts-row="true", but previous cell + + //cell w/ starts-row="true", but previous cell //didn't have ends-row="true", so index has still has //to be reset (for other cases this already happened in //body.addChildNode()) - if( startsRow && !((TableBody) parent).lastCellEndedRow() ) { + if (startsRow && !((TableBody) parent).lastCellEndedRow()) { //reset column index, and reassign... ((TableBody) parent).resetColumnIndex(); columnIndex = parent.getCurrentColumnIndex(); @@ -60,8 +62,9 @@ public class ColumnNumberPropertyMaker extends NumberProperty.Maker { } return new NumberProperty(columnIndex); } else { - throw new PropertyException("column-number property is only allowed on " - + "fo:table-cell or fo:table-column, not on " + fo.getName()); + throw new PropertyException("column-number property is only allowed" + + " on fo:table-cell or fo:table-column, not on " + + fo.getName()); } } }