Search in sources :

Example 1 with MouseDoubleClickHandler

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

the class ControlPointControlImpl method registerHandlers.

@SuppressWarnings("unchecked")
private void registerHandlers(final Element element, final Shape<?> shape) {
    if (shape.getShapeView() instanceof HasEventHandlers && element instanceof Edge && element.getContent() instanceof ViewConnector) {
        final HasEventHandlers hasEventHandlers = (HasEventHandlers) shape.getShapeView();
        // Register handler on the Connector to Add a ControlPoint
        MouseDoubleClickHandler eventHandler = new MouseDoubleClickHandler() {

            @Override
            public void handle(MouseDoubleClickEvent event) {
                addControlPoint((Edge) element, new ControlPointImpl(event.getX(), event.getY()));
            }
        };
        hasEventHandlers.addHandler(ViewEventType.MOUSE_DBL_CLICK, eventHandler);
        registerHandler(element.getUUID(), eventHandler);
    }
}
Also used : ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) MouseDoubleClickHandler(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseDoubleClickHandler) ControlPointImpl(org.kie.workbench.common.stunner.core.graph.content.view.ControlPointImpl) HasEventHandlers(org.kie.workbench.common.stunner.core.client.shape.view.HasEventHandlers) MouseDoubleClickEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseDoubleClickEvent) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Aggregations

HasEventHandlers (org.kie.workbench.common.stunner.core.client.shape.view.HasEventHandlers)1 MouseDoubleClickEvent (org.kie.workbench.common.stunner.core.client.shape.view.event.MouseDoubleClickEvent)1 MouseDoubleClickHandler (org.kie.workbench.common.stunner.core.client.shape.view.event.MouseDoubleClickHandler)1 Edge (org.kie.workbench.common.stunner.core.graph.Edge)1 ControlPointImpl (org.kie.workbench.common.stunner.core.graph.content.view.ControlPointImpl)1 ViewConnector (org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector)1