@Override public void cancel() { m_dragging = false; if (m_addedRectangle) { m_dragLayer.remove(m_rectangle); m_addedRectangle = false; m_dragLayer.draw(); } }
@Override public void onClose( final IAnimation iAnimation, final IAnimationHandle iAnimationHandle ) { for ( Group ctrl : controls ) { WiresBaseShape.this.getLayer().remove( ctrl ); } } } );
@Override public void onClose( final IAnimation iAnimation, final IAnimationHandle iAnimationHandle ) { isControlsVisible = !controls.isEmpty(); for ( Group ctrl : controlsToRemove ) { WiresBaseShape.this.getLayer().remove( ctrl ); } } } );
/** * Remove a child TreeNode from this TreeNode. Connectors are automatically cleared up. * @param child */ public void removeChildNode( final WiresBaseTreeNode child ) { child.setParentNode( null ); final int index = children.indexOf( child ); final WiresTreeNodeConnector connector = connectors.get( index ); children.remove( child ); connectors.remove( connector ); getLayer().remove( connector ); }
@Override public void hideMagnetPoints() { final Layer layer = getLayer(); if ( !magnets.isEmpty() && showingMagnets ) { for ( Magnet m : magnets ) { layer.remove( m ); } showingMagnets = false; getLayer().draw(); } }
@Override public void hideControlPoints() { final Layer layer = getLayer(); if ( !controlPoints.isEmpty() && showingControlPoints ) { for ( ControlPoint cp : controlPoints ) { layer.remove( cp ); } showingControlPoints = false; getLayer().draw(); } }
@Override public void destroy() { //Remove children final List<WiresBaseTreeNode> cloneChildren = new ArrayList<WiresBaseTreeNode>( children ); for ( WiresBaseTreeNode child : cloneChildren ) { shapesManager.forceDeleteShape( child ); } children.clear(); //Remove connectors to children final List<WiresTreeNodeConnector> cloneConnectors = new ArrayList<WiresTreeNodeConnector>( connectors ); for ( WiresTreeNodeConnector connector : cloneConnectors ) { getLayer().remove( connector ); } connectors.clear(); //Remove from its parent if ( parent != null ) { parent.removeChildNode( this ); } super.destroy(); }
canvasLayer.remove( connector ); canvasLayer.draw(); connector = null;
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().getPoint( 0 ).set( prospectiveParent.getLocation() ); connector.getPoints().getPoint( 1 ).set( new Point2D( cx, cy ) ); } else if ( connector != null ) { canvasLayer.remove( connector ); connector = null; } dropContext.setContext( prospectiveParent ); canvasLayer.draw(); }