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; } }
public function execute(INotification $oNote) { require 'DjBpmMediator.php'; require 'DjControlProxy.php'; /* setup the view */ $this->facade->registerMediator(new DjBpmMediator()); /* setup the model*/ $iAmount = $oNote->getBody(); $sCommandType = $oNote->getType(); $oDjControlProxy = new DjControlProxy(); $this->facade->registerProxy($oDjControlProxy); switch ($sCommandType) { case '<<': $oDjControlProxy->decBpm(); break; case '>>': $oDjControlProxy->incBpm(); break; case 'set': $oDjControlProxy->setBpm($iAmount); break; default: break; } /* save our changes and the view automatically gets updated! */ $oDjControlProxy->save(); $this->oDjControlProxy = $oDjControlProxy; }
/** * Override execute to add logic. In the <code>StartModelCommand</code> * the ApplicationDataProxy is started and registered, and then * the selected CSS file is loaded. */ public function execute(INotification $notification) { $view = $notification->getBody(); $cssFileName = $notification->getType(); $applicationDataProxy = new ApplicationDataProxy(); $this->facade->registerProxy($applicationDataProxy); $applicationDataProxy->loadCSS($cssFileName); }
/** * 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; } }
/** * 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; } }