NumberFractionElement.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.number;

  29. import org.odftoolkit.odfdom.dom.DefaultElementVisitor;
  30. import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
  31. import org.odftoolkit.odfdom.dom.attribute.number.NumberDenominatorValueAttribute;
  32. import org.odftoolkit.odfdom.dom.attribute.number.NumberGroupingAttribute;
  33. import org.odftoolkit.odfdom.dom.attribute.number.NumberMinDenominatorDigitsAttribute;
  34. import org.odftoolkit.odfdom.dom.attribute.number.NumberMinIntegerDigitsAttribute;
  35. import org.odftoolkit.odfdom.dom.attribute.number.NumberMinNumeratorDigitsAttribute;
  36. import org.odftoolkit.odfdom.pkg.ElementVisitor;
  37. import org.odftoolkit.odfdom.pkg.OdfElement;
  38. import org.odftoolkit.odfdom.pkg.OdfFileDom;
  39. import org.odftoolkit.odfdom.pkg.OdfName;

  40. /** DOM implementation of OpenDocument element {@odf.element number:fraction}. */
  41. public class NumberFractionElement extends OdfElement {

  42.   public static final OdfName ELEMENT_NAME =
  43.       OdfName.newName(OdfDocumentNamespace.NUMBER, "fraction");

  44.   /**
  45.    * Create the instance of <code>NumberFractionElement</code>
  46.    *
  47.    * @param ownerDoc The type is <code>OdfFileDom</code>
  48.    */
  49.   public NumberFractionElement(OdfFileDom ownerDoc) {
  50.     super(ownerDoc, ELEMENT_NAME);
  51.   }

  52.   /**
  53.    * Get the element name
  54.    *
  55.    * @return return <code>OdfName</code> the name of element {@odf.element number:fraction}.
  56.    */
  57.   public OdfName getOdfName() {
  58.     return ELEMENT_NAME;
  59.   }

  60.   /**
  61.    * Receives the value of the ODFDOM attribute representation <code>NumberDenominatorValueAttribute
  62.    * </code> , See {@odf.attribute number:denominator-value}
  63.    *
  64.    * @return - the <code>Integer</code> , the value or <code>null</code>, if the attribute is not
  65.    *     set and no default value defined.
  66.    */
  67.   public Integer getNumberDenominatorValueAttribute() {
  68.     NumberDenominatorValueAttribute attr =
  69.         (NumberDenominatorValueAttribute)
  70.             getOdfAttribute(OdfDocumentNamespace.NUMBER, "denominator-value");
  71.     if (attr != null) {
  72.       return Integer.valueOf(attr.intValue());
  73.     }
  74.     return null;
  75.   }

  76.   /**
  77.    * Sets the value of ODFDOM attribute representation <code>NumberDenominatorValueAttribute</code>
  78.    * , See {@odf.attribute number:denominator-value}
  79.    *
  80.    * @param numberDenominatorValueValue The type is <code>Integer</code>
  81.    */
  82.   public void setNumberDenominatorValueAttribute(Integer numberDenominatorValueValue) {
  83.     NumberDenominatorValueAttribute attr =
  84.         new NumberDenominatorValueAttribute((OdfFileDom) this.ownerDocument);
  85.     setOdfAttribute(attr);
  86.     attr.setIntValue(numberDenominatorValueValue.intValue());
  87.   }

  88.   /**
  89.    * Receives the value of the ODFDOM attribute representation <code>NumberGroupingAttribute</code>
  90.    * , See {@odf.attribute number:grouping}
  91.    *
  92.    * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
  93.    *     set and no default value defined.
  94.    */
  95.   public Boolean getNumberGroupingAttribute() {
  96.     NumberGroupingAttribute attr =
  97.         (NumberGroupingAttribute) getOdfAttribute(OdfDocumentNamespace.NUMBER, "grouping");
  98.     if (attr != null) {
  99.       return Boolean.valueOf(attr.booleanValue());
  100.     }
  101.     return Boolean.valueOf(NumberGroupingAttribute.DEFAULT_VALUE);
  102.   }

  103.   /**
  104.    * Sets the value of ODFDOM attribute representation <code>NumberGroupingAttribute</code> , See
  105.    * {@odf.attribute number:grouping}
  106.    *
  107.    * @param numberGroupingValue The type is <code>Boolean</code>
  108.    */
  109.   public void setNumberGroupingAttribute(Boolean numberGroupingValue) {
  110.     NumberGroupingAttribute attr = new NumberGroupingAttribute((OdfFileDom) this.ownerDocument);
  111.     setOdfAttribute(attr);
  112.     attr.setBooleanValue(numberGroupingValue.booleanValue());
  113.   }

  114.   /**
  115.    * Receives the value of the ODFDOM attribute representation <code>
  116.    * NumberMinDenominatorDigitsAttribute</code> , See {@odf.attribute number:min-denominator-digits}
  117.    *
  118.    * @return - the <code>Integer</code> , the value or <code>null</code>, if the attribute is not
  119.    *     set and no default value defined.
  120.    */
  121.   public Integer getNumberMinDenominatorDigitsAttribute() {
  122.     NumberMinDenominatorDigitsAttribute attr =
  123.         (NumberMinDenominatorDigitsAttribute)
  124.             getOdfAttribute(OdfDocumentNamespace.NUMBER, "min-denominator-digits");
  125.     if (attr != null) {
  126.       return Integer.valueOf(attr.intValue());
  127.     }
  128.     return null;
  129.   }

  130.   /**
  131.    * Sets the value of ODFDOM attribute representation <code>NumberMinDenominatorDigitsAttribute
  132.    * </code> , See {@odf.attribute number:min-denominator-digits}
  133.    *
  134.    * @param numberMinDenominatorDigitsValue The type is <code>Integer</code>
  135.    */
  136.   public void setNumberMinDenominatorDigitsAttribute(Integer numberMinDenominatorDigitsValue) {
  137.     NumberMinDenominatorDigitsAttribute attr =
  138.         new NumberMinDenominatorDigitsAttribute((OdfFileDom) this.ownerDocument);
  139.     setOdfAttribute(attr);
  140.     attr.setIntValue(numberMinDenominatorDigitsValue.intValue());
  141.   }

  142.   /**
  143.    * Receives the value of the ODFDOM attribute representation <code>NumberMinIntegerDigitsAttribute
  144.    * </code> , See {@odf.attribute number:min-integer-digits}
  145.    *
  146.    * @return - the <code>Integer</code> , the value or <code>null</code>, if the attribute is not
  147.    *     set and no default value defined.
  148.    */
  149.   public Integer getNumberMinIntegerDigitsAttribute() {
  150.     NumberMinIntegerDigitsAttribute attr =
  151.         (NumberMinIntegerDigitsAttribute)
  152.             getOdfAttribute(OdfDocumentNamespace.NUMBER, "min-integer-digits");
  153.     if (attr != null) {
  154.       return Integer.valueOf(attr.intValue());
  155.     }
  156.     return null;
  157.   }

  158.   /**
  159.    * Sets the value of ODFDOM attribute representation <code>NumberMinIntegerDigitsAttribute</code>
  160.    * , See {@odf.attribute number:min-integer-digits}
  161.    *
  162.    * @param numberMinIntegerDigitsValue The type is <code>Integer</code>
  163.    */
  164.   public void setNumberMinIntegerDigitsAttribute(Integer numberMinIntegerDigitsValue) {
  165.     NumberMinIntegerDigitsAttribute attr =
  166.         new NumberMinIntegerDigitsAttribute((OdfFileDom) this.ownerDocument);
  167.     setOdfAttribute(attr);
  168.     attr.setIntValue(numberMinIntegerDigitsValue.intValue());
  169.   }

  170.   /**
  171.    * Receives the value of the ODFDOM attribute representation <code>
  172.    * NumberMinNumeratorDigitsAttribute</code> , See {@odf.attribute number:min-numerator-digits}
  173.    *
  174.    * @return - the <code>Integer</code> , the value or <code>null</code>, if the attribute is not
  175.    *     set and no default value defined.
  176.    */
  177.   public Integer getNumberMinNumeratorDigitsAttribute() {
  178.     NumberMinNumeratorDigitsAttribute attr =
  179.         (NumberMinNumeratorDigitsAttribute)
  180.             getOdfAttribute(OdfDocumentNamespace.NUMBER, "min-numerator-digits");
  181.     if (attr != null) {
  182.       return Integer.valueOf(attr.intValue());
  183.     }
  184.     return null;
  185.   }

  186.   /**
  187.    * Sets the value of ODFDOM attribute representation <code>NumberMinNumeratorDigitsAttribute
  188.    * </code> , See {@odf.attribute number:min-numerator-digits}
  189.    *
  190.    * @param numberMinNumeratorDigitsValue The type is <code>Integer</code>
  191.    */
  192.   public void setNumberMinNumeratorDigitsAttribute(Integer numberMinNumeratorDigitsValue) {
  193.     NumberMinNumeratorDigitsAttribute attr =
  194.         new NumberMinNumeratorDigitsAttribute((OdfFileDom) this.ownerDocument);
  195.     setOdfAttribute(attr);
  196.     attr.setIntValue(numberMinNumeratorDigitsValue.intValue());
  197.   }

  198.   @Override
  199.   public void accept(ElementVisitor visitor) {
  200.     if (visitor instanceof DefaultElementVisitor) {
  201.       DefaultElementVisitor defaultVisitor = (DefaultElementVisitor) visitor;
  202.       defaultVisitor.visit(this);
  203.     } else {
  204.       visitor.visit(this);
  205.     }
  206.   }
  207. }