[FOray-commit] SF.net SVN: foray: [10194] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
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.
|