Adds the specified component to the IContainer.
@param  IComponent
@param  string
@param  string
@return self
@throws Nette\InvalidStateException
494886
public function addComponent(IComponent $component, $name, $insertBefore = NULL)
	{
		if ($name === NULL) {
			$name = $component->getName();
		}

		if (is_int($name)) {
			$name = (string) $name;

		} elseif (!is_string($name)) {
			throw new Nette\InvalidArgumentException(sprintf('Component name must be integer or string, %s given.', gettype($name)));

		} elseif (!preg_match('#^[a-zA-Z0-9_]+\z#', $name)) {
			throw new Nette\InvalidArgumentException("Component name must be non-empty alphanumeric string, '$name' given.");
		}

		if (isset($this->components[$name])) {
			throw new Nette\InvalidStateException("Component with name '$name' already exists.");
		}

		// check circular reference
		$obj = $this;
		do {
			if ($obj === $component) {
				throw new Nette\InvalidStateException("Circular reference detected while adding component '$name'.");
			}
			$obj = $obj->getParent();
		} while ($obj !== NULL);

		// user checking
		$this->validateChildComponent($component);

		try {
			if (isset($this->components[$insertBefore])) {
				$tmp = [];
				foreach ($this->components as $k => $v) {
					if ($k === $insertBefore) {
						$tmp[$name] = $component;
					}
					$tmp[$k] = $v;
				}
				$this->components = $tmp;
			} else {
				$this->components[$name] = $component;
			}
			$component->setParent($this, $name);

		} catch (\Exception $e) {
			unset($this->components[$name]); // undo
			throw $e;
		}
		return $this;
	}
3835
public static function factory(IComponent $component, array $events, $callbackOnSuccess = 'onSuccess', $callbackOnException = 'onException'): IEventContainer
    {
        $instance = new self($component, $events, $callbackOnSuccess, $callbackOnException);
        return $instance;
    }
109487
protected function marshall(QtiComponent $component)
    {
        $element = static::getDOMCradle()->createElement($component->getQtiClassName());

        $this->setDOMElementAttribute($element, 'select', $component->getSelect());
        $this->setDOMElementAttribute($element, 'withReplacement', $component->isWithReplacement());
        
        if (($xml = $component->getXml()) !== null) {
            $selectionElt = $xml->documentElement->cloneNode(true);
            
            Utils::importChildNodes($selectionElt, $element);
            Utils::importAttributes($selectionElt, $element);
        }

        return $element;
    }
1131544
public void add(final WComponent component, final Serializable... constraints) {
		add(component);

		if (constraints != null && constraints.length > 0) {
			PanelModel model = getOrCreateComponentModel();

			if (model.layoutConstraints == null) {
				model.layoutConstraints = new HashMap<>();
			}

			model.layoutConstraints.put(component, constraints);
		}
	}
167259
public JComponent addScreenControl(Container parent, Converter fieldInfo)
    {
        JComponent component = this.createScreenComponent(fieldInfo);
        if (component instanceof ScreenComponent)
            if (((ScreenComponent)component).getConverter() != null)
                fieldInfo = (Converter)((ScreenComponent)component).getConverter();
        this.addScreenComponent(parent, fieldInfo, component);
        return component;
    }
378533
public function addContainerPlugin(ContainerPluginInterface $plugin)
    {
        if ($this->hasContainerPlugin($plugin->getName())) {
            throw new PluginException(sprintf(
                'Container plugin named "%s" is already registered.',
                $plugin->getName()
            ));
        }

        if ($plugin instanceof PluginRegistryAwareInterface) {
            $plugin->setPluginRegistry($this);
        }

        $this->containerPlugins[$plugin->getName()] = $plugin;
    }
1280798
protected <T extends IComponent> void addComponent(Class<T> componentType, T component) {
        components.put(componentType, component);
    }
