From c84f2250df9928f6b03549ba9691ab82deb241ca Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Thu, 15 Sep 2005 10:37:17 +0000 Subject: Added new Maker subclass for the column-number property git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@289197 13f79535-47bb-0310-9956-ffa450edef68 --- .../fo/properties/ColumnNumberPropertyMaker.java | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java (limited to 'src/java/org/apache/fop/fo/properties') diff --git a/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java b/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java new file mode 100644 index 000000000..5e3b4ae7d --- /dev/null +++ b/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java @@ -0,0 +1,50 @@ +/* + * 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.properties; + +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.flow.TableFObj; + +public class ColumnNumberPropertyMaker extends NumberProperty.Maker { + + public ColumnNumberPropertyMaker(int propId) { + super(propId); + } + + /** + * Set default column-number from parent's currentColumnIndex + * + * @return the default value for column-number + */ + public Property make(PropertyList propertyList) throws PropertyException { + FObj fo = propertyList.getFObj(); + + if( fo.getNameId() == Constants.FO_TABLE_CELL + || fo.getNameId() == Constants.FO_TABLE_COLUMN ) { + TableFObj parent = (TableFObj) propertyList.getParentFObj(); + return new NumberProperty(parent.getCurrentColumnIndex()); + } else { + throw new PropertyException("column-number property is only allowed on " + + "fo:table-cell or fo:table-column, not on " + fo.getName()); + } + } +} -- cgit v1.2.3