Package org.itsnat.impl.core.clientdoc

Examples of org.itsnat.impl.core.clientdoc.ClientDocumentStfulImpl


    public void stopInternal()
    {
        super.stopInternal();

        ClientDocumentStfulImpl clientDoc = getClientDocumentStful();
        ItsNatDocumentImpl itsNatDoc = getItsNatStfulDocument();
        synchronized(itsNatDoc) // Por si el stop es llamado por el hilo generador de cambios. No es necesario sincronizar los padres pues esta acci�n s�lo afecta a este documento
        {
            clientDoc.removeCometNotifier(this);
        }
    }
View Full Code Here


    {
        // Evitamos cachear con un nuevo id si todos los clientes ya usan
        // dicho id, es el caso de un nodo que ya fue "cacheado preventivamente"
        // por las vistas y se quiere una nueva referencia como string.
        ItsNatStfulDocumentImpl itsNatDoc = getItsNatStfulDocument();
        ClientDocumentStfulImpl clientDocOwner = itsNatDoc.getClientDocumentStfulOwner();
        NodeCacheRegistryImpl nodeCache = clientDocOwner.getNodeCacheRegistry(); // No puede ser nula
        final String oldId = nodeCache.getId(node);

        ClientDocStfulTask clientTask = new ClientDocStfulTask()
        {
            public boolean doTask(ClientDocumentStfulImpl clientDoc,Object arg)
            {
                boolean cached = isNodeCachedWithId(node,oldId,clientDoc);
                return cached; // true = continuar
            }
        };
        boolean res = itsNatDoc.executeTaskOnClients(clientTask,null);
        if (res) return false; // Ya est� cacheado por todos los clientes con el mismo id

        // Debe generarse un nuevo id por el documento pues algunos ids pueden compartirse entre cach�s de un mismo documento como es este caso
        String id = NodeCacheRegistryImpl.generateUniqueId(itsNatDoc);

        ClientDocumentStfulImpl[] allClient = itsNatDoc.getAllClientDocumentStfulsCopy();
        for(int i = 0; i < allClient.length; i++)
        {
            ClientDocumentStfulImpl clientDoc = allClient[i];
            preventiveNodeCaching(node,id,clientDoc);
        }

        return true;
    }
View Full Code Here

    }

    protected boolean preventiveNodeCachingOneClient(Node node)
    {
        ItsNatStfulDocumentImpl itsNatDoc = getItsNatStfulDocument();
        ClientDocumentStfulImpl clientDoc = itsNatDoc.getClientDocumentStfulOwner();
        return preventiveNodeCachingOneClient(node,clientDoc);
    }
View Full Code Here

        evt.checkInitializedEvent();

        // timers, asynctask y comet no tienen mucho sentido aqu�

        ItsNatStfulDocumentImpl itsNatDoc = evt.getItsNatStfulDocument();
        ClientDocumentStfulImpl clientDoc = evt.getClientDocumentStful();
        ItsNatDOMEventListenerRegistryImpl[] registries = new ItsNatDOMEventListenerRegistryImpl[2];
        if (evt instanceof ServerItsNatDOMStdEventImpl)
        {
            registries[0] = itsNatDoc.getDOMStdEventListenerRegistry();
            registries[1] = clientDoc.getDOMStdEventListenerRegistry();
        }
        else if (evt instanceof ServerItsNatUserEventImpl)
        {
            registries[0] = itsNatDoc.getUserEventListenerRegistry();
            registries[1] = clientDoc.getUserEventListenerRegistry();
        }
        else if (evt instanceof ServerItsNatContinueEventImpl)
        {
            registries[0] = clientDoc.getContinueEventListenerRegistry();
            registries[1] = null; // para que quede claro
        }
        else throw new ItsNatException("Event type is not supported:" + event.getType(),event); // Por ahora no hay m�s casos

        return dispatchEventLocally(target,evt,registries);
View Full Code Here

    {
        if (extraParams == null)
            return;

        RequestNormalEventImpl request = event.getRequestNormalEvent();
        ClientDocumentStfulImpl clientDoc = event.getClientDocumentStful();

        boolean wasEnabled = clientDoc.isSendCodeEnabled();
        if (wasEnabled)
            clientDoc.disableSendCode(); // para que no se env�e de nuevo al cliente el valor tra�do (salvo observers para que vean el cambio del cliente)
        try
        {
            for(int i = 0; i < extraParams.length; i++)
            {
                ParamTransport param = extraParams[i];
                if (param.isSync())
                {
                    ParamTransportUtil paramUtil = ParamTransportUtil.getSingleton(param);
                    if (before)
                        paramUtil.syncServerBeforeDispatch(param,request,event);
                    else
                        paramUtil.syncServerAfterDispatch(param,request,event);
                }
            }
        }
        finally
        {
            if (wasEnabled)
                clientDoc.enableSendCode(); // restauramos
        }
    }
