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 ad...@apache.org on 2005/09/15 12:37:23 UTC

svn commit: r289197 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java

Author: adelmelle
Date: Thu Sep 15 03:37:17 2005
New Revision: 289197

URL: http://svn.apache.org/viewcvs?rev=289197&view=rev
Log:
Added new Maker subclass for the column-number property

Added:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java   (with props)

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java?rev=289197&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java Thu Sep 15 03:37:17 2005
@@ -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());
+        }
+    }
+}

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org