use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class ViewEventHandlerManager method registerExitHandler.
protected HandlerRegistration[] registerExitHandler(final ViewHandler<ViewEvent> eventHandler) {
return new HandlerRegistration[] { shape.addNodeMouseExitHandler(e -> {
if (isEnabled()) {
final MouseExitEvent event = new MouseExitEvent(e.getX(), e.getY(), e.getMouseEvent().getClientX(), e.getMouseEvent().getClientY());
event.setShiftKeyDown(e.isShiftKeyDown());
event.setAltKeyDown(e.isAltKeyDown());
event.setMetaKeyDown(e.isMetaKeyDown());
eventHandler.handle(event);
}
}) };
}
use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class ViewEventHandlerManager method registerTextDoubleClickHandler.
protected HandlerRegistration[] registerTextDoubleClickHandler(final ViewHandler<ViewEvent> eventHandler) {
return new HandlerRegistration[] { node.addNodeMouseDoubleClickHandler(nodeMouseDoubleClickEvent -> {
if (isEnabled()) {
skipClickHandler();
final TextDoubleClickEvent event = new TextDoubleClickEvent(nodeMouseDoubleClickEvent.getX(), nodeMouseDoubleClickEvent.getY(), nodeMouseDoubleClickEvent.getMouseEvent().getClientX(), nodeMouseDoubleClickEvent.getMouseEvent().getClientY());
event.setShiftKeyDown(nodeMouseDoubleClickEvent.isShiftKeyDown());
event.setAltKeyDown(nodeMouseDoubleClickEvent.isAltKeyDown());
event.setMetaKeyDown(nodeMouseDoubleClickEvent.isMetaKeyDown());
eventHandler.handle(event);
restoreClickHandler();
}
}) };
}
use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class ViewEventHandlerManager method registerGestureHandler.
protected HandlerRegistration[] registerGestureHandler(final GestureHandler gestureHandler) {
HandlerRegistration gestureStartReg = node.addNodeGestureStartHandler(new NodeGestureStartHandler() {
@Override
public void onNodeGestureStart(final NodeGestureStartEvent event) {
if (isEnabled()) {
final GestureEvent event1 = buildGestureEvent(event);
if (null != event1) {
gestureHandler.start(event1);
}
}
}
});
HandlerRegistration gestureChangeReg = node.addNodeGestureChangeHandler(new NodeGestureChangeHandler() {
@Override
public void onNodeGestureChange(final NodeGestureChangeEvent event) {
if (isEnabled()) {
final GestureEvent event1 = buildGestureEvent(event);
if (null != event1) {
gestureHandler.change(event1);
}
}
}
});
HandlerRegistration gestureEndReg = node.addNodeGestureEndHandler(new NodeGestureEndHandler() {
@Override
public void onNodeGestureEnd(final NodeGestureEndEvent event) {
if (isEnabled()) {
final GestureEvent event1 = buildGestureEvent(event);
if (null != event1) {
gestureHandler.end(event1);
}
}
}
});
return new HandlerRegistration[] { gestureStartReg, gestureChangeReg, gestureEndReg };
}
use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class ViewEventHandlerManager method removeHandler.
@SuppressWarnings("unchecked")
public void removeHandler(final ViewHandler<? extends ViewEvent> eventHandler) {
final ViewEventType type = eventHandler.getType();
if (registrationMap.containsKey(type)) {
final HandlerRegistration[] registrations = registrationMap.get(type);
if (null != registrations && registrations.length > 0) {
for (final HandlerRegistration registration : registrations) {
registrationManager.deregister(registration);
}
}
registrationMap.remove(type);
}
}
use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class ViewEventHandlerManager method registerEnterHandler.
protected HandlerRegistration[] registerEnterHandler(final ViewHandler<ViewEvent> eventHandler) {
return new HandlerRegistration[] { shape.addNodeMouseEnterHandler(e -> {
if (isEnabled()) {
final MouseEnterEvent event = new MouseEnterEvent(e.getX(), e.getY(), e.getMouseEvent().getClientX(), e.getMouseEvent().getClientY());
event.setShiftKeyDown(e.isShiftKeyDown());
event.setAltKeyDown(e.isAltKeyDown());
event.setMetaKeyDown(e.isMetaKeyDown());
eventHandler.handle(event);
}
}) };
}
Aggregations