gmazza      2004/08/20 02:38:21

  Modified:    src/java/org/apache/fop/area AreaTreeHandler.java
               src/java/org/apache/fop/fo FObj.java
               src/java/org/apache/fop/fo/flow Float.java Marker.java
                        Table.java TableColumn.java
  Log:
  1.) validateChildNode() added for fo:marker.
  
  2.) new getPropString() convenience method added to FObj, will reduce
  need for many individual methods on each FO.
  
  3.) fo:float disconnected from ToBeImplementedElement in favor of a
  class-specific warning.
  
  Revision  Changes    Path
  1.4       +2 -2      xml-fop/src/java/org/apache/fop/area/AreaTreeHandler.java
  
  Index: AreaTreeHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTreeHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AreaTreeHandler.java      16 Aug 2004 11:59:51 -0000      1.3
  +++ AreaTreeHandler.java      20 Aug 2004 09:38:21 -0000      1.4
  @@ -436,7 +436,7 @@
           // to the Title.
           InlineStackingLayoutManager lm;
           lm = new InlineStackingLayoutManager(foTitle);
  -        lm.setLMiter(new LMiter(lm, foTitle.childNodes.listIterator()));
  +        lm.setLMiter(new LMiter(lm, foTitle.getChildNodes()));
           lm.initialize();
   
           // get breaks then add areas to title
  
  
  
  1.69      +13 -2     xml-fop/src/java/org/apache/fop/fo/FObj.java
  
  Index: FObj.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- FObj.java 18 Aug 2004 03:26:35 -0000      1.68
  +++ FObj.java 20 Aug 2004 09:38:21 -0000      1.69
  @@ -180,7 +180,7 @@
       /**
        * Helper method to quickly obtain the value of a property
        * for this FO, without querying for the propertyList first.
  -     * @param name - the name of the desired property to obtain
  +     * @param propId - the Constants ID of the desired property to obtain
        * @return the property
        */
       public Property getProperty(int propId) {
  @@ -188,6 +188,17 @@
       }
   
       /**
  +     * Helper method to quickly obtain the String value of a property
  +     * for this FO, without querying for the propertyList first.
  +     * Meaningful only for properties having a string representation
  +     * @param propId - the Constants ID of the desired property to obtain
  +     * @return the String value of the property value
  +     */
  +    public String getPropString(int propId) {
  +        return propertyList.get(propId).getString();
  +    }
  +
  +    /**
        * @see org.apache.fop.fo.FONode#addChildNode(FONode)
        */
       protected void addChildNode(FONode child) {
  @@ -378,7 +389,7 @@
        * @param marker Marker to add.
        */
       protected void addMarker(Marker marker) {
  -        String mcname = marker.getMarkerClassName();
  +        String mcname = marker.getPropString(PR_MARKER_CLASS_NAME);
           if (childNodes != null) {
               // check for empty childNodes
               for (Iterator iter = childNodes.iterator(); iter.hasNext();) {
  
  
  
  1.14      +9 -2      xml-fop/src/java/org/apache/fop/fo/flow/Float.java
  
  Index: Float.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Float.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Float.java        16 Aug 2004 04:11:41 -0000      1.13
  +++ Float.java        20 Aug 2004 09:38:21 -0000      1.14
  @@ -25,18 +25,25 @@
   
   // FOP
   import org.apache.fop.fo.FONode;
  -import org.apache.fop.fo.ToBeImplementedElement;
  +import org.apache.fop.fo.FObj;
   
   /**
    * fo:float element.
    */
  -public class Float extends ToBeImplementedElement {
  +public class Float extends FObj {
   
  +    static boolean notImplementedWarningGiven = false;
  +    
       /**
        * @see org.apache.fop.fo.FONode#FONode(FONode)
        */
       public Float(FONode parent) {
           super(parent);
  +        
  +        if (!notImplementedWarningGiven) {
  +            getLogger().warn("fo:float is not yet implemented.");
  +            notImplementedWarningGiven = true;
  +        }
       }
   
       /**
  
  
  
  1.15      +15 -12    xml-fop/src/java/org/apache/fop/fo/flow/Marker.java
  
  Index: Marker.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Marker.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Marker.java       8 Aug 2004 18:39:23 -0000       1.14
  +++ Marker.java       20 Aug 2004 09:38:21 -0000      1.15
  @@ -20,6 +20,7 @@
   
   // XML
   import org.xml.sax.Attributes;
  +import org.xml.sax.Locator;
   import org.xml.sax.SAXParseException;
   
   // FOP
  @@ -28,16 +29,11 @@
   
   /**
    * Marker formatting object.
  - * This is the marker formatting object that handles merkers.
  - * This attempts to add itself to the parent formatting object.
    */
   public class Marker extends FObjMixed {
   
  -    private String markerClassName;
  -
       /**
        * Create a marker fo.
  -     *
        * @param parent the parent fo node
        */
       public Marker(FONode parent) {
  @@ -49,19 +45,26 @@
        */
       protected void addProperties(Attributes attlist) throws SAXParseException {
           super.addProperties(attlist);
  -        this.markerClassName =
  -            this.propertyList.get(PR_MARKER_CLASS_NAME).getString();
       }
   
       /**
  -     * Get the marker class name for this marker.
  -     *
  -     * @return the marker class name
  +     * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
  +     * XSL Content Model: (#PCDATA|%inline;|%block;)*
  +     * Additionally: "An fo:marker may contain any formatting objects that 
  +     * are permitted as a replacement of any fo:retrieve-marker that retrieves
  +     * the fo:marker's children."
  +     * @todo implement "additional" constraint, possibly within fo:retrieve-marker
        */
  -    public String getMarkerClassName() {
  -        return markerClassName;
  +    protected void validateChildNode(Locator loc, String nsURI, String localName) 
  +        throws SAXParseException {
  +        if (!isBlockOrInlineItem(nsURI, localName)) {
  +            invalidChildError(loc, nsURI, localName);
  +        }
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FObj#getName()
  +     */
       public String getName() {
           return "fo:marker";
       }
  
  
  
  1.30      +3 -1      xml-fop/src/java/org/apache/fop/fo/flow/Table.java
  
  Index: Table.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Table.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Table.java        18 Aug 2004 03:26:36 -0000      1.29
  +++ Table.java        20 Aug 2004 09:38:21 -0000      1.30
  @@ -168,7 +168,6 @@
       }
   
       public Column getTableColumnLayoutManager(TableColumn node) {
  -         node.initialize();
            Column clm = new Column(node);
            return clm;
       }
  @@ -178,6 +177,9 @@
            return blm;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FObj#getName()
  +     */
       public String getName() {
           return "fo:table";
       }
  
  
  
  1.28      +16 -26    xml-fop/src/java/org/apache/fop/fo/flow/TableColumn.java
  
  Index: TableColumn.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableColumn.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- TableColumn.java  11 Aug 2004 04:15:27 -0000      1.27
  +++ TableColumn.java  20 Aug 2004 09:38:21 -0000      1.28
  @@ -36,14 +36,11 @@
   public class TableColumn extends FObj {
   
       private ColorType backgroundColor;
  -
       private Length columnWidth;
       private int columnOffset;
       private int numColumnsRepeated;
       private int iColumnNumber;
   
  -    private boolean initialized = false;
  -
       /**
        * @param parent FONode that is the parent of this object
        */
  @@ -61,15 +58,29 @@
       }
   
       /**
  -     * @see org.apache.fop.fo.FObj#addProperties
  +     * @see org.apache.fop.fo.FObj#addProperties(Attributes)
        */
       protected void addProperties(Attributes attlist) throws SAXParseException {
           super.addProperties(attlist);
  -        initialize();    // init some basic property values
  +
  +        iColumnNumber = propertyList.get(PR_COLUMN_NUMBER).getNumber().intValue();
  +        numColumnsRepeated =
  +            propertyList.get(PR_NUMBER_COLUMNS_REPEATED).getNumber().intValue();
  +        this.backgroundColor =
  +            this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
  +        columnWidth = this.propertyList.get(PR_COLUMN_WIDTH).getLength();
  +
           getFOInputHandler().startColumn(this);
       }
   
       /**
  +     * @see org.apache.fop.fo.FONode#endOfNode
  +     */
  +    protected void endOfNode() throws SAXParseException {
  +        getFOInputHandler().endColumn(this);
  +    }
  +
  +    /**
        * @return Length object containing column width
        */
       public Length getColumnWidth() {
  @@ -90,27 +101,6 @@
           return numColumnsRepeated;
       }
   
  -    /**
  -     * @todo convert to addProperties()
  -     */
  -    public void initialize() {
  -        iColumnNumber = propertyList.get(PR_COLUMN_NUMBER).getNumber().intValue();
  -
  -        numColumnsRepeated =
  -            propertyList.get(PR_NUMBER_COLUMNS_REPEATED).getNumber().intValue();
  -
  -        this.backgroundColor =
  -            this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
  -
  -        columnWidth = this.propertyList.get(PR_COLUMN_WIDTH).getLength();
  -
  -        initialized = true;
  -    }
  -
  -    protected void endOfNode() throws SAXParseException {
  -        getFOInputHandler().endColumn(this);
  -    }
  -    
       public String getName() {
           return "fo:table-column";
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to