public int getNodeLevel() { // for cursor navigation within a level (PN) int level = 0; MindMapNode parent; for (parent = this; !parent.isRoot(); parent = parent.getParentNode()) { level++; } return level; }
/** * can this node have the supplied type as a child ? * * @seealso setAvailableActions */ public boolean canHaveAsChild(MindMapNode child) { // Ok - so root can have children // but we don;t want it dragged. if (this.isRoot()) { return (false); } else { // If this isn't the root, it can't // have a cloud for a child if (child.getCloud() != null) { return (false); } } if (getPrimaryIcon().equals("recinterest")) { if (child.getPrimaryIcon().equals("recproduct")) { return (false); } } else if (getPrimaryIcon().equals("recgoal")) { if (child.getPrimaryIcon().equals("recgoal")) { return (false); } } return (true); }
public MindMapNode shallowCopy() { MindMapNode copy = basicCopy(); copy.setColor(getColor()); copy.setFont(getFont()); copy.setLink(getLink()); if (isLeft() != null) copy.setLeft(isLeft().getValue()); Vector icons = getIcons(); for (int i = 0; i < icons.size(); ++i) { copy.addIcon((MindIcon) icons.get(i)); } return copy; }
public void removeFromParent() { parent.remove(this); }