562396
public function getComponent($name, $need = TRUE)
	{
		if (isset($this->components[$name])) {
			return $this->components[$name];
		}

		if (is_int($name)) {
			$name = (string) $name;

		} elseif (!is_string($name)) {
			throw new Nette\InvalidArgumentException(sprintf('Component name must be integer or string, %s given.', gettype($name)));

		} else {
			$a = strpos($name, self::NAME_SEPARATOR);
			if ($a !== FALSE) {
				$ext = (string) substr($name, $a + 1);
				$name = substr($name, 0, $a);
			}

			if ($name === '') {
				if ($need) {
					throw new Nette\InvalidArgumentException('Component or subcomponent name must not be empty string.');
				}
				return;
			}
		}

		if (!isset($this->components[$name])) {
			$component = $this->createComponent($name);
			if ($component) {
				if (!$component instanceof IComponent) {
					throw new Nette\UnexpectedValueException('Method createComponent() did not return Nette\ComponentModel\IComponent.');

				} elseif (!isset($this->components[$name])) {
					$this->addComponent($component, $name);
				}
			}
		}

		if (isset($this->components[$name])) {
			if (!isset($ext)) {
				return $this->components[$name];

			} elseif ($this->components[$name] instanceof IContainer) {
				return $this->components[$name]->getComponent($ext, $need);

			} elseif ($need) {
				throw new Nette\InvalidArgumentException("Component with name '$name' is not container and cannot have '$ext' component.");
			}

		} elseif ($need) {
			$hint = Nette\Utils\ObjectMixin::getSuggestion(array_merge(
				array_keys($this->components),
				array_map('lcfirst', preg_filter('#^createComponent([A-Z0-9].*)#', '$1', get_class_methods($this)))
			), $name);
			throw new Nette\InvalidArgumentException("Component with name '$name' does not exist" . ($hint ? ", did you mean '$hint'?" : '.'));
		}
	}
1205856
@SuppressWarnings("unused")
    public static void addTo(
        AbstractSingleComponentContainer componentContainer,
        int scrollBarrier,
        int barrierMargin,
        String styleName) {

        new CmsScrollPositionCss(componentContainer, scrollBarrier, barrierMargin, styleName);
    }
59589
public function addLabel($label, $before=false, $icon=NULL) {
		$this->tagName="div";
		$this->addToProperty("class", "labeled");
		$this->content=new HtmlButton("button-" . $this->identifier, $this->content);
		$this->content->setTagName("div");
		$label=new HtmlLabel("label-" . $this->identifier, $label, "a");
		if(isset($icon))
			$label->addIcon($icon);
		$label->setBasic();
		$this->addContent($label, $before);
		return $label;
	}
299441
protected ComponentContainer createContainer(@Nullable ComponentContainer parent) {
    if (parent == null) {
      return new ComponentContainer();
    }
    return parent.createChild();
  }
881134
public void init(ImageIcon imageBackground, Color colorBackground, Container compAnchor)
    {
        m_imageBackground = imageBackground;
        m_compAnchor = compAnchor;
        if (colorBackground != null)
            this.setBackground(colorBackground);
    }
317392
public void addChildComponent(final WicketField<?> parent)
	{
		if ((parent.getChildren() != null) && !parent.getChildren().isEmpty())
		{
			for (final SimpleTag iterable_element : parent.getChildren())
			{
				final WicketField<?> field = (WicketField<?>)iterable_element;
				final Component c = parent.getComponent();
				if (c instanceof MarkupContainer)
				{
					final MarkupContainer mc = (MarkupContainer)c;
					mc.add(field.getComponent());
				}
				addChildComponent(field);
			}
		}
	}
400266
public function addComponent(ComponentInterface $component)
    {
        $component->preMergeParams($this);
        return $this->overwriteWith($component->toArray());
    }
27871
public static function fromComponent(IColumnComponent $component) : ChartAxis
    {
        return new self($component->getName(), $component->getLabel(), [$component]);
    }
7951
public function create($model, string $column): Component
    {
        if (!isset($this->panelElementTypes[$model->type])) {
            throw ComponentNotFound::forModel($model);
        }

        $className = $this->panelElementTypes[$model->type];

        return new $className(
            $model,
            $this->templateEngine,
            $this->colorRotate,
            $this->scopeMatcher,
            $column
        );
    }
728158
private static MutablePicoContainer createContainer(ComponentContainer parent) {
    ComponentMonitor componentMonitor = new NullComponentMonitor();
    ReflectionLifecycleStrategy lifecycleStrategy = new StopSafeReflectionLifecycleStrategy(componentMonitor) {
      @Override
      public boolean isLazy(ComponentAdapter<?> adapter) {
        return adapter.getComponentImplementation().getAnnotation(EagerStart.class) == null;
      }
    };

    return new DefaultPicoContainer(new OptInCaching(), lifecycleStrategy, parent.getPicoContainer(), componentMonitor);
  }