diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2005-09-15 10:37:17 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2005-09-15 10:37:17 +0000 |
commit | c84f2250df9928f6b03549ba9691ab82deb241ca (patch) | |
tree | 036258a553959357a34b0b9adce08ea8c15c2abb /src/java/org/apache/fop/fo/properties | |
parent | 051501e7459d8a204d820213b5cc6854a2054722 (diff) | |
download | xmlgraphics-fop-c84f2250df9928f6b03549ba9691ab82deb241ca.tar.gz xmlgraphics-fop-c84f2250df9928f6b03549ba9691ab82deb241ca.zip |
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
Diffstat (limited to 'src/java/org/apache/fop/fo/properties')
-rw-r--r-- | src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java | 50 |
1 files changed, 50 insertions, 0 deletions
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()); + } + } +} |