[FOray-commit] SF.net SVN: foray: [7881] trunk/foray/foray-fotree/src/java/org/foray/ fotree
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-09-04 16:57:34
|
Revision: 7881
http://svn.sourceforge.net/foray/?rev=7881&view=rev
Author: victormote
Date: 2006-09-04 09:57:28 -0700 (Mon, 04 Sep 2006)
Log Message:
-----------
1. Move some common code to SubSequenceSpecifier.
2. Add some descendant validation of the SubSequenceSpecifier sub-classes.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMAlternatives.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMReference.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SubSequenceSpecifier.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-09-04 16:35:31 UTC (rev 7880)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2006-09-04 16:57:28 UTC (rev 7881)
@@ -190,6 +190,19 @@
return true;
}
+ public void validateEmptyContent() throws FOTreeException {
+ if (this.getChildCount() > 0) {
+ throwException(this.getFullName() + " has NO content.");
+ }
+ }
+
+ public void validateAtLeastOneChild() throws FOTreeException {
+ if (this.getChildCount() > 1) {
+ throwException(this.getFullName() + " must have at least one "
+ + "child.");
+ }
+ }
+
/**
* {@inheritDoc}
*/
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMAlternatives.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMAlternatives.java 2006-09-04 16:35:31 UTC (rev 7880)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMAlternatives.java 2006-09-04 16:57:28 UTC (rev 7881)
@@ -51,16 +51,6 @@
/**
* {@inheritDoc}
*/
- protected void validateAncestry() throws FOTreeException {
- if (! (this.getParent() instanceof PageSequenceMaster)) {
- throwException(getFullName() + " must be child of "
- + "fo:page-sequence-master.");
- }
- }
-
- /**
- * {@inheritDoc}
- */
protected void validateProperties() throws FOTreeException {
return;
}
@@ -68,22 +58,17 @@
/**
* {@inheritDoc}
*/
- protected void setup() throws FOTreeException {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
- protected void end() throws FOTreeException {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
protected void validateDescendants() throws FOTreeException {
- return;
+ validateAtLeastOneChild();
+ /* All children must be conditional-page-master-reference. */
+ for (int i = 0; i < this.getChildCount(); i++) {
+ final Object child = this.getChildAt(i);
+ if (! (child instanceof ConditionalPageMasterReference)) {
+ final FObj fobj = (FObj) child;
+ fobj.throwException(this.getFullName() + " children must be "
+ + "conditional-page-master-reference");
+ }
+ }
}
public String getName() {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMReference.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMReference.java 2006-09-04 16:35:31 UTC (rev 7880)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RepeatablePMReference.java 2006-09-04 16:57:28 UTC (rev 7881)
@@ -51,16 +51,6 @@
/**
* {@inheritDoc}
*/
- protected void validateAncestry() throws FOTreeException {
- if (! (this.getParent() instanceof PageSequenceMaster)) {
- throwException(getFullName() + " must be child of "
- + "fo:page-sequence-master.");
- }
- }
-
- /**
- * {@inheritDoc}
- */
protected void validateProperties() throws FOTreeException {
final String masterReference = traitMasterReference();
if (masterReference == null
@@ -73,22 +63,8 @@
/**
* {@inheritDoc}
*/
- public void setup() {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
- protected void end() throws FOTreeException {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
protected void validateDescendants() throws FOTreeException {
- return;
+ validateEmptyContent();
}
public String getName() {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java 2006-09-04 16:35:31 UTC (rev 7880)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java 2006-09-04 16:57:28 UTC (rev 7881)
@@ -50,16 +50,6 @@
/**
* {@inheritDoc}
*/
- protected void validateAncestry() throws FOTreeException {
- if (! (this.getParent() instanceof PageSequenceMaster)) {
- throwException(getFullName() + " must be child of "
- + "fo:page-sequence-master.");
- }
- }
-
- /**
- * {@inheritDoc}
- */
protected void validateProperties() throws FOTreeException {
final String masterReference = traitMasterReference();
if (masterReference.equals("")) {
@@ -71,22 +61,8 @@
/**
* {@inheritDoc}
*/
- public void setup() {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
- protected void end() throws FOTreeException {
- return;
- }
-
- /**
- * {@inheritDoc}
- */
protected void validateDescendants() throws FOTreeException {
- return;
+ validateEmptyContent();
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SubSequenceSpecifier.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SubSequenceSpecifier.java 2006-09-04 16:35:31 UTC (rev 7880)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SubSequenceSpecifier.java 2006-09-04 16:57:28 UTC (rev 7881)
@@ -27,11 +27,14 @@
import org.foray.fotree.FObj;
import org.foray.fotree.PropertyList;
+import org.axsl.foR.FOTreeException;
+
import java.util.Set;
/**
* Abstract superclass for the formatting objects that can be used to specify a
* sub-sequence of pages to be used in a page-sequence-master.
+ * @see "XSL-FO Standard 1.0, Section 6.4.7"
*/
public abstract class SubSequenceSpecifier extends FObj {
@@ -42,6 +45,30 @@
}
/**
+ * {@inheritDoc}
+ */
+ protected void validateAncestry() throws FOTreeException {
+ if (! (this.getParent() instanceof PageSequenceMaster)) {
+ throwException(getFullName() + " must be child of "
+ + "fo:page-sequence-master.");
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setup() {
+ return;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void end() throws FOTreeException {
+ return;
+ }
+
+ /**
* Returns the page-master instances that are included in this template.
* @return The page-master instances that can be generated from this
* template.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|