Name

LzReplicationManager — The controller for views replicated by data.

Synopsis

JavaScript: LzReplicationManager
Type: Class
Access: public
Topic: LFC.Data
Declared in: WEB-INF/lps/lfc/data/LzReplicationManager.lzs

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.

 <canvas height="140">
   <dataset name="somedata">
     <one/> <two/> <three/> <four/> <five/>
 
   </dataset>
   <simplelayout/>
   <button onclick="moveClone()">
     Move clone 
     
     <attribute name="cnum" value="0"/>
 
   </button>
   <view name="replView" datapath="somedata:/*">
     <text datapath="name()"/>
   </view>
 </canvas>
 

Superclass Chain

node (LzNode) » datapointer (LzDatapointer) » datapath (LzDatapath) » LzReplicationManager

Known Subclasses

Known Direct Subclasses: LzLazyReplicationManager

Details

Properties (8)

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;
nodes
public var 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 (4)

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
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.)
setVisible()
public function setVisible(vis : Boolean);
Sets the visibility of all the clones controlled by the replication manager

Events (3)

onclones
public event onclones;
onnodes
public event onnodes;
onvisible
public event onvisible;

JavaScript Synopsis

public LzReplicationManager extends  LzDatapath  {
  public var asyncnew  = true;
  public var checkDependentContexts  = null;
  public var clones  : [LzNode];
  public var datacontrolsvisibility  = false;
  public var handleModify  = null;
  public var nodes ;
  public var pooling  = false;
  public var visible  = true;
  prototype public function getCloneForNode (p : LzDataElement) : LzView;
  prototype public function getCloneNumber (n : Number) : LzView;
  prototype public event onclones ;
  prototype public event onnodes ;
  prototype public event onvisible ;
  prototype public function setDatapath (xp : String);
  prototype public function setVisible (vis : Boolean);
}