Search in sources :

Example 16 with Shape

use of org.kie.workbench.common.stunner.core.client.shape.Shape in project kie-wb-common by kiegroup.

the class CanvasHighlight method applyStateToShape.

private void applyStateToShape(final String uuid, final ShapeState state) {
    final Shape shape = getShape(uuid);
    if (null != shape) {
        uuids.add(uuid);
        shape.applyState(state);
    }
    if (ShapeState.INVALID.equals(state)) {
        setInvalidCursor();
    } else {
        setValidCursor();
    }
}
Also used : Shape(org.kie.workbench.common.stunner.core.client.shape.Shape)

Example 17 with Shape

use of org.kie.workbench.common.stunner.core.client.shape.Shape in project kie-wb-common by kiegroup.

the class CanvasHighlight method unhighLight.

public CanvasHighlight unhighLight() {
    if (!uuids.isEmpty()) {
        uuids.forEach(uuid -> {
            final Shape shape = getShape(uuid);
            if (null != shape) {
                shape.applyState(ShapeState.NONE);
            }
        });
        getCanvas().draw();
        uuids.clear();
    }
    setValidCursor();
    return this;
}
Also used : Shape(org.kie.workbench.common.stunner.core.client.shape.Shape)

Example 18 with Shape

use of org.kie.workbench.common.stunner.core.client.shape.Shape in project kie-wb-common by kiegroup.

the class SessionPreviewCanvasHandlerProxyTest method checkApplyElementMutationDelegatesToWrapped.

@Test
public void checkApplyElementMutationDelegatesToWrapped() {
    final Shape shape = mock(Shape.class);
    final Element candidate = mock(Element.class);
    final boolean applyPosition = true;
    final boolean applyProperties = false;
    final MutationContext mutationContext = mock(MutationContext.class);
    proxy.applyElementMutation(shape, candidate, applyPosition, applyProperties, mutationContext);
    verify(wrapped).applyElementMutation(eq(shape), eq(candidate), eq(applyPosition), eq(applyProperties), eq(mutationContext));
    proxy.applyElementMutation(candidate, mutationContext);
    verify(wrapped).applyElementMutation(eq(candidate), eq(mutationContext));
    proxy.applyElementMutation(candidate, applyPosition, applyProperties, mutationContext);
    verify(wrapped).applyElementMutation(eq(candidate), eq(applyPosition), eq(applyProperties), eq(mutationContext));
}
Also used : Shape(org.kie.workbench.common.stunner.core.client.shape.Shape) Element(org.kie.workbench.common.stunner.core.graph.Element) MutationContext(org.kie.workbench.common.stunner.core.client.shape.MutationContext) Test(org.junit.Test)

Example 19 with Shape

use of org.kie.workbench.common.stunner.core.client.shape.Shape in project kie-wb-common by kiegroup.

the class CaseManagementCanvasHandler method removeChild.

@Override
public void removeChild(final Element parent, final Element child) {
    final Shape parentShape = getCanvas().getShape(parent.getUUID());
    final Shape childShape = getCanvas().getShape(child.getUUID());
    if (!isRenderable(parentShape, childShape)) {
        return;
    }
    super.removeChild(parent, child);
}
Also used : NullShape(org.kie.workbench.common.stunner.cm.client.shape.NullShape) Shape(org.kie.workbench.common.stunner.core.client.shape.Shape)

Example 20 with Shape

use of org.kie.workbench.common.stunner.core.client.shape.Shape in project kie-wb-common by kiegroup.

the class CaseManagementCanvasHandler method addChild.

@Override
public void addChild(final Element parent, final Element child) {
    final Shape parentShape = getCanvas().getShape(parent.getUUID());
    final Shape childShape = getCanvas().getShape(child.getUUID());
    if (!isRenderable(parentShape, childShape)) {
        return;
    }
    super.addChild(parent, child);
}
Also used : NullShape(org.kie.workbench.common.stunner.cm.client.shape.NullShape) Shape(org.kie.workbench.common.stunner.core.client.shape.Shape)

Aggregations

Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)42 Test (org.junit.Test)14 Element (org.kie.workbench.common.stunner.core.graph.Element)8 ElementShape (org.kie.workbench.common.stunner.core.client.shape.ElementShape)7 NullShape (org.kie.workbench.common.stunner.cm.client.shape.NullShape)5 Node (org.kie.workbench.common.stunner.core.graph.Node)4 AbstractCanvas (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas)3 EdgeShape (org.kie.workbench.common.stunner.core.client.shape.EdgeShape)3 HasEventHandlers (org.kie.workbench.common.stunner.core.client.shape.view.HasEventHandlers)3 ShapeView (org.kie.workbench.common.stunner.core.client.shape.view.ShapeView)3 CanvasShapeRemovedEvent (org.kie.workbench.common.stunner.core.client.canvas.event.registration.CanvasShapeRemovedEvent)2 ShapeFactory (org.kie.workbench.common.stunner.core.client.shape.factory.ShapeFactory)2 MouseClickEvent (org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent)2 MouseClickHandler (org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickHandler)2 ShapeGlyph (org.kie.workbench.common.stunner.core.definition.shape.ShapeGlyph)2 BoundsImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl)2 Index (org.kie.workbench.common.stunner.core.graph.processing.index.Index)2 Group (com.ait.lienzo.client.core.shape.Group)1 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)1 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)1