cvs commit: xml-fop/src/java/org/apache/fop/fo/flow FoStaticContent.java

2004-04-15 Thread pbwest
pbwest  2004/04/15 22:12:34

  Modified:src/java/org/apache/fop/fo/flow Tag: FOP_0-20-0_Alt-Design
FoStaticContent.java
  Log:
  Added getFlowName()
  Fixed erroneous exception messages
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.1.2.11  +19 -6 
xml-fop/src/java/org/apache/fop/fo/flow/Attic/FoStaticContent.java
  
  Index: FoStaticContent.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Attic/FoStaticContent.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- FoStaticContent.java  25 Feb 2004 23:40:28 -  1.1.2.10
  +++ FoStaticContent.java  16 Apr 2004 05:12:34 -  1.1.2.11
  @@ -91,8 +91,7 @@
   
   /**
* Construct an fo:static-content node, and buffer the contents for later
  -* parsing
  - * subtree.
  + * parsing.
* Content model for fo:static-content: (%block;)+
* @param foTree the FO tree being built
* @param parent the parent FONode of this node
  @@ -109,9 +108,11 @@
   ncName = (NCName)(getPropertyValue(PropNames.FLOW_NAME));
   } catch (PropertyException e) {
   throw new FOPException(
  -"Cannot find marker-class-name in fo:marker", e);
  +"Cannot find flow-name in fo:static-content", e);
   } catch (ClassCastException e) {
  -throw new FOPException("Wrong PropertyValue type in fo:marker", e);
  +throw new FOPException
  +("Wrong PropertyValue type for flow-name in fo:static-content",
  +e);
   }
   flowName = ncName.getNCName();
   
  @@ -132,11 +133,23 @@
   }
   
   /**
  + * Gets the buffer of XmlEvents from this
  + * fo:static-content subtree
  + * 
* @return the static-content subtree buffer
*/
   public XmlEventsArrayBuffer getEventBuffer() {
   return buffer;
   }
   
  +/**
  + * Gets the flow-name with which this fo:static-content
  + * is associated
  + * 
  + * @return the flow-name
  + */
  +public String getFlowName() {
  +return flowName;
  +}
   
   }
  
  
  

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



cvs commit: xml-fop/src/java/org/apache/fop/fo/flow FoStaticContent.java

2004-01-21 Thread pbwest
pbwest  2004/01/20 23:04:18

  Modified:src/java/org/apache/fop/fo/flow Tag: FOP_0-20-0_Alt-Design
FoStaticContent.java
  Log:
  Modified to buffer static-content subtree events
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.1.2.7   +48 -34
xml-fop/src/java/org/apache/fop/fo/flow/Attic/FoStaticContent.java
  
  Index: FoStaticContent.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Attic/FoStaticContent.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- FoStaticContent.java  20 Jan 2004 05:57:07 -  1.1.2.6
  +++ FoStaticContent.java  21 Jan 2004 07:04:18 -  1.1.2.7
  @@ -60,15 +60,16 @@
   
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.datastructs.TreeException;
  +import org.apache.fop.datatypes.NCName;
   import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.FOTree;
   import org.apache.fop.fo.FObjectNames;
  -import org.apache.fop.fo.FObjects;
   import org.apache.fop.fo.PropNames;
  +import org.apache.fop.fo.expr.PropertyException;
   import org.apache.fop.xml.FoXmlEvent;
   import org.apache.fop.xml.XmlEvent;
   import org.apache.fop.xml.XmlEventReader;
  -import org.apache.fop.xml.UnexpectedStartElementException;
  +import org.apache.fop.xml.XmlEventsArrayBuffer;
   
   /**
* Implements the fo:simple-page-master flow object
  @@ -92,7 +93,17 @@
   /** The number of applicable properties.  This is the size of the
   sparsePropsSet array. */
   private static final int numProps;
  -
  +
  +/**
  + * The flow-name for this fo:static-content
  + */
  +public final String flowName;
  +
  +/**
  + * The buffer which will hold the contents of the fo:static-content subtree
  + */
  +private XmlEventsArrayBuffer buffer;
  +
   static {
   // Collect the sets of properties that apply
   BitSet propsets = new BitSet();
  @@ -110,7 +121,8 @@
   }
   
   /**
  - * Construct an fo:static-content node, and build the fo:static-content
  + * Construct an fo:static-content node, and buffer the contents for later
  +* parsing
* subtree.
* Content model for fo:static-content: (%block;)+
* @param foTree the FO tree being built
  @@ -123,36 +135,38 @@
   {
   super(foTree, FObjectNames.STATIC_CONTENT, parent, event,
 FONode.STATIC_SET, sparsePropsMap, sparseIndices);
  -XmlEvent ev;
  +NCName ncName;
   try {
  -// Get at least one %block;
  -if ((ev = xmlevents.expectBlock()) == null)
  -throw new FOPException
  -("%block; not found in fo:static-content");
  -// Generate the flow object
  -//System.out.println("Generating first block for static-content.");
  -FObjects.fobjects.makeFlowObject(
  -foTree, this, (FoXmlEvent)ev, FONode.STATIC_SET);
  -// Clear the blockage
  -ev = xmlevents.getEndElement(XmlEventReader.DISCARD_EV, ev);
  -namespaces.relinquishEvent(ev);
  -// Get the rest of the %block;s
  -while ((ev = xmlevents.expectBlock()) != null) {
  -// Generate the flow object
  -//System.out.println
  -//("Generating subsequent block for static-content.");
  -FObjects.fobjects.makeFlowObject(
  -foTree, this, (FoXmlEvent)ev, FONode.STATIC_SET);
  -ev = xmlevents.getEndElement(XmlEventReader.DISCARD_EV, ev);
  -namespaces.relinquishEvent(ev);
  -}
  -} catch(UnexpectedStartElementException e) {
  -throw new FOPException
  -("Block not found or unexpected non-block in fo:static-content");
  +ncName = (NCName)(getPropertyValue(PropNames.FLOW_NAME));
  +} catch (PropertyException e) {
  +throw new FOPException("Cannot find marker-class-name in fo:marker", e);
  +} catch (ClassCastException e) {
  +throw new FOPException("Wrong PropertyValue type in fo:marker", e);
   }
  -
  -System.out.println("Making sparsePropsSet for static-content.");
  -makeSparsePropsSet();
  +flowName = ncName.getNCName();
  +
  +// sparsePropsSet cannot be made for static content, because the full
  +// ancestor tree of properties must be available for the later
  +// resolution of properties in the static-content subtree and any
  +// markers which are later attached to the subtree.
  +// makeSparsePropsSet();
  +
  +// Collect the contents of fo:static-content for future processing
  +buffer = new