.getTransferData(mxGraphTransferable.dataFlavor); if (gt.getCells() != null)
.getTransferData(mxGraphTransferable.dataFlavor); if (gt.getCells() != null)
/** * Returns the drop target for the given transferable and location. */ protected Object getDropTarget(mxGraphComponent graphComponent, mxGraphTransferable gt) { Object[] cells = gt.getCells(); Object target = null; // Finds the target cell at the given location and checks if the // target is not already the parent of the first imported cell if (location != null) { target = graphComponent.getGraph().getDropTarget(cells, location, graphComponent.getCellAt(location.x, location.y)); if (cells.length > 0 && graphComponent.getGraph().getModel().getParent(cells[0]) == target) { target = null; } } return target; }
/** * Returns the drop target for the given transferable and location. */ protected Object getDropTarget(mxGraphComponent graphComponent, mxGraphTransferable gt) { Object[] cells = gt.getCells(); Object target = null; // Finds the target cell at the given location and checks if the // target is not already the parent of the first imported cell if (location != null) { target = graphComponent.getGraph().getDropTarget(cells, location, graphComponent.getCellAt(location.x, location.y)); if (cells.length > 0 && graphComponent.getGraph().getModel().getParent(cells[0]) == target) { target = null; } } return target; }
/** * Gets a drop target using getDropTarget and imports the cells using * mxGraph.splitEdge or mxGraphComponent.importCells depending on the * drop target and the return values of mxGraph.isSplitEnabled and * mxGraph.isSplitTarget. Selects and returns the cells that have been * imported. */ protected Object[] importCells(mxGraphComponent graphComponent, mxGraphTransferable gt, double dx, double dy) { Object target = getDropTarget(graphComponent, gt); mxGraph graph = graphComponent.getGraph(); Object[] cells = gt.getCells(); cells = graphComponent.getImportableCells(cells); if (graph.isSplitEnabled() && graph.isSplitTarget(target, cells)) { graph.splitEdge(target, cells, dx, dy); } else { cells = graphComponent.importCells(cells, dx, dy, target, location); graph.setSelectionCells(cells); } return cells; }
/** * Gets a drop target using getDropTarget and imports the cells using * mxGraph.splitEdge or mxGraphComponent.importCells depending on the * drop target and the return values of mxGraph.isSplitEnabled and * mxGraph.isSplitTarget. Selects and returns the cells that have been * imported. */ protected Object[] importCells(mxGraphComponent graphComponent, mxGraphTransferable gt, double dx, double dy) { Object target = getDropTarget(graphComponent, gt); mxGraph graph = graphComponent.getGraph(); Object[] cells = gt.getCells(); cells = graphComponent.getImportableCells(cells); if (graph.isSplitEnabled() && graph.isSplitTarget(target, cells)) { graph.splitEdge(target, cells, dx, dy); } else { cells = graphComponent.importCells(cells, dx, dy, target, location); graph.setSelectionCells(cells); } return cells; }
dragCells = gt.getCells();
dragCells = gt.getCells();