/**
  * Registers a component into the existing page hierarchy.
  *
  * This method generates UniqueID for the registered component.
  * It also registers the component to the page if it implements
  * certain interfaces (IPostBackDataHandler, IPostBackEventHandler,
  * IValidator, ICallbackEventHandler). The component's children are also registered recursively.
  * @param TComponent the component to be registered
  */
 private function registerComponent($component)
 {
     $component->root = $this->root;
     $component->uniqueID = strlen($this->uniqueID) ? $this->uniqueID . ':' . $component->id : $component->id;
     if ($this->root instanceof TPage) {
         if ($component instanceof TForm) {
             $this->root->setForm($component);
         }
         if ($component instanceof THead) {
             $this->root->setHead($component);
         }
         if ($component instanceof TContentPlaceHolder) {
             $this->root->registerContentPlaceHolder($component);
         }
         if ($component instanceof IPostBackDataHandler) {
             $this->root->registerPostDataLoader($component);
         }
         if ($component instanceof IPostBackEventHandler) {
             $this->root->registerPostBackCandidate($component);
         }
         if ($component instanceof IValidator) {
             $this->root->registerValidator($component);
         }
         if (class_exists('ICallbackEventHandler', FALSE)) {
             if ($component instanceof ICallbackEventHandler) {
                 $this->root->registerCallbackCandidate($component);
             }
             if ($this->root instanceof ICallbackEventHandler) {
                 $this->root->registerCallbackCandidate($this->root);
             }
         }
         foreach ($component->children as $child) {
             $component->registerComponent($child);
         }
     }
 }