View Full Code Here

    protected void renderAndSendMutationCode(final MutationEvent mutEvent,ClientDocumentImpl[] allClients)
    {
        for(int i = 0; i < allClients.length; i++)
        {
            ClientDocumentStfulImpl clientDoc = (ClientDocumentStfulImpl)allClients[i];
            ClientMutationEventListenerStfulImpl mutListener = clientDoc.getClientMutationEventListenerStful();

            mutListener.beforeRenderAndSendMutationCode(mutEvent);
            if (mutListener.canRenderAndSendMutationJSCode()) // Si es false es que seguramente estamos en fase carga y fast load
            {
                // Cuidado: pre and post m�todos s�lo se llaman si se genera c�digo de la mutaci�n
View Full Code Here

        count += itsNatDoc.removeAllDOMStdEventListeners(eventTarget,true);
        count += itsNatDoc.removeAllUserEventListeners(eventTarget,true);

        for(int i = 0; i < allClients.length; i++)
        {
            ClientDocumentStfulImpl clientDoc = (ClientDocumentStfulImpl)allClients[i];
            count += clientDoc.removeAllDOMStdEventListeners(eventTarget, true);
            count += clientDoc.removeAllUserEventListeners(eventTarget, true);
            count += clientDoc.removeAllTimerEventListeners(eventTarget, true);
            count += clientDoc.removeAllContinueEventListeners(eventTarget, true);
        }

        if ((count > 0) && itsNatDoc.isLoadingPhaseAndFastLoadMode())
            throw new ItsNatException("An event listener was registered in a node removed in the document load phase and in fast load mode",node);
    }
View Full Code Here

        }

        ClientDocumentImpl[] allClients = getAllClientDocumentsCopy();
        for(int i = 0; i < allClients.length; i++)
        {
            ClientDocumentStfulImpl clientDoc = (ClientDocumentStfulImpl)allClients[i];
            ClientMutationEventListenerStfulImpl mutListener = clientDoc.getClientMutationEventListenerStful();
            mutListener.removeAllChild(node); // Se eliminan en el cliente
        }

        // Se supone que el nodo est� vac�o en el servidor pues no dejamos insertar hasta que haya reconexi�n
        delegNode.setDisconnectedChildNodesFromClient(false);
View Full Code Here

        StringBuilder retEvent = new StringBuilder();
        if (sync)
        {
            if (event.getPreventDefault())
            {
                ClientDocumentStfulImpl clientDoc = event.getClientDocumentStful();
                Browser browser = clientDoc.getBrowser();
                JSRenderItsNatDOMStdEventImpl render = JSRenderItsNatDOMStdEventImpl.getJSItsNatDOMStdEventRender((ClientItsNatDOMStdEventImpl)event,browser);
                retEvent.append( render.getPreventDefault("event.getNativeEvent()",clientDoc) );
            }

            if (event.getStopPropagation())
            {
                ClientDocumentStfulImpl clientDoc = event.getClientDocumentStful();
                Browser browser = clientDoc.getBrowser();
                JSRenderItsNatDOMStdEventImpl render = JSRenderItsNatDOMStdEventImpl.getJSItsNatDOMStdEventRender((ClientItsNatDOMStdEventImpl)event,browser);
                retEvent.append( render.getStopPropagation("event.getNativeEvent()",clientDoc) );
            }
        }
View Full Code Here

            preSerializeDocument();
            docMarkup = serializeDocument();
            mutListener.setEnabled(true); // Restauramos
        }

        ClientDocumentStfulImpl clientDoc = getClientDocumentStful();
        if (clientDoc.isScriptingEnabled())
        {
            String scriptsMarkup = generateFinalScriptsMarkup();
            if (getResponseLoadStfulDocumentValid().isOnlyReturnMarkupOfScripts())
                docMarkup = scriptsMarkup;
            else
View Full Code Here

TOP

Related Classes of org.itsnat.impl.core.clientdoc.ClientDocumentStfulImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.