public class OptimalDeltaRenderer extends 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.
| Constructor and Description |
|---|
OptimalDeltaRenderer(HtmlFullRenderer fullr,
IRequestContext ctx,
Page page) |
| Modifier and Type | Method and Description |
|---|---|
IRequestContext |
ctx() |
IBrowserOutput |
o() |
Page |
page() |
void |
render() |
void |
renderLoadCSS(String path) |
void |
renderLoadJavascript(String path) |
public OptimalDeltaRenderer(HtmlFullRenderer fullr, IRequestContext ctx, Page page)
@Nonnull public IBrowserOutput o()
public IRequestContext ctx()
public Page page()
public void renderLoadCSS(@Nonnull String path) throws IOException
IOExceptionpublic void renderLoadJavascript(@Nonnull String path) throws IOException
IOExceptionCopyright © 2017 etc.to. All rights reserved.