public void onDragPreviewHandler(@Observes ShapeDragPreviewEvent shapeDragPreviewEvent) { //Only Shapes that require a ContainerManager can be dropped into Containers if (!(shapeDragPreviewEvent.getShape() instanceof RequiresContainerManager)) { dropContext.setContext(null); return; } //Find a Container to drop the Shape into final double cx = getX(shapeDragPreviewEvent.getX()); final double cy = getY(shapeDragPreviewEvent.getY()); final WiresContainer container = getContainer(cx, cy); dropContext.setContext(container); canvasLayer.batch(); }
public void onDragPreviewHandler(@Observes ShapeDragPreviewEvent shapeDragPreviewEvent) { //Only Shapes that require a ContainerManager can be dropped into Containers if (!(shapeDragPreviewEvent.getShape() instanceof RequiresContainerManager)) { dropContext.setContext(null); return; } //Find a Container to drop the Shape into final double cx = getX(shapeDragPreviewEvent.getX()); final double cy = getY(shapeDragPreviewEvent.getY()); final WiresContainer container = getContainer(cx, cy); dropContext.setContext(container); canvasLayer.batch(); }
public void onDragPreviewHandler(@Observes ShapeDragPreviewEvent shapeDragPreviewEvent) { //We can only connect WiresTreeNodes to each other if (!(shapeDragPreviewEvent.getShape() instanceof BaseGuidedDecisionTreeShape)) { dropContext.setContext(null); return; } //Find a Parent Node to attach the Shape to final double cx = getX(shapeDragPreviewEvent.getX()); final double cy = getY(shapeDragPreviewEvent.getY()); final BaseGuidedDecisionTreeShape uiChild = (BaseGuidedDecisionTreeShape) shapeDragPreviewEvent.getShape(); final BaseGuidedDecisionTreeShape uiProspectiveParent = getParentNode(uiChild, cx, cy); //If there is a prospective parent show the line between child and parent if (uiProspectiveParent != null) { if (connector == null) { connector = new WiresTreeNodeConnector(); canvasLayer.add(connector); connector.moveToBottom(); } connector.getPoints().get(0).set(uiProspectiveParent.getLocation()); connector.getPoints().get(1).set(new Point2D(cx, cy)); } else if (connector != null) { canvasLayer.remove(connector); connector = null; } dropContext.setContext(uiProspectiveParent); canvasLayer.batch(); }
public void onDragPreviewHandler(@Observes ShapeDragPreviewEvent shapeDragPreviewEvent) { //We can only connect WiresTreeNodes to each other if (!(shapeDragPreviewEvent.getShape() instanceof WiresBaseTreeNode)) { dropContext.setContext(null); return; } //Find a Parent Node to attach the Shape to final double cx = getX(shapeDragPreviewEvent.getX()); final double cy = getY(shapeDragPreviewEvent.getY()); final WiresBaseTreeNode child = (WiresBaseTreeNode) shapeDragPreviewEvent.getShape(); final WiresBaseTreeNode prospectiveParent = getParentNode(child, cx, cy); //If there is a prospective parent show the line between child and parent if (prospectiveParent != null) { if (connector == null) { connector = new WiresTreeNodeConnector(); canvasLayer.add(connector); connector.moveToBottom(); } connector.getPoints().get(0).set(prospectiveParent.getLocation()); connector.getPoints().get(1).set(new Point2D(cx, cy)); } else if (connector != null) { canvasLayer.remove(connector); connector = null; } dropContext.setContext(prospectiveParent); canvasLayer.batch(); }
public void onDragPreviewHandler(@Observes ShapeDragPreviewEvent shapeDragPreviewEvent) { //We can only connect WiresTreeNodes to each other if (!(shapeDragPreviewEvent.getShape() instanceof BaseGuidedDecisionTreeShape)) { dropContext.setContext(null); return; } //Find a Parent Node to attach the Shape to final double cx = getX(shapeDragPreviewEvent.getX()); final double cy = getY(shapeDragPreviewEvent.getY()); final BaseGuidedDecisionTreeShape uiChild = (BaseGuidedDecisionTreeShape) shapeDragPreviewEvent.getShape(); final BaseGuidedDecisionTreeShape uiProspectiveParent = getParentNode(uiChild, cx, cy); //If there is a prospective parent show the line between child and parent if (uiProspectiveParent != null) { if (connector == null) { connector = new WiresTreeNodeConnector(); canvasLayer.add(connector); connector.moveToBottom(); } connector.getPoints().get(0).set(uiProspectiveParent.getLocation()); connector.getPoints().get(1).set(new Point2D(cx, cy)); } else if (connector != null) { canvasLayer.remove(connector); connector = null; } dropContext.setContext(uiProspectiveParent); canvasLayer.batch(); }
public void onDragPreviewHandler(@Observes ShapeDragPreviewEvent shapeDragPreviewEvent) { //We can only connect WiresTreeNodes to each other if (!(shapeDragPreviewEvent.getShape() instanceof WiresBaseTreeNode)) { dropContext.setContext(null); return; } //Find a Parent Node to attach the Shape to final double cx = getX(shapeDragPreviewEvent.getX()); final double cy = getY(shapeDragPreviewEvent.getY()); final WiresBaseTreeNode child = (WiresBaseTreeNode) shapeDragPreviewEvent.getShape(); final WiresBaseTreeNode prospectiveParent = getParentNode(child, cx, cy); //If there is a prospective parent show the line between child and parent if (prospectiveParent != null) { if (connector == null) { connector = new WiresTreeNodeConnector(); canvasLayer.add(connector); connector.moveToBottom(); } connector.getPoints().get(0).set(prospectiveParent.getLocation()); connector.getPoints().get(1).set(new Point2D(cx, cy)); } else if (connector != null) { canvasLayer.remove(connector); connector = null; } dropContext.setContext(prospectiveParent); canvasLayer.batch(); }