/** * Factory method for component creation according to the given parameters. * * example of usage * <code> * //create a component by giving a tag name * $commandlink = __ComponentFactory::getInstance()->createComponent("commandlink"); * * //create a component by giving a component spec: * $commandlink_spec = __ComponentSpecFactory::getInstance()->createComponentSpec("commandlink"); * $commandlink = __ComponentFactory::createComponent($commandlink_spec); * </code> * * @param mixed $component_spec_or_tag A {@link __ComponentSpec} instance or a tag name * * @return __IComponent */ public function &createComponent($component_spec_or_tag, $component_index = null) { $return_value = null; if ($component_spec_or_tag instanceof __ComponentSpec) { $return_value = $this->_doCreateComponent($component_spec_or_tag, $component_index); } else { if (is_string($component_spec_or_tag)) { $component_spec = __ComponentSpecFactory::getInstance()->createComponentSpec($component_spec_or_tag); $return_value = $this->_doCreateComponent($component_spec, $component_index); } } return $return_value; }
protected function _generateRemoteServiceCode($method_name, $arguments = array()) { $component_name = $method_name; $component_handler = __ComponentHandlerManager::getInstance()->getComponentHandler($this->_event_handler->getViewCode()); //get the remote_service_writer: $remote_service_spec = __ComponentSpecFactory::getInstance()->createComponentSpec('remoteservice'); $remote_service_spec->setId(substr(md5($this->_view_code . ':' . $method_name), 0, 8)); $remote_service_writer = $remote_service_spec->getWriter(); if ($component_handler->hasComponent($component_name)) { $remote_service = $component_handler->getComponent($component_name); } else { $remote_service = __ComponentFactory::getInstance()->createComponent($remote_service_spec); $remote_service->setName($component_name); foreach ($arguments as $argument_name => $argument_value) { $remote_service->{$argument_name} = $argument_value; } $component_handler->registerComponent($remote_service); } $remote_service_writer->bindComponentToClient($remote_service); $remote_service_writer->startRender($remote_service); }
function yy_r10() { //Setup and validate current component: $tag_name = $this->_getTagName($this->yystack[$this->yyidx + 0]->minor); $component_spec = __ComponentSpecFactory::getInstance()->createComponentSpec($tag_name); $attribute_list = $this->_getAttributeList($this->yystack[$this->yyidx + 0]->minor); $component_spec->setDefaultValues($attribute_list); $component_spec->setViewCode($this->_view_code); $this->_registerComponentSpec($component_spec); $this->_pushComponentSpec($component_spec); $this->_retvalue = $this->_getComponentBeginTagCode($component_spec); }