Search in sources :

Example 1 with CanvasShapeListener

use of org.kie.workbench.common.stunner.core.client.canvas.listener.CanvasShapeListener in project kie-wb-common by kiegroup.

the class CanvasControlRegistrationHandler method initializeListeners.

private void initializeListeners() {
    // Canvas listeners.
    final C canvas = getCanvas();
    this.shapeListener = new CanvasShapeListener() {

        @Override
        public void register(final Shape item) {
            onRegisterShape(item);
        }

        @Override
        public void deregister(final Shape item) {
            onDeregisterShape(item);
        }

        @Override
        public void clear() {
            onClear();
        }
    };
    canvas.addRegistrationListener(shapeListener);
    // Canvas handler listeners.
    this.elementListener = new CanvasElementListener() {

        @Override
        public void update(final Element item) {
            onElementRegistration(item, false, true);
        }

        @Override
        public void register(final Element item) {
            onRegisterElement(item);
        }

        @Override
        public void deregister(final Element item) {
            onDeregisterElement(item);
        }

        @Override
        public void clear() {
            onClear();
        }
    };
    getCanvasHandler().addRegistrationListener(elementListener);
}
Also used : Shape(org.kie.workbench.common.stunner.core.client.shape.Shape) CanvasElementListener(org.kie.workbench.common.stunner.core.client.canvas.listener.CanvasElementListener) Element(org.kie.workbench.common.stunner.core.graph.Element) CanvasShapeListener(org.kie.workbench.common.stunner.core.client.canvas.listener.CanvasShapeListener)

Aggregations

CanvasElementListener (org.kie.workbench.common.stunner.core.client.canvas.listener.CanvasElementListener)1 CanvasShapeListener (org.kie.workbench.common.stunner.core.client.canvas.listener.CanvasShapeListener)1 Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)1 Element (org.kie.workbench.common.stunner.core.graph.Element)1