public function bindComponentToClient(__IComponent &$component) { $cep = new __HtmlElementProperty($component->getId(), 'value'); $cep->setValueDomain(__ClientValueHolder::VALUE_DOMAIN_BOOL); __UIBindingManager::getInstance()->bind(new __ComponentProperty($component, 'value'), $cep); __UIBindingManager::getInstance()->bind(new __ComponentProperty($component, 'caption'), new __HtmlElementCallback($component->getId() . '_caption', 'update')); }
/** * Gets a {@link __UIBindingManager} singleton instance * * @return __UIBindingManager */ public static function &getInstance() { if (self::$_instance == null) { self::$_instance = new __UIBindingManager(); } return self::$_instance; }
public function bindComponentToClient(__IComponent &$component) { $component_id = $component->getId(); $cep = new __JavascriptCallback($component_id, 'execute'); $cep->setExecuteAlways(true); __UIBindingManager::getInstance()->bindFromServerToClient(new __ComponentProperty($component, 'lastResponse'), $cep); }
public function bindComponentToClient(__IComponent &$component) { $sep = new __ComponentProperty($component, 'response'); $cep = new __HtmlElementCallback($component->getId(), 'update'); $cep->setSynchronizationPrefilterCallback(new __Callback($component, 'isUnsynchronized')); __UIBindingManager::getInstance()->bindFromServerToClient($sep, $cep); }
/** * Updates client end-point with values received from request: * * @param __IRequest $request * @param __IResponse $response */ public function preFilter(__IRequest &$request, __IResponse &$response) { //update client end-points with values received from request: $request_component_values = __ContextManager::getInstance()->getApplicationContext()->getPropertyContent('REQUEST_CLIENT_ENDPOINT_VALUES'); if ($request->hasParameter($request_component_values)) { $values = $request->getParameter($request_component_values); if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { $scape_chars = array('\\n', '\\r', '\\t'); $double_scape_chars = array('\\\\n', '\\\\r', '\\\\t'); $values = str_replace($scape_chars, $double_scape_chars, $values); $values = stripslashes($values); } $client_values = json_decode($values, true); if (is_array($client_values)) { $ui_binding_manager = __UIBindingManager::getInstance(); foreach ($client_values as $id => $value) { if ($ui_binding_manager->hasUIBinding($id)) { $ui_binding_manager->getUIBinding($id)->getClientEndPoint()->setValue($value); } else { if ($request->hasParameter('viewCode')) { $view_code = $request->getParameter('viewCode'); __ComponentLazyLoader::loadView($view_code); if ($ui_binding_manager->hasUIBinding($id)) { $ui_binding_manager->getUIBinding($id)->getClientEndPoint()->setValue($value); } else { throw __ExceptionFactory::getInstance()->createException('Can not sync component status between client and server'); } } } } } } }
private function _getComponentSetupCommands(__IComponent &$component) { $return_value = array(); //update client end-point with current component state: $component->updateClient(); //get all commands from client end-points $binding_codes = $component->getBindingCodes(); foreach ($binding_codes as $binding_code) { $ui_binding = __UIBindingManager::getInstance()->getUIBinding($binding_code); if ($ui_binding != null) { $command = $ui_binding->getClientEndPoint()->getSetupCommand(); if ($command != null) { $return_value[] = $command; } } } $handled_events = __EventHandlerManager::getInstance()->getEventHandler($component->getViewCode())->getComponentHandledEvents($component->getName()); foreach ($handled_events as $handled_event) { if ($handled_event != 'submit') { $command = new __AsyncMessageCommand(); $command->setClass('__RegisterEventListenerCommand'); $command->setData(array('element' => $component->getId(), 'event' => $handled_event)); $return_value[] = $command; } } return $return_value; }
public function bindComponentToClient(__IComponent &$component) { $this->_component_writer->bindComponentToClient($component); $component_id = $component->getId(); $cep = new __HtmlSelectiveElementCallback($component_id); $cep->addMappingCallback(true, 'show'); $cep->addMappingCallback(false, 'hide'); __UIBindingManager::getInstance()->bindFromServerToClient(new __ComponentProperty($component, 'visible'), $cep); __UIBindingManager::getInstance()->bindFromClientToServer(new __ComponentProperty($component, 'visible'), new __HtmlElementAccessor($component_id, 'visible')); __UIBindingManager::getInstance()->bind(new __ComponentProperty($component, 'disabled'), new __HtmlElementProperty($component_id, 'disabled')); }
public function bindComponentToClient(__IComponent &$component) { $component_id = $component->getId(); if ($component->getModal()) { $show_code = $component_id . '.showCenter(true);'; } else { $show_code = $component_id . '.showCenter();'; } $js_code = 'if({value} == 1) {' . $show_code . '} else {' . $component_id . '.close();}'; $cep = new __JavascriptOnDemand($js_code); __UIBindingManager::getInstance()->bindFromServerToClient(new __ComponentProperty($component, 'visible'), $cep); $cep = new __JavascriptCallback($component_id, 'setHTMLContent'); __UIBindingManager::getInstance()->bindFromServerToClient(new __ComponentProperty($component, 'content'), $cep); $cep = new __JavascriptObjectProperty($component_id, 'url'); __UIBindingManager::getInstance()->bindFromServerToClient(new __ComponentProperty($component, 'url'), $cep); $cep = new __JavascriptObjectProperty($component_id, 'title'); __UIBindingManager::getInstance()->bindFromServerToClient(new __ComponentProperty($component, 'title'), $cep); $cep = new __JavascriptObjectProperty($component_id, 'width'); __UIBindingManager::getInstance()->bindFromServerToClient(new __ComponentProperty($component, 'width'), $cep); $cep = new __JavascriptObjectProperty($component_id, 'height'); __UIBindingManager::getInstance()->bindFromServerToClient(new __ComponentProperty($component, 'height'), $cep); }
public function bindComponentToClient(__IComponent &$component) { __UIBindingManager::getInstance()->bind(new __ComponentProperty($component, 'value'), new __JavascriptObjectProperty($component->getId(), 'value')); }
public function bindComponentToClient(__IComponent &$component) { __UIBindingManager::getInstance()->bind(new __ComponentProperty($component, 'errorMessage'), new __ShowErrorMessage($component->getId())); }
public function bindComponentToClient(__IComponent &$component) { $component_id = $component->getId(); __UIBindingManager::getInstance()->bindFromServerToClient(new __ComponentProperty($component, 'caption'), new __JavascriptObjectProperty($component_id, 'caption')); __UIBindingManager::getInstance()->bind(new __ComponentProperty($component, 'value'), new __JavascriptObjectProperty($component_id, 'value')); }
public function bindComponentToClient(__IComponent &$component) { $sep = new __ComponentProperty($component, 'data'); $cep = new __JavascriptObject($component->getId()); __UIBindingManager::getInstance()->bind($sep, $cep); }
public function bindComponentToClient(__IComponent &$component) { __UIBindingManager::getInstance()->bindFromServerToClient(new __ComponentProperty($component, 'text'), new __HtmlElementCallback($component->getId(), 'update')); }
public function bindComponentToClient(__IComponent &$component) { __UIBindingManager::getInstance()->bind(new __ComponentProperty($component, 'itemValues'), new __HtmlElementProperty($component->getId(), 'items')); __UIBindingManager::getInstance()->bind(new __ComponentProperty($component, 'selectedIndex'), new __HtmlElementProperty($component->getId(), 'selectedIndex')); }
/** * Forces an update for all client end-points associated with current component. * */ public function updateClient() { foreach ($this->_binding_codes as $binding_code) { $ui_binding = __UIBindingManager::getInstance()->getUIBinding($binding_code); if ($ui_binding != null) { $ui_binding->synchronizeClient(); } } }