OfficeEventListenersElement.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.office;

  29. import org.odftoolkit.odfdom.dom.DefaultElementVisitor;
  30. import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
  31. import org.odftoolkit.odfdom.dom.element.presentation.PresentationEventListenerElement;
  32. import org.odftoolkit.odfdom.dom.element.script.ScriptEventListenerElement;
  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 office:event-listeners}. */
  38. public class OfficeEventListenersElement extends OdfElement {

  39.   public static final OdfName ELEMENT_NAME =
  40.       OdfName.newName(OdfDocumentNamespace.OFFICE, "event-listeners");

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

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

  57.   /**
  58.    * Create child element {@odf.element presentation:event-listener}.
  59.    *
  60.    * @param presentationActionValue the <code>String</code> value of <code>
  61.    *     PresentationActionAttribute</code>, see {@odf.attribute presentation:action} at
  62.    *     specification
  63.    * @param scriptEventNameValue the <code>String</code> value of <code>ScriptEventNameAttribute
  64.    *     </code>, see {@odf.attribute script:event-name} at specification
  65.    * @return the element {@odf.element presentation:event-listener}
  66.    */
  67.   public PresentationEventListenerElement newPresentationEventListenerElement(
  68.       String presentationActionValue, String scriptEventNameValue) {
  69.     PresentationEventListenerElement presentationEventListener =
  70.         ((OdfFileDom) this.ownerDocument).newOdfElement(PresentationEventListenerElement.class);
  71.     presentationEventListener.setPresentationActionAttribute(presentationActionValue);
  72.     presentationEventListener.setScriptEventNameAttribute(scriptEventNameValue);
  73.     this.appendChild(presentationEventListener);
  74.     return presentationEventListener;
  75.   }

  76.   /**
  77.    * Create child element {@odf.element script:event-listener}.
  78.    *
  79.    * @param scriptEventNameValue the <code>String</code> value of <code>ScriptEventNameAttribute
  80.    *     </code>, see {@odf.attribute script:event-name} at specification
  81.    * @param scriptLanguageValue the <code>String</code> value of <code>ScriptLanguageAttribute
  82.    *     </code>, see {@odf.attribute script:language} at specification
  83.    * @return the element {@odf.element script:event-listener}
  84.    */
  85.   public ScriptEventListenerElement newScriptEventListenerElement(
  86.       String scriptEventNameValue, String scriptLanguageValue) {
  87.     ScriptEventListenerElement scriptEventListener =
  88.         ((OdfFileDom) this.ownerDocument).newOdfElement(ScriptEventListenerElement.class);
  89.     scriptEventListener.setScriptEventNameAttribute(scriptEventNameValue);
  90.     scriptEventListener.setScriptLanguageAttribute(scriptLanguageValue);
  91.     this.appendChild(scriptEventListener);
  92.     return scriptEventListener;
  93.   }

  94.   @Override
  95.   public void accept(ElementVisitor visitor) {
  96.     if (visitor instanceof DefaultElementVisitor) {
  97.       DefaultElementVisitor defaultVisitor = (DefaultElementVisitor) visitor;
  98.       defaultVisitor.visit(this);
  99.     } else {
  100.       visitor.visit(this);
  101.     }
  102.   }
  103. }