content: sub init()
      m.top.observeField("view", "renderView")
      m.top.observeField("privacyManagerViewData", "renderRightCol")
  end sub
  
  sub clearCategoryDesc(event as object)
      focusedChild = event.getData()
      if focusedChild = invalid then
          updateCategoryDesc(invalid)
      end if
  end sub
  
  function getCategory(id) as object
      if id <> invalid and m.top.privacyManagerViewData <> invalid and m.top.privacyManagerViewData.categories <> invalid then
          return m.top.privacyManagerViewData.categories[id]
      end if
      return invalid
  end function
  
  sub observeCategoryList(event as object)
      index = event.getData()
      if m.categoryList <> invalid and m.categoryList.content <> invalid then
          item = m.categoryList.content.getChild(index)
          category = getCategory(item.id)
          if category <> invalid then
              changeView("CategoryDetailsView", category)
          end if
      end if
  end sub
  
  sub observeCategoryListFocus()
      if m.categoryList <> invalid then
          updateCategoryDesc(m.categoryList.focusedContentNode)
      end if
  end sub
  
  sub updateCategoryDesc(listItem as object)
      text = ""
      if listItem <> invalid then
          category = getCategory(listItem.id)
          if category <> invalid then
              text = category.description
          end if
      end if
      m.categoryDescription.text = text
  end sub
  
  sub renderCategoryDescription()
      if m.categoryDescription = invalid and m.components.text_category_description <> invalid then
          m.categoryDescription = createObject("roSGNode", "SpNativeText")
          m.categoryDescription.settings = m.components.text_category_description.settings
          m.categoryDescription.textComponent.horizAlign = "center"
          m.categoryDescription.textComponent.wrap = true
          m.categoryDescription.textComponent.width = m.colLeftWidth * .8
          m.categoryDescription.textComponent.maxLines = 3
          m.colLeft.appendChild(m.categoryDescription)
      end if
  end sub
  
  sub renderRightCol()
      if m.buttonTask = invalid then
          m.buttonTask = createObject("roSGNode", "CategoriesButtonTaskCCPA")
          m.buttonTask.privacyManagerViewData = m.top.privacyManagerViewData
          m.buttonTask.buttonCategorySettings = m.components.button_category.settings
          m.buttonTask.observeField("buttons", "renderButtonLists")
          m.buttonTask.observeField("error", "onError")
          m.buttonTask.control = "RUN"
      else
          m.buttonTask.privacyManagerViewData = m.top.privacyManagerViewData
          m.buttonTask.control = "RUN"
      end if
  end sub
  
  sub renderButtonLists()
      buttons = m.buttonTask.buttons
      hideRightColLoader()
      if m.categoriesHeader = invalid and m.components.text_categories_header <> invalid then
          m.categoriesHeader = createObject("roSGNode", "SpNativeText")
          m.categoriesHeader.settings = m.components.text_categories_header.settings
          m.colRight.appendChild(m.categoriesHeader)
      end if
      if m.purposesDefinition = invalid and m.components.text_purposes_definition <> invalid then
          m.purposesDefinition = createObject("roSGNode", "SpNativeText")
          m.purposesDefinition.settings = m.components.text_purposes_definition.settings
          m.colRight.appendChild(m.purposesDefinition)
      end if
      if m.categoryList = invalid and buttons <> invalid and buttons.count() > 0 then
          m.categoryList = createObject("roSGNode", "SpButtonList")
          m.categoryList.id = "category_list"
          m.categoryList.width = m.colRightWidth
          m.colRight.appendChild(m.categoryList)
          m.rightColFocus = m.categoryList
          m.categoryList.observeField("itemSelected", "observeCategoryList")
          m.categoryList.observeField("itemFocused", "observeCategoryListFocus")
          m.categoryList.observeField("focusedChild", "clearCategoryDesc")
      end if
      if m.categoryList <> invalid then
          m.categoryList.buttonComponents = buttons
      end if
  end sub
  
  sub renderView(event as object)
      getPrivacyManagerViewData(2)
      renderRightColLoader()
      view = event.getData()
      mapComponents(view)
      renderLogo()
      renderCategoryDescription()
      renderNav([])
      setFocus(m.back_button)
  end sub