예제 #1
0
 /**
  *
  * @param string $name
  * @param closure $newMethod 
  */
 public function __construct($name, $newMethod)
 {
     Args::isString($name, 'name');
     Args::callBackArgs($newMethod, 1, 'newMethod');
     $this->name = $name;
     $this->newMethod = new SerializableClosure($newMethod);
 }
예제 #2
0
 /**
  *
  * @param closure $callback 
  */
 public function notify($callback)
 {
     Args::callBackArgs($callback, 1, 'callback');
     foreach ($this->listeners as $listener) {
         $callback($listener);
     }
 }
예제 #3
0
 public function __construct($id, $callback, $callDecorator = null)
 {
     parent::__construct($id);
     Args::callBackArgs($callback, 1, 'callback');
     $this->eventBehaviour = new AjaxEventBehaviour('onclick', $callback);
     $this->add($this->eventBehaviour);
     $this->callback = $callback;
 }
예제 #4
0
 public function __construct($event, $callback)
 {
     parent::__construct();
     Args::isString($event, 'event');
     Args::callBackArgs($callback, 1, 'callback');
     $this->event = $event;
     $this->callback = $callback;
 }
예제 #5
0
 /**
  *
  * @param Tab $tab
  * @param closure $newMethod 
  */
 public function addTab($tab, $newMethod = null)
 {
     if ($tab instanceof Tab) {
         array_push($this->tabs, $tab);
     } else {
         Args::isString($tab, 'tab');
         Args::callBackArgs($newMethod, 1, 'newMethod');
         array_push($this->tabs, new Tab($tab, $newMethod));
     }
 }
예제 #6
0
 public function __construct($id, $columnId, $columns, $callback = null, $model = null)
 {
     parent::__construct($id, $model);
     if ($callback != null) {
         Args::callBackArgs($callback, 1, 'callback');
     }
     $this->columns = $columns;
     $this->columnId = $columnId;
     $this->callback = $callback;
 }
예제 #7
0
 /**
  *
  * @param closure $valueCallable
  * @param closure $displayCallable 
  */
 public function __construct($valueCallable = null, $displayCallable = null)
 {
     if ($valueCallable != null) {
         Args::callBackArgs($valueCallable, 2, 'valueCallable');
     }
     if ($displayCallable != null) {
         Args::callBackArgs($displayCallable, 2, 'displayCallable');
     }
     $this->displayCallable = $displayCallable;
     $this->valueCallable = $valueCallable;
 }
 /**
  *
  * @param type $name
  * @param type $function 
  * @param ... args the names of the arguments the javascript function should take
  */
 public function __construct($name, $callback, $function)
 {
     parent::__construct($name);
     Args::isString($function, 'function');
     Args::callBackArgs($callback, 1, 'callback');
     $this->callback = new SerializableClosure($callback);
     $this->function = $function;
     $args = func_get_args();
     for ($i = 3; $i < count($args); $i++) {
         array_push($this->args, $args[$i]);
     }
 }
 /**
  *
  * @param closure $decorator
  * @param closure $successDecorator
  * @param closure $failDecorator 
  */
 public function __construct($decorator, $successDecorator = null, $failDecorator = null)
 {
     Args::callBackArgs($decorator, 1, 'decorator');
     if ($successDecorator != null) {
         Args::callBackArgs($successDecorator, 1, 'successDecorator');
     }
     if ($failDecorator != null) {
         Args::callBackArgs($failDecorator, 1, 'failDecorator');
     }
     $this->decorator = $decorator;
     $this->successDecorator = $successDecorator;
     $this->failDecorator = $failDecorator;
 }
예제 #10
0
 /**
  *
  * @param string $id
  * @param array $choices
  * @param Model $model 
  */
 public function __construct($id, $choices, ChoiceRenderer $choiceRenderer = null, Model $model = null, $isDisabled = null)
 {
     parent::__construct($id, $model);
     Args::isArray($choices, 'choices');
     $this->choices = $choices;
     if ($choiceRenderer == null) {
         $choiceRenderer = new ChoiceRenderer();
     }
     $this->choiceRenderer = $choiceRenderer;
     if ($isDisabled != null) {
         Args::callBackArgs($isDisabled, 2, 'isDisabled');
         $this->isDisabled = $isDisabled;
     }
 }
 public function __construct($event, $onEvent, $onSubmit, $onError)
 {
     Args::callBackArgs($onEvent, 1, 'onEvent');
     if ($onSubmit != null) {
         Args::callBackArgs($onSubmit, 1, 'onSubmit');
     }
     if ($onError != null) {
         Args::callBackArgs($onError, 1, 'onError');
     }
     $self = $this;
     parent::__construct($event, function ($target) use($self, $onEvent, $onSubmit, $onError) {
         $formComponent = $self->getComponent();
         $formComponent->processInput();
         $onEvent($target);
         if ($formComponent->isValid() && $onSubmit != null) {
             $onSubmit($target);
         }
         if (!$formComponent->isValid() && $onError != null) {
             $onError($target);
         }
     });
 }
 public function __construct($event, $onSubmit = null, $onError = null, $form = null)
 {
     $self = $this;
     parent::__construct($event, function ($target) use($self) {
         $self->setAjaxRequestTarget($target);
         $self->getForm()->process($self);
     });
     if ($onSubmit != null) {
         Args::callBackArgs($onSubmit, 1, 'onSubmit');
     }
     if ($onError != null) {
         Args::callBackArgs($onError, 1, 'onError');
     }
     $this->onSubmit = $onSubmit;
     $this->onError = $onError;
     if ($form != null) {
         if ($form instanceof Form) {
             $this->form = $form;
         } else {
             throw new \InvalidArgumentException('$form must be an instance of Form');
         }
     }
 }
예제 #13
0
 public function __construct($heading, $callback)
 {
     Args::callBackArgs($callback, 2, 'callback');
     $this->callback = $callback;
 }
예제 #14
0
 /**
  * Recursivly visit all child components matching the Identifier and execute
  * a callback on each
  * @param Identifier $identifier
  * @param closure $callback 
  */
 public function visitChildren(Identifier $identifier, $callback)
 {
     Args::callBackArgs($callback, 1, 'callback');
     $this->internalVisitChildren($identifier, $this->getChildren(), $callback);
 }
예제 #15
0
 /**
  *
  * @param String $id
  * @param closure $callback
  * @param Model $model optional
  */
 public function __construct($id, $callback, $model = null)
 {
     parent::__construct($id, $model);
     Args::callBackArgs($callback, 1, 'callback');
     $this->callback = $callback;
 }
예제 #16
0
 public function setBeforeClose($beforeClose, $function = '')
 {
     Args::callBackArgs($beforeClose, 1, 'beforeClose');
     $this->getOptions()->add(new CallbackFunctionOption('beforeClose', $beforeClose, $function));
 }
예제 #17
0
 public function setRenderHeadCallback($renderHeadCallback)
 {
     Args::callBackArgs($renderHeadCallback, 2, 'renderHeadCallback');
     $this->renderHeadCallback = $renderHeadCallback;
 }
예제 #18
0
 public function setStopCallback($stopCallback, $jsCode = '')
 {
     Args::callBackArgs($stopCallback, 1, 'stopCallback');
     $this->getOptions()->add(new CallbackFunctionOption('stop', $stopCallback, $jsCode, 'event', 'ui'));
 }