Attaches a widget to a parent widget in the widget tree

@param SwatUIObject $object the object to attach.
@param SwatUIParent $parent the parent to attach the widget to.

@throws SwatDoesNotImplementException
177848
private function attachToParent(SwatUIObject $object, SwatUIParent $parent)
    {
        if ($parent instanceof SwatUIParent) {
            $parent->addChild($object);
        } else {
            $class_name = get_class($parent);
            throw new SwatDoesNotImplementException(
                "Can not add object to parent. '{$class_name}' does not " .
                    'implement SwatUIParent.',
                0,
                $parent
            );
        }
    }
1248937
public function setParent(Page $parent)
    {
        $this->parent = $parent;

        $this->parentId = $parent->getPageId();
    }
1048287
public function setWidget(SwatWidget $widget)
    {
        if ($this->widget !== null) {
            throw new SwatException(
                'SwatUI: Only one widget can be nested ' .
                    'within a SwatActionItem'
            );
        }

        $this->widget = $widget;
        $widget->parent = $this;
    }
547993
public void init(Object parent, Object record)
    {
        super.init(parent, record);
        this.setOpaque(false);
        this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
        this.addButtons();
    }
410101
public function bindParent($parent, $parentPropertyName = null)
    {
        $this->parent = $parent;
        $this->parentPropertyName = $parentPropertyName;
        return $this;
    }
631436
public function setParent($item)
    {
        if (is_object($item)) {
            if (!$item->exists()) {
                $item->write();
            }
            $this->setField("ParentID", $item->ID);
        } else {
            $this->setField("ParentID", $item);
        }
    }
939487
public function render($object, string $context = null): void
    {
        if ($this->noDirectory) {
            throw new NoTemplateFoundException("Cannot render object of class ".get_class($object). '. Directory ' .$this->directory.' does not exists.');
        }
        $fileName = $this->getTemplateFileName($object, $context);

        if ($fileName != false) {
            if (method_exists($object, 'getPrivateProperties')) {
                $array = $object->getPrivateProperties();
            } else {
                $array = get_object_vars($object);
            }
            if ($fileName['type'] == 'twig') {
                if (!isset($array['this'])) {
                    $array['this'] = $object;
                }
                echo $this->twig->render($fileName['fileName'], $array);
            } else {
                // Let's store the filename into the object ($this) in order to avoid name conflict between
                // the variables.
                $this->tmpFileName = $fileName;

                extract($array);
                // Let's create a local variable
                /*foreach ($array as $var__tplt=>$value__tplt) {
                    $$var__tplt = $value__tplt;
                }*/
                include $this->directory.'/'.$this->tmpFileName['fileName'];
            }
        } else {
            throw new NoTemplateFoundException("Cannot render object of class ".get_class($object).". No template found.");
        }
    }
1180733
protected void setParent(Object parent, Object child) {
        getProxyBuilder().getCurrentFactory().setParent(getProxyBuilder().getChildBuilder(), parent, child);
        Factory parentFactory = getProxyBuilder().getParentFactory();
        if (parentFactory != null) {
            parentFactory.setChild(getProxyBuilder().getCurrentBuilder(), parent, child);
        }
    }
1065550
public function postProcessContentObjectInitialization(ContentObjectRenderer &$parentObject)
    {
        if (!empty($parentObject->currentRecord)) {
            list($table) = explode(':', $parentObject->currentRecord);

            if (!empty($table) && $table != 'pages') {
                $this->findFrontendGroups($parentObject->data, $table);
            }
        }
    }
106588
public function setParent($object) {
		
		if (! is_object($object)) {
			throw new \InvalidArgumentException("Expecting object, given: ".gettype($object));
		}
		
		$this->parent = $object;
		return $this;
	}
723619
public function attach(Threaded $object, $data = null)
    {
        $this->data[] = $object;
        $this->info[] = $data;
    }
449956
public function setParent($parent)
    {
        if (!empty($parent)) {
            $this->_parent = $this->_normalizeClass($parent);
        } else {
            $this->_parent = null;
        }

        return $this;
    }
1097033
@UiThread
    public void addObjectSync(T object) {
        if (object == null) return;
        if (shouldIgnoreToken(object)) {
            if (listener != null) {
                listener.onTokenIgnored(object);
            }
            return;
        }
        if (tokenLimit != -1 && getObjects().size() == tokenLimit) return;
        insertSpan(buildSpanForObject(object));
        if (getText() != null && isFocused()) setSelection(getText().length());
    }
1025687
static function appendParentNodeIDs( $object, $versionNum, &$nodeIDList )
    {
        foreach ( $object->parentNodeIDArray() as $parentNodeID )
        {
            $nodeIDList[] = $parentNodeID;
        }
    }
1243170
public function handleChildren($parent, $parentWrapper)
    {
        if ($parent instanceof TaskAdapter) {
            $parent = $parent->getProxy();
        }

        $parentClass = $parent === null ? get_class() : get_class($parent);
        $ih = IntrospectionHelper::getHelper($parentClass);

        for ($i = 0, $childrenCount = count($this->children); $i < $childrenCount; $i++) {
            $childWrapper = $parentWrapper->getChild($i);
            $child = $this->children[$i];

            $realChild = null;
            if ($parent instanceof TaskContainer) {
                $parent->addTask($child);
                continue;
            }

            $project = $this->project === null ? $parent->project : $this->project;
            $realChild = $ih->createElement($project, $parent, $child->getTag());

            $childWrapper->setProxy($realChild);
            if ($realChild instanceof Task) {
                $realChild->setRuntimeConfigurableWrapper($childWrapper);
            }

            $childWrapper->maybeConfigure($this->project);
            $child->handleChildren($realChild, $childWrapper);
        }
    }
1124780
public function setParent(Container $parent = null)
        {
            if ($parent === $this) {
                throw new Exception(
                    'A page cannot have itself as a parent');
            }

            // return if the given parent already is parent
            if ($parent === $this->_parent) {
                return $this;
            }

            // remove from old parent
            if (null !== $this->_parent) {
                $this->_parent->removePage($this);
            }

            // set new parent
            $this->_parent = $parent;

            // add to parent if page and not already a child
            if (null !== $this->_parent && !$this->_parent->hasPage($this, false)) {
                $this->_parent->addPage($this);
            }

            return $this;
        }
892658
public function inContext($bucket, $parent = null)
    {
        $this->bucket = (object) ['id' => $bucket];
        if ($parent) $this->parent = (object) ['id' => $parent];
    }