public function object($sName) { return parent::get($sName); }
public function display(UI $aUI, IHashTable $aVariables = null, IOutputStream $aDevice = null) { $sTemplateName = $this->templateName(); $sSubTemplateName = $this->subTemplateName(); if (!$sTemplateName and !$sSubTemplateName) { throw new Exception("显示UI控件时遇到错误,UI控件尚未设置模板文件", $this->id()); } if (!$aVariables) { $aVariables = new HashTable(); } $oldWidget = $aVariables->get('theWidget'); $aVariables->set('theWidget', $this); $aVariables->set('theUI', $aUI); if ($sTemplateName) { $aUI->display($sTemplateName, $aVariables, $aDevice); } else { if (!function_exists($sSubTemplateName)) { throw new Exception("正在调用无效的子模板:%s %s", array($sSubTemplateName, $this->id())); } call_user_func_array($sSubTemplateName, array($aVariables, $aDevice)); } $aVariables->set('theWidget', $oldWidget); }