Link Here
|
127 |
protected void validateChildNode(Locator loc, String nsURI, String localName) |
127 |
protected void validateChildNode(Locator loc, String nsURI, String localName) |
128 |
throws ValidationException { |
128 |
throws ValidationException { |
129 |
if (FO_URI.equals(nsURI)) { |
129 |
if (FO_URI.equals(nsURI)) { |
130 |
if (localName.equals("title")) { |
130 |
if ("title".equals(localName)) { |
131 |
if (titleFO != null) { |
131 |
if (titleFO != null) { |
132 |
tooManyNodesError(loc, "fo:title"); |
132 |
tooManyNodesError(loc, "fo:title"); |
133 |
} else if (flowMap.size() > 0) { |
133 |
} else if (!flowMap.isEmpty()) { |
134 |
nodesOutOfOrderError(loc, "fo:title", "fo:static-content"); |
134 |
nodesOutOfOrderError(loc, "fo:title", "fo:static-content"); |
135 |
} else if (mainFlow != null) { |
135 |
} else if (mainFlow != null) { |
136 |
nodesOutOfOrderError(loc, "fo:title", "fo:flow"); |
136 |
nodesOutOfOrderError(loc, "fo:title", "fo:flow"); |
137 |
} |
137 |
} |
138 |
} else if (localName.equals("static-content")) { |
138 |
} else if ("static-content".equals(localName)) { |
139 |
if (mainFlow != null) { |
139 |
if (mainFlow != null) { |
140 |
nodesOutOfOrderError(loc, "fo:static-content", "fo:flow"); |
140 |
nodesOutOfOrderError(loc, "fo:static-content", "fo:flow"); |
141 |
} |
141 |
} |
142 |
} else if (localName.equals("flow")) { |
142 |
} else if ("flow".equals(localName)) { |
143 |
if (mainFlow != null) { |
143 |
if (mainFlow != null) { |
144 |
tooManyNodesError(loc, "fo:flow"); |
144 |
tooManyNodesError(loc, "fo:flow"); |
145 |
} |
145 |
} |
Link Here
|
157 |
public void addChildNode(FONode child) throws FOPException { |
157 |
public void addChildNode(FONode child) throws FOPException { |
158 |
int childId = child.getNameId(); |
158 |
int childId = child.getNameId(); |
159 |
|
159 |
|
160 |
if (childId == FO_TITLE) { |
160 |
switch (childId) { |
161 |
this.titleFO = (Title) child; |
161 |
case FO_TITLE: |
162 |
} else if (childId == FO_FLOW) { |
162 |
this.titleFO = (Title)child; |
163 |
this.mainFlow = (Flow) child; |
163 |
break; |
164 |
addFlow(mainFlow); |
164 |
case FO_FLOW: |
165 |
} else if (childId == FO_STATIC_CONTENT) { |
165 |
this.mainFlow = (Flow)child; |
166 |
addFlow((StaticContent) child); |
166 |
addFlow(mainFlow); |
167 |
String flowName = ((StaticContent) child).getFlowName(); |
167 |
break; |
168 |
flowMap.put(flowName, child); |
168 |
case FO_STATIC_CONTENT: |
|
|
169 |
addFlow((StaticContent)child); |
170 |
flowMap.put(((StaticContent)child).getFlowName(), child); |
171 |
break; |
172 |
default: |
173 |
assert false; |
169 |
} |
174 |
} |
170 |
} |
175 |
} |
171 |
|
176 |
|
Link Here
|
245 |
* page sequence |
250 |
* page sequence |
246 |
* @param isLastPage indicator whether this page is the last page of the |
251 |
* @param isLastPage indicator whether this page is the last page of the |
247 |
* page sequence |
252 |
* page sequence |
248 |
* @param isOnlyPage indicator whether this page is the only page of the |
|
|
249 |
* page sequence |
250 |
* @param isBlank indicator whether the page will be blank |
253 |
* @param isBlank indicator whether the page will be blank |
251 |
* @return the SimplePageMaster to use for this page |
254 |
* @return the SimplePageMaster to use for this page |
252 |
* @throws PageProductionException if there's a problem determining the page master |
255 |
* @throws PageProductionException if there's a problem determining the page master |
253 |
*/ |
256 |
*/ |
254 |
public SimplePageMaster getNextSimplePageMaster(int page, |
257 |
public SimplePageMaster getNextSimplePageMaster(int page, |
255 |
boolean isFirstPage, |
258 |
boolean isFirstPage, |
256 |
boolean isLastPage, |
259 |
boolean isLastPage, |
257 |
boolean isOnlyPage, |
260 |
boolean isBlank) throws PageProductionException { |
258 |
boolean isBlank) throws PageProductionException { |
|
|
259 |
|
261 |
|
260 |
if (pageSequenceMaster == null) { |
262 |
if (pageSequenceMaster == null) { |
261 |
return simplePageMaster; |
263 |
return simplePageMaster; |
Link Here
|
266 |
+ " isOdd=" + isOddPage |
268 |
+ " isOdd=" + isOddPage |
267 |
+ " isFirst=" + isFirstPage |
269 |
+ " isFirst=" + isFirstPage |
268 |
+ " isLast=" + isLastPage |
270 |
+ " isLast=" + isLastPage |
269 |
+ " isOnly=" + isOnlyPage |
|
|
270 |
+ " isBlank=" + isBlank + ")"); |
271 |
+ " isBlank=" + isBlank + ")"); |
271 |
} |
272 |
} |
272 |
return pageSequenceMaster.getNextSimplePageMaster(isOddPage, |
273 |
return pageSequenceMaster.getNextSimplePageMaster(isOddPage, |
273 |
isFirstPage, isLastPage, isOnlyPage, isBlank); |
274 |
isFirstPage, isLastPage, isBlank); |
274 |
} |
275 |
} |
275 |
|
276 |
|
276 |
/** |
277 |
/** |
Link Here
|
278 |
* @return true if there is a previous item, false if the current one was the first one. |
279 |
* @return true if there is a previous item, false if the current one was the first one. |
279 |
*/ |
280 |
*/ |
280 |
public boolean goToPreviousSimplePageMaster() { |
281 |
public boolean goToPreviousSimplePageMaster() { |
281 |
if (pageSequenceMaster == null) { |
282 |
return pageSequenceMaster == null || pageSequenceMaster.goToPreviousSimplePageMaster(); |
282 |
return true; |
|
|
283 |
} else { |
284 |
return pageSequenceMaster.goToPreviousSimplePageMaster(); |
285 |
} |
286 |
} |
283 |
} |
287 |
|
284 |
|
288 |
/** @return true if the page-sequence has a page-master with page-position="last" */ |
285 |
/** @return true if the page-sequence has a page-master with page-position="last" */ |
289 |
public boolean hasPagePositionLast() { |
286 |
public boolean hasPagePositionLast() { |
290 |
if (pageSequenceMaster == null) { |
287 |
return pageSequenceMaster != null && pageSequenceMaster.hasPagePositionLast(); |
291 |
return false; |
|
|
292 |
} else { |
293 |
return pageSequenceMaster.hasPagePositionLast(); |
294 |
} |
295 |
} |
288 |
} |
296 |
|
289 |
|
297 |
/** @return true if the page-sequence has a page-master with page-position="only" */ |
290 |
/** @return true if the page-sequence has a page-master with page-position="only" */ |
298 |
public boolean hasPagePositionOnly() { |
291 |
public boolean hasPagePositionOnly() { |
299 |
if (pageSequenceMaster == null) { |
292 |
return pageSequenceMaster != null && pageSequenceMaster.hasPagePositionOnly(); |
300 |
return false; |
|
|
301 |
} else { |
302 |
return pageSequenceMaster.hasPagePositionOnly(); |
303 |
} |
304 |
} |
293 |
} |
305 |
|
294 |
|
306 |
/** |
295 |
/** |