use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class ViewEventHandlerManager method registerDoubleClickHandler.
protected HandlerRegistration[] registerDoubleClickHandler(final ViewHandler<ViewEvent> eventHandler) {
return new HandlerRegistration[] { node.addNodeMouseDoubleClickHandler(nodeMouseDoubleClickEvent -> {
if (isEnabled()) {
skipClickHandler();
final MouseDoubleClickEvent event = new MouseDoubleClickEvent(nodeMouseDoubleClickEvent.getX(), nodeMouseDoubleClickEvent.getY(), nodeMouseDoubleClickEvent.getMouseEvent().getClientX(), nodeMouseDoubleClickEvent.getMouseEvent().getClientY());
event.setShiftKeyDown(nodeMouseDoubleClickEvent.isShiftKeyDown());
event.setAltKeyDown(nodeMouseDoubleClickEvent.isAltKeyDown());
event.setMetaKeyDown(nodeMouseDoubleClickEvent.isMetaKeyDown());
event.setButtonLeft(nodeMouseDoubleClickEvent.isButtonLeft());
event.setButtonMiddle(nodeMouseDoubleClickEvent.isButtonMiddle());
event.setButtonRight(nodeMouseDoubleClickEvent.isButtonRight());
eventHandler.handle(event);
restoreClickHandler();
}
}) };
}
use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class WiresShapeViewExt method registerDragHandler.
private HandlerRegistration[] registerDragHandler(final ViewHandler<DragEvent> eventHandler) {
if (!getAttachableShape().isDraggable()) {
final DragHandler dragHandler = (DragHandler) eventHandler;
setDragEnabled(true);
HandlerRegistration dragStartReg = addWiresDragStartHandler(wiresDragStartEvent -> {
final DragEvent e = buildDragEvent(wiresDragStartEvent);
dragHandler.start(e);
});
HandlerRegistration dragMoveReg = addWiresDragMoveHandler(wiresDragMoveEvent -> {
final DragEvent e = buildDragEvent(wiresDragMoveEvent);
dragHandler.handle(e);
});
HandlerRegistration dragEndReg = addWiresDragEndHandler(wiresDragEndEvent -> {
final DragEvent e = buildDragEvent(wiresDragEndEvent);
dragHandler.end(e);
});
return new HandlerRegistration[] { dragStartReg, dragMoveReg, dragEndReg };
}
return null;
}
use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class WiresShapeViewExt method registerResizeHandler.
private HandlerRegistration[] registerResizeHandler(final ViewHandler<ResizeEvent> eventHandler) {
final ResizeHandler resizeHandler = (ResizeHandler) eventHandler;
setResizable(true);
HandlerRegistration r0 = addWiresResizeStartHandler(wiresResizeStartEvent -> {
final ResizeEvent event = buildResizeEvent(wiresResizeStartEvent);
resizeHandler.start(event);
});
HandlerRegistration r1 = addWiresResizeStepHandler(wiresResizeStepEvent -> {
final ResizeEvent event = buildResizeEvent(wiresResizeStepEvent);
resizeHandler.handle(event);
rebuildTextBoundaries(event.getWidth(), event.getHeight());
});
HandlerRegistration r2 = addWiresResizeEndHandler(wiresResizeEndEvent -> {
final ResizeEvent event = buildResizeEvent(wiresResizeEndEvent);
resizeHandler.end(event);
});
return new HandlerRegistration[] { r0, r1, r2 };
}
use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class CustomGroupItemTest method setup.
@Before
public void setup() throws Exception {
styles.clear();
text.clear();
clickHandler = null;
customGroupItem = new CustomGroupItem("item", IconType.ADJUST, command) {
public void addStyleName(final String style) {
styles.add(style);
}
public void removeStyleName(final String style) {
styles.remove(style);
}
public String getStyleName() {
return styles.toString();
}
public void setText(final String value) {
text.add(value);
}
public String getText() {
return text.get(0);
}
public IconType getIcon() {
return icon.get(0);
}
public void setIcon(IconType icontype) {
icon.add(icontype);
}
public HandlerRegistration addClickHandler(final ClickHandler handler) {
clickHandler = handler;
return new HandlerRegistration() {
@Override
public void removeHandler() {
}
};
}
};
}
use of com.google.gwt.event.shared.HandlerRegistration in project kie-wb-common by kiegroup.
the class AnalyzerControllerImplTest method areHandlersTornDownOnTerminate.
@Test
public void areHandlersTornDownOnTerminate() throws Exception {
final HandlerRegistration validateEvent = mock(HandlerRegistration.class);
when(eventBus.addHandler(ValidateEvent.TYPE, controller)).thenReturn(validateEvent);
final HandlerRegistration deleteRowEvent = mock(HandlerRegistration.class);
when(eventBus.addHandler(DeleteRowEvent.TYPE, controller)).thenReturn(deleteRowEvent);
final HandlerRegistration afterColumnDeleted = mock(HandlerRegistration.class);
when(eventBus.addHandler(AfterColumnDeleted.TYPE, controller)).thenReturn(afterColumnDeleted);
final HandlerRegistration updateColumnDataEvent = mock(HandlerRegistration.class);
when(eventBus.addHandler(UpdateColumnDataEvent.TYPE, controller)).thenReturn(updateColumnDataEvent);
final HandlerRegistration appendRowEvent = mock(HandlerRegistration.class);
when(eventBus.addHandler(AppendRowEvent.TYPE, controller)).thenReturn(appendRowEvent);
final HandlerRegistration insertRowEvent = mock(HandlerRegistration.class);
when(eventBus.addHandler(InsertRowEvent.TYPE, controller)).thenReturn(insertRowEvent);
final HandlerRegistration afterColumnInserted = mock(HandlerRegistration.class);
when(eventBus.addHandler(AfterColumnInserted.TYPE, controller)).thenReturn(afterColumnInserted);
controller.initialiseAnalysis();
controller.terminateAnalysis();
verify(validateEvent).removeHandler();
verify(deleteRowEvent).removeHandler();
verify(afterColumnDeleted).removeHandler();
verify(updateColumnDataEvent).removeHandler();
verify(appendRowEvent).removeHandler();
verify(insertRowEvent).removeHandler();
verify(afterColumnDeleted).removeHandler();
}
Aggregations