/** * */ protected mxGraphHandler createGraphHandler() { return new mxGraphHandler(this); }
/** * * @param e */ public void drop(DropTargetDropEvent e) { if (canImport) { mxGraphTransferHandler handler = getGraphTransferHandler(e); MouseEvent event = createEvent(e); // Ignores the event in mouseReleased if it is // handled by the transfer handler as a drop if (handler != null && !handler.isLocalDrag()) { event.consume(); } mouseReleased(event); } }
/** * Helper method to return the component for a drop target event. */ protected static final mxGraphTransferHandler getGraphTransferHandler( DropTargetEvent e) { JComponent component = getDropTarget(e); TransferHandler transferHandler = component.getTransferHandler(); if (transferHandler instanceof mxGraphTransferHandler) { return (mxGraphTransferHandler) transferHandler; } return null; }
if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()) if (cell != null && !e.isPopupTrigger() && isSelectEnabled() && (first != null || !isMoveEnabled())) e.getY())) fold(initialCell); e.getY())) fold(tmp); e.consume(); && isRemoveCellsFromParent() && shouldRemoveCellFromParent(graph.getModel() .getParent(initialCell), cells, e)) boolean clone = isCloneEnabled() && graphComponent.isCloneEvent(e); Object[] result = movePreview.stop(true, e, dx, dy, clone, else if (isVisible()) moveCells(cells, dx, dy, target, e); reset();
marker = createMarker(); movePreview = createMovePreview(); installDragGestureHandler(); installDropTargetHandler(); setVisible(false);
JComponent component = getDropTarget(e); TransferHandler th = component.getTransferHandler(); boolean isLocal = th instanceof mxGraphTransferHandler setVisible(false); setPreviewBounds(new Rectangle( (int) transferBounds.getX(), (int) transferBounds.getY(), w, h)); if (!isLivePreview()) updateDragImage(graph .getMovableCells(dragCells)); updateDragImage(tmp); setVisible(true);
mouseDragged(createEvent(e)); mxGraphTransferHandler handler = getGraphTransferHandler(e); setPreviewBounds(new Rectangle(pt, previewBounds.getSize()));
/** * */ public void start(MouseEvent e) { if (isLivePreview()) { movePreview.start(e, graphComponent.getGraph().getView().getState(initialCell)); } else { mxGraph graph = graphComponent.getGraph(); // Constructs an array with cells that are indeed movable cells = getCells(initialCell); cellBounds = graph.getView().getBounds(cells); if (cellBounds != null) { // Updates the size of the graph handler that is in // charge of painting all other handlers bbox = graph.getView().getBoundingBox(cells); Rectangle bounds = cellBounds.getRectangle(); bounds.width += 1; bounds.height += 1; setPreviewBounds(bounds); } } first = e.getPoint(); }
/** * */ public void mouseMoved(MouseEvent e) { if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()) { Cursor cursor = getCursor(e); if (cursor != null) { graphComponent.getGraphControl().setCursor(cursor); e.consume(); } else { graphComponent.getGraphControl().setCursor(DEFAULT_CURSOR); } } }
JComponent component = getDropTarget(e); Point location = null; int action = 0; location = convertPoint(location); Rectangle r = graphComponent.getViewport().getViewRect(); location.translate(r.x, r.y);
/** * Moves the cells. */ protected void moveCells(Object[] cells, double dx, double dy, Object target, MouseEvent e) { String error = SValidation.getMoveValidationError(cells, target); if (error == null) { super.moveCells(cells, dx, dy, target, e); ((BpmnGraph) graphComponent.getGraph()).getModelContainer().setDirty(true); ((BpmnGraph) graphComponent.getGraph()).getModelContainer().setEditMode(ModelContainer.EDIT_MODE_SELECTION); } else { if (error.length() > 0) { Logger.getLogger(BpmnEditor.APP_NAME).log(Level.WARNING, error); } } }
if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()) if (cell != null && !e.isPopupTrigger() && isSelectEnabled() && (first != null || !isMoveEnabled())) e.getY())) fold(initialCell); e.getY())) fold(tmp); e.consume(); && isRemoveCellsFromParent() && shouldRemoveCellFromParent(graph.getModel() .getParent(initialCell), cells, e)) boolean clone = isCloneEnabled() && graphComponent.isCloneEvent(e); Object[] result = movePreview.stop(true, e, dx, dy, clone, else if (isVisible()) moveCells(cells, dx, dy, target, e); reset();
marker = createMarker(); movePreview = createMovePreview(); installDragGestureHandler(); installDropTargetHandler(); setVisible(false);
JComponent component = getDropTarget(e); TransferHandler th = component.getTransferHandler(); boolean isLocal = th instanceof mxGraphTransferHandler setVisible(false); setPreviewBounds(new Rectangle( (int) transferBounds.getX(), (int) transferBounds.getY(), w, h)); if (!isLivePreview()) updateDragImage(graph .getMovableCells(dragCells)); updateDragImage(tmp); setVisible(true);
mouseDragged(createEvent(e)); mxGraphTransferHandler handler = getGraphTransferHandler(e); setPreviewBounds(new Rectangle(pt, previewBounds.getSize()));
/** * */ public void start(MouseEvent e) { if (isLivePreview()) { movePreview.start(e, graphComponent.getGraph().getView().getState(initialCell)); } else { mxGraph graph = graphComponent.getGraph(); // Constructs an array with cells that are indeed movable cells = getCells(initialCell); cellBounds = graph.getView().getBounds(cells); if (cellBounds != null) { // Updates the size of the graph handler that is in // charge of painting all other handlers bbox = graph.getView().getBoundingBox(cells); Rectangle bounds = cellBounds.getRectangle(); bounds.width += 1; bounds.height += 1; setPreviewBounds(bounds); } } first = e.getPoint(); }
/** * */ public void mouseMoved(MouseEvent e) { if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()) { Cursor cursor = getCursor(e); if (cursor != null) { graphComponent.getGraphControl().setCursor(cursor); e.consume(); } else { graphComponent.getGraphControl().setCursor(DEFAULT_CURSOR); } } }
JComponent component = getDropTarget(e); Point location = null; int action = 0; location = convertPoint(location); Rectangle r = graphComponent.getViewport().getViewRect(); location.translate(r.x, r.y);
/** * * @param e */ public void drop(DropTargetDropEvent e) { if (canImport) { mxGraphTransferHandler handler = getGraphTransferHandler(e); MouseEvent event = createEvent(e); // Ignores the event in mouseReleased if it is // handled by the transfer handler as a drop if (handler != null && !handler.isLocalDrag()) { event.consume(); } mouseReleased(event); } }