| 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 | |
|---|
| 22 | package org.docx4j.wml; |
|---|
| 23 | |
|---|
| 24 | import java.util.ArrayList; |
|---|
| 25 | import java.util.List; |
|---|
| 26 | import javax.xml.bind.Unmarshaller; |
|---|
| 27 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 28 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 29 | import javax.xml.bind.annotation.XmlAttribute; |
|---|
| 30 | import javax.xml.bind.annotation.XmlTransient; |
|---|
| 31 | import javax.xml.bind.annotation.XmlType; |
|---|
| 32 | import org.jvnet.jaxb2_commons.ppp.Child; |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | /** |
|---|
| 36 | * <p>Java class for CT_DocPartTypes complex type. |
|---|
| 37 | * |
|---|
| 38 | * <p>The following schema fragment specifies the expected content contained within this class. |
|---|
| 39 | * |
|---|
| 40 | * <pre> |
|---|
| 41 | * <complexType name="CT_DocPartTypes"> |
|---|
| 42 | * <complexContent> |
|---|
| 43 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> |
|---|
| 44 | * <choice> |
|---|
| 45 | * <element name="type" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_DocPartType" maxOccurs="unbounded"/> |
|---|
| 46 | * </choice> |
|---|
| 47 | * <attribute name="all" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" /> |
|---|
| 48 | * </restriction> |
|---|
| 49 | * </complexContent> |
|---|
| 50 | * </complexType> |
|---|
| 51 | * </pre> |
|---|
| 52 | * |
|---|
| 53 | * |
|---|
| 54 | */ |
|---|
| 55 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 56 | @XmlType(name = "CT_DocPartTypes", propOrder = { |
|---|
| 57 | "type" |
|---|
| 58 | }) |
|---|
| 59 | public class CTDocPartTypes implements Child |
|---|
| 60 | { |
|---|
| 61 | |
|---|
| 62 | protected List<CTDocPartType> type; |
|---|
| 63 | @XmlAttribute(namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main") |
|---|
| 64 | protected Boolean all; |
|---|
| 65 | @XmlTransient |
|---|
| 66 | private Object parent; |
|---|
| 67 | |
|---|
| 68 | /** |
|---|
| 69 | * Gets the value of the type property. |
|---|
| 70 | * |
|---|
| 71 | * <p> |
|---|
| 72 | * This accessor method returns a reference to the live list, |
|---|
| 73 | * not a snapshot. Therefore any modification you make to the |
|---|
| 74 | * returned list will be present inside the JAXB object. |
|---|
| 75 | * This is why there is not a <CODE>set</CODE> method for the type property. |
|---|
| 76 | * |
|---|
| 77 | * <p> |
|---|
| 78 | * For example, to add a new item, do as follows: |
|---|
| 79 | * <pre> |
|---|
| 80 | * getType().add(newItem); |
|---|
| 81 | * </pre> |
|---|
| 82 | * |
|---|
| 83 | * |
|---|
| 84 | * <p> |
|---|
| 85 | * Objects of the following type(s) are allowed in the list |
|---|
| 86 | * {@link CTDocPartType } |
|---|
| 87 | * |
|---|
| 88 | * |
|---|
| 89 | */ |
|---|
| 90 | public List<CTDocPartType> getType() { |
|---|
| 91 | if (type == null) { |
|---|
| 92 | type = new ArrayList<CTDocPartType>(); |
|---|
| 93 | } |
|---|
| 94 | return this.type; |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | /** |
|---|
| 98 | * Gets the value of the all property. |
|---|
| 99 | * |
|---|
| 100 | * @return |
|---|
| 101 | * possible object is |
|---|
| 102 | * {@link Boolean } |
|---|
| 103 | * |
|---|
| 104 | */ |
|---|
| 105 | public boolean isAll() { |
|---|
| 106 | if (all == null) { |
|---|
| 107 | return true; |
|---|
| 108 | } else { |
|---|
| 109 | return all; |
|---|
| 110 | } |
|---|
| 111 | } |
|---|
| 112 | |
|---|
| 113 | /** |
|---|
| 114 | * Sets the value of the all property. |
|---|
| 115 | * |
|---|
| 116 | * @param value |
|---|
| 117 | * allowed object is |
|---|
| 118 | * {@link Boolean } |
|---|
| 119 | * |
|---|
| 120 | */ |
|---|
| 121 | public void setAll(Boolean value) { |
|---|
| 122 | this.all = value; |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | /** |
|---|
| 126 | * Gets the parent object in the object tree representing the unmarshalled xml document. |
|---|
| 127 | * |
|---|
| 128 | * @return |
|---|
| 129 | * The parent object. |
|---|
| 130 | */ |
|---|
| 131 | public Object getParent() { |
|---|
| 132 | return this.parent; |
|---|
| 133 | } |
|---|
| 134 | |
|---|
| 135 | public void setParent(Object parent) { |
|---|
| 136 | this.parent = parent; |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | /** |
|---|
| 140 | * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. |
|---|
| 141 | * |
|---|
| 142 | * @param parent |
|---|
| 143 | * The parent object in the object tree. |
|---|
| 144 | * @param unmarshaller |
|---|
| 145 | * The unmarshaller that generated the instance. |
|---|
| 146 | */ |
|---|
| 147 | public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { |
|---|
| 148 | setParent(parent); |
|---|
| 149 | } |
|---|
| 150 | |
|---|
| 151 | } |
|---|