Search in sources :

Example 1 with ShapeGlyph

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

the class GlyphTests method testShapeGlyph.

@Test
public void testShapeGlyph() {
    final ShapeGlyph glyph = ShapeGlyph.create();
    glyph.setDefinitionId("def1");
    glyph.setFactorySupplier(factorySupplier);
    assertEquals("def1", glyph.getDefinitionId());
    assertEquals(factorySupplier, glyph.getFactorySupplier());
}
Also used : ShapeGlyph(org.kie.workbench.common.stunner.core.definition.shape.ShapeGlyph) Test(org.junit.Test)

Example 2 with ShapeGlyph

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

the class DelegateShapeFactoryTest method testDelegate2.

@Test
@SuppressWarnings("unchecked")
public void testDelegate2() {
    final String definition2Id = BindableAdapterUtils.getDefinitionId(Definition2.class);
    tested.delegate(Definition2.class, shapeDef2, () -> shapeDefFactoryStub);
    final Shape shape = tested.newShape(definition2);
    assertNotNull(shape);
    assertEquals(shape2, shape);
    final ShapeGlyph glyph = (ShapeGlyph) tested.getGlyph(definition2Id);
    assertNotNull(glyph);
    assertEquals(definition2Id, glyph.getDefinitionId());
    assertEquals(tested, glyph.getFactorySupplier().get());
}
Also used : Shape(org.kie.workbench.common.stunner.core.client.shape.Shape) ShapeGlyph(org.kie.workbench.common.stunner.core.definition.shape.ShapeGlyph) Test(org.junit.Test)

Example 3 with ShapeGlyph

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

the class DelegateShapeFactoryTest method testDelegate1.

@Test
@SuppressWarnings("unchecked")
public void testDelegate1() {
    final String definition1Id = BindableAdapterUtils.getDefinitionId(Definition1.class);
    tested.delegate(Definition1.class, shapeDef1, () -> shapeDefFactoryStub);
    final Shape shape = tested.newShape(definition1);
    assertNotNull(shape);
    assertEquals(shape1, shape);
    final ShapeGlyph glyph = (ShapeGlyph) tested.getGlyph(definition1Id);
    assertNotNull(glyph);
    assertEquals(definition1Id, glyph.getDefinitionId());
    assertEquals(tested, glyph.getFactorySupplier().get());
}
Also used : Shape(org.kie.workbench.common.stunner.core.client.shape.Shape) ShapeGlyph(org.kie.workbench.common.stunner.core.definition.shape.ShapeGlyph) Test(org.junit.Test)

Example 4 with ShapeGlyph

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

the class AbstractShapeFactory method getGlyph.

@Override
public Glyph getGlyph(final String definitionId) {
    final Glyph glyph = getGlyphFor(definitionId);
    if (ShapeGlyph.class.equals(glyph.getClass())) {
        final ShapeGlyph shapeGlyph = (ShapeGlyph) glyph;
        shapeGlyph.setDefinitionId(definitionId);
        shapeGlyph.setFactorySupplier(() -> this);
    }
    return glyph;
}
Also used : ShapeGlyph(org.kie.workbench.common.stunner.core.definition.shape.ShapeGlyph) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) ShapeGlyph(org.kie.workbench.common.stunner.core.definition.shape.ShapeGlyph)

Example 5 with ShapeGlyph

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

the class LienzoGlyphRenderersTest method testRender.

@Test
@SuppressWarnings("unchecked")
public void testRender() {
    final ShapeGlyph glyph = ShapeGlyph.create();
    tested.render(glyph, 100, 200);
    verify(rendererProvider, times(1)).apply(eq(ShapeGlyph.class));
}
Also used : ShapeGlyph(org.kie.workbench.common.stunner.core.definition.shape.ShapeGlyph) Test(org.junit.Test)

Aggregations

ShapeGlyph (org.kie.workbench.common.stunner.core.definition.shape.ShapeGlyph)7 Test (org.junit.Test)6 Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)2 LienzoPanel (com.ait.lienzo.client.widget.LienzoPanel)1 Glyph (org.kie.workbench.common.stunner.core.definition.shape.Glyph)1