TextTocMarkElement.java

  1. /**
  2.  * **********************************************************************
  3.  *
  4.  * <p>DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
  5.  *
  6.  * <p>Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved.
  7.  *
  8.  * <p>Use is subject to license terms.
  9.  *
  10.  * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
  11.  * except in compliance with the License. You may obtain a copy of the License at
  12.  * http://www.apache.org/licenses/LICENSE-2.0. You can also obtain a copy of the License at
  13.  * http://odftoolkit.org/docs/license.txt
  14.  *
  15.  * <p>Unless required by applicable law or agreed to in writing, software distributed under the
  16.  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  17.  * express or implied.
  18.  *
  19.  * <p>See the License for the specific language governing permissions and limitations under the
  20.  * License.
  21.  *
  22.  * <p>**********************************************************************
  23.  */

  24. /*
  25.  * This file is automatically generated.
  26.  * Don't edit manually.
  27.  */
  28. package org.odftoolkit.odfdom.dom.element.text;

  29. import org.odftoolkit.odfdom.dom.DefaultElementVisitor;
  30. import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
  31. import org.odftoolkit.odfdom.dom.attribute.text.TextOutlineLevelAttribute;
  32. import org.odftoolkit.odfdom.dom.attribute.text.TextStringValueAttribute;
  33. import org.odftoolkit.odfdom.pkg.ElementVisitor;
  34. import org.odftoolkit.odfdom.pkg.OdfElement;
  35. import org.odftoolkit.odfdom.pkg.OdfFileDom;
  36. import org.odftoolkit.odfdom.pkg.OdfName;

  37. /** DOM implementation of OpenDocument element {@odf.element text:toc-mark}. */
  38. public class TextTocMarkElement extends OdfElement {

  39.   public static final OdfName ELEMENT_NAME = OdfName.newName(OdfDocumentNamespace.TEXT, "toc-mark");

  40.   /**
  41.    * Create the instance of <code>TextTocMarkElement</code>
  42.    *
  43.    * @param ownerDoc The type is <code>OdfFileDom</code>
  44.    */
  45.   public TextTocMarkElement(OdfFileDom ownerDoc) {
  46.     super(ownerDoc, ELEMENT_NAME);
  47.   }

  48.   /**
  49.    * Get the element name
  50.    *
  51.    * @return return <code>OdfName</code> the name of element {@odf.element text:toc-mark}.
  52.    */
  53.   public OdfName getOdfName() {
  54.     return ELEMENT_NAME;
  55.   }

  56.   /**
  57.    * Receives the value of the ODFDOM attribute representation <code>TextOutlineLevelAttribute
  58.    * </code> , See {@odf.attribute text:outline-level}
  59.    *
  60.    * @return - the <code>Integer</code> , the value or <code>null</code>, if the attribute is not
  61.    *     set and no default value defined.
  62.    */
  63.   public Integer getTextOutlineLevelAttribute() {
  64.     TextOutlineLevelAttribute attr =
  65.         (TextOutlineLevelAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "outline-level");
  66.     if (attr != null) {
  67.       return Integer.valueOf(attr.intValue());
  68.     }
  69.     return null;
  70.   }

  71.   /**
  72.    * Sets the value of ODFDOM attribute representation <code>TextOutlineLevelAttribute</code> , See
  73.    * {@odf.attribute text:outline-level}
  74.    *
  75.    * @param textOutlineLevelValue The type is <code>Integer</code>
  76.    */
  77.   public void setTextOutlineLevelAttribute(Integer textOutlineLevelValue) {
  78.     TextOutlineLevelAttribute attr = new TextOutlineLevelAttribute((OdfFileDom) this.ownerDocument);
  79.     setOdfAttribute(attr);
  80.     attr.setIntValue(textOutlineLevelValue.intValue());
  81.   }

  82.   /**
  83.    * Receives the value of the ODFDOM attribute representation <code>TextStringValueAttribute</code>
  84.    * , See {@odf.attribute text:string-value}
  85.    *
  86.    * <p>Attribute is mandatory.
  87.    *
  88.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  89.    *     and no default value defined.
  90.    */
  91.   public String getTextStringValueAttribute() {
  92.     TextStringValueAttribute attr =
  93.         (TextStringValueAttribute) getOdfAttribute(OdfDocumentNamespace.TEXT, "string-value");
  94.     if (attr != null) {
  95.       return String.valueOf(attr.getValue());
  96.     }
  97.     return null;
  98.   }

  99.   /**
  100.    * Sets the value of ODFDOM attribute representation <code>TextStringValueAttribute</code> , See
  101.    * {@odf.attribute text:string-value}
  102.    *
  103.    * @param textStringValueValue The type is <code>String</code>
  104.    */
  105.   public void setTextStringValueAttribute(String textStringValueValue) {
  106.     TextStringValueAttribute attr = new TextStringValueAttribute((OdfFileDom) this.ownerDocument);
  107.     setOdfAttribute(attr);
  108.     attr.setValue(textStringValueValue);
  109.   }

  110.   @Override
  111.   public void accept(ElementVisitor visitor) {
  112.     if (visitor instanceof DefaultElementVisitor) {
  113.       DefaultElementVisitor defaultVisitor = (DefaultElementVisitor) visitor;
  114.       defaultVisitor.visit(this);
  115.     } else {
  116.       visitor.visit(this);
  117.     }
  118.   }
  119. }