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 ke...@locus.apache.org on 2000/07/11 07:34:12 UTC

cvs commit: xml-fop/src/org/apache/fop/fo FOTreeBuilder.java PropertyList.java PropertyListBuilder.java XTFOTreeBuilder.java

keiron      00/07/10 22:34:11

  Modified:    src/org/apache/fop/fo FOTreeBuilder.java PropertyList.java
                        PropertyListBuilder.java XTFOTreeBuilder.java
  Log:
  added namespace separation of properties
  also added all the currently supported svg properties
  
  Revision  Changes    Path
  1.8       +2 -2      xml-fop/src/org/apache/fop/fo/FOTreeBuilder.java
  
  Index: FOTreeBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FOTreeBuilder.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FOTreeBuilder.java	2000/07/11 02:27:40	1.7
  +++ FOTreeBuilder.java	2000/07/11 05:34:11	1.8
  @@ -1,4 +1,4 @@
  -/*-- $Id: FOTreeBuilder.java,v 1.7 2000/07/11 02:27:40 arved Exp $ -- 
  +/*-- $Id: FOTreeBuilder.java,v 1.8 2000/07/11 05:34:11 keiron Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -223,7 +223,7 @@
   	}
   	
   	try {
  -		PropertyList list = this.propertyListBuilder.makeList(attlist,  
  +		PropertyList list = this.propertyListBuilder.makeList(fullName, attlist,  
   		     (currentFObj == null) ? null : currentFObj.properties);
   	    fobj = fobjMaker.make(currentFObj, list);
   	} catch (FOPException e) {
  
  
  
  1.7       +9 -2      xml-fop/src/org/apache/fop/fo/PropertyList.java
  
  Index: PropertyList.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/PropertyList.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PropertyList.java	2000/06/27 22:13:16	1.6
  +++ PropertyList.java	2000/07/11 05:34:11	1.7
  @@ -1,4 +1,4 @@
  -/*-- $Id: PropertyList.java,v 1.6 2000/06/27 22:13:16 fotis Exp $ -- 
  +/*-- $Id: PropertyList.java,v 1.7 2000/07/11 05:34:11 keiron Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -58,9 +58,11 @@
   public class PropertyList extends Hashtable {
     private PropertyListBuilder builder;
     private PropertyList parentPropertyList = null;
  +  String namespace = "";
   
  -  public PropertyList(PropertyList parentPropertyList) {
  +  public PropertyList(PropertyList parentPropertyList, String space) {
       this.parentPropertyList = parentPropertyList;
  +    this.namespace = space;
     }
   
     public Property get(String propertyName) {
  @@ -89,4 +91,9 @@
     public void setBuilder(PropertyListBuilder builder) {
       this.builder = builder;
     }
  +
  +	public String getNameSpace()
  +	{
  +		return namespace;
  +	}
   }
  
  
  
  1.16      +80 -16    xml-fop/src/org/apache/fop/fo/PropertyListBuilder.java
  
  Index: PropertyListBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/PropertyListBuilder.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PropertyListBuilder.java	2000/07/11 02:28:11	1.15
  +++ PropertyListBuilder.java	2000/07/11 05:34:11	1.16
  @@ -1,4 +1,4 @@
  -/*-- $Id: PropertyListBuilder.java,v 1.15 2000/07/11 02:28:11 arved Exp $ -- 
  +/*-- $Id: PropertyListBuilder.java,v 1.16 2000/07/11 05:34:11 keiron Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -54,6 +54,7 @@
   import org.apache.fop.fo.properties.*;
   import org.apache.fop.messaging.MessageHandler;
   import org.apache.fop.svg.*;
  +import org.apache.fop.datatypes.*;
   
   import org.apache.fop.apps.FOPException;
   
  @@ -64,6 +65,8 @@
   public class PropertyListBuilder {
       
       private Hashtable propertyTable;
  +	private Hashtable spaceTable;
  +	private Hashtable elementTable;
   
       public PropertyListBuilder() {
   	this.propertyTable = new Hashtable();
  @@ -112,15 +115,13 @@
   	propertyTable.put("padding-right",PaddingRight.maker());
   	propertyTable.put("external-destination",ExternalDestination.maker());
           propertyTable.put("internal-destination",InternalDestination.maker());
  -	propertyTable.put("height",SVGLength.maker());
  -	propertyTable.put("width",SVGLength.maker());
  -	propertyTable.put("x",SVGLength.maker());
  -	propertyTable.put("y",SVGLength.maker());
  -	propertyTable.put("x1",SVGLength.maker());
  -	propertyTable.put("x2",SVGLength.maker());
  -	propertyTable.put("y1",SVGLength.maker());
  -	propertyTable.put("y2",SVGLength.maker());
  -        
  +	propertyTable.put("x",SVGLengthProperty.maker());
  +	propertyTable.put("y",SVGLengthProperty.maker());
  +	propertyTable.put("x1",SVGLengthProperty.maker());
  +	propertyTable.put("x2",SVGLengthProperty.maker());
  +	propertyTable.put("y1",SVGLengthProperty.maker());
  +	propertyTable.put("y2",SVGLengthProperty.maker());
  +
   	propertyTable.put("border-after-color",BorderAfterColor.maker());
   	propertyTable.put("border-after-style",BorderAfterStyle.maker());
   	propertyTable.put("border-after-width",BorderAfterWidth.maker());
  @@ -172,7 +173,48 @@
   	propertyTable.put("odd-or-even",OddOrEven.maker());
   	propertyTable.put("blank-or-not-blank",BlankOrNotBlank.maker());
   
  -    }
  +		// should split up name space properties into separate files
  +		spaceTable = new Hashtable();
  +		Hashtable table = new Hashtable();
  +		table.put("height",SVGLengthProperty.maker());
  +		table.put("width",SVGLengthProperty.maker());
  +		spaceTable.put("http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd", table);
  +
  +		propertyTable.put("rx",SVGLengthProperty.maker());
  +		propertyTable.put("ry",SVGLengthProperty.maker());
  +		propertyTable.put("dx",SVGLengthProperty.maker());
  +		propertyTable.put("dy",SVGLengthProperty.maker());
  +		propertyTable.put("cx",SVGLengthProperty.maker());
  +		propertyTable.put("cy",SVGLengthProperty.maker());
  +		propertyTable.put("r",SVGLengthProperty.maker());
  +		propertyTable.put("fx",SVGLengthProperty.maker());
  +		propertyTable.put("fy",SVGLengthProperty.maker());
  +		propertyTable.put("refX",SVGLengthProperty.maker());
  +		propertyTable.put("refY",SVGLengthProperty.maker());
  +		propertyTable.put("markerWidth",SVGLengthProperty.maker());
  +		propertyTable.put("markerHeight",SVGLengthProperty.maker());
  +		propertyTable.put("offset",SVGLengthProperty.maker());
  +
  +/*		propertyTable.put("orient",SVGOrient.maker());*/
  +		propertyTable.put("xlink:href",HRef.maker());
  +		propertyTable.put("style",SVGStyle.maker());
  +		propertyTable.put("transform",SVGTransform.maker());
  +		propertyTable.put("d",SVGD.maker());
  +		propertyTable.put("points",SVGPoints.maker());
  +//		propertyTable.put("viewBox",SVGBox.maker());
  +
  +//		propertyTable.put("id", SVGStringProperty.maker());
  +
  +		elementTable = new Hashtable();
  +		table = new Hashtable();
  +		table.put("x",SVGLengthListProperty.maker());
  +		table.put("y",SVGLengthListProperty.maker());
  +		table.put("dx",SVGLengthListProperty.maker());
  +		table.put("dy",SVGLengthListProperty.maker());
  +//		table.put("id",SVGStringProperty.maker());
  +		elementTable.put("http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd^tref", table);
  +		elementTable.put("http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd^tspan", table);
  +	}
   
       public Property computeProperty(PropertyList propertyList, String propertyName) {
   	
  @@ -200,14 +242,36 @@
   	return b;
       }
       
  -    public PropertyList makeList(Attributes attributes, PropertyList parentPropertyList) throws FOPException {
  -	
  -	PropertyList p = new PropertyList(parentPropertyList);
  +    public PropertyList makeList(String elementName, Attributes attributes, PropertyList parentPropertyList) throws FOPException {
  +	int index = elementName.indexOf("^");
  +	String space = "http://www.w3.org/TR/1999/XSL/Format";
  +    Hashtable sptable = null;
  +	if(index != -1) {
  +		space = elementName.substring(0, index);
  +		sptable = (Hashtable)spaceTable.get(space);
  +	}
  +
  +	PropertyList par = null;
  +	if(parentPropertyList != null && space.equals(parentPropertyList.getNameSpace())) {
  +		par = parentPropertyList;
  +	}
  +	PropertyList p = new PropertyList(par, space);
   	p.setBuilder(this);
  -	
  +    Hashtable table;
  +    table = (Hashtable)elementTable.get(elementName);
   	for (int i = 0; i < attributes.getLength(); i++) {
   	    String attributeName = attributes.getRawName(i);
  -	    Property.Maker propertyMaker = (Property.Maker)propertyTable.get(attributeName);
  +	    Property.Maker propertyMaker = null;
  +	    if(sptable != null) {
  +	    	propertyMaker = (Property.Maker)sptable.get(attributeName);
  +	    }
  +	    if(propertyMaker == null) {
  +	    	if(table != null) {
  +		    	propertyMaker = (Property.Maker)table.get(attributeName);
  +		    }
  +	    }
  +	    if(propertyMaker == null)
  +		    propertyMaker = (Property.Maker)propertyTable.get(attributeName);
   	    if (propertyMaker != null) {
   		p.put(attributeName,propertyMaker.make(p,attributes.getValue(i)));
   	    } else {
  
  
  
  1.2       +2 -2      xml-fop/src/org/apache/fop/fo/XTFOTreeBuilder.java
  
  Index: XTFOTreeBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/XTFOTreeBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XTFOTreeBuilder.java	2000/07/11 02:59:00	1.1
  +++ XTFOTreeBuilder.java	2000/07/11 05:34:11	1.2
  @@ -1,4 +1,4 @@
  -/*-- $Id: XTFOTreeBuilder.java,v 1.1 2000/07/11 02:59:00 arved Exp $ -- 
  +/*-- $Id: XTFOTreeBuilder.java,v 1.2 2000/07/11 05:34:11 keiron Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -223,7 +223,7 @@
   	}
   	
   	try {
  -		PropertyList list = this.propertyListBuilder.makeList(attlist,  
  +		PropertyList list = this.propertyListBuilder.makeList(fullName, attlist,  
   		     (currentFObj == null) ? null : currentFObj.properties);
   	    fobj = fobjMaker.make(currentFObj, list);
   	} catch (FOPException e) {