source: trunk/docx4j/src/main/java/org/docx4j/wml/Tc.java @ 1473

Revision 1473, 10.5 KB checked in by jharrop, 13 months ago (diff)

Implement ContentAccessor? interface

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 * <p>Java class for CT_Tc complex type.
42 *
43 * <p>The following schema fragment specifies the expected content contained within this class.
44 *
45 * <pre>
46 * &lt;complexType name="CT_Tc">
47 *   &lt;complexContent>
48 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
49 *       &lt;sequence>
50 *         &lt;element name="tcPr" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_TcPr" minOccurs="0"/>
51 *         &lt;group ref="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}EG_BlockLevelElts" maxOccurs="unbounded"/>
52 *       &lt;/sequence>
53 *     &lt;/restriction>
54 *   &lt;/complexContent>
55 * &lt;/complexType>
56 * </pre>
57 *
58 *
59 */
60@XmlAccessorType(XmlAccessType.FIELD)
61@XmlType(name = "CT_Tc", propOrder = {
62    "tcPr",
63    "egBlockLevelElts"
64})
65@XmlRootElement(name = "tc")
66public class Tc
67    implements Child, ContentAccessor
68{
69
70    protected TcPr tcPr;
71    @XmlElementRefs({
72        @XmlElementRef(name = "moveToRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
73        @XmlElementRef(name = "customXmlMoveFromRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
74        @XmlElementRef(name = "customXml", 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 = "customXmlDelRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
77        @XmlElementRef(name = "bookmarkStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
78        @XmlElementRef(name = "commentRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = CommentRangeStart.class),
79        @XmlElementRef(name = "altChunk", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
80        @XmlElementRef(name = "ins", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = RunIns.class),
81        @XmlElementRef(name = "permEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
82        @XmlElementRef(name = "customXmlMoveToRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
83        @XmlElementRef(name = "p", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = P.class),
84        @XmlElementRef(name = "oMath", namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", type = JAXBElement.class),
85        @XmlElementRef(name = "moveFromRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
86        @XmlElementRef(name = "customXmlMoveToRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
87        @XmlElementRef(name = "sdt", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = SdtBlock.class),
88        @XmlElementRef(name = "moveToRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
89        @XmlElementRef(name = "customXmlMoveFromRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
90        @XmlElementRef(name = "commentRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = CommentRangeEnd.class),
91        @XmlElementRef(name = "customXmlInsRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
92        @XmlElementRef(name = "permStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
93        @XmlElementRef(name = "moveFromRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
94        @XmlElementRef(name = "proofErr", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = ProofErr.class),
95        @XmlElementRef(name = "del", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = RunDel.class),
96        @XmlElementRef(name = "oMathPara", namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", type = JAXBElement.class),
97        @XmlElementRef(name = "bookmarkEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
98        @XmlElementRef(name = "customXmlInsRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
99        @XmlElementRef(name = "customXmlDelRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
100        @XmlElementRef(name = "moveFrom", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
101        @XmlElementRef(name = "moveTo", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class)
102    })
103    protected List<Object> egBlockLevelElts;
104    @XmlTransient
105    private Object parent;
106
107    /**
108     * Gets the value of the tcPr property.
109     *
110     * @return
111     *     possible object is
112     *     {@link TcPr }
113     *     
114     */
115    public TcPr getTcPr() {
116        return tcPr;
117    }
118
119    /**
120     * Sets the value of the tcPr property.
121     *
122     * @param value
123     *     allowed object is
124     *     {@link TcPr }
125     *     
126     */
127    public void setTcPr(TcPr value) {
128        this.tcPr = value;
129    }
130
131    /**
132     * Gets the value of the egBlockLevelElts property.
133     *
134     * <p>
135     * This accessor method returns a reference to the live list,
136     * not a snapshot. Therefore any modification you make to the
137     * returned list will be present inside the JAXB object.
138     * This is why there is not a <CODE>set</CODE> method for the egBlockLevelElts property.
139     *
140     * <p>
141     * For example, to add a new item, do as follows:
142     * <pre>
143     *    getEGBlockLevelElts().add(newItem);
144     * </pre>
145     *
146     *
147     * <p>
148     * Objects of the following type(s) are allowed in the list
149     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
150     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
151     * {@link JAXBElement }{@code <}{@link CTCustomXmlBlock }{@code >}
152     * {@link JAXBElement }{@code <}{@link Tbl }{@code >}
153     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
154     * {@link JAXBElement }{@code <}{@link CTBookmark }{@code >}
155     * {@link CommentRangeStart }
156     * {@link JAXBElement }{@code <}{@link CTAltChunk }{@code >}
157     * {@link RunIns }
158     * {@link JAXBElement }{@code <}{@link CTPerm }{@code >}
159     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
160     * {@link P }
161     * {@link JAXBElement }{@code <}{@link CTOMath }{@code >}
162     * {@link JAXBElement }{@code <}{@link CTMoveBookmark }{@code >}
163     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
164     * {@link SdtBlock }
165     * {@link JAXBElement }{@code <}{@link CTMoveBookmark }{@code >}
166     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
167     * {@link CommentRangeEnd }
168     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
169     * {@link JAXBElement }{@code <}{@link RangePermissionStart }{@code >}
170     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
171     * {@link ProofErr }
172     * {@link RunDel }
173     * {@link JAXBElement }{@code <}{@link CTOMathPara }{@code >}
174     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
175     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
176     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
177     * {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
178     * {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
179     *
180     *
181     */
182    @Deprecated
183    public List<Object> getEGBlockLevelElts() {
184        if (egBlockLevelElts == null) {
185            egBlockLevelElts = new ArrayList<Object>();
186        }
187        return this.egBlockLevelElts;
188    }
189
190    /**
191     * Get the content of this element.
192     * @since 2.7
193     */   
194    public List<Object> getContent() {
195        if (egBlockLevelElts == null) {
196            egBlockLevelElts = new ArrayList<Object>();
197        }
198        return this.egBlockLevelElts;
199    }
200   
201    /**
202     * Gets the parent object in the object tree representing the unmarshalled xml document.
203     *
204     * @return
205     *     The parent object.
206     */
207    public Object getParent() {
208        return this.parent;
209    }
210
211    public void setParent(Object parent) {
212        this.parent = parent;
213    }
214
215    /**
216     * This method is invoked by the JAXB implementation on each instance when unmarshalling completes.
217     *
218     * @param parent
219     *     The parent object in the object tree.
220     * @param unmarshaller
221     *     The unmarshaller that generated the instance.
222     */
223    public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
224        setParent(parent);
225    }
226
227}
Note: See TracBrowser for help on using the repository browser.