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());
}
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());
}
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());
}
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;
}
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));
}
Aggregations