[FOray-commit] SF.net SVN: foray: [10114] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-07-26 20:23:32
|
Revision: 10114
http://foray.svn.sourceforge.net/foray/?rev=10114&view=rev
Author: victormote
Date: 2007-07-26 13:23:29 -0700 (Thu, 26 Jul 2007)
Log Message:
-----------
Conform to axsl changes removing unnecessary convenience method.
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-07-26 19:44:15 UTC (rev 10113)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkTitleArea.java 2007-07-26 20:23:29 UTC (rev 10114)
@@ -71,9 +71,9 @@
* @return The text for this bookmark title.
*/
public String getTitleText() {
- // Cast verified at construction.
final BookmarkTitle generatedBy = traitGeneratedBy();
- return new String(generatedBy.getContent());
+ final char[] text = generatedBy.getChildAt(0).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-07-26 19:44:15 UTC (rev 10113)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java 2007-07-26 20:23:29 UTC (rev 10114)
@@ -53,7 +53,8 @@
private FObj parent;
/** The children of this object. */
- private List<FObj> children = new ArrayList<FObj>();
+ private List<CharacterSequence4a> children =
+ new ArrayList<CharacterSequence4a>(1);
/**
* Constructor.
@@ -96,30 +97,12 @@
throwException(this.getFullName() + " must have exactly one "
+ "child.");
}
- if (! (this.getChildren().get(0) instanceof CharacterSequence4a)) {
- throwException(this.getFullName() + " child must be #PCDATA.");
- }
}
/**
- * Returns the text of this bookmark title.
- * @return The text of this title.
- */
- public CharacterSequence4a getText() {
- /* Existence and cast verified in end(). */
- return (CharacterSequence4a) this.getChildren().get(0);
- }
-
/**
* {@inheritDoc}
*/
- public char[] getContent() {
- return getText().getAreaTreeText(null);
- }
-
- /**
- * {@inheritDoc}
- */
public String getName() {
return "bookmark-title";
}
@@ -195,22 +178,28 @@
/**
* {@inheritDoc}
*/
- public List<FObj> getChildren() {
+ public List<CharacterSequence4a> getChildren() {
return this.children;
}
/**
* {@inheritDoc}
*/
- public void addTextNode(final CharacterSequence4a textNode) {
+ public void addTextNode(final CharacterSequence4a textNode)
+ throws FoTreeException {
+ if (this.children.size() > 0) {
+ textNode.throwException("BookmarkTitle should have exactly one "
+ + "child.");
+ }
this.children.add(textNode);
}
/**
* {@inheritDoc}
*/
- public void addNonTextNode(final FObj nonTextNode) {
- this.children.add(nonTextNode);
+ public void addNonTextNode(final FObj nonTextNode) throws FoTreeException {
+ nonTextNode.throwException("Violates BookmarkTitle content model: "
+ + "(#PCDATA)");
}
/**
@@ -241,4 +230,11 @@
return this.getParent().getPrimaryFont(context);
}
+ /**
+ * {@inheritDoc}
+ */
+ public CharacterSequence4a getChildAt(final int index) {
+ return this.children.get(index);
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|