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); }
function __construct($params = null, $sName = null, $bBuildAtonce = true) { $this->setName($sName); parent::__construct("org\\jecat\\framework\\mvc\\controller\\Controller"); $this->buildParams($params); // auto build bean config if ($bBuildAtonce and $arrConfig = $this->createBeanConfig()) { $this->buildBean($arrConfig); } $this->init(); }