Inheritance: extends Component, implements Nette\ComponentModel\IContainer
Beispiel #1
0
 /**
  * Data grid column constructor.
  * @param  string  textual caption of column
  * @param  int     maximum number of dislayed characters
  */
 public function __construct($caption = NULL, $maxLength = NULL)
 {
     parent::__construct();
     $this->addComponent(new Nette\ComponentModel\Container(), 'filters');
     $this->header = Html::el();
     $this->cell = Html::el();
     $this->caption = $caption;
     if ($maxLength !== NULL) {
         $this->maxLength = $maxLength;
     }
     $this->monitor('DataGrid\\DataGrid');
 }
Beispiel #2
0
 /**
  * Returns component specified by name or path.
  *
  * @param  string
  * @param  bool   throw exception if component doesn't exist?
  * @return IComponent|NULL
  */
 public function getComponent($name, $need = TRUE)
 {
     $origName = $name;
     if (($pos = strpos($name, self::NAME_SEPARATOR)) !== FALSE) {
         $name = substr($name, 0, $pos);
     }
     if (array_search($name, $this->registered) === FALSE && $this->widgetList->exists($name)) {
         $this->registered[] = $name;
         $this->addComponent($this->widgetList->get($name), $name);
     }
     return parent::getComponent($origName, $need);
 }
Beispiel #3
0
 protected function attached($obj)
 {
     parent::attached($obj);
     if ($obj instanceof FilterComponent) {
         /** @var Form $cmp */
         foreach ($this->getComponents() as $cmp) {
             if ($this->isAjax()) {
                 $cmp->getElementPrototype()->appendAttribute('class', 'ajax');
             }
             $cmp->onSuccess[] = [$obj, 'successForm'];
             $cmp->setDefaults($obj->getFilterValues());
         }
     }
 }
Beispiel #4
0
 /**
  * @param \Nette\ComponentModel\Container $parent
  * @throws \Nette\InvalidStateException
  * @return void
  */
 protected function attached($parent)
 {
     if ($parent instanceof Nette\Forms\Form) {
         if ($parent->getMethod() !== Nette\Forms\Form::POST) {
             throw new Nette\InvalidStateException('File upload requires method POST.');
         }
         $parent->getElementPrototype()->enctype = 'multipart/form-data';
     } elseif ($parent instanceof Nette\Application\UI\Presenter) {
         if (!$this->httpRequest) {
             $this->httpRequest = $parent->getContext()->httpRequest;
             $this->httpResponse = $parent->getContext()->httpResponse;
         }
     }
     parent::attached($parent);
 }
 /**
  */
 public function __construct(Nette\ComponentModel\IContainer $parent = NULL, $name = NULL)
 {
     $this->monitor('Nette\\Application\\UI\\Presenter');
     parent::__construct($parent, $name);
 }
Beispiel #6
0
 /**
  * Adds the specified component to the IContainer.
  * @param  Nette\ComponentModel\IComponent
  * @param  string
  * @param  string
  * @return self
  * @throws Nette\InvalidStateException
  */
 public function addComponent(Nette\ComponentModel\IComponent $component, $name, $insertBefore = NULL)
 {
     parent::addComponent($component, $name, $insertBefore);
     if ($this->currentGroup !== NULL && $component instanceof IControl) {
         $this->currentGroup->add($component);
     }
     return $this;
 }
 /**
  * @return void
  */
 protected function validateParent(Nette\ComponentModel\IContainer $parent)
 {
     parent::validateParent($parent);
     $this->monitor('Nette\\Application\\UI\\Presenter');
 }
Beispiel #8
0
 public function attached($niceUrl)
 {
     parent::attached($niceUrl);
     $this->prefix = $this->lookupPath('Zax\\Application\\Routers\\NiceUrl\\NiceUrl');
 }
Beispiel #9
0
 /**
  * @return void
  */
 protected function validateParent(Nette\ComponentModel\IContainer $parent)
 {
     parent::validateParent($parent);
     $this->monitor(Presenter::class);
 }
 public function addComponent(IComponent $component, $name, $insertBefore = NULL)
 {
     if (!$component instanceof IBuilder) {
         throw new InvalidArgumentException("IBuilder expected, instance of " . get_class($component) . ' given.');
     }
     $this->container[$name] = $component->getFormComponent();
     return parent::addComponent($component, $name, $insertBefore);
 }
Beispiel #11
0
 public function __construct($caption, $icon = null)
 {
     parent::__construct();
     $this->caption = $caption;
     $this->icon = $icon;
 }
Beispiel #12
0
 public function __call($name, $args)
 {
     if ($callback = Nette\Utils\ObjectMixin::getExtensionMethod(__CLASS__, $name)) {
         return Nette\Utils\Callback::invoke($callback, $this, ...$args);
     }
     return parent::__call($name, $args);
 }