public void onMouseDown(MouseDownEvent event) { setMouseDown(true); updateCSS(); DOM.setCapture(view.getElement()); dragStartX = event.getX(); dragStartY = event.getY(); event.preventDefault(); }
public void onMouseUp(MouseUpEvent event) { Element element = view.getElement(); if (!isDragging()) { updateCSS(); limitToBoundingBox(); if (NodeProxy.EXPANDED.equals(model.getState())) { model.setState(NodeProxy.COLLAPSED); for (NodeProxy neighbor : graph.getNeighbors(model)) { boolean collapsed = NodeProxy.COLLAPSED.equals(neighbor.getState()); boolean leafNode = graph.degree(neighbor) == 1; if (collapsed && leafNode) { graph.removeNode(neighbor); } } } parent.toggle(model); } else { parent.save(model, true); setDragging(false); } setMouseDown(false); DOM.releaseCapture(element); event.preventDefault(); }