Beispiel #1
0
 public function __construct($sName = null, $sTemplate = null, $bVagrantContainer = true, UI $aUI = null)
 {
     parent::__construct("org\\jecat\\framework\\mvc\\view\\IView");
     if (!$sName) {
         if (!$sTemplate) {
             throw new Exception("创建视图时必须提供 \$sName 或 \$sTemplate");
         }
         $sName = $sTemplate;
     }
     $this->setName($sName);
     // 用于收容”流浪“视图的装配单
     if ($bVagrantContainer) {
         $this->sVagrantViewsAssemlyListId = $this->id() . '-vagrants';
         ViewAssembler::singleton()->defineAssemblyList($this->sVagrantViewsAssemlyListId, ViewAssembler::layout_vertical, array('container' => ViewAssembler::container_use_controller, 'priority' => ViewAssembler::soft, 'xpaths' => null, 'view' => $this));
     }
     $this->setTemplate($sTemplate);
     $this->setUi($aUI);
     // 消息队列过滤器
     $this->messageQueue()->filters()->add(function (Message $aMsg, $aView) {
         $aPoster = $aMsg->poster();
         // 来自视图自身的消息
         if ($aPoster == $aView) {
             return array($aMsg);
         }
         // 来自视图所拥有的窗体的消息
         if ($aPoster instanceof IViewWidget and $aView->hasWidget($aPoster)) {
             return array($aMsg);
         }
         StopFilterSignal::stop();
     }, $this);
 }
Beispiel #2
0
 public function __construct($sId = null, $sTemplateName = null, $sTitle = null, IView $aView = null)
 {
     parent::__construct();
     $this->setId($sId);
     $this->setTitle($sTitle ? $sTitle : $sId);
     $this->setTemplateName($sTemplateName);
     // 消息队列过滤器
     $this->messageQueue()->filters()->add(function ($aMsg, $aWidget) {
         if ($aMsg->poster() != $aWidget) {
             StopFilterSignal::stop();
         }
         return array($aMsg);
     }, $this);
     if ($aView) {
         $aView->addWidget($this);
     }
 }