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 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 execute(INotification $note) { if (!$note->getBody()) { $layoutMediator = $this->facade->retrieveMediator(LayoutMediator::NAME); $layoutMediator->alert('Add User Role', 'Role already exists for this user!'); } }
/** * get the current bpm value from the notification, load our templates * and provide them w/ data they need. as well, some of the data is * generated by us here. */ public function handleNotification(INotification $oNote) { $this->iBpm = $oNote->getBody(); /* set template values */ $this->sBpmGraphic = $this->renderBpmGraphic(); include 'layout.php'; }
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; }
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; } }
/** * Prints the view to the browser when the VIEW_DATA_READY * notification is sent. */ private function _printDisplay(INotification $notification) { $viewData = $notification->getBody(); $css = $viewData['css']; $template = $this->getApplicationView()->getViewTemplate(); $output = str_replace("{css}", $css, $template); print $output; }
/** * 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); }
public function execute(INotification $note) { $user = $note->getBody(); $userProxy = $this->facade->retrieveProxy(UserProxy::NAME); $roleProxy = $this->facade->retrieveProxy(RoleProxy::NAME); $userProxy->deleteItem($user); $roleProxy->deleteItem($user); $this->sendNotification(AppFacade::USER_DELETED); }
/** * Fabricate a result by multiplying the input by 2 * * @param INotification $note the Notification carrying the FacadeTestVO */ public function execute(INotification $note) { $vo = $note->getBody(); $vo->result2 = $vo->input * $vo->input; }
/** * A function that is used as the observer notification * method. It multiplies the input number by the * observerTestVar value */ public function observerTestMethod(INotification $note) { $this->observerTestVar = $note->getBody(); }
/** * The <code>execute()</code> method is overridden in order * to add your application logic for this specific command. */ public function execute(INotification $notification) { $view = $notification->getBody(); $this->facade->registerMediator(new ApplicationMediator(new ApplicationView($view))); }
/** * 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; } }
/** * A utility method to test the notification of Observers by the view * * @param INotification $note */ public function viewTestMethod(INotification $note) { $this->viewTestVar = $note->getBody(); }