<commit_before>/**
  * Copyright (C) 2010 Orbeon, Inc.
  *
  * This program is free software; you can redistribute it and/or modify it under the terms of the
  * GNU Lesser General Public License as published by the Free Software Foundation; either version
  * 2.1 of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU Lesser General Public License for more details.
  *
  * The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
  *//**
  * Copyright (C) 2010 Orbeon, Inc.
  *
  * This program is free software; you can redistribute it and/or modify it under the terms of the
  * GNU Lesser General Public License as published by the Free Software Foundation; either version
  * 2.1 of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU Lesser General Public License for more details.
  *
  * The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
  */
package org.orbeon.oxf.xforms.processor.handlers.xhtml

import org.orbeon.oxf.xforms.XFormsConstants
import org.orbeon.oxf.xforms.control.controls.{PlaceHolderInfo, XFormsTextareaControl}
import org.orbeon.oxf.xforms.processor.handlers.XFormsBaseHandler
import org.orbeon.oxf.xml.{XMLConstants, XMLReceiverHelper, XMLUtils}
import org.xml.sax.Attributes

/**
  * Handle xf:textarea.
  */
class XFormsTextareaHandler(
  uri            : String,
  localname      : String,
  qName          : String,
  attributes     : Attributes,
  matched        : AnyRef,
  handlerContext : AnyRef
) extends XFormsControlLifecyleHandler(uri, localname, qName, attributes, matched, handlerContext, repeating = false, forwarding = false) {

  private val placeHolderInfo: Option[PlaceHolderInfo] =
    staticControlOpt flatMap (PlaceHolderInfo.placeHolderValueOpt( _, currentControlOpt))

  override protected def handleControlStart(): Unit = {

    val textareaControl        = currentControlOrNull.asInstanceOf[XFormsTextareaControl]
    val xmlReceiver            = xformsHandlerContext.getController.getOutput
    val isConcreteControl      = textareaControl ne null
    val htmlTextareaAttributes = getEmptyNestedControlAttributesMaybeWithId(getEffectiveId, textareaControl, addId = true)

    // Create xhtml:textarea
    val xhtmlPrefix = xformsHandlerContext.findXHTMLPrefix

    if (! XFormsBaseHandler.isStaticReadonly(textareaControl)) {

      val textareaQName = XMLUtils.buildQName(xhtmlPrefix, "textarea")
      htmlTextareaAttributes.addAttribute("", "name", "name", XMLReceiverHelper.CDATA, getEffectiveId)

      XFormsBaseHandler.handleAccessibilityAttributes(attributes, htmlTextareaAttributes)
      handleAriaByAtts(htmlTextareaAttributes)

      // Output all extension attributes
      if (isConcreteControl) {
        // Output xxf:* extension attributes
        textareaControl.addExtensionAttributesExceptClassAndAcceptForHandler(htmlTextareaAttributes, XFormsConstants.XXFORMS_NAMESPACE_URI)
      }
<commit_msg>Whitespace<commit_after>/**
  * Copyright (C) 2010 Orbeon, Inc.
  *
  * This program is free software; you can redistribute it and/or modify it under the terms of the
  * GNU Lesser General Public License as published by the Free Software Foundation; either version
  * 2.1 of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU Lesser General Public License for more details.
  *
  * The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
  *//**
  * Copyright (C) 2010 Orbeon, Inc.
  *
  * This program is free software; you can redistribute it and/or modify it under the terms of the
  * GNU Lesser General Public License as published by the Free Software Foundation; either version
  * 2.1 of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU Lesser General Public License for more details.
  *
  * The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
  */
package org.orbeon.oxf.xforms.processor.handlers.xhtml

import org.orbeon.oxf.xforms.XFormsConstants
import org.orbeon.oxf.xforms.control.controls.{PlaceHolderInfo, XFormsTextareaControl}
import org.orbeon.oxf.xforms.processor.handlers.XFormsBaseHandler
import org.orbeon.oxf.xml.{XMLConstants, XMLReceiverHelper, XMLUtils}
import org.xml.sax.Attributes

/**
  * Handle xf:textarea.
  */
class XFormsTextareaHandler(
  uri            : String,
  localname      : String,
  qName          : String,
  attributes     : Attributes,
  matched        : AnyRef,
  handlerContext : AnyRef
) extends XFormsControlLifecyleHandler(uri, localname, qName, attributes, matched, handlerContext, repeating = false, forwarding = false) {

  private val placeHolderInfo: Option[PlaceHolderInfo] =
    staticControlOpt flatMap (PlaceHolderInfo.placeHolderValueOpt(_, currentControlOpt))

  override protected def handleControlStart(): Unit = {

    val textareaControl        = currentControlOrNull.asInstanceOf[XFormsTextareaControl]
    val xmlReceiver            = xformsHandlerContext.getController.getOutput
    val isConcreteControl      = textareaControl ne null
    val htmlTextareaAttributes = getEmptyNestedControlAttributesMaybeWithId(getEffectiveId, textareaControl, addId = true)

    // Create xhtml:textarea
    val xhtmlPrefix = xformsHandlerContext.findXHTMLPrefix

    if (! XFormsBaseHandler.isStaticReadonly(textareaControl)) {

      val textareaQName = XMLUtils.buildQName(xhtmlPrefix, "textarea")
      htmlTextareaAttributes.addAttribute("", "name", "name", XMLReceiverHelper.CDATA, getEffectiveId)

      XFormsBaseHandler.handleAccessibilityAttributes(attributes, htmlTextareaAttributes)
      handleAriaByAtts(htmlTextareaAttributes)

      // Output all extension attributes
      if (isConcreteControl) {
        // Output xxf:* extension attributes
        textareaControl.addExtensionAttributesExceptClassAndAcceptForHandler(htmlTextareaAttributes, XFormsConstants.XXFORMS_NAMESPACE_URI)
      }

{'fraction_non_alphanumeric': 0.07010739856801909, 'fraction_numerical': 0.003579952267303103, 'mean_word_length': 4.094984802431611, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4745707', 'n_tokens_mistral': 1851, 'n_tokens_neox': 1790, 'n_words': 592}