本文整理汇总了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);
}