Search in sources :

Example 1 with ShapeState

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

the class SVGShapeImplTest method testApplyState.

@Test
public void testApplyState() {
    final ShapeState state = ShapeState.SELECTED;
    mocked.applyState(state);
    verify(lienzoShape, times(1)).applyState(eq(state));
    verify(lienzoShape, times(0)).beforeDraw();
    verify(lienzoShape, times(0)).afterDraw();
    verify(lienzoShape, times(0)).destroy();
}
Also used : ShapeState(org.kie.workbench.common.stunner.core.client.shape.ShapeState) Test(org.junit.Test)

Example 2 with ShapeState

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

the class ShapeStateAttributeHandler method reset.

@Override
public ShapeState reset() {
    final ShapeState result = this.state;
    newDefaultStateApplier().accept(getShapeView(), stateHolder.copy());
    this.state = ShapeState.NONE;
    return result;
}
Also used : ShapeState(org.kie.workbench.common.stunner.core.client.shape.ShapeState)

Example 3 with ShapeState

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

the class AbstractElementShape method applyProperties.

@Override
public void applyProperties(final E element, final MutationContext mutationContext) {
    final ShapeState shapeState = getShape().getShapeStateHandler().reset();
    // Apply generic view operations.
    getShapeHandlersDef().viewHandler().accept(getDefinition(element), getShapeView());
    // Apply custom view operations.
    applyCustomProperties(element, mutationContext);
    // Apply size operations.
    getShapeHandlersDef().sizeHandler().ifPresent(h -> h.accept(element.getContent(), getShapeView()));
    getShape().getShapeStateHandler().shapeAttributesChanged().applyState(shapeState);
}
Also used : ShapeState(org.kie.workbench.common.stunner.core.client.shape.ShapeState)

Example 4 with ShapeState

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

the class ShapeStateAttributeAnimationHandler method applyState.

@Override
public void applyState(final ShapeState shapeState) {
    final ShapeState currentState = getShapeState();
    if (!shapeState.equals(currentState)) {
        if (null != animationHandle) {
            animationHandle.stop();
            setAnimationHandle(null);
        }
        handler.applyState(shapeState);
    }
}
Also used : ShapeState(org.kie.workbench.common.stunner.core.client.shape.ShapeState)

Aggregations

ShapeState (org.kie.workbench.common.stunner.core.client.shape.ShapeState)4 Test (org.junit.Test)1