to.etc.domui.dom.html
Class OptimalDeltaRenderer

java.lang.Object
  extended by to.etc.domui.dom.html.OptimalDeltaRenderer

public class OptimalDeltaRenderer
extends java.lang.Object

This class is used to calculate a delta between the "old" and "new" presentations in a Page. It gets used ONLY when the page has changes in it's tree somewhere.

The delta needs to take the rendering process into consideration. Nodes have unique IDs, and this must remain true during every step of the rendering process. If a part of the rendering process causes a duplicate ID (possible only because a node is moved forward/earlier in the tree, when it's new version is rendered before the later "delete" is visited). If this occurs, later rendering commands cannot uniquely identify the node because it's ID refers to two nodes in the browser's DOM.

This code visits all nodes in the page, and creates a to-do list of rendering changes in multiple steps. For nodes whose attributes have changed simply it adds the node to the attribute change list; this is all that's needed for the node.

Nodes that are unchanged are skipped fully.

The rest of the nodes are nodes with tree changes; of these we only directly handle containers since they contain the changes to their children. We annotate each node with the deletes and adds of IT's children, so at the end of the 1st loop we have a list of actual changes per node. The goal of this change list is to create all deletes before all inserts, and to minimize the #of deletes and inserts.

Author:
Frits Jalvingh Created on Jun 6, 2008

Constructor Summary
OptimalDeltaRenderer(HtmlFullRenderer fullr, IRequestContext ctx, Page page)
           
 
Method Summary
 IRequestContext ctx()
           
 IBrowserOutput o()
           
 Page page()
           
 void render()
           
 void renderLoadCSS(java.lang.String path)
           
 void renderLoadJavascript(java.lang.String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptimalDeltaRenderer

public OptimalDeltaRenderer(HtmlFullRenderer fullr,
                            IRequestContext ctx,
                            Page page)
Method Detail

o

public IBrowserOutput o()

ctx

public IRequestContext ctx()

page

public Page page()

render

public void render()
            throws java.lang.Exception
Throws:
java.lang.Exception

renderLoadCSS

public void renderLoadCSS(java.lang.String path)
                   throws java.io.IOException
Throws:
java.io.IOException

renderLoadJavascript

public void renderLoadJavascript(java.lang.String path)
                          throws java.io.IOException
Throws:
java.io.IOException