public void setParesent(YAMMNode t) { treeNode tselfNode = cast<treeNode>(); treeNode pNode = t.cast<treeNode>(); tselfNode.setParesent(pNode); }
public void init() { mRoot = new YAMMRootNode(); var node = mRoot.cast<YAMMNode>(); mCurrent = node; node.setText("main_topic"); var ui = mRoot.cast<UIMM>(); ui.mRoot.evtOnChar += (self, k, isC, isS) => { Console.WriteLine(k +" is pressed"); if (k == 45/*insert*/) { mCurrent.tryAdd(delegate(YAMMNode n) { setCurrent(n); }); } if (k == 46/*del*/) { if(mCurrent.cast<YAMMRootNode>() == null) deleteNode(mCurrent); } else if (k == 37/*left*/) { var p = mCurrent.cast<treeNode>().mParesent; if(p != null) { node = p.cast<YAMMNode>(); setCurrent(node); } } else if (k == 39/*right*/) { var f = mCurrent.cast<treeNode>().firstChild(); if (f != null) { mCurrent.cast<YAMMNode>().open(true); node = f.cast<YAMMNode>(); setCurrent(node); } } else if (k == 38/*up*/) { var p = mCurrent.cast<treeNode>().pre(); if (p != null) { node = p.cast<YAMMNode>(); setCurrent(node); } } else if (k == 40/*down*/) { var n = mCurrent.cast<treeNode>().next(); if (n != null) { node = n.cast<YAMMNode>(); setCurrent(node); } } UI.Instance.flush(); return false; }; }
public void appendChild(YAMMNode node) { if (node == null) return; node.cast<UIMM>().mRoot.paresent = this.cast<UIMM>().mRoot.findByPath("subs"); //生成连线 var selfNode = cast<treeNode>(); node.cast<treeNode>().setParesent(selfNode); selfNode.root().cast<UIMM>().rerangeChildren(); }
public void deleteNode(YAMMNode node) { node.cast<treeNode>().setParesent(null); node.cast<UIMM>().breakLink(); YAMM.Instance.mRoot.cast<UIMM>().rerangeChildren(); UI.Instance.flush(); }