use of org.kie.workbench.common.stunner.core.client.components.drag.DragProxyCallback in project kie-wb-common by kiegroup.
the class ShapeGlyphDragHandlerImplTest method testShow.
@Test
public void testShow() throws Exception {
CountDownLatch latch = new CountDownLatch(1);
DragProxyCallback callback = mock(DragProxyCallback.class);
shapeGlyphDragHandler.show(item, 0, 0, callback);
// asserting handlers registrations
assertEquals(shapeGlyphDragHandler.handlerRegistrations.size(), 2);
// delay timeout to add MouseUp handler
latch.await(201, TimeUnit.MILLISECONDS);
assertEquals(shapeGlyphDragHandler.handlerRegistrations.size(), 2);
assertNotNull(shapeGlyphDragHandler.dragProxyPanel);
verify(glyphLienzoGlyphRenderer).render(item.getShape(), item.getWidth(), item.getHeight());
}
use of org.kie.workbench.common.stunner.core.client.components.drag.DragProxyCallback in project kie-wb-common by kiegroup.
the class ShapeViewDragProxyImpl method show.
@Override
public DragProxy<AbstractCanvas, ShapeView<?>, DragProxyCallback> show(final ShapeView<?> item, final int x, final int y, final DragProxyCallback callback) {
final AbstractDragProxy.Callback c = new AbstractDragProxy.Callback() {
@Override
public void onStart(final int x, final int y) {
callback.onStart(x, y);
}
@Override
public void onMove(final int x, final int y) {
callback.onMove(x, y);
}
@Override
public void onComplete(final int x, final int y) {
callback.onComplete(x, y);
}
};
if (item instanceof WiresShape) {
final WiresShape wiresShape = (WiresShape) item;
this.proxy = new WiresShapeDragProxy(getLayer().getLienzoLayer(), wiresShape, x, y, 100, c);
} else if (item instanceof WiresConnector) {
final WiresConnector wiresConnector = (WiresConnector) item;
this.proxy = new WiresConnectorDragProxy(getLayer().getLienzoLayer(), wiresConnector, x, y, 100, c);
}
return this;
}
use of org.kie.workbench.common.stunner.core.client.components.drag.DragProxyCallback in project kie-wb-common by kiegroup.
the class BS3PaletteWidgetViewImpl method showDragProxy.
@Override
public void showDragProxy(String itemId, double x, double y, double width, double height) {
final Glyph glyph = presenter.getShapeGlyph(itemId);
itemDragProxy = shapeGlyphDragHandler.show(new ShapeGlyphDragHandler.Item() {
@Override
public Glyph getShape() {
return glyph;
}
@Override
public int getWidth() {
return (int) width;
}
@Override
public int getHeight() {
return (int) height;
}
}, (int) x, (int) y, new DragProxyCallback() {
@Override
public void onStart(int x, int y) {
presenter.onDragStart(itemId, x, y);
}
@Override
public void onMove(int x, int y) {
presenter.onDragProxyMove(itemId, (double) x, (double) y);
}
@Override
public void onComplete(int x, int y) {
presenter.onDragProxyComplete(itemId, (double) x, (double) y);
}
});
}
Aggregations