Revision: 7582
Author: victormote
Date: 2006-06-14 08:51:03 -0700 (Wed, 14 Jun 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=7582&view=rev
Log Message:
-----------
Add method recasting parent instead of using instance variable.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java
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 2006-06-14 15:36:45 UTC (rev 7581)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageSequenceMaster.java 2006-06-14 15:51:03 UTC (rev 7582)
@@ -40,7 +40,6 @@
*/
public class PageSequenceMaster extends FObj {
- private LayoutMasterSet layoutMasterSet;
private ArrayList subSequenceSpecifiers;
private SubSequenceSpecifier currentSubSequence;
private int currentSubSequenceNumber;
@@ -54,7 +53,7 @@
public PageSequenceMaster(FObj parent, PropertyList propertyList,
String systemId, int line, int column) throws FOTreeException {
super(parent, propertyList, systemId, line, column);
-
+ /* Validate ancestry. */
if (! (parent instanceof LayoutMasterSet)) {
throwException(getFullName() + " must be child "
+ "of fo:layout-master-set.");
@@ -65,18 +64,24 @@
}
public void start() throws FOTreeException {
- /* TODO: Handle context better. */
- FOContext context = null;
- this.layoutMasterSet = (LayoutMasterSet) getParent();
- if (this.traitMasterName(context) == null) {
+ String masterName = this.traitMasterName(null);
+ if (masterName == null) {
logWarning(getFullName() + " has no page-master-name, and will be "
+ "ignored.");
} else {
- this.layoutMasterSet.addPageSequenceMaster(traitMasterName(context),
- this);
+ this.layoutMasterSet().addPageSequenceMaster(masterName, this);
}
}
+ /**
+ * The parent.
+ * @return The parent, properly cast.
+ */
+ public LayoutMasterSet layoutMasterSet() {
+ /* Cast verified at construction. */
+ return (LayoutMasterSet) this.parentFO();
+ }
+
protected void addSubsequenceSpecifier(
SubSequenceSpecifier pageMasterReference) {
subSequenceSpecifiers.add(pageMasterReference);
@@ -138,7 +143,7 @@
pageMasterName = currentSubSequence
.getNextPageMasterName(context, oddPage, firstPage, blankPage);
}
- SimplePageMaster pageMaster=this.layoutMasterSet
+ SimplePageMaster pageMaster=this.layoutMasterSet()
.getSimplePageMaster(pageMasterName);
if (pageMaster==null) {
throwException("No simple-page-master matching '"
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-06-14 15:36:45 UTC (rev 7581)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/SinglePageMasterReference.java 2006-06-14 15:51:03 UTC (rev 7582)
@@ -60,12 +60,19 @@
this.logWarning(getFullName() + " has no master-reference, and "
+ "will be ignored.");
} else {
- /* Cast verified at construction. */
- PageSequenceMaster psm = (PageSequenceMaster) this.parentFO();
- psm.addSubsequenceSpecifier(this);
+ pageSequenceMaster().addSubsequenceSpecifier(this);
}
}
+ /**
+ * The parent.
+ * @return The parent, properly cast.
+ */
+ public PageSequenceMaster pageSequenceMaster() {
+ /* Cast verified at construction. */
+ return (PageSequenceMaster) this.parentFO();
+ }
+
public String getName() {
return "single-page-master-reference";
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|