Inheritance: extends Component, implements Nette\ComponentModel\IContainer
Esempio n. 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');
 }
Esempio n. 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);
 }
Esempio n. 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());
         }
     }
 }
Esempio n. 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);
 }
Esempio n. 5
0
 /**
  */
 public function __construct(Nette\ComponentModel\IContainer $parent = NULL, $name = NULL)
 {
     $this->monitor('Nette\\Application\\UI\\Presenter');
     parent::__construct($parent, $name);
 }
Esempio n. 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;
 }
Esempio n. 7
0
 /**
  * @return void
  */
 protected function validateParent(Nette\ComponentModel\IContainer $parent)
 {
     parent::validateParent($parent);
     $this->monitor('Nette\\Application\\UI\\Presenter');
 }
Esempio n. 8
0
 public function attached($niceUrl)
 {
     parent::attached($niceUrl);
     $this->prefix = $this->lookupPath('Zax\\Application\\Routers\\NiceUrl\\NiceUrl');
 }
Esempio n. 9
0
 /**
  * @return void
  */
 protected function validateParent(Nette\ComponentModel\IContainer $parent)
 {
     parent::validateParent($parent);
     $this->monitor(Presenter::class);
 }
Esempio n. 10
0
 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);
 }
Esempio n. 11
0
 public function __construct($caption, $icon = null)
 {
     parent::__construct();
     $this->caption = $caption;
     $this->icon = $icon;
 }
Esempio n. 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);
 }