コード例 #1
0
ファイル: ELTest.php プロジェクト: robo47/BlazeFramework
 protected function setUp()
 {
     $test1 = new ATest();
     $test1->setLabel(true);
     $test1->setName(10);
     $test1->setValue('MyValue1');
     $test2 = new ATest();
     $test2->setLabel('MyLabel2');
     $test2->setName('value');
     $test2->setValue($test1);
     $test3 = new ATest();
     $test3->setLabel('label');
     $test3->setName($test1);
     $test3->setValue('name');
     $netApp = \blazeServer\source\netlet\NetletApplication::getAdminApplication();
     $netlets = $netApp->getNetletContext()->getNetlets();
     \ob_start();
     // Need to do this because PHPUnit does something weird..
     set_error_handler(array('blaze\\lang\\System', 'systemErrorHandler'));
     $this->markTestIncomplete('getClass() alsways fails because of Call to a member function getClass() on a non-object');
     $app = $netlets->get('BlazeNetlet')->getClass()->getField('application')->get($netlets->get('BlazeNetlet'));
     $this->bCtx = new \blaze\web\application\BlazeContext($app, new \blazeServer\source\netlet\http\HttpNetletRequestImpl(), new \blazeServer\source\netlet\http\HttpNetletResponseImpl());
     \ob_clean();
     $this->bCtx = \blaze\web\application\BlazeContext::getCurrentInstance();
     $this->bCtx->getELContext()->setContext(ELContext::SCOPE_REQUEST, new scope\ELRequestScopeContext(new \blaze\collections\map\HashMap()));
     $this->bCtx->getELContext()->getContext(ELContext::SCOPE_REQUEST)->set($this->bCtx, 'test1', $test1);
     $this->bCtx->getELContext()->getContext(ELContext::SCOPE_REQUEST)->set($this->bCtx, 'test2', $test2);
     $this->bCtx->getELContext()->getContext(ELContext::SCOPE_REQUEST)->set($this->bCtx, 'test3', $test3);
 }
コード例 #2
0
ファイル: ELResolver.php プロジェクト: robo47/BlazeFramework
 private function getValueFromContext($key)
 {
     $ctx = \blaze\web\application\BlazeContext::getCurrentInstance();
     $key = \blaze\lang\String::asNative($key);
     $val = $this->context->getContext(ELContext::SCOPE_REQUEST)->get($ctx, $key);
     if ($val != null) {
         return $val;
     }
     $val = $this->context->getContext(ELContext::SCOPE_VIEW)->get($ctx, $key);
     if ($val != null) {
         return $val;
     }
     $val = $this->context->getContext(ELContext::SCOPE_SESSION)->get($ctx, $key);
     if ($val != null) {
         return $val;
     }
     $val = $this->context->getContext(ELContext::SCOPE_APPLICATION)->get($ctx, $key);
     if ($val != null) {
         return $val;
     }
     return null;
 }
コード例 #3
0
 public function processValueChange(ValueChangeEvent $event)
 {
     $this->expression->invoke(\blaze\web\application\BlazeContext::getCurrentInstance(), array($event));
 }
コード例 #4
0
 public function processAction(ActionEvent $obj)
 {
     $this->expression->invoke(\blaze\web\application\BlazeContext::getCurrentInstance(), array($event));
 }
コード例 #5
0
 protected function invokeResolvedExpression(\blaze\web\el\Expression $expr = null, $args = null)
 {
     if ($expr == null) {
         return null;
     }
     if (!$expr->isValid()) {
         return $expr->getExpressionString();
     }
     $context = \blaze\web\application\BlazeContext::getCurrentInstance();
     $args = func_get_args();
     array_shift($args);
     return $expr->invoke($context, $args);
 }