01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /* $Id: StaticContent.java 554104 2007-07-07 01:07:10Z adelmelle $ */
19:
20: package org.apache.fop.fo.pagination;
21:
22: // XML
23: import org.xml.sax.Locator;
24:
25: import org.apache.fop.apps.FOPException;
26: import org.apache.fop.fo.FONode;
27: import org.apache.fop.fo.ValidationException;
28:
29: /**
30: * Class modelling the fo:static-content object.
31: */
32: public class StaticContent extends Flow {
33:
34: /**
35: * @param parent FONode that is the parent of this object
36: */
37: public StaticContent(FONode parent) {
38: super (parent);
39: }
40:
41: /**
42: * @see org.apache.fop.fo.FONode#startOfNode()
43: */
44: protected void startOfNode() throws FOPException {
45: if (getFlowName() == null || getFlowName().equals("")) {
46: throw new ValidationException(
47: "A 'flow-name' is required for " + getName() + ".",
48: locator);
49: }
50: getFOEventHandler().startFlow(this );
51: }
52:
53: /**
54: * Make sure content model satisfied, if so then tell the
55: * FOEventHandler that we are at the end of the flow.
56: * @see org.apache.fop.fo.FONode#endOfNode
57: */
58: protected void endOfNode() throws FOPException {
59: if (firstChild == null && getUserAgent().validateStrictly()) {
60: missingChildElementError("(%block;)+");
61: }
62: getFOEventHandler().endFlow(this );
63: }
64:
65: /**
66: * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
67: * XSL Content Model: (%block;)+
68: */
69: protected void validateChildNode(Locator loc, String nsURI,
70: String localName) throws ValidationException {
71: if (!isBlockItem(nsURI, localName)) {
72: invalidChildError(loc, nsURI, localName);
73: }
74: }
75:
76: /** @see org.apache.fop.fo.FObj#getLocalName() */
77: public String getLocalName() {
78: return "static-content";
79: }
80:
81: /** @see org.apache.fop.fo.FObj#getNameId() */
82: public int getNameId() {
83: return FO_STATIC_CONTENT;
84: }
85: }
|