/** * */ protected void beforeUndo(mxUndoableEdit edit) { Collection<Object> cells = getCellsForChanges(edit.getChanges()); mxIGraphModel model = getGraph().getModel(); if (isBubbling()) { Object[] tmp = mxGraphModel.getParents(model, cells.toArray()); while (tmp.length > 0) { cells.addAll(Arrays.asList(tmp)); tmp = mxGraphModel.getParents(model, tmp); } } layoutCells(mxUtils.sortCells(cells, false).toArray()); }
/** * */ protected void beforeUndo(mxUndoableEdit edit) { Collection<Object> cells = getCellsForChanges(edit.getChanges()); mxIGraphModel model = getGraph().getModel(); if (isBubbling()) { Object[] tmp = mxGraphModel.getParents(model, cells.toArray()); while (tmp.length > 0) { cells.addAll(Arrays.asList(tmp)); tmp = mxGraphModel.getParents(model, tmp); } } layoutCells(mxUtils.sortCells(cells, false).toArray()); }
/** * */ protected void cellsMoved(Object[] cells, Point location) { if (cells != null && location != null) { mxIGraphModel model = getGraph().getModel(); // Checks if a layout exists to take care of the moving for (int i = 0; i < cells.length; i++) { mxIGraphLayout layout = getLayout(model.getParent(cells[i])); if (layout != null) { layout.moveCell(cells[i], location.x, location.y); } } } }
/** * */ protected void cellsMoved(Object[] cells, Point location) { if (cells != null && location != null) { mxIGraphModel model = getGraph().getModel(); // Checks if a layout exists to take care of the moving for (int i = 0; i < cells.length; i++) { mxIGraphLayout layout = getLayout(model.getParent(cells[i])); if (layout != null) { layout.moveCell(cells[i], location.x, location.y); } } } }
mxIGraphModel model = getGraph().getModel(); Set<Object> result = new HashSet<Object>();
mxIGraphModel model = getGraph().getModel(); Set<Object> result = new HashSet<Object>();
/** * */ protected void layoutCells(Object[] cells) { if (cells.length > 0) { // Invokes the layouts while removing duplicates mxIGraphModel model = getGraph().getModel(); model.beginUpdate(); try { for (int i = 0; i < cells.length; i++) { if (cells[i] != model.getRoot()) { executeLayout(getLayout(cells[i]), cells[i]); } } fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS, "cells", cells)); } finally { model.endUpdate(); } } }
/** * */ protected void layoutCells(Object[] cells) { if (cells.length > 0) { // Invokes the layouts while removing duplicates mxIGraphModel model = getGraph().getModel(); model.beginUpdate(); try { for (int i = 0; i < cells.length; i++) { if (cells[i] != model.getRoot()) { executeLayout(getLayout(cells[i]), cells[i]); } } fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS, "cells", cells)); } finally { model.endUpdate(); } } }