foray-commit Mailing List for FOray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
1
|
2
|
3
(5) |
4
(5) |
|
5
|
6
|
7
(5) |
8
(4) |
9
(10) |
10
(7) |
11
(3) |
|
12
|
13
(4) |
14
(1) |
15
|
16
|
17
|
18
|
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
|
26
(2) |
27
|
28
(8) |
29
(1) |
30
(4) |
31
(1) |
|
|
From: <vic...@us...> - 2007-08-31 17:40:41
|
Revision: 10195
http://foray.svn.sourceforge.net/foray/?rev=10195&view=rev
Author: victormote
Date: 2007-08-31 10:38:51 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Upgrade xml-graphics commons from 1.1. to 1.2.
Modified Paths:
--------------
trunk/foray/doc/web/app/using/release.html
trunk/foray/foray-graphic/.classpath
Added Paths:
-----------
trunk/foray/lib/xmlgraphics-commons-1.2.jar
trunk/foray/lib-build/xmlgraphics-commons/xmlgraphics-commons-1.2-src.zip
Removed Paths:
-------------
trunk/foray/lib/xmlgraphics-commons-1.1.jar
trunk/foray/lib-build/xmlgraphics-commons/xmlgraphics-commons-1.1-src.zip
Modified: trunk/foray/doc/web/app/using/release.html
===================================================================
--- trunk/foray/doc/web/app/using/release.html 2007-08-30 22:53:00 UTC (rev 10194)
+++ trunk/foray/doc/web/app/using/release.html 2007-08-31 17:38:51 UTC (rev 10195)
@@ -97,6 +97,8 @@
aXSL Graphic interfaces. This makes it much more feasible for users to drop in
another (perhaps commercial) SVG package. It also makes maintenance of the
Batik integration much more straightforward.</li>
+ <li>The Apache XML Graphics Commons dependency has been upgraded to
+ version 1.2.</li>
</ul>
<h2><a name="0_2">Release 0.2</a></h2>
Modified: trunk/foray/foray-graphic/.classpath
===================================================================
--- trunk/foray/foray-graphic/.classpath 2007-08-30 22:53:00 UTC (rev 10194)
+++ trunk/foray/foray-graphic/.classpath 2007-08-31 17:38:51 UTC (rev 10195)
@@ -7,7 +7,6 @@
<classpathentry kind="src" path="/axslGraphic"/>
<classpathentry kind="src" path="/axslCommon"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit.jar"/>
- <classpathentry kind="lib" path="/FOray Lib/xmlgraphics-commons-1.1.jar" sourcepath="/FOray Lib-Build/xmlgraphics-commons/xmlgraphics-commons-1.1-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.2.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.2-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib/svg-1.1.jar" sourcepath="/FOray Lib-Build/svg/svg-1.1-src.zip"/>
@@ -29,5 +28,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/axslPs"/>
<classpathentry kind="lib" path="/FOray Lib/batik-1.6-svggen.jar" sourcepath="/FOray Lib-Build/batik/batik-1.6-sources.zip"/>
<classpathentry kind="lib" path="/FOray Lib/jeuclid-core-3.0.1.jar" sourcepath="/FOray Lib-Build/jeuclid/jeuclid-3.0.1-source.zip"/>
+ <classpathentry kind="lib" path="/FOray Lib/xmlgraphics-commons-1.2.jar" sourcepath="/FOray Lib-Build/xmlgraphics-commons/xmlgraphics-commons-1.2-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Deleted: trunk/foray/lib/xmlgraphics-commons-1.1.jar
===================================================================
(Binary files differ)
Added: trunk/foray/lib/xmlgraphics-commons-1.2.jar
===================================================================
(Binary files differ)
Property changes on: trunk/foray/lib/xmlgraphics-commons-1.2.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/foray/lib-build/xmlgraphics-commons/xmlgraphics-commons-1.1-src.zip
===================================================================
(Binary files differ)
Added: trunk/foray/lib-build/xmlgraphics-commons/xmlgraphics-commons-1.2-src.zip
===================================================================
(Binary files differ)
Property changes on: trunk/foray/lib-build/xmlgraphics-commons/xmlgraphics-commons-1.2-src.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-30 22:53:02
|
Revision: 10194
http://foray.svn.sourceforge.net/foray/?rev=10194&view=rev
Author: victormote
Date: 2007-08-30 15:53:00 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Allow the bookmark-title to be empty, and handle that case properly in the Area Tree.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java 2007-08-30 21:37:28 UTC (rev 10193)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java 2007-08-30 22:53:00 UTC (rev 10194)
@@ -28,7 +28,10 @@
package org.foray.area;
+import org.foray.common.WKConstants;
+
import org.axsl.fo.fo.BookmarkTitle;
+import org.axsl.fo.fo.CharacterSequence;
import org.axsl.font.Font;
import java.awt.Color;
@@ -72,7 +75,12 @@
*/
public String getTitleText() {
final BookmarkTitle generatedBy = traitGeneratedBy();
- final char[] text = generatedBy.getChildAt(0).getAreaTreeText(null);
+ /* Allow for the possibility that the content is empty. */
+ if (generatedBy.getChildCount() < 1) {
+ return WKConstants.EMPTY_STRING;
+ }
+ final CharacterSequence charSequence = generatedBy.getChildAt(0);
+ final char[] text = charSequence.getAreaTreeText(null);
return new String(text);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2007-08-30 21:37:28 UTC (rev 10193)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2007-08-30 22:53:00 UTC (rev 10194)
@@ -93,7 +93,7 @@
protected void validateDescendants() throws FoTreeException {
/* Validate children. Content Model: (#PCDATA)
* Must have exactly one child, an FOText instance. */
- if (this.getChildren().size() != 1) {
+ if (this.getChildren().size() > 1) {
throwException(this.getFullName() + " must have exactly one "
+ "child.");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-30 21:37:29
|
Revision: 10193
http://foray.svn.sourceforge.net/foray/?rev=10193&view=rev
Author: victormote
Date: 2007-08-30 14:37:28 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Improve error message.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/axsl/obj/Metadata.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/axsl/obj/Metadata.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/axsl/obj/Metadata.java 2007-08-30 19:58:29 UTC (rev 10192)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/axsl/obj/Metadata.java 2007-08-30 21:37:28 UTC (rev 10193)
@@ -121,7 +121,7 @@
if (this.getChildren().size() != 1
|| ! (this.getChildAt(0) instanceof CharacterSequence4a)) {
throwException("The content model for " + this.getFullName()
- + " requires PCDATA content only");
+ + " is: (#PCDATA).");
}
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-30 19:58:31
|
Revision: 10192
http://foray.svn.sourceforge.net/foray/?rev=10192&view=rev
Author: victormote
Date: 2007-08-30 12:58:29 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Make sure that flow objects can be laid out in the page-sequence.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FlowAssignment.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java 2007-08-30 17:21:22 UTC (rev 10191)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/AbstractFlow.java 2007-08-30 19:58:29 UTC (rev 10192)
@@ -52,6 +52,10 @@
/** The children of this object. */
private List<FObj> children = new ArrayList<FObj>();
+ /** Indicates whether this flow can be laid out in the flow-map of the
+ * parent page-sequence. */
+ private boolean isValid = true;
+
/**
* Constructor.
* @param parent The parent FObj.
@@ -75,9 +79,24 @@
*/
protected void validateProperties() throws FoTreeException {
final String name = traitFlowName();
- if (name == null || name.equals("")) {
+ if (name == null
+ || name.equals("")) {
throwException(getFullName() + "requires a 'flow-name'.");
}
+
+ /* Make sure that this flow can be laid out on at least one page that
+ * can be created in the page-sequence. */
+ boolean canBeLaidOut = getParent().flowValid(this);
+ if (name.equals("xsl-footnote-separator")
+ || name.equals("xsl-before-float-separator")) {
+ canBeLaidOut = true;
+ }
+ if (! canBeLaidOut) {
+ this.isValid = false;
+ throwException(this.getFullName() + " '" + traitFlowName()
+ + "' cannot be laid out in any pages in '"
+ + this.getParent().traitMasterName() + "'");
+ }
}
/**
@@ -137,4 +156,20 @@
return this.children.get(index);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isValid() {
+ return this.isValid;
+ }
+
+ /**
+ * Set the validity flag.
+ * @param isValid The new value for "isValid".
+ */
+ protected void setIsValid(final boolean isValid) {
+ this.isValid = isValid;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2007-08-30 17:21:22 UTC (rev 10191)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2007-08-30 19:58:29 UTC (rev 10192)
@@ -55,33 +55,30 @@
/**
* {@inheritDoc}
*/
- @Override
- public void validateProperties() throws FoTreeException {
- super.validateProperties();
-
- /* Make sure that this flow can be laid out on at least one page that
- * can be created in the page-sequence. */
- final boolean canBeLaidOut = getParent().flowValid(this);
- if (! canBeLaidOut) {
- throwException(this.getFullName() + " '" + traitFlowName()
- + "' cannot be laid out in any pages in '"
- + this.getParent().traitMasterName() + "'");
- }
-
+ public void setup() throws FoTreeException {
+ getParent().addFlow(this);
}
/**
* {@inheritDoc}
*/
- public void setup() throws FoTreeException {
- getParent().addFlow(this);
+ public void end() throws FoTreeException {
+ return;
}
/**
* {@inheritDoc}
*/
- public void end() throws FoTreeException {
- return;
+ protected void validateProperties() throws FoTreeException {
+ super.validateProperties();
+
+ /* Make sure that this flow is included in the target list. */
+ final boolean isInFlowMap = getParent().isInFlowMap(this);
+ if (! isInFlowMap) {
+ this.setIsValid(false);
+ throwException(this.getFullName() + " '" + traitFlowName()
+ + "' is not found in the flow map.");
+ }
}
/**
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-08-30 17:21:22 UTC (rev 10191)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/FlowAssignment.java 2007-08-30 19:58:29 UTC (rev 10192)
@@ -103,7 +103,6 @@
+ "children.");
}
}
-
/**
* {@inheritDoc}
*/
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java 2007-08-30 17:21:22 UTC (rev 10191)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java 2007-08-30 19:58:29 UTC (rev 10192)
@@ -291,8 +291,8 @@
}
/**
- * Make sure that a given flow can be laid out on at least one page in this
- * page-sequence.
+ * Indicates whether a given flow can be laid out on at least one page in
+ * this page-sequence.
* @param flow The abstract flow to be tested.
* @return True iff the flow can be laid out on at least one page in this
* page-sequence.
@@ -302,6 +302,32 @@
}
/**
+ * Indicates whether a given flow is found in one of the flow-source-list
+ * instances in this page-sequence's flow-map.
+ * @param flow The abstract flow to be tested.
+ * @return True iff the flow is found in one of the flow-source-list
+ * instances in this page-sequence's flow-map.
+ */
+ protected boolean isInFlowMap(final AbstractFlow flow) {
+ final FlowMap flowMap = this.getFlowMap();
+ final List<FlowAssignment> flowAssignments = flowMap.getChildren();
+ for (FlowAssignment flowAssignment : flowAssignments) {
+ final FlowSourceList flowSourceList =
+ flowAssignment.getFlowSourceList();
+ final List<FlowNameSpecifier> flowNameSpecifiers =
+ flowSourceList.getChildren();
+ for (FlowNameSpecifier flowNameSpecifier : flowNameSpecifiers) {
+ final String flowNameReference =
+ flowNameSpecifier.getFlowNameReference();
+ if (flowNameReference.equals(flow.traitFlowName())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
* Returns the page sequence template for this page sequence.
* @return Returns the pageSequenceTemplate.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-30 17:21:58
|
Revision: 10191
http://foray.svn.sourceforge.net/foray/?rev=10191&view=rev
Author: victormote
Date: 2007-08-30 10:21:22 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Clean up the flow-to-page validation.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceTemplate.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2007-08-29 00:29:50 UTC (rev 10190)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2007-08-30 17:21:22 UTC (rev 10191)
@@ -58,17 +58,16 @@
@Override
public void validateProperties() throws FoTreeException {
super.validateProperties();
- /* Make sure that this flow name can be laid out on every page that can
- * be created in the page-sequence. */
- /* TODO: Find out whether this test is appropriate. */
-// final AbstractPageMaster problemPage = getParent().flowValid(
-// this);
-// if (problemPage != null) {
-// throwException(this.getFullName() + " '" + traitFlowName()
-// + "' cannot flow into page-master '"
-// + problemPage.traitMasterName() + "'");
-// }
+ /* Make sure that this flow can be laid out on at least one page that
+ * can be created in the page-sequence. */
+ final boolean canBeLaidOut = getParent().flowValid(this);
+ if (! canBeLaidOut) {
+ throwException(this.getFullName() + " '" + traitFlowName()
+ + "' cannot be laid out in any pages in '"
+ + this.getParent().traitMasterName() + "'");
+ }
+
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java 2007-08-29 00:29:50 UTC (rev 10190)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequence.java 2007-08-30 17:21:22 UTC (rev 10191)
@@ -291,13 +291,13 @@
}
/**
- * Make sure that a given flow can be laid out on every page in this
+ * Make sure that a given flow can be laid out on at least one page in this
* page-sequence.
* @param flow The abstract flow to be tested.
- * @return The first page-master detected which cannot take content from
- * <tt>flow</tt>, or null if the flow can be laid out on all pages.
+ * @return True iff the flow can be laid out on at least one page in this
+ * page-sequence.
*/
- protected AbstractPageMaster flowValid(final AbstractFlow flow) {
+ protected boolean flowValid(final AbstractFlow flow) {
return this.pageSequenceTemplate.flowValid(flow);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java 2007-08-29 00:29:50 UTC (rev 10190)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java 2007-08-30 17:21:22 UTC (rev 10191)
@@ -154,9 +154,8 @@
final Set<AbstractPageMaster> returnSet
= new HashSet<AbstractPageMaster>();
for (int i = 0; i < this.getChildren().size(); i++) {
- final Object child = this.getChildren().get(i);
- final SubSequenceSpecifier specifier = (SubSequenceSpecifier) child;
- returnSet.addAll(specifier.getPages());
+ final SubSequenceSpecifier child = this.getChildren().get(i);
+ returnSet.addAll(child.getPages());
}
return returnSet;
}
@@ -207,19 +206,15 @@
}
/**
- * Make sure that a given flow can be laid out on every page in this
- * page-sequence.
- * @param flow The abstract flow to be tested.
- * @return The first page-master detected which cannot take content from
- * <tt>flow</tt>, or null if the flow can be laid out on all pages.
+ * {@inheritDoc}
*/
- public AbstractPageMaster flowValid(final AbstractFlow flow) {
+ public boolean flowValid(final AbstractFlow flow) {
for (AbstractPageMaster pageMaster : this.getPages()) {
- if (! pageMaster.hasRegion(flow.traitFlowName())) {
- return pageMaster;
+ if (pageMaster.hasRegion(flow.traitFlowName())) {
+ return true;
}
}
- return null;
+ return false;
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceTemplate.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceTemplate.java 2007-08-29 00:29:50 UTC (rev 10190)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceTemplate.java 2007-08-30 17:21:22 UTC (rev 10191)
@@ -37,12 +37,12 @@
public interface PageSequenceTemplate {
/**
- * Make sure that a given flow can be laid out on every page in this
+ * Make sure that a given flow can be laid out on at least one page in this
* page-sequence template.
* @param flow The abstract flow to be tested.
- * @return The first page-master detected which cannot take content from
- * <tt>flow</tt>, or null if the flow can be laid out on all pages.
+ * @return True iff the flow can be laid out on at least one page in this
+ * page-sequence template.
*/
- AbstractPageMaster flowValid(final AbstractFlow flow);
+ boolean flowValid(final AbstractFlow flow);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java 2007-08-29 00:29:50 UTC (rev 10190)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SimplePageMaster.java 2007-08-30 17:21:22 UTC (rev 10191)
@@ -372,17 +372,10 @@
}
/**
- * Make sure that a given flow can be laid out on every page in this
- * page-sequence.
- * @param flow The abstract flow to be tested.
- * @return The first page-master detected which cannot take content from
- * <tt>flow</tt>, or null if the flow can be laid out on all pages.
+ * {@inheritDoc}
*/
- public AbstractPageMaster flowValid(final AbstractFlow flow) {
- if (! this.hasRegion(flow.traitFlowName())) {
- return this;
- }
- return null;
+ public boolean flowValid(final AbstractFlow flow) {
+ return this.hasRegion(flow.traitFlowName());
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-29 00:29:50
|
Revision: 10190
http://foray.svn.sourceforge.net/foray/?rev=10190&view=rev
Author: victormote
Date: 2007-08-28 17:29:50 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Fix bug in retrieval of the best marker.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2007-08-28 23:46:54 UTC (rev 10189)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2007-08-29 00:29:50 UTC (rev 10190)
@@ -94,7 +94,7 @@
private String formattedPageNumber;
/** The list of markers found on this page. */
- private List<Marker> markers = null;
+ private List<Marker> markers = new ArrayList<Marker>();
/**
* Private Constructor.
@@ -115,7 +115,6 @@
final PageRA newPage = new PageRA(parentArea);
newPage.generatedBy = newPage.linkage(generatedBy, null);
newPage.registerWithLinkage(null);
- newPage.markers = new ArrayList<Marker>();
newPage.createRegions();
return newPage;
}
@@ -513,17 +512,54 @@
* {@inheritDoc}
*/
public Marker bestMarker(final RetrieveMarker retrieve) {
- // locate qualifying areas by 'marker-class-name' and
- // 'retrieve-boundary'. Initially we will always check
- // the containing page
+ final Marker marker = this.bestMarkerThisPage(retrieve);
+ if (marker != null) {
+ return marker;
+ }
+ /* If marker not yet found, and 'retrieve-boundary' permits,
+ * search backward. */
+ List<Marker> additionalMarkers = null;
+ final PageCollection pageCollection = getPageCollection();
+ if (retrieve.traitRetrieveBoundary()
+ == RetrieveBoundary.PAGE_SEQUENCE) {
+ final PageSequence pageSequence = pageCollection.getPageSequence();
+ if (pageSequence == getPageSequence()) {
+ additionalMarkers = pageCollection
+ .getCurrentPageSequenceMarkers();
+ }
+ } else if (retrieve.traitRetrieveBoundary()
+ == RetrieveBoundary.DOCUMENT) {
+ additionalMarkers = pageCollection.getDocumentMarkers();
+ }
+ if (additionalMarkers == null) {
+ return null;
+ }
+ for (int i = additionalMarkers.size() - 1; i >= 0; i--) {
+ final Marker currentMarker = additionalMarkers.get(i);
+ if (currentMarker.traitMarkerClassName().equals(
+ retrieve.traitRetrieveClassName())) {
+ return currentMarker;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Finds, the best marker, if any, on the current page.
+ * @param retrieve The retrieve-marker for which the marker is sought.
+ * @return The best marker, or null if none on this page meet the criteria.
+ */
+ private Marker bestMarkerThisPage(final RetrieveMarker retrieve) {
final List<Marker> pageMarkers = getMarkers();
if (getMarkers().isEmpty()) {
return null;
}
+
+ final RetrievePosition retrievePosition =
+ retrieve.traitRetrievePosition();
// search forward if 'first-starting-within-page' or
// 'first-including-carryover'
- if (retrieve.traitRetrievePosition()
- == RetrievePosition.FIRST_INCLUDING_CARRYOVER) {
+ if (retrievePosition == RetrievePosition.FIRST_INCLUDING_CARRYOVER) {
for (int i = 0; i < pageMarkers.size(); i++) {
final Marker currentMarker = pageMarkers.get(i);
if (currentMarker.traitMarkerClassName().equals(
@@ -531,7 +567,7 @@
return currentMarker;
}
}
- } else if (retrieve.traitRetrievePosition()
+ } else if (retrievePosition
== RetrievePosition.FIRST_STARTING_WITHIN_PAGE) {
for (int i = 0; i < pageMarkers.size(); i++) {
final Marker currentMarker = pageMarkers.get(i);
@@ -542,7 +578,7 @@
}
}
}
- } else if (retrieve.traitRetrievePosition()
+ } else if (retrievePosition
== RetrievePosition.LAST_STARTING_WITHIN_PAGE) {
for (int i = pageMarkers.size() - 1; i >= 0; i--) {
final Marker currentMarker = pageMarkers.get(i);
@@ -553,7 +589,7 @@
}
}
}
- } else if (retrieve.traitRetrievePosition()
+ } else if (retrievePosition
== RetrievePosition.LAST_ENDING_WITHIN_PAGE) {
for (int i = pageMarkers.size() - 1; i >= 0; i--) {
final Marker currentMarker = pageMarkers.get(i);
@@ -565,31 +601,6 @@
}
}
}
- // If marker not yet found, and 'retrieve-boundary' permits,
- // search backward.
- List<Marker> additionalMarkers = null;
- final PageCollection pageCollection = getPageCollection();
- if (retrieve.traitRetrieveBoundary()
- == RetrieveBoundary.PAGE_SEQUENCE) {
- final PageSequence pageSequence = pageCollection.getPageSequence();
- if (pageSequence == getPageSequence()) {
- additionalMarkers = pageCollection
- .getCurrentPageSequenceMarkers();
- }
- } else if (retrieve.traitRetrieveBoundary()
- == RetrieveBoundary.DOCUMENT) {
- additionalMarkers = pageCollection.getDocumentMarkers();
- }
- if (additionalMarkers == null) {
- return null;
- }
- for (int i = additionalMarkers.size() - 1; i >= 0; i--) {
- final Marker currentMarker = additionalMarkers.get(i);
- if (currentMarker.traitMarkerClassName().equals(
- retrieve.traitRetrieveClassName())) {
- return currentMarker;
- }
- }
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-28 23:46:58
|
Revision: 10189
http://foray.svn.sourceforge.net/foray/?rev=10189&view=rev
Author: victormote
Date: 2007-08-28 16:46:54 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Fix bug in computation of percentage values for IPD and BPD.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java 2007-08-28 23:41:41 UTC (rev 10188)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java 2007-08-28 23:46:54 UTC (rev 10189)
@@ -28,6 +28,7 @@
package org.foray.fotree.fo.prop;
+import org.foray.common.WKConstants;
import org.foray.fotree.FObj;
import org.foray.fotree.LengthRange;
import org.foray.fotree.Property;
@@ -142,7 +143,8 @@
return FObj.DIMENSION_AUTO;
}
final float percentage = value().evalPercentage();
- return Math.round(percentage * base);
+ return Math.round(percentage * base
+ / WKConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-28 23:41:41
|
Revision: 10188
http://foray.svn.sourceforge.net/foray/?rev=10188&view=rev
Author: victormote
Date: 2007-08-28 16:41:41 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Fix bug in calculation of the algorithm (either fixed or auto) that should be used in computing table column sizes.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java 2007-08-28 22:33:57 UTC (rev 10187)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Table.java 2007-08-28 23:41:41 UTC (rev 10188)
@@ -409,7 +409,7 @@
if (this.traitTableLayout() != TableLayout.FIXED) {
return false;
}
- return this.getPropertyList().isIpdAuto(this);
+ return ! this.getPropertyList().isIpdAuto(this);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-28 22:33:58
|
Revision: 10187
http://foray.svn.sourceforge.net/foray/?rev=10187&view=rev
Author: victormote
Date: 2007-08-28 15:33:57 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Make TextArea creation more consistent.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2007-08-28 21:06:11 UTC (rev 10186)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2007-08-28 22:33:57 UTC (rev 10187)
@@ -168,9 +168,6 @@
newTextArea.generatedBy = newTextArea.linkage(generatedBy,
graftingPoint);
newTextArea.registerWithLinkage(graftingPoint);
- final int initialPD = newTextArea.computeInitialPD();
- newTextArea.setProgressionDimension(initialPD);
- newTextArea.initializeAnteriorSpace();
newTextArea.init(parentArea, backingOffset, backingSize,
progressionDimensionUsed,
hasDiscretionaryHyphen, hasFauxSmallCaps);
@@ -252,6 +249,7 @@
this.hasDiscretionaryHyphen = hasDiscretionaryHyphen;
this.hasFauxSmallCaps = hasFauxSmallCaps;
setProgressionDimension(progressionDimensionUsed);
+ this.initializeAnteriorSpace();
this.ancestorLineArea().lineContentChanged();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-28 21:06:21
|
Revision: 10186
http://foray.svn.sourceforge.net/foray/?rev=10186&view=rev
Author: victormote
Date: 2007-08-28 14:06:11 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Fix NPE.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2007-08-28 20:06:10 UTC (rev 10185)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Flow.java 2007-08-28 21:06:11 UTC (rev 10186)
@@ -35,6 +35,7 @@
import org.axsl.fo.FoTreeException;
import org.axsl.fo.ProxyFactory;
+import java.util.Collections;
import java.util.List;
/**
@@ -166,7 +167,12 @@
final FlowMap flowMap = this.getParent().getFlowMap();
final String flowName = this.traitFlowName();
final FlowTargetList targetList = flowMap.getTargetList(flowName);
- return targetList.childrenAsStrings();
+ if (targetList == null) {
+ final List<String> emptyList = Collections.emptyList();
+ return emptyList;
+ } else {
+ return targetList.childrenAsStrings();
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-28 20:06:10
|
Revision: 10185
http://foray.svn.sourceforge.net/foray/?rev=10185&view=rev
Author: victormote
Date: 2007-08-28 13:06:10 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Upgrade JEuclid source code.
Modified Paths:
--------------
trunk/foray/foray-graphic/.classpath
Added Paths:
-----------
trunk/foray/lib-build/jeuclid/jeuclid-3.0.1-source.zip
Removed Paths:
-------------
trunk/foray/lib-build/jeuclid/jeuclid-core-2.9.8-src.zip
Modified: trunk/foray/foray-graphic/.classpath
===================================================================
--- trunk/foray/foray-graphic/.classpath 2007-08-28 19:36:14 UTC (rev 10184)
+++ trunk/foray/foray-graphic/.classpath 2007-08-28 20:06:10 UTC (rev 10185)
@@ -28,6 +28,6 @@
<classpathentry kind="lib" path="/FOray Lib/batik-1.6-pdf-transcoder.jar" sourcepath="/FOray Lib-Build/batik/batik-1.6-pdf-transcoder-src.zip"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslPs"/>
<classpathentry kind="lib" path="/FOray Lib/batik-1.6-svggen.jar" sourcepath="/FOray Lib-Build/batik/batik-1.6-sources.zip"/>
- <classpathentry kind="lib" path="/FOray Lib/jeuclid-core-3.0.1.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/jeuclid-core-3.0.1.jar" sourcepath="/FOray Lib-Build/jeuclid/jeuclid-3.0.1-source.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Added: trunk/foray/lib-build/jeuclid/jeuclid-3.0.1-source.zip
===================================================================
(Binary files differ)
Property changes on: trunk/foray/lib-build/jeuclid/jeuclid-3.0.1-source.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/foray/lib-build/jeuclid/jeuclid-core-2.9.8-src.zip
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-28 19:36:14
|
Revision: 10184
http://foray.svn.sourceforge.net/foray/?rev=10184&view=rev
Author: victormote
Date: 2007-08-28 12:36:14 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Upgrade JEuclid to 3.0.1.
Modified Paths:
--------------
trunk/foray/foray-graphic/.classpath
Added Paths:
-----------
trunk/foray/lib/jeuclid-core-3.0.1.jar
Removed Paths:
-------------
trunk/foray/lib/jeuclid-core-2.9.8.jar
Modified: trunk/foray/foray-graphic/.classpath
===================================================================
--- trunk/foray/foray-graphic/.classpath 2007-08-28 19:01:26 UTC (rev 10183)
+++ trunk/foray/foray-graphic/.classpath 2007-08-28 19:36:14 UTC (rev 10184)
@@ -27,7 +27,7 @@
<classpathentry kind="lib" path="/FOray Lib/batik-1.6-ext.jar" sourcepath="/FOray Lib-Build/batik/batik-1.6-sources.zip"/>
<classpathentry kind="lib" path="/FOray Lib/batik-1.6-pdf-transcoder.jar" sourcepath="/FOray Lib-Build/batik/batik-1.6-pdf-transcoder-src.zip"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslPs"/>
- <classpathentry kind="lib" path="/FOray Lib/jeuclid-core-2.9.8.jar" sourcepath="/FOray Lib-Build/jeuclid/jeuclid-core-2.9.8-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib/batik-1.6-svggen.jar" sourcepath="/FOray Lib-Build/batik/batik-1.6-sources.zip"/>
+ <classpathentry kind="lib" path="/FOray Lib/jeuclid-core-3.0.1.jar"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Deleted: trunk/foray/lib/jeuclid-core-2.9.8.jar
===================================================================
(Binary files differ)
Added: trunk/foray/lib/jeuclid-core-3.0.1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/foray/lib/jeuclid-core-3.0.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-28 19:01:27
|
Revision: 10183
http://foray.svn.sourceforge.net/foray/?rev=10183&view=rev
Author: victormote
Date: 2007-08-28 12:01:26 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Add to-do item to handle MathML as an instream-foreign-object.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/InstreamMathElement.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/InstreamMathElement.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/InstreamMathElement.java 2007-08-28 16:46:50 UTC (rev 10182)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/InstreamMathElement.java 2007-08-28 19:01:26 UTC (rev 10183)
@@ -34,10 +34,12 @@
import org.foray.fotree.svg.obj.SVGElement;
import org.axsl.fo.FoTreeException;
-import org.axsl.graphic.GraphicException;
+import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
+import com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl;
+
/**
* The content of an instream Math (MathML) document.
*/
@@ -58,11 +60,10 @@
* {@inheritDoc}
*/
protected Document createDOMDocument() throws FoTreeException {
- try {
- return this.getGraphicServer().makeSvgDocument();
- } catch (final GraphicException e) {
- throw new FoTreeException(e);
- }
+ final DOMImplementation domImpl = new DOMImplementationImpl();
+ final Document document = domImpl.createDocument(
+ this.getNamespace().getNamespaceURI(), "math", null);
+ return document;
}
/**
@@ -72,4 +73,12 @@
return this.getFoTree().getMathNamespace();
}
+ /**
+ * {@inheritDoc}
+ */
+ protected void end() throws FoTreeException {
+ /* TODO: Add GraphicServer methods to get the DOM document converted to
+ * SVG or perhaps to a new MathGraphic instance. */
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-28 16:46:48
|
Revision: 10182
http://foray.svn.sourceforge.net/foray/?rev=10182&view=rev
Author: victormote
Date: 2007-08-28 09:46:50 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Key the map off of the graphic instance itself instead of its URL, as instream graphics won't have a URL.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2007-08-25 16:20:28 UTC (rev 10181)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2007-08-28 16:46:50 UTC (rev 10182)
@@ -38,6 +38,7 @@
import org.axsl.font.Font;
import org.axsl.font.FontUse;
+import org.axsl.graphic.Graphic;
import org.axsl.pdf.PdfException;
import org.axsl.pdf.PdfVersion;
import org.axsl.ps.Encoding;
@@ -49,7 +50,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -149,9 +149,10 @@
/**
* A global map of all XObjects used in the document, whose purpose is to
* create the possibility of reusing XObjects.
- * The key is a URL instance and the value is a PDFXObject instance.
+ * The key is the Graphic instance and the value is a PDFXObject instance.
*/
- private Map<URL, PDFXObject> xObjectsMap = new HashMap<URL, PDFXObject>();
+ private Map<Graphic, PDFXObject> xObjectsMap =
+ new HashMap<Graphic, PDFXObject>();
/**
* Default list of filters that should be applied to each stream in this
@@ -509,14 +510,14 @@
/**
* Register an X object for use in this document.
+ * @param graphic The Graphic instance backing the X object resource.
* @param theXObject The X object to register.
- * @param url The URL of the X object resource.
* @return The incremented X object count.
*/
- public int registerXObjectResource(final PDFXObject theXObject,
- final URL url) {
+ public int registerXObjectResource(final Graphic graphic,
+ final PDFXObject theXObject) {
// Add it to the global map so that it can be reused.
- this.xObjectsMap.put(url, theXObject);
+ this.xObjectsMap.put(graphic, theXObject);
registerIndirectObject(theXObject);
getResources().addXObject(theXObject);
return ++this.lastXObjectAssigned;
@@ -592,11 +593,11 @@
/**
* If a PDFXObject has already been created for a given URL, return that
* PDFXObject so that it can be reused.
- * @param url The URL for whom a PDFXObject is sought.
+ * @param graphic The Graphic instance for which a PDFXObject is sought.
* @return The corresponding PDFXObject, or null if there is none.
*/
- public PDFXObject findXObject(final URL url) {
- return this.xObjectsMap.get(url);
+ public PDFXObject findXObject(final Graphic graphic) {
+ return this.xObjectsMap.get(graphic);
}
/**
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java 2007-08-25 16:20:28 UTC (rev 10181)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java 2007-08-28 16:46:50 UTC (rev 10182)
@@ -77,7 +77,7 @@
if (graphic == null) {
throw new NullPointerException("Graphic must not be null.");
}
- this.xNumber = doc.registerXObjectResource(this, graphic.getUrl());
+ this.xNumber = doc.registerXObjectResource(graphic, this);
}
/**
@@ -95,7 +95,7 @@
final Graphic img, final FontConsumer fontConsumer,
final boolean strokeText) throws GraphicException {
/* If it has already been created, reuse it ... */
- PDFXObject xObject = pdfDoc.findXObject(img.getUrl());
+ PDFXObject xObject = pdfDoc.findXObject(img);
if (xObject != null) {
return xObject;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-26 11:36:35
|
Revision: 10181
http://foray.svn.sourceforge.net/foray/?rev=10181&view=rev
Author: victormote
Date: 2007-08-25 09:20:28 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Update links based on server-side redirects.
Modified Paths:
--------------
trunk/foray/doc/web/app/resources/other.html
Modified: trunk/foray/doc/web/app/resources/other.html
===================================================================
--- trunk/foray/doc/web/app/resources/other.html 2007-08-25 16:01:45 UTC (rev 10180)
+++ trunk/foray/doc/web/app/resources/other.html 2007-08-25 16:20:28 UTC (rev 10181)
@@ -139,10 +139,10 @@
href="http://www.oreilly.com/catalog/xslfo/">XSL-FO</a>, by Dave Pawson,
O'Reilly & Associates, 2002, ISBN 0-596-00355-2.</li>
<li>[book] <a rel="external"
-href="http://www.phptr.com/bookstore/product.asp?isbn=0131403745&rl=1">Definitive
+href="http://www.informit.com/store/product.aspx?isbn=0131403745&rl=1">Definitive
XSL-FO</a>, by G. Ken Holman, Prentice Hall PTR, 2003, ISBN 0-131-40374-5.</li>
<li>[book] <a rel="external"
-href="http://www.samspublishing.com/bookstore/product.asp?isbn=0672322811&rl=1">XSL
+href="http://www.informit.com/store/product.aspx?isbn=0672322811&rl=1">XSL
Formatting Objects Developer's Handbook</a>, by Doug Lovell, Sams, 2002,
ISBN 0-672-32281-1.</li>
<li>[book] <a rel="external"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-26 11:35:22
|
Revision: 10180
http://foray.svn.sourceforge.net/foray/?rev=10180&view=rev
Author: victormote
Date: 2007-08-25 09:01:45 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Fix broken links and clean up module display in menu.
Modified Paths:
--------------
trunk/foray/doc/web/00-rsrc/include/leftmenu-module.html
trunk/foray/doc/web/app/using/configuration.html
trunk/foray/doc/web/module/graphic/index.html
Modified: trunk/foray/doc/web/00-rsrc/include/leftmenu-module.html
===================================================================
--- trunk/foray/doc/web/00-rsrc/include/leftmenu-module.html 2007-08-14 20:00:26 UTC (rev 10179)
+++ trunk/foray/doc/web/00-rsrc/include/leftmenu-module.html 2007-08-25 16:01:45 UTC (rev 10180)
@@ -47,85 +47,85 @@
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/common/">FOrayCommon</a>
+ <a class="Menu" href="/module/common/">FOray Common</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/ps/">FOrayPs</a>
+ <a class="Menu" href="/module/ps/">FOray PS</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/pretty/">FOrayPretty</a>
+ <a class="Menu" href="/module/pretty/">FOray Pretty</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/font/">FOrayFont</a>
+ <a class="Menu" href="/module/font/">FOray Font</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/hyphen/">FOrayHyphen</a>
+ <a class="Menu" href="/module/hyphen/">FOray Hyphen</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/graphic/">FOrayGraphic</a>
+ <a class="Menu" href="/module/graphic/">FOray Graphic</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/speech/">FOraySpeech</a>
+ <a class="Menu" href="/module/speech/">FOray Speech</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/text/">FOrayText</a>
+ <a class="Menu" href="/module/text/">FOray Text</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/pdf/">FOrayPDF</a>
+ <a class="Menu" href="/module/pdf/">FOray PDF</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/mif/">FOrayMIF</a>
+ <a class="Menu" href="/module/mif/">FOray MIF</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/fotree/">FOrayFOTree</a>
+ <a class="Menu" href="/module/fotree/">FOray FOTree</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/area/">FOrayAreaTree</a>
+ <a class="Menu" href="/module/area/">FOray AreaTree</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/output/">FOrayOutput</a>
+ <a class="Menu" href="/module/output/">FOray Output</a>
</td>
</tr>
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/render/">FOrayRender</a>
+ <a class="Menu" href="/module/render/">FOray Render</a>
</td>
</tr>
<tr>
@@ -137,7 +137,7 @@
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/core/">FOrayCore</a>
+ <a class="Menu" href="/module/core/">FOray Core</a>
</td>
</tr>
</table>
Modified: trunk/foray/doc/web/app/using/configuration.html
===================================================================
--- trunk/foray/doc/web/app/using/configuration.html 2007-08-14 20:00:26 UTC (rev 10179)
+++ trunk/foray/doc/web/app/using/configuration.html 2007-08-25 16:01:45 UTC (rev 10180)
@@ -60,7 +60,7 @@
<p>The easiest way to get started using a FOray configuration file is to copy
the sample found at
-<a href="http://svn.sourceforge.net/viewcvs.cgi/foray/trunk/foray/config/sample-foray-config.xml?view=markup"
+<a href="http://foray.svn.sourceforge.net/viewvc/foray/trunk/foray/config/sample-foray-config.xml?view=markup"
rel="external">{foray-dir}/conf/userconfig.xml</a> to a location
of your choice, and then to edit it according to your needs.
It contains templates for some configuration options, most of which are
Modified: trunk/foray/doc/web/module/graphic/index.html
===================================================================
--- trunk/foray/doc/web/module/graphic/index.html 2007-08-14 20:00:26 UTC (rev 10179)
+++ trunk/foray/doc/web/module/graphic/index.html 2007-08-25 16:01:45 UTC (rev 10180)
@@ -6,7 +6,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
- <title>FOray Modules: FOrayGraphic</title>
+ <title>FOray Modules: FOray Graphic</title>
<meta name="content-revised"
content="$Date$"/>
<!--#include virtual="/00-rsrc/include/standard-head.html" -->
@@ -15,7 +15,7 @@
<body>
<!--#include virtual="/00-rsrc/include/leftmenu-module.html" -->
-<h1>FOray Modules: FOrayGraphic</h1>
+<h1>FOray Modules: FOray Graphic</h1>
<h2>Contents</h2>
<ul>
<li><a href="#intro">Introduction</a></li>
@@ -24,20 +24,20 @@
</ul>
<h2><a name="intro">Introduction</a></h2>
-<p>FOrayGraphic is an implementation of the
-<a href="http://www.axsl.org/graphic-r/" rel="external">axslGraphic-R</a>
-interface, which should be consulted for details on the general API, sample
+<p>FOray Graphic is an implementation of the
+<a href="http://www.axsl.org/graphic/" rel="external">aXSL Graphic</a>
+interfaces, which should be consulted for details on the general API, sample
code, etc.
-Although it is possible to use the FOrayGraphic package directly, there is
+Although it is possible to use the FOray Graphic package directly, there is
probably no good reason to do so.
-If the axslGraphic-R interface is not sufficient for your needs, we recommend
-that you suggest changes to it instead of using the FOrayGraphic package
+If the aXSL Graphic interface is not sufficient for your needs, we recommend
+that you suggest changes to it instead of using the FOray Graphic package
directly.
This allows your application to use any aXSL-compliant graphic system without
making substantial changes to your code.</p>
-<h2><a name="boot">Bootstrapping FOrayGraphic</a></h2>
-<p>The FOray-specific tasks that are needed to bootstrap the use of FOrayGraphic
+<h2><a name="boot">Bootstrapping FOray Graphic</a></h2>
+<p>The FOray-specific tasks that are needed to bootstrap the use of FOray Graphic
are as follows:</p>
<ol>
<li>Obtain a GraphicServer4a instance.
@@ -50,7 +50,7 @@
</ol>
<p>Once these tasks are accomplished, all downstream processing is documented
-in the <a href="http://www.axsl.org/graphic/" rel="external">axslGraphic</a>
+in the <a href="http://www.axsl.org/graphic/" rel="external">aXSL Graphic</a>
API.
In general, this consists of using passing a URL to the
GraphicServer.makeGraphic() method and getting a Graphic instance back, which
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-14 20:00:22
|
Revision: 10179
http://foray.svn.sourceforge.net/foray/?rev=10179&view=rev
Author: victormote
Date: 2007-08-14 13:00:26 -0700 (Tue, 14 Aug 2007)
Log Message:
-----------
Fix link to repository.
Modified Paths:
--------------
trunk/foray/doc/web/00-rsrc/include/leftmenu-dev.html
Modified: trunk/foray/doc/web/00-rsrc/include/leftmenu-dev.html
===================================================================
--- trunk/foray/doc/web/00-rsrc/include/leftmenu-dev.html 2007-08-13 17:49:45 UTC (rev 10178)
+++ trunk/foray/doc/web/00-rsrc/include/leftmenu-dev.html 2007-08-14 20:00:26 UTC (rev 10179)
@@ -39,7 +39,7 @@
<td class="Bullet1"> </td>
<td class="Menu1">
<a class="Menu" rel="external"
- href="http://svn.sourceforge.net/viewcvs.cgi/foray/">View Repository</a>
+ href="http://foray.svn.sourceforge.net/viewvc/foray/">View Repository</a>
</td>
</tr>
<tr>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-13 17:49:58
|
Revision: 10178
http://foray.svn.sourceforge.net/foray/?rev=10178&view=rev
Author: victormote
Date: 2007-08-13 10:49:45 -0700 (Mon, 13 Aug 2007)
Log Message:
-----------
Fix class cast problem in padding computation, and rework computation to use the correct precedence.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-08-13 17:17:34 UTC (rev 10177)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-08-13 17:49:45 UTC (rev 10178)
@@ -153,6 +153,7 @@
import org.foray.fotree.fo.prop.OddOrEven;
import org.foray.fotree.fo.prop.Orphans;
import org.foray.fotree.fo.prop.Overflow;
+import org.foray.fotree.fo.prop.Padding;
import org.foray.fotree.fo.prop.PageBreakAfter;
import org.foray.fotree.fo.prop.PageBreakBefore;
import org.foray.fotree.fo.prop.PageBreakInside;
@@ -2907,30 +2908,47 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param direction The direction for which the padding width is needed.
+ * @param relativeDirection The direction for which the padding width is
+ * needed.
* @return The width, in millipoints, of the padding.
*/
public int getPadding(final FObj fobj, final FoContext context,
- final RelativeCompass direction) {
- AbstractPadding padding = null;
- // Try the most explicit setting first, e.g "padding-top"
- FoProperty rawPropertyType = AbstractPadding.rawPropertyType(direction);
- padding = (AbstractPadding) getProperty(rawPropertyType);
- if (padding == null) {
- // Now try the shorthand
- padding = (AbstractPadding) getProperty(FoProperty.PADDING);
+ final RelativeCompass relativeDirection) {
+
+ /* NOTE: The precedence of the various properties and shorthand values
+ * is discussed in XSL-FO Recommendation 1.1, Sections 5.2 and 5.3. */
+
+ /* Precedence is given to the absolute explicit property, if it is
+ * set. */
+ AbstractPadding explicitPadding = null;
+ final AbsoluteCompass absoluteDirection = getWritingMode(fobj,
+ context).getAbsoluteDirection(relativeDirection);
+ FoProperty rawPropertyType = AbstractPadding.rawPropertyType(
+ absoluteDirection);
+ explicitPadding = (AbstractPadding) getProperty(rawPropertyType);
+
+ /* The next item to check is the relative explicit property. */
+ if (explicitPadding == null) {
+ rawPropertyType = AbstractPadding.rawPropertyType(
+ relativeDirection);
+ explicitPadding = (AbstractPadding) getProperty(rawPropertyType);
}
- if (padding == null) {
- // Now try the corresponding direction
- final Compass otherDirection = getWritingMode(fobj,
- context).getCorresponding(direction);
- rawPropertyType = AbstractPadding.rawPropertyType(otherDirection);
- padding = (AbstractPadding) getProperty(rawPropertyType);
+
+ /* If either the explicit absolute or relative directions are set,
+ * return that value. */
+ if (explicitPadding != null) {
+ return explicitPadding.getValue(context, fobj);
}
- if (padding == null) {
- return AbstractPadding.getValueNoInstance();
+
+ /* Neither the explicit absolute nor explicit relative directions are
+ * set. Check the "padding" shorthand. */
+ final Padding padding = (Padding) getProperty(FoProperty.PADDING);
+ if (padding != null) {
+ return padding.getValue(context, absoluteDirection, fobj);
}
- return padding.getValue(context, fobj);
+
+ /* Return the initial value. */
+ return AbstractPadding.getValueNoInstance();
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-13 17:17:32
|
Revision: 10177
http://foray.svn.sourceforge.net/foray/?rev=10177&view=rev
Author: victormote
Date: 2007-08-13 10:17:34 -0700 (Mon, 13 Aug 2007)
Log Message:
-----------
Make BidiOverride a subclass of FObjMixed.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java 2007-08-13 17:05:37 UTC (rev 10176)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BidiOverride.java 2007-08-13 17:17:34 UTC (rev 10177)
@@ -29,6 +29,7 @@
package org.foray.fotree.fo.obj;
import org.foray.fotree.FObj;
+import org.foray.fotree.FObjMixed;
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
@@ -42,7 +43,7 @@
/**
* A "bidi-override" object in XSL-FO.
*/
-public class BidiOverride extends FObj
+public class BidiOverride extends FObjMixed
implements org.axsl.fo.fo.BidiOverride {
/** The parent of this node. */
@@ -51,9 +52,6 @@
/** The children of this object. */
private List<FObj> children = new ArrayList<FObj>();
- /** The property list for this object. */
- private PropertyList propertyList;
-
/** The resolved primary Font. */
private org.axsl.font.FontUse resolvedFont = null;
@@ -63,9 +61,8 @@
* @param propertyList The property list for this FObj.
*/
public BidiOverride(final FObj parent, final PropertyList propertyList) {
- super(parent);
+ super(parent, propertyList);
this.parent = parent;
- this.propertyList = propertyList;
}
/**
@@ -127,6 +124,13 @@
/**
* {@inheritDoc}
*/
+ public boolean blockMustEnclosePCDATA() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public Object acceptProxyFactory(final ProxyFactory factory) {
return factory.makeProxy(this);
}
@@ -148,29 +152,29 @@
/**
* {@inheritDoc}
*/
- public void addChild(final FObj child) throws FoTreeException {
- this.getChildren().add(child);
+ public void addTextNode(final CharacterSequence4a textNode) {
+ this.children.add(textNode);
}
/**
* {@inheritDoc}
*/
- public boolean isContentBlock() {
- return false;
+ public void addNonTextNode(final FObj nonTextNode) {
+ this.children.add(nonTextNode);
}
/**
* {@inheritDoc}
*/
- public boolean isContentPcdata() {
+ public boolean isContentBlock() {
return false;
}
/**
* {@inheritDoc}
*/
- public PropertyList getPropertyList() {
- return this.propertyList;
+ public boolean isContentPcdata() {
+ return false;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-13 17:05:34
|
Revision: 10176
http://foray.svn.sourceforge.net/foray/?rev=10176&view=rev
Author: victormote
Date: 2007-08-13 10:05:37 -0700 (Mon, 13 Aug 2007)
Log Message:
-----------
Fix bug in the computation of the previous table cell.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java 2007-08-13 01:09:43 UTC (rev 10175)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java 2007-08-13 17:05:37 UTC (rev 10176)
@@ -145,16 +145,22 @@
return null;
}
final TableRow row = (TableRow) this.getParent();
- final List<FObj> children = row.getChildren();
- boolean thisFound = false;
- for (int i = children.size() - 1; i >= 0; i--) {
- final Object child = children.get(i);
- if (thisFound && child instanceof TableCell) {
- return (TableCell) child;
+ int previousCellIndex = -1;
+ final int thisIndex = row.getIndex(this);
+ if (thisIndex > -1) {
+ /* "this" was found in the children. */
+ previousCellIndex = thisIndex - 1;
+ } else {
+ /* "this" has not yet been added to the children of the parent.
+ * Therefore, the previous cell is the last child of the parent. */
+ previousCellIndex = row.getChildCount() - 1;
+ }
+ if (previousCellIndex > -1) {
+ final FObj previous = row.getChildAt(previousCellIndex);
+ /* Existing children could be markers as well as table-cells. */
+ if (previous instanceof TableCell) {
+ return (TableCell) previous;
}
- if (children.get(i) == this) {
- thisFound = true;
- }
}
return null;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-13 01:09:57
|
Revision: 10175
http://foray.svn.sourceforge.net/foray/?rev=10175&view=rev
Author: victormote
Date: 2007-08-12 18:09:43 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
Update build script to include required jeuclid lib.
Modified Paths:
--------------
trunk/foray/foray-graphic/scripts/build.xml
Modified: trunk/foray/foray-graphic/scripts/build.xml
===================================================================
--- trunk/foray/foray-graphic/scripts/build.xml 2007-08-11 20:16:45 UTC (rev 10174)
+++ trunk/foray/foray-graphic/scripts/build.xml 2007-08-13 01:09:43 UTC (rev 10175)
@@ -34,6 +34,7 @@
<include name="commons-io-*.jar"/>
<include name="commons-logging-*.jar"/>
<include name="xmlgraphics-commons-*.jar"/>
+ <include name="jeuclid-core-*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-11 20:16:45
|
Revision: 10174
http://foray.svn.sourceforge.net/foray/?rev=10174&view=rev
Author: victormote
Date: 2007-08-11 13:16:45 -0700 (Sat, 11 Aug 2007)
Log Message:
-----------
Rough-in support for the MathML namespace for instream-foreign-object.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/ForeignXML.java
trunk/foray/resource/fo-examples/basic/instream.fo
Added Paths:
-----------
trunk/foray/foray-fotree/src/java/org/foray/fotree/math/
trunk/foray/foray-fotree/src/java/org/foray/fotree/math/MathNamespace.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/math/MathObjectMaker.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/
trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/InstreamMathElement.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/package.html
trunk/foray/foray-fotree/src/java/org/foray/fotree/math/package.html
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2007-08-11 16:14:11 UTC (rev 10173)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2007-08-11 20:16:45 UTC (rev 10174)
@@ -34,6 +34,7 @@
import org.foray.fotree.fo.obj.PageSequence;
import org.foray.fotree.fo.obj.Root;
import org.foray.fotree.foray.NamespaceForay;
+import org.foray.fotree.math.MathNamespace;
import org.foray.fotree.svg.NamespaceSVG;
import org.foray.fotree.xml.NamespaceXML;
@@ -436,6 +437,14 @@
}
/**
+ * Return the MathML namespace instance.
+ * @return The MathML namespace instance.
+ */
+ public MathNamespace getMathNamespace() {
+ return getTreeServer().getMathNamespace();
+ }
+
+ /**
* Return the XML namespace instance.
* @return The XML namespace instance.
*/
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java 2007-08-11 16:14:11 UTC (rev 10173)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java 2007-08-11 20:16:45 UTC (rev 10174)
@@ -32,6 +32,7 @@
import org.foray.fotree.axsl.NamespaceAxsl;
import org.foray.fotree.fo.NamespaceFO;
import org.foray.fotree.foray.NamespaceForay;
+import org.foray.fotree.math.MathNamespace;
import org.foray.fotree.svg.NamespaceSVG;
import org.foray.fotree.xml.NamespaceXML;
@@ -89,6 +90,9 @@
/** The "SVG" namespace. */
private NamespaceSVG namespaceSVG;
+ /** The "MathML" namespace. */
+ private MathNamespace namespaceMath;
+
/** The "XML namespace. */
private NamespaceXML namespaceXML;
@@ -133,6 +137,9 @@
final NamespaceSVG svg = new NamespaceSVG();
registerNamespace(svg);
this.namespaceSVG = svg;
+ final MathNamespace math = new MathNamespace();
+ this.registerNamespace(math);
+ this.namespaceMath = math;
final NamespaceForay extensions = new NamespaceForay();
registerNamespace(extensions);
this.namespaceForay = extensions;
@@ -198,6 +205,14 @@
}
/**
+ * Returns the namespace used for "MathML" items.
+ * @return The namespace used for "MathML" items.
+ */
+ public MathNamespace getMathNamespace() {
+ return this.namespaceMath;
+ }
+
+ /**
* Returns the namespace used for "XML" items.
* @return The namespace used for "XML" items.
*/
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/ForeignXML.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/ForeignXML.java 2007-08-11 16:14:11 UTC (rev 10173)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/ForeignXML.java 2007-08-11 20:16:45 UTC (rev 10174)
@@ -165,8 +165,8 @@
/**
* This is pretending to be a SAX Handler for the start of an element.
- * Control is passed here from FOTreeBuilder while foreign XML is being
- * processed.
+ * Control is passed here from {@link FOTreeBuilder#startElement(String,
+ * String, String, Attributes)} while foreign XML is being processed.
* @param namespaceURI The Namespace URI, or the empty string if the element
* has no Namespace URI or if Namespace processing is not being performed.
* @param localName The local name (without prefix), or the empty string if
@@ -212,8 +212,8 @@
/**
* This is pretending to be a SAX Handler for the end of an element.
- * Control is passed here from FOTreeBuilder while foreign XML is being
- * processed.
+ * Control is passed here from {@link FOTreeBuilder#endElement(String,
+ * String, String)} while foreign XML is being processed.
* @param uri The Namespace URI, or the empty string if the element has no
* Namespace URI or if Namespace processing is not being performed.
* @param localName The local name (without prefix), or the empty string if
@@ -248,8 +248,8 @@
/**
* This is pretending to be a SAX Handler for the characters (content) of
* an element.
- * Control is passed here from FOTreeBuilder while foreign XML is being
- * processed.
+ * Control is passed here from {@link FOTreeBuilder#characters(char[], int,
+ * int)} while foreign XML is being processed.
* @param data The characters.
* @param start The start position in the character array.
* @param length The number of characters to use from the character array.
Added: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/MathNamespace.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/math/MathNamespace.java (rev 0)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/math/MathNamespace.java 2007-08-11 20:16:45 UTC (rev 10174)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy: victormote $
+ */
+
+package org.foray.fotree.math;
+
+import org.foray.fotree.FOTreeBuilder;
+import org.foray.fotree.FObj;
+import org.foray.fotree.Namespace;
+import org.foray.fotree.Property;
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyList;
+import org.foray.fotree.PropertyListUnparsed;
+
+import org.axsl.fo.FoTreeException;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
+/**
+ * This class manages the namespace that is used for the Math Markup Language
+ * (MathML).
+ */
+public class MathNamespace extends Namespace {
+
+ /**
+ * Constructor.
+ */
+ public MathNamespace() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getNamespaceURI() {
+ return "http://www.w3.org/1998/Math/MathML";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getTypicalPrefix() {
+ return "m";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public FObj parseElementForNS(final String localName,
+ final FObj currentFObj, final PropertyList list,
+ final Locator locator) throws FoTreeException {
+ return MathObjectMaker.makeObject(localName, currentFObj, list);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void parseAttributes(final PropertyList propertyList,
+ final Attributes attlist, final FObj currentFObj,
+ final Locator locator, final FOTreeBuilder builder) {
+ /*
+ * There is nothing to do here. We passed the raw attributes when
+ * we created the propertyList instance.
+ */
+ return;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Property parseAttributeForNS(final Attributes attributes,
+ final String attributeName, final String attributeValue,
+ final FObj fobj, final Locator locator)
+ throws PropertyException {
+ /* This method is required by the abstract superclass Namespace, but is
+ * not used, because the parseAttributes method does all of the work. */
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected PropertyList createNewPropertyList(final Attributes attlist) {
+ return new PropertyListUnparsed(attlist);
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/MathNamespace.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/MathObjectMaker.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/math/MathObjectMaker.java (rev 0)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/math/MathObjectMaker.java 2007-08-11 20:16:45 UTC (rev 10174)
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy: victormote $
+ */
+
+package org.foray.fotree.math;
+
+import org.foray.fotree.FObj;
+import org.foray.fotree.PropertyList;
+import org.foray.fotree.PropertyListUnparsed;
+import org.foray.fotree.fo.obj.InstreamForeignObject;
+import org.foray.fotree.svg.obj.SVGElement;
+
+import org.axsl.fo.FoTreeException;
+
+/**
+ * Factory class for creating formatting objects in the "m" (MathML) namespace.
+ */
+public final class MathObjectMaker {
+
+ /**
+ * Private constructor. This is a utility class and should never be
+ * instantiated.
+ */
+ private MathObjectMaker() { }
+
+ /**
+ * Converts an unparsed SVG element into an FObj instance that can be added
+ * to the FO Tree.
+ * @param objectName The unparsed SVG element name.
+ * @param parent The parent FObj.
+ * @param propertyList The property list of the parent FObj.
+ * @return The new FObj instance for this SVG element.
+ * @throws FoTreeException If the parent object is not an instance of
+ * {@link InstreamForeignObject}.
+ */
+ public static FObj makeObject(final String objectName, final FObj parent,
+ final PropertyList propertyList) throws FoTreeException {
+ /* We only need to handle one element here, the root element, which is
+ * always "math". */
+ if (! objectName.equals("math")) {
+ throw new IllegalArgumentException("Cannot parse any MathML "
+ + "elements except \"math\".");
+ }
+ // The PropertyList must be of the unparsed variety
+ final PropertyListUnparsed propertyListUnparsed
+ = (PropertyListUnparsed) propertyList;
+ if (parent instanceof InstreamForeignObject) {
+ final InstreamForeignObject ifo =
+ (InstreamForeignObject) parent;
+ return new SVGElement(ifo, propertyListUnparsed);
+ } else {
+ parent.throwException("Instream MathML content must be inside "
+ + "an fo:instream-foreign-object.");
+ return null;
+ }
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/MathObjectMaker.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/InstreamMathElement.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/InstreamMathElement.java (rev 0)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/InstreamMathElement.java 2007-08-11 20:16:45 UTC (rev 10174)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy: victormote $
+ */
+
+package org.foray.fotree.math.obj;
+
+import org.foray.fotree.Namespace;
+import org.foray.fotree.PropertyListUnparsed;
+import org.foray.fotree.fo.obj.InstreamForeignObject;
+import org.foray.fotree.svg.obj.SVGElement;
+
+import org.axsl.fo.FoTreeException;
+import org.axsl.graphic.GraphicException;
+
+import org.w3c.dom.Document;
+
+/**
+ * The content of an instream Math (MathML) document.
+ */
+public class InstreamMathElement extends SVGElement {
+
+ /**
+ * Constructor.
+ * @param parent The parent FObj.
+ * @param propertyList The property list for this FObj.
+ * @throws FoTreeException For errors during construction.
+ */
+ public InstreamMathElement(final InstreamForeignObject parent,
+ final PropertyListUnparsed propertyList) throws FoTreeException {
+ super(parent, propertyList);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Document createDOMDocument() throws FoTreeException {
+ try {
+ return this.getGraphicServer().makeSvgDocument();
+ } catch (final GraphicException e) {
+ throw new FoTreeException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Namespace getNamespace() {
+ return this.getFoTree().getMathNamespace();
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/InstreamMathElement.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/package.html
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/package.html (rev 0)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/package.html 2007-08-11 20:16:45 UTC (rev 10174)
@@ -0,0 +1,6 @@
+<html>
+<title>Package org.foray.fotree.math.obj</title>
+<body>
+<p>Classes representing objects in the m: (MathML) namespace.</p>
+</body>
+</html>
Property changes on: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/obj/package.html
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/package.html
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/math/package.html (rev 0)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/math/package.html 2007-08-11 20:16:45 UTC (rev 10174)
@@ -0,0 +1,6 @@
+<html>
+<title>Package org.foray.fotree.math</title>
+<body>
+<p>Namespace and Factory classes for objects in the m: (MathML) namespace.</p>
+</body>
+</html>
Property changes on: trunk/foray/foray-fotree/src/java/org/foray/fotree/math/package.html
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/resource/fo-examples/basic/instream.fo
===================================================================
--- trunk/foray/resource/fo-examples/basic/instream.fo 2007-08-11 16:14:11 UTC (rev 10173)
+++ trunk/foray/resource/fo-examples/basic/instream.fo 2007-08-11 20:16:45 UTC (rev 10174)
@@ -1,32 +1,38 @@
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+<fo:root
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:m="http://www.w3.org/1998/Math/MathML">
+
<fo:layout-master-set>
<fo:simple-page-master master-name="one">
- <fo:region-body margin-top="25pt" margin-bottom="25pt" margin-left="50pt" margin-right="50pt" />
+ <fo:region-body
+ margin-top="25pt"
+ margin-bottom="25pt"
+ margin-left="50pt"
+ margin-right="50pt"/>
</fo:simple-page-master>
</fo:layout-master-set>
+
<fo:page-sequence master-reference="one">
<fo:flow flow-name="xsl-region-body">
- <fo:block>This is used to show how foreign objects are placed in a line area.</fo:block>
- <fo:block>
- Some block text to separate instream objects.
- </fo:block>
- <fo:block>
- Some text before
-<fo:instream-foreign-object>
+
+ <fo:block>This is used to show how foreign objects are placed in a line
+area.</fo:block>
+
+ <fo:block>Some block text to separate instream objects.</fo:block>
+
+ <fo:block>Some text before<fo:instream-foreign-object>
<svg:svg width="20" height="20">
<svg:g style="fill:red; stroke:#000000">
<svg:rect x="0" y="0" width="15" height="15"/>
<svg:rect x="5" y="5" width="15" height="15"/>
</svg:g>
-</svg:svg>
-</fo:instream-foreign-object>
- and some after the svg element.
- </fo:block>
- <fo:block>
- A text line below the instream object.
- </fo:block>
- <fo:block>
-<fo:instream-foreign-object>
+</svg:svg></fo:instream-foreign-object> and some after the svg
+element.</fo:block>
+
+ <fo:block>A text line below the instream object.</fo:block>
+
+ <fo:block><fo:instream-foreign-object>
<svg:svg width="250" height="50">
<svg:g style="fill:red; stroke:#000000">
<svg:rect x="0" y="0" width="15" height="15"/>
@@ -34,58 +40,47 @@
</svg:g>
<svg:text x="10" y="30">SVG placed in a block</svg:text>
</svg:svg>
-</fo:instream-foreign-object>
- </fo:block>
- <fo:block>
- A text line below the block.
- </fo:block>
- <fo:block>
- A text line with an instream foreign object that is before the line break.
-<fo:instream-foreign-object>
+</fo:instream-foreign-object></fo:block>
+
+ <fo:block>A text line below the block.</fo:block>
+
+ <fo:block>A text line with an instream foreign object that is before the line
+break. <fo:instream-foreign-object>
<svg:svg width="50" height="50">
<svg:g style="fill:red; stroke:#000000">
<svg:rect x="0" y="0" width="15" height="15"/>
<svg:rect x="5" y="5" width="15" height="15"/>
</svg:g>
<svg:rect style="fill:none;stroke:black" x="0" y="0" width="49" height="49"/>
-</svg:svg>
-</fo:instream-foreign-object>
-With some text on the next line. With a bit more text to go over the to the next line.
- </fo:block>
- <fo:block>
- A text line with an instream foreign object that is after the line break.
-With some text on the next line. With a bit
-<fo:instream-foreign-object>
+</svg:svg></fo:instream-foreign-object> With some text on the next line. With a
+bit more text to go over the to the next line.</fo:block>
+
+ <fo:block>A text line with an instream foreign object that is after the line
+break. With some text on the next line. With a bit <fo:instream-foreign-object>
<svg:svg width="50" height="50">
<svg:g style="fill:red; stroke:#000000">
<svg:rect x="0" y="0" width="15" height="15"/>
<svg:rect x="5" y="5" width="15" height="15"/>
</svg:g>
<svg:rect style="fill:none;stroke:black" x="0" y="0" width="49" height="49"/>
-</svg:svg>
-</fo:instream-foreign-object>
-more text to go over the to the next line.
- </fo:block>
- <fo:block>
- A text line with an instream foreign object that is over the line break.
-With some text
-<fo:instream-foreign-object>
+</svg:svg></fo:instream-foreign-object> more text to go over the to the next
+line.</fo:block>
+
+ <fo:block>A text line with an instream foreign object that is over the line
+break. With some text <fo:instream-foreign-object>
<svg:svg width="50" height="50">
<svg:g style="fill:red; stroke:#000000">
<svg:rect x="0" y="0" width="15" height="15"/>
<svg:rect x="5" y="5" width="15" height="15"/>
</svg:g>
<svg:rect style="fill:none;stroke:black" x="0" y="0" width="49" height="49"/>
-</svg:svg>
-</fo:instream-foreign-object>
-on the next line. With a bit more text to go over the to the next line to
-see it handles it properly.
- </fo:block>
- <fo:block>
- The next block has an instream object wider than the area.
- </fo:block>
- <fo:block>
-<fo:instream-foreign-object>
+</svg:svg></fo:instream-foreign-object> on the next line. With a bit more text
+to go over the to the next line to see it handles it properly.</fo:block>
+
+ <fo:block>The next block has an instream object wider than the
+area.</fo:block>
+
+ <fo:block><fo:instream-foreign-object>
<svg:svg width="550" height="50">
<svg:g style="fill:red; stroke:#000000">
<svg:rect x="0" y="0" width="15" height="15"/>
@@ -94,11 +89,10 @@
<svg:rect style="fill:none;stroke:black" x="0" y="0" width="549" height="49"/>
<svg:text x="10" y="30">SVG placed in a really wide block</svg:text>
</svg:svg>
-</fo:instream-foreign-object>
- </fo:block>
- <fo:block>
- This block has an instream object wider than the area after this text
-<fo:instream-foreign-object>
+</fo:instream-foreign-object></fo:block>
+
+ <fo:block>This block has an instream object wider than the area after this
+text <fo:instream-foreign-object>
<svg:svg width="550" height="50">
<svg:g style="fill:red; stroke:#000000">
<svg:rect x="0" y="0" width="15" height="15"/>
@@ -107,8 +101,27 @@
<svg:rect style="fill:none;stroke:black" x="0" y="0" width="549" height="49"/>
<svg:text x="10" y="30">SVG placed in a really wide block</svg:text>
</svg:svg>
-</fo:instream-foreign-object>
- </fo:block>
- </fo:flow>
- </fo:page-sequence>
+</fo:instream-foreign-object></fo:block>
+
+ <fo:block>The next paragraph demonstrates the use of an instream MathML
+document.</fo:block>
+
+ <fo:block>This demonstration formula comes from the JEuclid web site:
+<fo:instream-foreign-object>
+<m:math display="inline">
+ <m:mrow>
+ <m:munderover>
+ <m:mo>∫</m:mo>
+ <m:mn>1</m:mn>
+ <m:mi>x</m:mi>
+ </m:munderover>
+ <m:mfrac>
+ <m:mi>dt</m:mi>
+ <m:mi>t</m:mi>
+ </m:mfrac>
+ </m:mrow>
+</m:math></fo:instream-foreign-object></fo:block>
+
+</fo:flow>
+</fo:page-sequence>
</fo:root>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-11 16:14:10
|
Revision: 10173
http://foray.svn.sourceforge.net/foray/?rev=10173&view=rev
Author: victormote
Date: 2007-08-11 09:14:11 -0700 (Sat, 11 Aug 2007)
Log Message:
-----------
Workaround bug in Batik(??) to get the DOM Document hooked up with its root element.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/MathFactory.java
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/MathFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/MathFactory.java 2007-08-11 14:57:16 UTC (rev 10172)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/MathFactory.java 2007-08-11 16:14:11 UTC (rev 10173)
@@ -30,6 +30,8 @@
import net.sourceforge.jeuclid.DOMBuilder;
import net.sourceforge.jeuclid.MathBase;
+import net.sourceforge.jeuclid.elements.AbstractJEuclidElement;
+import net.sourceforge.jeuclid.elements.generic.MathImpl;
import org.foray.graphic.GraphicServer4a;
import org.foray.graphic.SVGGraphic;
@@ -108,12 +110,45 @@
*/
private SVGDocument domToSvgDom(final Document dom)
throws GraphicException {
+ /* Do some basic validation of the DOM document. */
+ final Element rootElement = dom.getDocumentElement();
+ if (! AbstractJEuclidElement.URI.equals(
+ rootElement.getNamespaceURI())) {
+ throw new GraphicException("Document is not in the MathML "
+ + "namespace");
+ }
+ final String rootElementName = rootElement.getLocalName();
+ if (! MathImpl.ELEMENT.equals(rootElementName)) {
+ throw new GraphicException("Expected root element <math> for "
+ + "MathML document, but was: " + rootElementName);
+ }
+
final MathBase mathBase = new MathBase(MathBase.getDefaultParameters());
new DOMBuilder(dom, mathBase);
final SVGGraphics2D svgGenerator = this.createSVGGenerator(mathBase);
mathBase.paint(svgGenerator);
+
+ /* The following line is what /should/ work. However, there appears to
+ * be some disconnect in Batik between the Document and the root
+ * Element. The root Element recognizes the Document as its Document,
+ * but the Document does not see the root Element as its root Element
+ * ... */
+// final Document svgDocument = svgGenerator.getDOMFactory();
+
final Element svgRoot = svgGenerator.getRoot();
+
+ /* The variable svgDocument below is the same object as the one
+ * commented out above ... */
final Document svgDocument = svgRoot.getOwnerDocument();
+
+ /* ... however, the root element below is /NOT/ the same as the svgRoot
+ * variable above ... */
+ final Element svgRoot2 = svgDocument.getDocumentElement();
+
+ /* ... so we need to get the Document and the root element hooked up. */
+ svgDocument.removeChild(svgRoot2);
+ svgDocument.appendChild(svgRoot);
+
if (svgDocument == null) {
throw new GraphicException("Error converting MathML to SVG: "
+ "Document is null.");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-11 14:57:13
|
Revision: 10172
http://foray.svn.sourceforge.net/foray/?rev=10172&view=rev
Author: victormote
Date: 2007-08-11 07:57:16 -0700 (Sat, 11 Aug 2007)
Log Message:
-----------
Refactor code to make the API less JEuclid-specific.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/MathFactory.java
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/MathFactory.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/MathFactory.java 2007-08-10 23:56:56 UTC (rev 10171)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/factory/MathFactory.java 2007-08-11 14:57:16 UTC (rev 10172)
@@ -81,29 +81,35 @@
return null;
}
- /* Convert to an SVG and create an SVGGraphic instance. */
+ /* Convert the URL to a generic DOM document instance. */
final Document dom = this.getServer().urlToDom(url);
- final MathBase mathBase = new MathBase(MathBase.getDefaultParameters());
- new DOMBuilder(dom, mathBase);
+ /* Convert the generic DOM to an SVGDocument (DOM/SVG Document), using
+ * JEuclid. */
SVGDocument svgDocument = null;
try {
- svgDocument = this.convertToSvg(mathBase);
+ svgDocument = this.domToSvgDom(dom);
} catch (final GraphicException e) {
throw new IOException(e.getMessage());
}
+
+ /* Return an SVGGraphic instance. */
return new SVGGraphic(this.getServer(), svgDocument);
}
/**
- * Converts a MathBase (JEuclid MathML document) instance to an SVGDocument.
- * @param mathBase The JEuclid MathML document to be converted.
+ * Converts a generic DOM Document instance that contains a MathML document
+ * into an {@link SVGDocument}.
+ * @param dom A generic DOM Document instance that contains a MathML
+ * document.
* @return The SVGDocument containing an SVG representation of the MathML
* document.
* @throws GraphicException For errors during conversion.
*/
- private SVGDocument convertToSvg(final MathBase mathBase)
+ private SVGDocument domToSvgDom(final Document dom)
throws GraphicException {
+ final MathBase mathBase = new MathBase(MathBase.getDefaultParameters());
+ new DOMBuilder(dom, mathBase);
final SVGGraphics2D svgGenerator = this.createSVGGenerator(mathBase);
mathBase.paint(svgGenerator);
final Element svgRoot = svgGenerator.getRoot();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-08-10 23:56:58
|
Revision: 10171
http://foray.svn.sourceforge.net/foray/?rev=10171&view=rev
Author: victormote
Date: 2007-08-10 16:56:56 -0700 (Fri, 10 Aug 2007)
Log Message:
-----------
1. Add a test of the DOM parsing capability.
2. Refactor the logic for getting the sandbox and test directory so that it can be reused.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/fo/FoDocumentReader.java
trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java
trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestFOrayGraphic.java
Added Paths:
-----------
trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestGraphicServer4a.java
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/fo/FoDocumentReader.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/fo/FoDocumentReader.java 2007-08-10 23:01:54 UTC (rev 10170)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/fo/FoDocumentReader.java 2007-08-10 23:56:56 UTC (rev 10171)
@@ -29,8 +29,8 @@
package org.foray.app.fo;
import org.foray.app.FOraySpecific;
-import org.foray.common.Environment;
import org.foray.common.Logging;
+import org.foray.common.TestFOrayCommon;
import org.foray.common.sax.SaxParser;
import org.foray.common.url.URLFactory;
import org.foray.core.FOrayException;
@@ -56,7 +56,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.Properties;
import javax.xml.parsers.ParserConfigurationException;
@@ -85,11 +84,7 @@
final Log logger = Logging.makeQuietLogger();
final SessionConfig sessionConfig = new SessionConfig(logger);
- final Properties buildProperties = Environment.getBuildProperties();
- final String foraySandbox = buildProperties.getProperty(
- "foray.sandbox");
- final String testDir = foraySandbox + "/resource/test/";
- this.testDirectory = new File(testDir);
+ this.testDirectory = TestFOrayCommon.getTestDirectory();
final FontServer fontServer = FOraySpecific.makeFontServer(logger,
sessionConfig);
Modified: trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java
===================================================================
--- trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java 2007-08-10 23:01:54 UTC (rev 10170)
+++ trunk/foray/foray-common/src/javatest/org/foray/common/TestFOrayCommon.java 2007-08-10 23:56:56 UTC (rev 10171)
@@ -28,6 +28,10 @@
package org.foray.common;
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -38,6 +42,29 @@
public class TestFOrayCommon extends TestCase {
/**
+ * Returns the directory that is the root of the local sandbox, for example,
+ * "D:/u/user/foray/trunk/foray".
+ * @return The directory that is the root of the local sandbox.
+ * @throws IOException For errors obtaining the build properties.
+ */
+ public static File getSandbox() throws IOException {
+ final Properties buildProperties = Environment.getBuildProperties();
+ final String foraySandbox = buildProperties.getProperty(
+ "foray.sandbox");
+ return new File(foraySandbox);
+ }
+
+ /**
+ * Returns the local file that contains the test files.
+ * @return The local file that contains the test files.
+ * @throws IOException For errors obtaining the build properties.
+ */
+ public static File getTestDirectory() throws IOException {
+ final File sandbox = TestFOrayCommon.getSandbox();
+ return new File(sandbox, "/resource/test/");
+ }
+
+ /**
* Builds a test suite for all classes in this module.
* @return The built test suite.
*/
Modified: trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestFOrayGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestFOrayGraphic.java 2007-08-10 23:01:54 UTC (rev 10170)
+++ trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestFOrayGraphic.java 2007-08-10 23:56:56 UTC (rev 10171)
@@ -44,6 +44,7 @@
public static Test suite() {
final TestSuite testSuite = new TestSuite();
+ testSuite.addTestSuite(TestGraphicServer4a.class);
testSuite.addTestSuite(TestBmpGraphic.class);
testSuite.addTestSuite(TestGifGraphic.class);
testSuite.addTestSuite(TestJpegGraphic.class);
Added: trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestGraphicServer4a.java
===================================================================
--- trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestGraphicServer4a.java (rev 0)
+++ trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestGraphicServer4a.java 2007-08-10 23:56:56 UTC (rev 10171)
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.graphic;
+
+import org.foray.common.Logging;
+import org.foray.common.TestFOrayCommon;
+
+import org.axsl.graphic.GraphicException;
+
+import org.apache.commons.logging.Log;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for the class {@link GraphicServer4a}.
+ */
+public class TestGraphicServer4a extends TestCase {
+
+ /** A GraphicServer available for testing. */
+ private static GraphicServer4a graphicServer;
+
+ /**
+ * Provides static access to a static GraphicServer4a instance for testing.
+ * @return The GraphicServer4a to be used for testing.
+ * @throws GraphicException For errors creating the Server.
+ */
+ public static GraphicServer4a getServer() throws GraphicException {
+ if (TestGraphicServer4a.graphicServer == null) {
+ final Log logger = Logging.makeDefaultLogger();
+ final GraphicServer4a graphicServer = new GraphicServer4a(logger);
+ TestGraphicServer4a.graphicServer = graphicServer;
+ }
+ return TestGraphicServer4a.graphicServer;
+ }
+
+ /**
+ * Returns the directory containing the graphics files used for testing.
+ * @return The directory containing the graphics files used for testing.
+ * @throws IOException For errors obtaining the local sandbox.
+ */
+ public static File getTestGraphicsDir() throws IOException {
+ final File sandbox = TestFOrayCommon.getSandbox();
+ final File graphicsDir = new File(sandbox,
+ "resource/fo-examples/graphics");
+ return graphicsDir;
+ }
+
+ /**
+ * Returns the file for a given test graphic file.
+ * @param fileName The name of the test graphic file to obtain.
+ * @return The file.
+ * @throws IOException For errors obtaining the local sandbox or for the
+ * file itself.
+ */
+ public static File getTestGraphicsFile(final String fileName)
+ throws IOException {
+ final File graphicsDir = TestGraphicServer4a.getTestGraphicsDir();
+ return new File(graphicsDir, fileName);
+ }
+
+ /**
+ * Test the method {@link GraphicServer4a#urlToDom(java.net.URL)} by parsing
+ * a file and testing the results.
+ * @throws IOException For errors getting the local sandbox.
+ * @throws GraphicException For error obtaining a server instance.
+ */
+ public void testUrlToDom() throws IOException, GraphicException {
+ final File testFile = TestGraphicServer4a.getTestGraphicsFile(
+ "mathml-example-1.xml");
+ final URL url = testFile.toURL();
+ final GraphicServer4a server = TestGraphicServer4a.getServer();
+ final Document document = server.urlToDom(url);
+ assertNotNull(document);
+
+ /* The document itself has two children, the document type, and the
+ * root element. */
+ NodeList nodeList = document.getChildNodes();
+ assertEquals(2, nodeList.getLength());
+ /* The first node is the document type node. */
+ assertEquals(Node.DOCUMENT_TYPE_NODE, nodeList.item(0).getNodeType());
+
+ /* The second node is the root element. */
+ Node node = nodeList.item(1);
+ assertEquals(Node.ELEMENT_NODE, node.getNodeType());
+ assertEquals("math", node.getLocalName());
+
+ /* The root node has one child, an "mrow" element. */
+ nodeList = node.getChildNodes();
+ assertEquals(3, nodeList.getLength());
+ /* The first child is ignorable whitespace. */
+ assertEquals(Node.TEXT_NODE, nodeList.item(0).getNodeType());
+ /* The second child is the actual element. */
+ assertEquals(Node.ELEMENT_NODE, nodeList.item(1).getNodeType());
+ /* The third child is ignorable whitespace. */
+ assertEquals(Node.TEXT_NODE, nodeList.item(2).getNodeType());
+ node = nodeList.item(1);
+ assertEquals("mrow", node.getLocalName());
+
+ /* It is certainly possible to test this DOM document more extensively,
+ * but this is enough to show that it was parsed. */
+ }
+
+}
Property changes on: trunk/foray/foray-graphic/src/javatest/org/foray/graphic/TestGraphicServer4a.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|