[FOray-commit] SF.net SVN: foray: [9979] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-07-11 20:39:50
|
Revision: 9979
http://svn.sourceforge.net/foray/?rev=9979&view=rev
Author: victormote
Date: 2007-07-11 13:39:53 -0700 (Wed, 11 Jul 2007)
Log Message:
-----------
1. Fix some bugs related to flow-maps.
2. Partially implement multiple flows in layout logic.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FlowAssignment.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FlowAssignment.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FlowAssignment.java 2007-07-11 20:15:38 UTC (rev 9978)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FlowAssignment.java 2007-07-11 20:39:53 UTC (rev 9979)
@@ -158,7 +158,7 @@
if (this.children.size() < 2) {
throw new IllegalStateException("flow-target-list not yet parsed");
}
- return (FlowTargetList) this.children.get(0);
+ return (FlowTargetList) this.children.get(1);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java 2007-07-11 20:15:38 UTC (rev 9978)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/LayoutMasterSet.java 2007-07-11 20:39:53 UTC (rev 9979)
@@ -384,11 +384,20 @@
private FlowMap createImplicitFlowMap() {
final FlowMap flowMap = new FlowMap(this,
PropertyList.emptyPropertyList());
- addImplicitFlowMapAssignment(flowMap, "xsl-region-body");
- addImplicitFlowMapAssignment(flowMap, "xsl-region-before");
- addImplicitFlowMapAssignment(flowMap, "xsl-region-after");
- addImplicitFlowMapAssignment(flowMap, "xsl-region-start");
- addImplicitFlowMapAssignment(flowMap, "xsl-region-end");
+ try {
+ this.addChild(flowMap);
+ addImplicitFlowMapAssignment(flowMap, "xsl-region-body");
+ addImplicitFlowMapAssignment(flowMap, "xsl-region-before");
+ addImplicitFlowMapAssignment(flowMap, "xsl-region-after");
+ addImplicitFlowMapAssignment(flowMap, "xsl-region-start");
+ addImplicitFlowMapAssignment(flowMap, "xsl-region-end");
+ } catch (final FoTreeException e) {
+ /* This should not happen, as all parameters are controlled. */
+ throw new IllegalStateException(e);
+ } catch (final PropertyException e) {
+ /* This should not happen, as all parameters are controlled. */
+ throw new IllegalStateException(e);
+ }
return flowMap;
}
@@ -397,45 +406,40 @@
* created.
* @param flowMap The implicit flow map.
* @param impliedName The name which is being mapped in the flow map.
+ * @throws FoTreeException For errors attaching children to parents.
+ * @throws PropertyException For errors creating properties.
*/
private void addImplicitFlowMapAssignment(final FlowMap flowMap,
- final String impliedName) {
+ final String impliedName) throws FoTreeException,
+ PropertyException {
final FlowAssignment assignment = new FlowAssignment(flowMap,
PropertyList.emptyPropertyList());
+ flowMap.addChild(assignment);
/* The source part. */
final FlowSourceList sourceList = new FlowSourceList(assignment,
PropertyList.emptyPropertyList());
+ assignment.addChild(sourceList);
PropertyList propertyList = new PropertyList(1);
final FlowNameSpecifier flowNameSpecifier = new FlowNameSpecifier(
sourceList, propertyList);
- Property property;
- try {
- property = new FlowNameReference(flowNameSpecifier,
+ sourceList.addChild(flowNameSpecifier);
+ Property property = new FlowNameReference(flowNameSpecifier,
FoProperty.FLOW_NAME_REFERENCE.toXslFo(), impliedName);
- } catch (final PropertyException e) {
- /* This shouldn't happen, as all parameters are controlled. */
- throw new IllegalStateException("Logic error in (source): "
- + this.getClass().getName(), e);
- }
propertyList.addProperty(flowNameSpecifier, property);
/* The target part. */
final FlowTargetList targetList = new FlowTargetList(assignment,
PropertyList.emptyPropertyList());
+ assignment.addChild(targetList);
propertyList = new PropertyList(1);
final RegionNameSpecifier regionNameSpecifier = new RegionNameSpecifier(
targetList, propertyList);
- try {
- property = new RegionNameReference(regionNameSpecifier,
- FoProperty.REGION_NAME_REFERENCE.toXslFo(), impliedName);
- } catch (final PropertyException e) {
- /* This shouldn't happen, as all parameters are controlled. */
- throw new IllegalStateException("Logic error in (target): "
- + this.getClass().getName(), e);
- }
+ targetList.addChild(regionNameSpecifier);
+ property = new RegionNameReference(regionNameSpecifier,
+ FoProperty.REGION_NAME_REFERENCE.toXslFo(), impliedName);
propertyList.addProperty(regionNameSpecifier, property);
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java 2007-07-11 20:15:38 UTC (rev 9978)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java 2007-07-11 20:39:53 UTC (rev 9979)
@@ -189,7 +189,12 @@
*/
private void processFlow(final PageCollection pageCollection,
final org.axsl.fo.fo.Flow flow) throws AreaTreeException {
+ /* TODO: This needs to be reworked to handle multiple flows.
+ * For example, if we are on the second flow, we need to see whether
+ * layout should be done on already-existing pages. */
+
this.setLayoutProxy(flow, new FlowPL(flow, this));
+ final List<String> regionBodies = flow.regionBodies();
// make pages and layout content
Status status = Status.UNKNOWN;
@@ -209,7 +214,9 @@
* static content. This is likely also justifiable because of spec.
*/
final FlowPL flowPL = (FlowPL) this.getLayoutProxy(flow);
- for (RegionBodyRefArea bodyArea : currentPage.getRegionBodies()) {
+ for (String regionBodyName : regionBodies) {
+ final RegionBodyRefArea bodyArea = currentPage.getRegionBody(
+ regionBodyName);
flowPL.layout(bodyArea, null);
}
this.formatStaticContent(currentPage);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|