FoHyphenationRemainCharCountAttribute.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.fo;

  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. /**
  34.  * DOM implementation of OpenDocument attribute {@odf.attribute fo:hyphenation-remain-char-count}.
  35.  */
  36. public class FoHyphenationRemainCharCountAttribute extends OdfAttribute {

  37.   public static final OdfName ATTRIBUTE_NAME =
  38.       OdfName.newName(OdfDocumentNamespace.FO, "hyphenation-remain-char-count");

  39.   /**
  40.    * Create the instance of OpenDocument attribute {@odf.attribute
  41.    * fo:hyphenation-remain-char-count}.
  42.    *
  43.    * @param ownerDocument The type is <code>OdfFileDom</code>
  44.    */
  45.   public FoHyphenationRemainCharCountAttribute(OdfFileDom ownerDocument) {
  46.     super(ownerDocument, ATTRIBUTE_NAME);
  47.   }

  48.   /**
  49.    * Returns the attribute name.
  50.    *
  51.    * @return the <code>OdfName</code> for {@odf.attribute fo:hyphenation-remain-char-count}.
  52.    */
  53.   @Override
  54.   public OdfName getOdfName() {
  55.     return ATTRIBUTE_NAME;
  56.   }

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

  62.   /** @param value The <code>int</code> value of the attribute. */
  63.   public void setIntValue(int value) {
  64.     super.setValue(String.valueOf(value));
  65.   }

  66.   /** @return Returns the <code>int</code> value of the attribute */
  67.   public int intValue() {
  68.     String val = super.getValue();
  69.     try {
  70.       return Integer.parseInt(val);
  71.     } catch (NumberFormatException e) {
  72.       // TODO: validation handling/logging
  73.       throw (e);
  74.     }
  75.   }

  76.   /**
  77.    * Returns the default value of {@odf.attribute fo:hyphenation-remain-char-count}.
  78.    *
  79.    * @return the default value as <code>String</code> dependent of its element name return <code>
  80.    *     null</code> if the default value does not exist
  81.    */
  82.   @Override
  83.   public String getDefault() {
  84.     return null;
  85.   }

  86.   /**
  87.    * Default value indicator. As the attribute default value is dependent from its element, the
  88.    * attribute has only a default, when a parent element exists.
  89.    *
  90.    * @return <code>true</code> if {@odf.attribute fo:hyphenation-remain-char-count} has an element
  91.    *     parent otherwise return <code>false</code> as undefined.
  92.    */
  93.   @Override
  94.   public boolean hasDefault() {
  95.     return false;
  96.   }

  97.   /** @return Returns whether this attribute is known to be of type ID (i.e. xml:id ?) */
  98.   @Override
  99.   public boolean isId() {
  100.     return false;
  101.   }
  102. }