use of org.kie.workbench.common.stunner.core.client.shape.Shape in project kie-wb-common by kiegroup.
the class AbstractCanvasHandler method deregister.
/**
* De-registers an element from the graph structure and from the canvas.
* @param element The element to de-register and remove from the canvas.
* @param fireEvents If canvas and canvas handled registration events must be fired.
*/
public void deregister(final Element element, final boolean fireEvents) {
final Shape shape = getCanvas().getShape(element.getUUID());
deregister(shape, element, fireEvents);
}
use of org.kie.workbench.common.stunner.core.client.shape.Shape in project kie-wb-common by kiegroup.
the class AbstractCanvasHandler method applyElementMutation.
@SuppressWarnings("unchecked")
public void applyElementMutation(final Element candidate, final boolean applyPosition, final boolean applyProperties, final MutationContext mutationContext) {
if (null != candidate && !isCanvasRoot(candidate)) {
final Shape shape = getCanvas().getShape(candidate.getUUID());
applyElementMutation(shape, candidate, applyPosition, applyProperties, mutationContext);
}
}
use of org.kie.workbench.common.stunner.core.client.shape.Shape in project kie-wb-common by kiegroup.
the class BaseCanvasHandler method addChild.
@Override
@SuppressWarnings("unchecked")
public void addChild(final Element parent, final Element child) {
final Shape childShape = getCanvas().getShape(child.getUUID());
if (!isCanvasRoot(parent)) {
final Shape parentShape = getCanvas().getShape(parent.getUUID());
getCanvas().addChildShape(parentShape, childShape);
} else {
// -- Special case when parent is the canvas root --
// Ensure the shape is added into the layer, but no need to register it again and generate new
// handlers ( f.i. using canvas#addShape() method ).
getCanvas().getLayer().addShape(childShape.getShapeView());
}
}
use of org.kie.workbench.common.stunner.core.client.shape.Shape in project kie-wb-common by kiegroup.
the class AbstractRegistrationCanvasNodeCommand method register.
@SuppressWarnings("unchecked")
protected void register(final AbstractCanvasHandler context) {
context.register(shapeSetId, candidate);
// Update view bounds for the element, if not set, by using the values from the shape view.
final double[] size = GraphUtils.getNodeSize(candidate.getContent());
if (size[0] <= 0 || size[1] <= 0) {
final Shape shape = context.getCanvas().getShape(candidate.getUUID());
final ShapeView shapeView = shape.getShapeView();
final Point2D location = GraphUtils.getPosition(candidate.getContent());
final BoundingBox boundingBox = shapeView.getBoundingBox();
candidate.getContent().setBounds(new BoundsImpl(new BoundImpl(location.getX(), location.getY()), new BoundImpl(location.getX() + boundingBox.getWidth(), location.getY() + boundingBox.getHeight())));
}
}
use of org.kie.workbench.common.stunner.core.client.shape.Shape in project kie-wb-common by kiegroup.
the class AbstractCanvasHandlerRegistrationControl method deregister.
protected void deregister(final String uuid) {
if (isRegistered(uuid)) {
final Shape shape = canvasHandler.getCanvas().getShape(uuid);
final ViewHandler<?> handler = handlers.get(uuid);
doDeregisterHandler(shape, handler);
}
}
Aggregations