NumberPercentageStyleElement.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.NumberCountryAttribute;
  32. import org.odftoolkit.odfdom.dom.attribute.number.NumberLanguageAttribute;
  33. import org.odftoolkit.odfdom.dom.attribute.number.NumberRfcLanguageTagAttribute;
  34. import org.odftoolkit.odfdom.dom.attribute.number.NumberScriptAttribute;
  35. import org.odftoolkit.odfdom.dom.attribute.number.NumberTitleAttribute;
  36. import org.odftoolkit.odfdom.dom.attribute.number.NumberTransliterationCountryAttribute;
  37. import org.odftoolkit.odfdom.dom.attribute.number.NumberTransliterationFormatAttribute;
  38. import org.odftoolkit.odfdom.dom.attribute.number.NumberTransliterationLanguageAttribute;
  39. import org.odftoolkit.odfdom.dom.attribute.number.NumberTransliterationStyleAttribute;
  40. import org.odftoolkit.odfdom.dom.attribute.style.StyleDisplayNameAttribute;
  41. import org.odftoolkit.odfdom.dom.attribute.style.StyleNameAttribute;
  42. import org.odftoolkit.odfdom.dom.attribute.style.StyleVolatileAttribute;
  43. import org.odftoolkit.odfdom.dom.element.style.StyleMapElement;
  44. import org.odftoolkit.odfdom.dom.element.style.StyleTextPropertiesElement;
  45. import org.odftoolkit.odfdom.pkg.ElementVisitor;
  46. import org.odftoolkit.odfdom.pkg.OdfFileDom;
  47. import org.odftoolkit.odfdom.pkg.OdfName;

  48. /** DOM implementation of OpenDocument element {@odf.element number:percentage-style}. */
  49. public abstract class NumberPercentageStyleElement extends DataStyleElement {

  50.   public static final OdfName ELEMENT_NAME =
  51.       OdfName.newName(OdfDocumentNamespace.NUMBER, "percentage-style");

  52.   /**
  53.    * Create the instance of <code>NumberPercentageStyleElement</code>
  54.    *
  55.    * @param ownerDoc The type is <code>OdfFileDom</code>
  56.    */
  57.   public NumberPercentageStyleElement(OdfFileDom ownerDoc) {
  58.     super(ownerDoc, ELEMENT_NAME);
  59.   }

  60.   /**
  61.    * Get the element name
  62.    *
  63.    * @return return <code>OdfName</code> the name of element {@odf.element number:percentage-style}.
  64.    */
  65.   @Override
  66.   public OdfName getOdfName() {
  67.     return ELEMENT_NAME;
  68.   }

  69.   /**
  70.    * Receives the value of the ODFDOM attribute representation <code>NumberCountryAttribute</code> ,
  71.    * See {@odf.attribute number:country}
  72.    *
  73.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  74.    *     and no default value defined.
  75.    */
  76.   public String getNumberCountryAttribute() {
  77.     NumberCountryAttribute attr =
  78.         (NumberCountryAttribute) getOdfAttribute(OdfDocumentNamespace.NUMBER, "country");
  79.     if (attr != null) {
  80.       return String.valueOf(attr.getValue());
  81.     }
  82.     return null;
  83.   }

  84.   /**
  85.    * Sets the value of ODFDOM attribute representation <code>NumberCountryAttribute</code> , See
  86.    * {@odf.attribute number:country}
  87.    *
  88.    * @param numberCountryValue The type is <code>String</code>
  89.    */
  90.   public void setNumberCountryAttribute(String numberCountryValue) {
  91.     NumberCountryAttribute attr = new NumberCountryAttribute((OdfFileDom) this.ownerDocument);
  92.     setOdfAttribute(attr);
  93.     attr.setValue(numberCountryValue);
  94.   }

  95.   /**
  96.    * Receives the value of the ODFDOM attribute representation <code>NumberLanguageAttribute</code>
  97.    * , See {@odf.attribute number:language}
  98.    *
  99.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  100.    *     and no default value defined.
  101.    */
  102.   public String getNumberLanguageAttribute() {
  103.     NumberLanguageAttribute attr =
  104.         (NumberLanguageAttribute) getOdfAttribute(OdfDocumentNamespace.NUMBER, "language");
  105.     if (attr != null) {
  106.       return String.valueOf(attr.getValue());
  107.     }
  108.     return null;
  109.   }

  110.   /**
  111.    * Sets the value of ODFDOM attribute representation <code>NumberLanguageAttribute</code> , See
  112.    * {@odf.attribute number:language}
  113.    *
  114.    * @param numberLanguageValue The type is <code>String</code>
  115.    */
  116.   public void setNumberLanguageAttribute(String numberLanguageValue) {
  117.     NumberLanguageAttribute attr = new NumberLanguageAttribute((OdfFileDom) this.ownerDocument);
  118.     setOdfAttribute(attr);
  119.     attr.setValue(numberLanguageValue);
  120.   }

  121.   /**
  122.    * Receives the value of the ODFDOM attribute representation <code>NumberRfcLanguageTagAttribute
  123.    * </code> , See {@odf.attribute number:rfc-language-tag}
  124.    *
  125.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  126.    *     and no default value defined.
  127.    */
  128.   public String getNumberRfcLanguageTagAttribute() {
  129.     NumberRfcLanguageTagAttribute attr =
  130.         (NumberRfcLanguageTagAttribute)
  131.             getOdfAttribute(OdfDocumentNamespace.NUMBER, "rfc-language-tag");
  132.     if (attr != null) {
  133.       return String.valueOf(attr.getValue());
  134.     }
  135.     return null;
  136.   }

  137.   /**
  138.    * Sets the value of ODFDOM attribute representation <code>NumberRfcLanguageTagAttribute</code> ,
  139.    * See {@odf.attribute number:rfc-language-tag}
  140.    *
  141.    * @param numberRfcLanguageTagValue The type is <code>String</code>
  142.    */
  143.   public void setNumberRfcLanguageTagAttribute(String numberRfcLanguageTagValue) {
  144.     NumberRfcLanguageTagAttribute attr =
  145.         new NumberRfcLanguageTagAttribute((OdfFileDom) this.ownerDocument);
  146.     setOdfAttribute(attr);
  147.     attr.setValue(numberRfcLanguageTagValue);
  148.   }

  149.   /**
  150.    * Receives the value of the ODFDOM attribute representation <code>NumberScriptAttribute</code> ,
  151.    * See {@odf.attribute number:script}
  152.    *
  153.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  154.    *     and no default value defined.
  155.    */
  156.   public String getNumberScriptAttribute() {
  157.     NumberScriptAttribute attr =
  158.         (NumberScriptAttribute) getOdfAttribute(OdfDocumentNamespace.NUMBER, "script");
  159.     if (attr != null) {
  160.       return String.valueOf(attr.getValue());
  161.     }
  162.     return null;
  163.   }

  164.   /**
  165.    * Sets the value of ODFDOM attribute representation <code>NumberScriptAttribute</code> , See
  166.    * {@odf.attribute number:script}
  167.    *
  168.    * @param numberScriptValue The type is <code>String</code>
  169.    */
  170.   public void setNumberScriptAttribute(String numberScriptValue) {
  171.     NumberScriptAttribute attr = new NumberScriptAttribute((OdfFileDom) this.ownerDocument);
  172.     setOdfAttribute(attr);
  173.     attr.setValue(numberScriptValue);
  174.   }

  175.   /**
  176.    * Receives the value of the ODFDOM attribute representation <code>NumberTitleAttribute</code> ,
  177.    * See {@odf.attribute number:title}
  178.    *
  179.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  180.    *     and no default value defined.
  181.    */
  182.   public String getNumberTitleAttribute() {
  183.     NumberTitleAttribute attr =
  184.         (NumberTitleAttribute) getOdfAttribute(OdfDocumentNamespace.NUMBER, "title");
  185.     if (attr != null) {
  186.       return String.valueOf(attr.getValue());
  187.     }
  188.     return null;
  189.   }

  190.   /**
  191.    * Sets the value of ODFDOM attribute representation <code>NumberTitleAttribute</code> , See
  192.    * {@odf.attribute number:title}
  193.    *
  194.    * @param numberTitleValue The type is <code>String</code>
  195.    */
  196.   public void setNumberTitleAttribute(String numberTitleValue) {
  197.     NumberTitleAttribute attr = new NumberTitleAttribute((OdfFileDom) this.ownerDocument);
  198.     setOdfAttribute(attr);
  199.     attr.setValue(numberTitleValue);
  200.   }

  201.   /**
  202.    * Receives the value of the ODFDOM attribute representation <code>
  203.    * NumberTransliterationCountryAttribute</code> , See {@odf.attribute
  204.    * number:transliteration-country}
  205.    *
  206.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  207.    *     and no default value defined.
  208.    */
  209.   public String getNumberTransliterationCountryAttribute() {
  210.     NumberTransliterationCountryAttribute attr =
  211.         (NumberTransliterationCountryAttribute)
  212.             getOdfAttribute(OdfDocumentNamespace.NUMBER, "transliteration-country");
  213.     if (attr != null) {
  214.       return String.valueOf(attr.getValue());
  215.     }
  216.     return null;
  217.   }

  218.   /**
  219.    * Sets the value of ODFDOM attribute representation <code>NumberTransliterationCountryAttribute
  220.    * </code> , See {@odf.attribute number:transliteration-country}
  221.    *
  222.    * @param numberTransliterationCountryValue The type is <code>String</code>
  223.    */
  224.   public void setNumberTransliterationCountryAttribute(String numberTransliterationCountryValue) {
  225.     NumberTransliterationCountryAttribute attr =
  226.         new NumberTransliterationCountryAttribute((OdfFileDom) this.ownerDocument);
  227.     setOdfAttribute(attr);
  228.     attr.setValue(numberTransliterationCountryValue);
  229.   }

  230.   /**
  231.    * Receives the value of the ODFDOM attribute representation <code>
  232.    * NumberTransliterationFormatAttribute</code> , See {@odf.attribute
  233.    * number:transliteration-format}
  234.    *
  235.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  236.    *     and no default value defined.
  237.    */
  238.   public String getNumberTransliterationFormatAttribute() {
  239.     NumberTransliterationFormatAttribute attr =
  240.         (NumberTransliterationFormatAttribute)
  241.             getOdfAttribute(OdfDocumentNamespace.NUMBER, "transliteration-format");
  242.     if (attr != null) {
  243.       return String.valueOf(attr.getValue());
  244.     }
  245.     return NumberTransliterationFormatAttribute.DEFAULT_VALUE;
  246.   }

  247.   /**
  248.    * Sets the value of ODFDOM attribute representation <code>NumberTransliterationFormatAttribute
  249.    * </code> , See {@odf.attribute number:transliteration-format}
  250.    *
  251.    * @param numberTransliterationFormatValue The type is <code>String</code>
  252.    */
  253.   public void setNumberTransliterationFormatAttribute(String numberTransliterationFormatValue) {
  254.     NumberTransliterationFormatAttribute attr =
  255.         new NumberTransliterationFormatAttribute((OdfFileDom) this.ownerDocument);
  256.     setOdfAttribute(attr);
  257.     attr.setValue(numberTransliterationFormatValue);
  258.   }

  259.   /**
  260.    * Receives the value of the ODFDOM attribute representation <code>
  261.    * NumberTransliterationLanguageAttribute</code> , See {@odf.attribute
  262.    * number:transliteration-language}
  263.    *
  264.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  265.    *     and no default value defined.
  266.    */
  267.   public String getNumberTransliterationLanguageAttribute() {
  268.     NumberTransliterationLanguageAttribute attr =
  269.         (NumberTransliterationLanguageAttribute)
  270.             getOdfAttribute(OdfDocumentNamespace.NUMBER, "transliteration-language");
  271.     if (attr != null) {
  272.       return String.valueOf(attr.getValue());
  273.     }
  274.     return null;
  275.   }

  276.   /**
  277.    * Sets the value of ODFDOM attribute representation <code>NumberTransliterationLanguageAttribute
  278.    * </code> , See {@odf.attribute number:transliteration-language}
  279.    *
  280.    * @param numberTransliterationLanguageValue The type is <code>String</code>
  281.    */
  282.   public void setNumberTransliterationLanguageAttribute(String numberTransliterationLanguageValue) {
  283.     NumberTransliterationLanguageAttribute attr =
  284.         new NumberTransliterationLanguageAttribute((OdfFileDom) this.ownerDocument);
  285.     setOdfAttribute(attr);
  286.     attr.setValue(numberTransliterationLanguageValue);
  287.   }

  288.   /**
  289.    * Receives the value of the ODFDOM attribute representation <code>
  290.    * NumberTransliterationStyleAttribute</code> , See {@odf.attribute number:transliteration-style}
  291.    *
  292.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  293.    *     and no default value defined.
  294.    */
  295.   public String getNumberTransliterationStyleAttribute() {
  296.     NumberTransliterationStyleAttribute attr =
  297.         (NumberTransliterationStyleAttribute)
  298.             getOdfAttribute(OdfDocumentNamespace.NUMBER, "transliteration-style");
  299.     if (attr != null) {
  300.       return String.valueOf(attr.getValue());
  301.     }
  302.     return NumberTransliterationStyleAttribute.DEFAULT_VALUE;
  303.   }

  304.   /**
  305.    * Sets the value of ODFDOM attribute representation <code>NumberTransliterationStyleAttribute
  306.    * </code> , See {@odf.attribute number:transliteration-style}
  307.    *
  308.    * @param numberTransliterationStyleValue The type is <code>String</code>
  309.    */
  310.   public void setNumberTransliterationStyleAttribute(String numberTransliterationStyleValue) {
  311.     NumberTransliterationStyleAttribute attr =
  312.         new NumberTransliterationStyleAttribute((OdfFileDom) this.ownerDocument);
  313.     setOdfAttribute(attr);
  314.     attr.setValue(numberTransliterationStyleValue);
  315.   }

  316.   /**
  317.    * Receives the value of the ODFDOM attribute representation <code>StyleDisplayNameAttribute
  318.    * </code> , See {@odf.attribute style:display-name}
  319.    *
  320.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  321.    *     and no default value defined.
  322.    */
  323.   public String getStyleDisplayNameAttribute() {
  324.     StyleDisplayNameAttribute attr =
  325.         (StyleDisplayNameAttribute) getOdfAttribute(OdfDocumentNamespace.STYLE, "display-name");
  326.     if (attr != null) {
  327.       return String.valueOf(attr.getValue());
  328.     }
  329.     return null;
  330.   }

  331.   /**
  332.    * Sets the value of ODFDOM attribute representation <code>StyleDisplayNameAttribute</code> , See
  333.    * {@odf.attribute style:display-name}
  334.    *
  335.    * @param styleDisplayNameValue The type is <code>String</code>
  336.    */
  337.   public void setStyleDisplayNameAttribute(String styleDisplayNameValue) {
  338.     StyleDisplayNameAttribute attr = new StyleDisplayNameAttribute((OdfFileDom) this.ownerDocument);
  339.     setOdfAttribute(attr);
  340.     attr.setValue(styleDisplayNameValue);
  341.   }

  342.   /**
  343.    * Receives the value of the ODFDOM attribute representation <code>StyleNameAttribute</code> , See
  344.    * {@odf.attribute style:name}
  345.    *
  346.    * <p>Attribute is mandatory.
  347.    *
  348.    * @return - the <code>String</code> , the value or <code>null</code>, if the attribute is not set
  349.    *     and no default value defined.
  350.    */
  351.   public String getStyleNameAttribute() {
  352.     StyleNameAttribute attr =
  353.         (StyleNameAttribute) getOdfAttribute(OdfDocumentNamespace.STYLE, "name");
  354.     if (attr != null) {
  355.       return String.valueOf(attr.getValue());
  356.     }
  357.     return null;
  358.   }

  359.   /**
  360.    * Sets the value of ODFDOM attribute representation <code>StyleNameAttribute</code> , See
  361.    * {@odf.attribute style:name}
  362.    *
  363.    * @param styleNameValue The type is <code>String</code>
  364.    */
  365.   public void setStyleNameAttribute(String styleNameValue) {
  366.     StyleNameAttribute attr = new StyleNameAttribute((OdfFileDom) this.ownerDocument);
  367.     setOdfAttribute(attr);
  368.     attr.setValue(styleNameValue);
  369.   }

  370.   /**
  371.    * Receives the value of the ODFDOM attribute representation <code>StyleVolatileAttribute</code> ,
  372.    * See {@odf.attribute style:volatile}
  373.    *
  374.    * @return - the <code>Boolean</code> , the value or <code>null</code>, if the attribute is not
  375.    *     set and no default value defined.
  376.    */
  377.   public Boolean getStyleVolatileAttribute() {
  378.     StyleVolatileAttribute attr =
  379.         (StyleVolatileAttribute) getOdfAttribute(OdfDocumentNamespace.STYLE, "volatile");
  380.     if (attr != null) {
  381.       return Boolean.valueOf(attr.booleanValue());
  382.     }
  383.     return null;
  384.   }

  385.   /**
  386.    * Sets the value of ODFDOM attribute representation <code>StyleVolatileAttribute</code> , See
  387.    * {@odf.attribute style:volatile}
  388.    *
  389.    * @param styleVolatileValue The type is <code>Boolean</code>
  390.    */
  391.   public void setStyleVolatileAttribute(Boolean styleVolatileValue) {
  392.     StyleVolatileAttribute attr = new StyleVolatileAttribute((OdfFileDom) this.ownerDocument);
  393.     setOdfAttribute(attr);
  394.     attr.setBooleanValue(styleVolatileValue.booleanValue());
  395.   }

  396.   /**
  397.    * Create child element {@odf.element number:number}.
  398.    *
  399.    * @return the element {@odf.element number:number}
  400.    */
  401.   public NumberNumberElement newNumberNumberElement() {
  402.     NumberNumberElement numberNumber =
  403.         ((OdfFileDom) this.ownerDocument).newOdfElement(NumberNumberElement.class);
  404.     this.appendChild(numberNumber);
  405.     return numberNumber;
  406.   }

  407.   /**
  408.    * Create child element {@odf.element number:text}.
  409.    *
  410.    * @return the element {@odf.element number:text}
  411.    */
  412.   public NumberTextElement newNumberTextElement() {
  413.     NumberTextElement numberText =
  414.         ((OdfFileDom) this.ownerDocument).newOdfElement(NumberTextElement.class);
  415.     this.appendChild(numberText);
  416.     return numberText;
  417.   }

  418.   /**
  419.    * Create child element {@odf.element style:map}.
  420.    *
  421.    * @param styleApplyStyleNameValue the <code>String</code> value of <code>
  422.    *     StyleApplyStyleNameAttribute</code>, see {@odf.attribute style:apply-style-name} at
  423.    *     specification
  424.    * @param styleConditionValue the <code>String</code> value of <code>StyleConditionAttribute
  425.    *     </code>, see {@odf.attribute style:condition} at specification
  426.    * @return the element {@odf.element style:map}
  427.    */
  428.   public StyleMapElement newStyleMapElement(
  429.       String styleApplyStyleNameValue, String styleConditionValue) {
  430.     StyleMapElement styleMap =
  431.         ((OdfFileDom) this.ownerDocument).newOdfElement(StyleMapElement.class);
  432.     styleMap.setStyleApplyStyleNameAttribute(styleApplyStyleNameValue);
  433.     styleMap.setStyleConditionAttribute(styleConditionValue);
  434.     this.appendChild(styleMap);
  435.     return styleMap;
  436.   }

  437.   /**
  438.    * Create child element {@odf.element style:text-properties}.
  439.    *
  440.    * @param textDisplayValue the <code>String</code> value of <code>TextDisplayAttribute</code>, see
  441.    *     {@odf.attribute text:display} at specification
  442.    * @return the element {@odf.element style:text-properties}
  443.    */
  444.   public StyleTextPropertiesElement newStyleTextPropertiesElement(String textDisplayValue) {
  445.     StyleTextPropertiesElement styleTextProperties =
  446.         ((OdfFileDom) this.ownerDocument).newOdfElement(StyleTextPropertiesElement.class);
  447.     styleTextProperties.setTextDisplayAttribute(textDisplayValue);
  448.     this.appendChild(styleTextProperties);
  449.     return styleTextProperties;
  450.   }

  451.   @Override
  452.   public void accept(ElementVisitor visitor) {
  453.     if (visitor instanceof DefaultElementVisitor) {
  454.       DefaultElementVisitor defaultVisitor = (DefaultElementVisitor) visitor;
  455.       defaultVisitor.visit(this);
  456.     } else {
  457.       visitor.visit(this);
  458.     }
  459.   }
  460. }