public function handleNotification(INotification $note)
 {
     switch ($note->getName()) {
         case AppFacade::NEW_USER:
             $this->clearForm();
             break;
         case AppFacade::USER_ADDED:
             $this->rolePanel->user = $note->getBody();
             $this->roleProxy->addItem(new RoleVO($this->rolePanel->user->username));
             $this->clearForm();
             break;
         case AppFacade::USER_UPDATED:
             $this->clearForm();
             break;
         case AppFacade::USER_DELETED:
             $this->clearForm();
             break;
         case AppFacade::CANCEL_SELECTED:
             $this->clearForm();
             break;
         case AppFacade::USER_SELECTED:
             $this->rolePanel->user = $note->getBody();
             $this->rolePanel->setUserRoles($this->roleProxy->getUserRoles($this->rolePanel->user->username));
             $this->rolePanel->reset();
             break;
         case AppFacade::ADD_ROLE_RESULT:
             $note->getBody() && $this->rolePanel->addUserRole($note->getType(), RoleEnum::getValue($note->getType()));
             $this->rolePanel->reset();
             break;
     }
 }
Example #2
0
 public function handleNotification(INotification $notification)
 {
     if (self::$isVerbose) {
         echo $notification->getName() . PHP_EOL;
     }
     return parent::handleNotification($notification);
 }
 /**
  * Handles notifications sent by the PureMVC framework that this
  * Mediator is interested in.
  */
 public function handleNotification(INotification $notification)
 {
     switch ($notification->getName()) {
         case ApplicationFacade::VIEW_DATA_READY:
             $this->_printDisplay($notification);
             break;
         default:
             break;
     }
 }
 public function handleNotification(INotification $note)
 {
     switch ($note->getName()) {
         case AppFacade::NEW_USER:
             $this->userForm->setUser($note->getBody(), UserFormComponent::MODE_ADD);
             break;
         case AppFacade::USER_DELETED:
             $this->userForm->reset();
             break;
         case AppFacade::USER_SELECTED:
             $this->userForm->setUser($note->getBody(), UserFormComponent::MODE_EDIT);
             break;
     }
 }
 public function handleNotification(INotification $note)
 {
     switch ($note->getName()) {
         case AppFacade::CANCEL_SELECTED:
             $this->userList->deSelect();
             break;
         case AppFacade::USER_ADDED:
             $refID = $this->userProxy->getIndex($note->getBody());
             $this->userList->addUser($refID, $note->getBody());
             break;
         case AppFacade::USER_UPDATED:
             $refID = $this->userProxy->getIndex($note->getBody());
             $this->userList->updateUser($refID, $note->getBody());
             $this->userList->deSelect();
             break;
     }
 }
 /**
  * Handle Notification.
  * <P>
  * This provides the handling for common junction activities. It 
  * accepts input and output pipes in response to <code>IPipeAware</code>
  * interface calls.</P>
  * <P>
  * Override in subclass, and call <code>super.handleNotification</code>
  * if none of the subclass-specific notification names are matched.</P>
  * 
  * @param INotification $notification
  * @return void 
  */
 public function handleNotification(INotification $notification)
 {
     switch ($notification->getName()) {
         // accept an input pipe
         // register the pipe and if successful
         // set this mediator as its listener
         case JunctionMediator::ACCEPT_INPUT_PIPE:
             $inputPipeName = $notification->getType();
             $inputPipe = $notification->getBody();
             if ($this->junction > registerPipe($inputPipeName, Junction::INPUT, $inputPipe)) {
                 $this->junction->addPipeListener($inputPipeName, $this, 'handlePipeMessage');
             }
             break;
             // accept an output pipe
         // accept an output pipe
         case JunctionMediator::ACCEPT_OUTPUT_PIPE:
             $outputPipeName = $notification->getType();
             $outputPipe = $notification->getBody();
             $this->junction->registerPipe($outputPipeName, Junction::OUTPUT, $outputPipe);
             break;
     }
 }
 public function notifyObservers(INotification $notification)
 {
     if ($this->observerMap[$notification->getName()] != null) {
         $observers = $this->observerMap[$notification->getName()];
         foreach ($observers as $observer) {
             $observer->notifyObserver($notification);
         }
     }
 }
 /**
  *
  * @param notification the <b>INotification</b> to be handled
  * @see IMediator::handleNotification()
  */
 public function handleNotification(INotification $notification)
 {
     $this->viewTest()->lastNotification = $notification->getName();
 }
 /**
  * If an <code>ICommand</code> has previously been registered 
  * to handle a the given <code>INotification</code>, then it is executed.
  * 
  * @param note an <code>INotification</code>
  */
 public function executeCommand(INotification $note)
 {
     if (isset($this->commandMap[$note->getName()])) {
         $commandClassName = $this->commandMap[$note->getName()];
         $commandClassReflector = new ReflectionClass($commandClassName);
         $commandClassRef = $commandClassReflector->newInstance();
         $commandClassRef->execute($note);
     }
 }
 /**
  * Notify the <code>IObservers</code> for a particular <code>INotification</code>.
  * 
  * <P>
  * All previously attached <code>IObservers</code> for this <code>INotification</code>'s
  * list are notified and are passed a reference to the <code>INotification</code> in 
  * the order in which they were registered.</P>
  * 
  * @param notification the <code>INotification</code> to notify <code>IObservers</code> of.
  */
 public function notifyObservers(INotification $notification)
 {
     if (isset($this->observerMap[$notification->getName()])) {
         // Copy observers from reference array to working array,
         // since the reference array may change during the notification loop
         $observers = $this->observerMap[$notification->getName()];
         foreach ($observers as $observer) {
             $observer->notifyObserver($notification);
         }
     }
 }
 /**
  * Notify Observers
  *
  * Notify the <b>IObservers</b> for a particular <b>INotification</b>.
  *
  * All previously attached <b>IObservers</b> for this <b>INotification</b>'s
  * list are notified and are passed a reference to the <b>INotification</b> in
  * the order in which they were registered.
  *
  * @param INotification $notification The <b>INotification</b> to notify <b>IObservers</b> of.
  * @return void
  */
 public function notifyObservers(INotification $notification)
 {
     if (isset($this->observerMap[$notification->getName()])) {
         // Get a reference to the observers list for this notification name
         $observers_ref = $this->observerMap[$notification->getName()];
         // Copy observers from reference array to working array,
         // since the reference array may change during the notification loop
         $observers = array();
         foreach ($observers_ref as $observer) {
             array_push($observers, $observer);
         }
         // Notify Observers from the working array
         foreach ($observers as $observer) {
             $observer->notifyObserver($notification);
         }
     }
 }
 public function execute(INotification $notification)
 {
     echo $notification->getName();
 }
 /**
  * Handle notifications the <b>StateMachine</b> is interested in.
  * 
  * <b>StateMachine::ACTION</b>: Triggers the transition to a new state.<BR>
  * <b>StateMachine::CANCEL</b>: Cancels the transition if sent in response to the exiting note for the current state.<BR>
  * 
  * @param INotification $notification The <b>INotification</b> to be handled.
  * @return void
  */
 public function handleNotification(INotification $notification)
 {
     switch ($notification->getName()) {
         case StateMachine::ACTION:
             $action = $notification->getType();
             $target = $this->getCurrentState()->getTarget($action);
             $newState = $this->states[$target];
             if ($newState) {
                 $this->transitionTo($newState, $notification->getBody());
             }
             break;
         case StateMachine::CANCEL:
             $this->canceled = true;
             break;
     }
 }
 /**
  * Execute Command
  *
  * Execute the <b>ICommand</b> previously registered as the
  * handler for <b>INotification</b>s with the given notification name.
  *
  * @param INotification $notification The <b>INotification</b> to execute the associated <b>Command</b> for.
  * @return void
  */
 public function executeCommand(INotification $notification)
 {
     // if the Command is registered...
     if ($this->hasCommand($notification->getName())) {
         $commandClassName = $this->commandMap[$notification->getName()];
         $commandClassRef = new $commandClassName();
         $commandClassRef->initializeNotifier($this->multitonKey);
         $commandClassRef->execute($notification);
     }
 }