/** * Inserts the given cell into its parent and terminal cells. */ public void insertIntoGraph(mxICell cell) { mxICell parent = cell.getParent(); mxICell source = cell.getTerminal(true); mxICell target = cell.getTerminal(false); // Fixes possible inconsistencies during insert into graph cell.setTerminal(null, false); cell.setTerminal(null, true); cell.setParent(null); if (parent != null) { parent.insert(cell); } if (source != null) { source.insertEdge(cell, true); } if (target != null) { target.insertEdge(cell, false); } }
/** * Inner helper method for cloning cells recursively. */ protected Object cloneCell(Object cell, Map<Object, Object> mapping, boolean includeChildren) throws CloneNotSupportedException { if (cell instanceof mxICell) { mxICell mxc = (mxICell) ((mxICell) cell).clone(); mapping.put(cell, mxc); if (includeChildren) { int childCount = getChildCount(cell); for (int i = 0; i < childCount; i++) { Object clone = cloneCell(getChildAt(cell, i), mapping, true); mxc.insert((mxICell) clone); } } return mxc; } return null; }
/** * Inner helper method for cloning cells recursively. */ protected Object cloneCell(Object cell, Map<Object, Object> mapping, boolean includeChildren) throws CloneNotSupportedException { if (cell instanceof mxICell) { mxICell mxc = (mxICell) ((mxICell) cell).clone(); mapping.put(cell, mxc); if (includeChildren) { int childCount = getChildCount(cell); for (int i = 0; i < childCount; i++) { Object clone = cloneCell(getChildAt(cell, i), mapping, true); mxc.insert((mxICell) clone); } } return mxc; } return null; }
/** * Inserts the given cell into its parent and terminal cells. */ public void insertIntoGraph(mxICell cell) { mxICell parent = cell.getParent(); mxICell source = cell.getTerminal(true); mxICell target = cell.getTerminal(false); // Fixes possible inconsistencies during insert into graph cell.setTerminal(null, false); cell.setTerminal(null, true); cell.setParent(null); if (parent != null) { parent.insert(cell); } if (source != null) { source.insertEdge(cell, true); } if (target != null) { target.insertEdge(cell, false); } }
((mxICell) parent).insert(child, index);
((mxICell) parent).insert(child, index);
target = to.insert(clone); cellAdded(target);
target = to.insert(clone); cellAdded(target);
newparent.insert(cell); graph.addCell(cell, newparent);