KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > fo > pagination > StaticContent


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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 426576 2006-07-28 15:44:37Z jeremias $ */
19
20 package org.apache.fop.fo.pagination;
21
22 // XML
23
import org.xml.sax.Locator JavaDoc;
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("A 'flow-name' is required for "
47                                    + getName() + ".", locator);
48         }
49         getFOEventHandler().startFlow(this);
50     }
51
52     /**
53      * Make sure content model satisfied, if so then tell the
54      * FOEventHandler that we are at the end of the flow.
55      * @see org.apache.fop.fo.FONode#endOfNode
56      */

57     protected void endOfNode() throws FOPException {
58         if (childNodes == null && getUserAgent().validateStrictly()) {
59             missingChildElementError("(%block;)+");
60         }
61         getFOEventHandler().endFlow(this);
62     }
63
64     /**
65      * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
66      * XSL Content Model: (%block;)+
67      */

68     protected void validateChildNode(Locator JavaDoc loc, String JavaDoc nsURI, String JavaDoc localName)
69         throws ValidationException {
70         if (!isBlockItem(nsURI, localName)) {
71             invalidChildError(loc, nsURI, localName);
72         }
73     }
74
75     /** @see org.apache.fop.fo.FObj#getLocalName() */
76     public String JavaDoc getLocalName() {
77         return "static-content";
78     }
79
80     /** @see org.apache.fop.fo.FObj#getNameId() */
81     public int getNameId() {
82         return FO_STATIC_CONTENT;
83     }
84 }
85
Popular Tags