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

Revision 1473, 10.9 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
21package org.docx4j.wml;
22
23import java.util.ArrayList;
24import java.util.List;
25import javax.xml.bind.JAXBElement;
26import javax.xml.bind.Unmarshaller;
27import javax.xml.bind.annotation.XmlAccessType;
28import javax.xml.bind.annotation.XmlAccessorType;
29import javax.xml.bind.annotation.XmlElement;
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_Tbl 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_Tbl">
47 *   &lt;complexContent>
48 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
49 *       &lt;sequence>
50 *         &lt;element name="tblPr" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_TblPr"/>
51 *         &lt;element name="tblGrid" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_TblGrid"/>
52 *         &lt;group ref="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}EG_ContentRowContent" maxOccurs="unbounded" minOccurs="0"/>
53 *       &lt;/sequence>
54 *     &lt;/restriction>
55 *   &lt;/complexContent>
56 * &lt;/complexType>
57 * </pre>
58 *
59 *
60 */
61@XmlAccessorType(XmlAccessType.FIELD)
62@XmlType(name = "CT_Tbl", propOrder = {
63    "tblPr",
64    "tblGrid",
65    "egContentRowContent"
66})
67@XmlRootElement(name = "tbl")
68public class Tbl
69    implements Child, ContentAccessor
70{
71
72    @XmlElement(required = true)
73    protected TblPr tblPr;
74    @XmlElement(required = true)
75    protected TblGrid tblGrid;
76    @XmlElementRefs({
77        @XmlElementRef(name = "customXmlMoveFromRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
78        @XmlElementRef(name = "customXmlInsRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
79        @XmlElementRef(name = "commentRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = CommentRangeStart.class),
80        @XmlElementRef(name = "bookmarkStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
81        @XmlElementRef(name = "ins", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = RunIns.class),
82        @XmlElementRef(name = "moveTo", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
83        @XmlElementRef(name = "customXmlMoveToRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
84        @XmlElementRef(name = "oMath", namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", type = JAXBElement.class),
85        @XmlElementRef(name = "permEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
86        @XmlElementRef(name = "moveToRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
87        @XmlElementRef(name = "moveFromRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
88        @XmlElementRef(name = "tr", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = Tr.class),
89        @XmlElementRef(name = "commentRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = CommentRangeEnd.class),
90        @XmlElementRef(name = "customXmlInsRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
91        @XmlElementRef(name = "customXmlMoveFromRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
92        @XmlElementRef(name = "moveFromRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
93        @XmlElementRef(name = "bookmarkEnd", 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 = "customXmlDelRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
97        @XmlElementRef(name = "moveToRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
98        @XmlElementRef(name = "oMathPara", namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", type = JAXBElement.class),
99        @XmlElementRef(name = "permStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
100        @XmlElementRef(name = "customXmlDelRangeEnd", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
101        @XmlElementRef(name = "sdt", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
102        @XmlElementRef(name = "moveFrom", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
103        @XmlElementRef(name = "customXml", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
104        @XmlElementRef(name = "customXmlMoveToRangeStart", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class)
105    })
106    protected List<Object> egContentRowContent;
107    @XmlTransient
108    private Object parent;
109
110    /**
111     * Gets the value of the tblPr property.
112     *
113     * @return
114     *     possible object is
115     *     {@link TblPr }
116     *     
117     */
118    public TblPr getTblPr() {
119        return tblPr;
120    }
121
122    /**
123     * Sets the value of the tblPr property.
124     *
125     * @param value
126     *     allowed object is
127     *     {@link TblPr }
128     *     
129     */
130    public void setTblPr(TblPr value) {
131        this.tblPr = value;
132    }
133
134    /**
135     * Gets the value of the tblGrid property.
136     *
137     * @return
138     *     possible object is
139     *     {@link TblGrid }
140     *     
141     */
142    public TblGrid getTblGrid() {
143        return tblGrid;
144    }
145
146    /**
147     * Sets the value of the tblGrid property.
148     *
149     * @param value
150     *     allowed object is
151     *     {@link TblGrid }
152     *     
153     */
154    public void setTblGrid(TblGrid value) {
155        this.tblGrid = value;
156    }
157
158    /**
159     * Gets the value of the egContentRowContent property.
160     *
161     * <p>
162     * This accessor method returns a reference to the live list,
163     * not a snapshot. Therefore any modification you make to the
164     * returned list will be present inside the JAXB object.
165     * This is why there is not a <CODE>set</CODE> method for the egContentRowContent property.
166     *
167     * <p>
168     * For example, to add a new item, do as follows:
169     * <pre>
170     *    getEGContentRowContent().add(newItem);
171     * </pre>
172     *
173     *
174     * <p>
175     * Objects of the following type(s) are allowed in the list
176     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
177     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
178     * {@link CommentRangeStart }
179     * {@link JAXBElement }{@code <}{@link CTBookmark }{@code >}
180     * {@link RunIns }
181     * {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
182     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
183     * {@link JAXBElement }{@code <}{@link CTOMath }{@code >}
184     * {@link JAXBElement }{@code <}{@link CTPerm }{@code >}
185     * {@link JAXBElement }{@code <}{@link CTMoveBookmark }{@code >}
186     * {@link JAXBElement }{@code <}{@link CTMoveBookmark }{@code >}
187     * {@link Tr }
188     * {@link CommentRangeEnd }
189     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
190     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
191     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
192     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
193     * {@link ProofErr }
194     * {@link RunDel }
195     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
196     * {@link JAXBElement }{@code <}{@link CTMarkupRange }{@code >}
197     * {@link JAXBElement }{@code <}{@link CTOMathPara }{@code >}
198     * {@link JAXBElement }{@code <}{@link RangePermissionStart }{@code >}
199     * {@link JAXBElement }{@code <}{@link RunTrackChange }{@code >}
200     * {@link JAXBElement }{@code <}{@link CTMarkup }{@code >}
201     * {@link JAXBElement }{@code <}{@link CTSdtRow }{@code >}
202     * {@link JAXBElement }{@code <}{@link CTCustomXmlRow }{@code >}
203     * {@link JAXBElement }{@code <}{@link CTTrackChange }{@code >}
204     *
205     *
206     */
207    @Deprecated
208    public List<Object> getEGContentRowContent() {
209        if (egContentRowContent == null) {
210            egContentRowContent = new ArrayList<Object>();
211        }
212        return this.egContentRowContent;
213    }
214
215    /**
216     * Get the content of this element.
217     * @since 2.7
218     */   
219    public List<Object> getContent() {
220        if (egContentRowContent == null) {
221            egContentRowContent = new ArrayList<Object>();
222        }
223        return this.egContentRowContent;
224    }
225   
226    /**
227     * Gets the parent object in the object tree representing the unmarshalled xml document.
228     *
229     * @return
230     *     The parent object.
231     */
232    public Object getParent() {
233        return this.parent;
234    }
235
236    public void setParent(Object parent) {
237        this.parent = parent;
238    }
239
240    /**
241     * This method is invoked by the JAXB implementation on each instance when unmarshalling completes.
242     *
243     * @param parent
244     *     The parent object in the object tree.
245     * @param unmarshaller
246     *     The unmarshaller that generated the instance.
247     */
248    public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
249        setParent(parent);
250    }
251
252}
Note: See TracBrowser for help on using the repository browser.