Java Code Examples for javafx.scene.input.DragEvent#getTarget()
The following examples show how to use
javafx.scene.input.DragEvent#getTarget() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DragDropGesture.java From gef with Eclipse Public License 2.0 | 5 votes |
@Override public void handle(final DragEvent event) { final EventTarget target = event.getTarget(); if (target instanceof Node) { dragEntered((Node) target, event); } }
Example 2
Source File: DragDropGesture.java From gef with Eclipse Public License 2.0 | 5 votes |
@Override public void handle(final DragEvent event) { final EventTarget target = event.getTarget(); if (target instanceof Node) { dragExited((Node) target, event); } }
Example 3
Source File: DragDropGesture.java From gef with Eclipse Public License 2.0 | 5 votes |
@Override public void handle(final DragEvent event) { final EventTarget target = event.getTarget(); if (event.getGestureSource() != target && (target instanceof Node)) { final Node targetNode = (Node) target; dragOver(targetNode, event); } }
Example 4
Source File: DragDropGesture.java From gef with Eclipse Public License 2.0 | 4 votes |
/** * @param target * The targeted {@link Node} * @param event * The original {@link DragEvent} */ protected void dragOver(final Node target, final DragEvent event) { final IViewer viewer = PartUtils.retrieveViewer(getDomain(), target); if (viewer == null) { return; } if (viewer instanceof InfiniteCanvasViewer) { final InfiniteCanvas canvas = ((InfiniteCanvasViewer) viewer) .getCanvas(); // if any node in the target hierarchy is a scrollbar, // do not process the event if (event.getTarget() instanceof Node) { Node targetNode = (Node) event.getTarget(); while (targetNode != null) { if (targetNode == canvas.getHorizontalScrollBar() || targetNode == canvas.getVerticalScrollBar()) { return; } targetNode = targetNode.getParent(); } } } final Scene scene = target.getScene(); if (scene == null) { return; } // determine viewer that contains the given target part activeViewer = PartUtils.retrieveViewer(getDomain(), target); final List<? extends IOnDragDropHandler> dragDropPolicies = getHandlerResolver() .resolve(DragDropGesture.this, target, activeViewer, ON_DRAGDROP_HANDLER_KEY); setActiveHandlers(activeViewer, dragDropPolicies); if (dragDropPolicies != null && !dragDropPolicies.isEmpty()) { for (final IOnDragDropHandler dragDropPolicy : dragDropPolicies) { dragDropPolicy.dragOver(event); } } }