本文整理匯總了TypeScript中@eg/share/tree/tree.Tree類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Tree類的具體用法?TypeScript Tree怎麽用?TypeScript Tree使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Tree類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: addChildNode
addChildNode() {
this.changesMade = true;
const pnode = this.tree.selectedNode();
const point = this.idl.create('vmsp');
point.id(this.newId--);
point.isnew(true);
point.parent(pnode.id);
point.match_set(this.matchSet_.id());
point.children([]);
const ptype = this.newPoint.values.pointType;
if (ptype === 'bool') {
point.bool_op(this.newPoint.values.boolOp);
} else {
if (ptype === 'attr') {
point.svf(this.newPoint.values.recordAttr);
} else if (ptype === 'marc') {
point.tag(this.newPoint.values.marcTag);
point.subfield(this.newPoint.values.marcSf);
} else if (ptype === 'heading') {
point.heading(true);
}
point.negate(this.newPoint.values.negate);
point.quality(this.newPoint.values.matchScore);
}
const node: TreeNode = new TreeNode({
id: point.id(),
callerData: {point: point}
});
// Match points are added to the DB only when the tree is saved.
this.setNodeLabel(node, point).then(() => pnode.children.push(node));
}
示例2: isRootNode
isRootNode(): boolean {
const node = this.tree.selectedNode();
if (node && this.tree.findParentNode(node) === null) {
return true;
}
return false;
}
示例3: selectedIsBool
selectedIsBool(): boolean {
if (this.tree) {
const node = this.tree.selectedNode();
return node && node.callerData.point.bool_op();
}
return false;
}
示例4: Boolean
hasSelectedNode(): boolean {
return Boolean(this.tree.selectedNode());
}
示例5: deleteNode
deleteNode() {
this.changesMade = true;
const node = this.tree.selectedNode();
this.tree.removeNode(node);
}