use of org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickHandler in project kie-wb-common by kiegroup.
the class ToolboxControlImpl method register.
@Override
@SuppressWarnings("unchecked")
public void register(final Element element) {
if (checkNotRegistered(element) && supportsToolbox(element)) {
final Shape shape = canvasHandler.getCanvas().getShape(element.getUUID());
final HasEventHandlers hasEventHandlers = (HasEventHandlers) shape.getShapeView();
if (hasEventHandlers.supports(ViewEventType.MOUSE_CLICK)) {
final MouseClickHandler clickHandler = new MouseClickHandler() {
@Override
public void handle(final MouseClickEvent event) {
if (event.isButtonLeft()) {
show(element);
}
}
};
hasEventHandlers.addHandler(ViewEventType.MOUSE_CLICK, clickHandler);
registerHandler(element.getUUID(), clickHandler);
}
}
}
Aggregations