TableGroupedByAttribute.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.attribute.table;

  29. import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
  30. import org.odftoolkit.odfdom.pkg.OdfAttribute;
  31. import org.odftoolkit.odfdom.pkg.OdfFileDom;
  32. import org.odftoolkit.odfdom.pkg.OdfName;

  33. /** DOM implementation of OpenDocument attribute {@odf.attribute table:grouped-by}. */
  34. public class TableGroupedByAttribute extends OdfAttribute {

  35.   public static final OdfName ATTRIBUTE_NAME =
  36.       OdfName.newName(OdfDocumentNamespace.TABLE, "grouped-by");

  37.   /**
  38.    * Create the instance of OpenDocument attribute {@odf.attribute table:grouped-by}.
  39.    *
  40.    * @param ownerDocument The type is <code>OdfFileDom</code>
  41.    */
  42.   public TableGroupedByAttribute(OdfFileDom ownerDocument) {
  43.     super(ownerDocument, ATTRIBUTE_NAME);
  44.   }

  45.   /**
  46.    * Returns the attribute name.
  47.    *
  48.    * @return the <code>OdfName</code> for {@odf.attribute table:grouped-by}.
  49.    */
  50.   @Override
  51.   public OdfName getOdfName() {
  52.     return ATTRIBUTE_NAME;
  53.   }

  54.   /** @return Returns the name of this attribute. */
  55.   @Override
  56.   public String getName() {
  57.     return ATTRIBUTE_NAME.getLocalName();
  58.   }

  59.   /** The value set of {@odf.attribute table:grouped-by}. */
  60.   public enum Value {
  61.     DAYS("days"),
  62.     HOURS("hours"),
  63.     MINUTES("minutes"),
  64.     MONTHS("months"),
  65.     QUARTERS("quarters"),
  66.     SECONDS("seconds"),
  67.     YEARS("years");

  68.     private String mValue;

  69.     Value(String value) {
  70.       mValue = value;
  71.     }

  72.     @Override
  73.     public String toString() {
  74.       return mValue;
  75.     }

  76.     public static Value enumValueOf(String value) {
  77.       for (Value aIter : values()) {
  78.         if (value.equals(aIter.toString())) {
  79.           return aIter;
  80.         }
  81.       }
  82.       return null;
  83.     }
  84.   }

  85.   /** @param attrValue The <code>Enum</code> value of the attribute. */
  86.   public void setEnumValue(Value attrValue) {
  87.     setValue(attrValue.toString());
  88.   }

  89.   /** @return Returns the <code>Enum</code> value of the attribute */
  90.   public Value getEnumValue() {
  91.     return Value.enumValueOf(this.getValue());
  92.   }

  93.   /**
  94.    * Returns the default value of {@odf.attribute table:grouped-by}.
  95.    *
  96.    * @return the default value as <code>String</code> dependent of its element name return <code>
  97.    *     null</code> if the default value does not exist
  98.    */
  99.   @Override
  100.   public String getDefault() {
  101.     return null;
  102.   }

  103.   /**
  104.    * Default value indicator. As the attribute default value is dependent from its element, the
  105.    * attribute has only a default, when a parent element exists.
  106.    *
  107.    * @return <code>true</code> if {@odf.attribute table:grouped-by} has an element parent otherwise
  108.    *     return <code>false</code> as undefined.
  109.    */
  110.   @Override
  111.   public boolean hasDefault() {
  112.     return false;
  113.   }

  114.   /** @return Returns whether this attribute is known to be of type ID (i.e. xml:id ?) */
  115.   @Override
  116.   public boolean isId() {
  117.     return false;
  118.   }
  119. }