Name
LzReplicationManager — The controller for views replicated by data.
Description
When a view's datapath matches more than one data node, one instance
of the view is created for each match. The replicated views are
referred to as clones' When this happens, a
replication manager (or a subclass of
LzReplicationManager
) is created to manage the
clones. Replication managers are never directly instantiated —
they are created when a datapath makes multiple matches.
If the replicated view was named, the clone manager takes over the
named spot in the parent. The example below demonstrates this, and
shows how to reference individual clones.
In the example that follows, a view, called
replView
is bound to a dataset
somedata
. For each matching node in the dataset, a
new view is created. These views contain the text of the dataset. In
other words, the single line
<pre>
<view name="replView" datapath="somedata:/*">
</pre>causes the creation of five views (because there were five elements
in the dataset that matched the selection criteria). These "cloned"
views are numbered successively, starting with zero. The highlited
section of the code below shows how to use the
getCloneNumber
method to access each replicated
view.
Development Note
A replication manager controls the replication of views as a result of
multiple matches to a datapath's xpath. When a datapath matches more than
one node, it immediate halts its own processing and creates a replication
manager to take over management of that datapath. If the view that contained
the datapath being replicated was named, the replication manager assumes that
name, so that it can be referred to the same way the non-replicated view
would have been.
Details
Static Methods (1)
-
__LZemptyFuntion()
-
static private function __LZemptyFuntion();
Properties (11)
-
asyncnew
-
public var asyncnew = true;
-
checkDependentContexts
-
public var checkDependentContexts = null;
-
clones
-
public var clones : [LzNode];
The LzNodes which this LzReplicationManager has created.
-
datacontrolsvisibility
-
public var datacontrolsvisibility = false;
-
handleModify
-
public var handleModify = null;
-
__LZdataoffset
-
private var __LZdataoffset = 0.0;
-
__LZpreventXPathUpdate
-
private var __LZpreventXPathUpdate = false;
-
__LZtakeDPSlot
-
private var __LZtakeDPSlot = false;
-
nodes
-
The nodes that this replication manager will map to views
-
pooling
-
public var pooling = false;
If true, the replication manager will reuse views it
has alreay created if the data changes if possible. If false, the
replication manager will always destroy views whose data has changed and
create new ones.
-
visible
-
public var visible = true;
Setters (3)
Setters for virtual properties, to be used with setAttribute. A setter may or may not have a corresponding getter method;
consult the Methods list in this section.
-
datapath
-
sortorder
-
sortpath
Methods (31)
-
ascDict()
-
private function ascDict(a, b);
-
construct()
-
private function construct(odp, args);
-
constructWithArgs()
-
private function constructWithArgs(args);
-
descDict()
-
private function descDict(a, b);
-
destroyClone()
-
private function destroyClone(v);
-
detachClone()
-
private function detachClone(cl);
-
getCloneForNode()
-
public function getCloneForNode(p : LzDataElement) : LzView;
Returns a clone which is mapped to the given data node.
-
getCloneNumber()
-
public function getCloneNumber(n : Number) : LzView;
Retuns a pointer to the nth clone controlled by the replication manager
-
getContext()
-
private function getContext(chgpkg);
-
getNewClone()
-
private function getNewClone(forceNew);
-
getNodeOffset()
-
private function getNodeOffset(p);
-
handleDeletedNode()
-
private function handleDeletedNode(c);
-
__LZadjustVisibleClones()
-
private function __LZadjustVisibleClones(lastnodes, newnodes);
-
__LZcheckChange()
-
private function __LZcheckChange(chgpkg);
-
__LZdiffArrays()
-
private function __LZdiffArrays(a, b);
returns the index at which the arrays differ
-
__LZHandleDocChange()
-
private function __LZHandleDocChange(who);
-
__LZHandleMultiNodes()
-
private function __LZHandleMultiNodes(n);
-
__LZHandleNoNodes()
-
private function __LZHandleNoNodes(n);
-
__LZHandleSingleNode()
-
private function __LZHandleSingleNode(n);
-
__LZneedsOpUpdate()
-
private function __LZneedsOpUpdate();
-
mergesort()
-
private function mergesort(arr, l, h);
-
orderf()
-
private function orderf(a, b);
-
poolClone()
-
private function poolClone();
-
reattachClone()
-
private function reattachClone(cl);
-
setComparator()
-
private function setComparator(comparator);
Sets the comparator for the sort used by the replication manager.
-
setDatapath()
-
public function setDatapath(xp : String);
This is an alias for the replication manager's setXPath method, but it is
provided for compatibility with the view API, since replication managers take
over the slot that a named replicated view occupied in the parent. (See
comment on the class as a whole, above.)
-
setOrder()
-
private function setOrder(xpath : String, comparator);
Orders the replicated nodes based on the value of the path passed in.
-
setVisible()
-
public function setVisible(vis : Boolean);
Sets the visibility of all the clones controlled by the replication manager
-
setXPath()
-
private function setXPath(xp);
-
toString()
-
private function toString();
-
updateData()
-
private function updateData(a, b);
Events (3)
-
onclones
-
-
onnodes
-
-
onvisible
-
JavaScript Synopsis
public
LzReplicationManager extends
LzDatapath
{
prototype private function
ascDict
(
a,
b);
prototype private function
construct
(
odp,
args);
prototype private function
descDict
(
a,
b);
prototype private function
mergesort
(
arr,
l,
h);
prototype private function
orderf
(
a,
b);
prototype private function
setOrder
(
xpath : String,
comparator);
prototype public function
setVisible
(
vis : Boolean);
prototype private function
setXPath
(
xp);
}