source: trunk/docx4j/src/main/java/org/docx4j/wml/Hdr.java @ 1504

Revision 1504, 9.9 KB checked in by jharrop, 12 months ago (diff)

Implement ContentAccessor?

Line 
1/*
2 *  Copyright 2007-2008, Plutext Pty Ltd.
3 *   
4 *  This file is part of docx4j.
5
6    docx4j is licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8
9    You may obtain a copy of the License at
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18
19 */
20
21
22package org.docx4j.wml;
23
24import java.util.ArrayList;
25import java.util.List;
26import javax.xml.bind.JAXBElement;
27import javax.xml.bind.Unmarshaller;
28import javax.xml.bind.annotation.XmlAccessType;
29import javax.xml.bind.annotation.XmlAccessorType;
30import javax.xml.bind.annotation.XmlElementRef;
31import javax.xml.bind.annotation.XmlElementRefs;
32import javax.xml.bind.annotation.XmlRootElement;
33import javax.xml.bind.annotation.XmlTransient;
34import javax.xml.bind.annotation.XmlType;
35import org.docx4j.math.CTOMath;
36import org.docx4j.math.CTOMathPara;
37import org.jvnet.jaxb2_commons.ppp.Child;
38
39
40/**
41 * Header
42 *
43 * <p>Java class for anonymous complex type.
44 *
45 * <p>The following schema fragment specifies the expected content contained within this class.
46 *
47 * <pre>
48 * &lt;complexType>
49 *   &lt;complexContent>
50 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
51 *       &lt;group ref="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}EG_BlockLevelElts" maxOccurs="unbounded"/>
52 *     &lt;/restriction>
53 *   &lt;/complexContent>
54 * &lt;/complexType>
55 * </pre>
56 *
57 *
58 */
59@XmlAccessorType(XmlAccessType.FIELD)
60@XmlType(name = "", propOrder = {
61    "egBlockLevelElts"
62})
63@XmlRootElement(name = "hdr")
64public class Hdr
65    implements Child, ContentAccessor
66{
67
68    @XmlElementRefs({
69        @XmlElementRef(name = "customXmlInsRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
70        @XmlElementRef(name = "moveFromRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
71        @XmlElementRef(name = "customXmlMoveFromRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
72        @XmlElementRef(name = "customXmlInsRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
73        @XmlElementRef(name = "commentRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = CommentRangeStart.class),
74        @XmlElementRef(name = "altChunk", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
75        @XmlElementRef(name = "tbl", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
76        @XmlElementRef(name = "ins", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = RunIns.class),
77        @XmlElementRef(name = "bookmarkEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
78        @XmlElementRef(name = "p", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = P.class),
79        @XmlElementRef(name = "oMath", namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", type = JAXBElement.class),
80        @XmlElementRef(name = "customXml", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
81        @XmlElementRef(name = "customXmlMoveFromRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
82        @XmlElementRef(name = "permStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
83        @XmlElementRef(name = "sdt", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = SdtBlock.class),
84        @XmlElementRef(name = "permEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
85        @XmlElementRef(name = "moveFrom", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
86        @XmlElementRef(name = "bookmarkStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
87        @XmlElementRef(name = "moveFromRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
88        @XmlElementRef(name = "commentRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = CommentRangeEnd.class),
89        @XmlElementRef(name = "customXmlDelRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
90        @XmlElementRef(name = "proofErr", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = ProofErr.class),
91        @XmlElementRef(name = "del", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = RunDel.class),
92        @XmlElementRef(name = "moveToRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
93        @XmlElementRef(name = "customXmlDelRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
94        @XmlElementRef(name = "customXmlMoveToRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
95        @XmlElementRef(name = "oMathPara", namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", type = JAXBElement.class),
96        @XmlElementRef(name = "moveToRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
97        @XmlElementRef(name = "moveTo", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
98        @XmlElementRef(name = "customXmlMoveToRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class)
99    })
100    protected List<Object> egBlockLevelElts;
101   
102       
103    @XmlTransient
104    private Object parent;
105
106    /**
107     * Gets the value of the egBlockLevelElts property.
108     *
109     * <p>
110     * This accessor method returns a reference to the live list,
111     * not a snapshot. Therefore any modification you make to the
112     * returned list will be present inside the JAXB object.
113     * This is why there is not a <CODE>set</CODE> method for the egBlockLevelElts property.
114     *
115     * <p>
116     * For example, to add a new item, do as follows:
117     * <pre>
118     *    getEGBlockLevelElts().add(newItem);
119     * </pre>
120     *
121     *
122     * <p>
123     * Objects of the following type(s) are allowed in the list
124     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
125     * {@link JAXBElement }{@code <}{@link CTMoveBookmark }{@code >}
126     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
127     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
128     * {@link CommentRangeStart }
129     * {@link JAXBElement }{@code <}{@link CTAltChunk }{@code >}
130     * {@link JAXBElement }{@code <}{@link Tbl }{@code >}
131     * {@link RunIns }
132     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
133     * {@link P }
134     * {@link JAXBElement }{@code <}{@link CTOMath }{@code >}
135     * {@link JAXBElement }{@code <}{@link CTCustomXmlBlock }{@code >}
136     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
137     * {@link JAXBElement }{@code <}{@link RangePermissionStart }{@code >}
138     * {@link SdtBlock }
139     * {@link JAXBElement }{@code <}{@link CTPerm }{@code >}
140     * {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
141     * {@link JAXBElement }{@code <}{@link CTBookmark }{@code >}
142     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
143     * {@link CommentRangeEnd }
144     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
145     * {@link ProofErr }
146     * {@link RunDel }
147     * {@link JAXBElement }{@code <}{@link CTMoveBookmark }{@code >}
148     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
149     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
150     * {@link JAXBElement }{@code <}{@link CTOMathPara }{@code >}
151     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
152     * {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
153     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
154     *
155     *
156     */
157    @Deprecated   
158    public List<Object> getEGBlockLevelElts() {
159        if (egBlockLevelElts == null) {
160            egBlockLevelElts = new ArrayList<Object>();
161        }
162        return this.egBlockLevelElts;
163    }
164
165    /**
166     * Get the content of this element.
167     * @since 2.7
168     */
169    public List<Object> getContent() {
170        if (egBlockLevelElts == null) {
171            egBlockLevelElts = new ArrayList<Object>();
172        }
173        return this.egBlockLevelElts;
174    }
175   
176    /**
177     * Gets the parent object in the object tree representing the unmarshalled xml document.
178     *
179     * @return
180     *     The parent object.
181     */
182    public Object getParent() {
183        return this.parent;
184    }
185
186    public void setParent(Object parent) {
187        this.parent = parent;
188    }
189
190    /**
191     * This method is invoked by the JAXB implementation on each instance when unmarshalling completes.
192     *
193     * @param parent
194     *     The parent object in the object tree.
195     * @param unmarshaller
196     *     The unmarshaller that generated the instance.
197     */
198    public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
199        setParent(parent);
200    }
201
202}
Note: See TracBrowser for help on using the repository browser.