use of com.ait.lienzo.client.core.event.NodeDragMoveHandler in project drools-wb by kiegroup.
the class RadarMenuViewImpl method setup.
@PostConstruct
public void setup() {
radarCanvas.add(radarLayer);
radarMenuDropdown.setTitle(translationService.getTranslation(GuidedDecisionTableErraiConstants.RowContextMenuViewImpl_Title));
visibleBounds.setDraggable(true);
visibleBounds.addNodeDragMoveHandler(new NodeDragMoveHandler() {
@Override
public void onNodeDragMove(final NodeDragMoveEvent event) {
presenter.onDragVisibleBounds(visibleBounds.getX(), visibleBounds.getY());
}
});
visibleBounds.setFillColor(ColorName.GRAY);
visibleBounds.setAlpha(0.25);
visibleBounds.setLocation(new Point2D((RADAR_WIDTH - visibleBounds.getWidth()) / 2, (RADAR_HEIGHT - visibleBounds.getHeight()) / 2));
radarLayer.add(visibleBounds);
radarCanvas.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (eventTargetsPopup(event.getNativeEvent(), radarMenu)) {
event.stopPropagation();
event.preventDefault();
}
}
private boolean eventTargetsPopup(final NativeEvent event, final Element element) {
final EventTarget target = event.getEventTarget();
if (Element.is(target)) {
return element.isOrHasChild(Element.as(target));
}
return false;
}
});
}
use of com.ait.lienzo.client.core.event.NodeDragMoveHandler in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method checkRegisteredNodeDragMoveHandler.
@Test
@SuppressWarnings("unchecked")
public void checkRegisteredNodeDragMoveHandler() {
final ArgumentCaptor<NodeDragMoveHandler> nodeDragMoveHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeDragMoveHandler.class);
// dtPresenter.setContent(...) is called by the base tests @Before method
verify(view, times(1)).registerNodeDragMoveHandler(nodeDragMoveHandlerArgumentCaptor.capture());
final NodeDragMoveHandler nodeDragMoveHandler = nodeDragMoveHandlerArgumentCaptor.getValue();
assertNotNull(nodeDragMoveHandler);
nodeDragMoveHandler.onNodeDragMove(mock(NodeDragMoveEvent.class));
verify(modellerPresenter, times(1)).updateRadar();
}
use of com.ait.lienzo.client.core.event.NodeDragMoveHandler in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method initialiseEventHandler.
@Test
@SuppressWarnings("unchecked")
public void initialiseEventHandler() {
final ArgumentCaptor<NodeDragMoveHandler> nodeDragMoveHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeDragMoveHandler.class);
final ArgumentCaptor<NodeMouseDoubleClickHandler> nodeMouseDoubleClickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseDoubleClickHandler.class);
// dtPresenter.setContent(...) is called by the base tests @Before method
verify(view, times(1)).registerNodeDragMoveHandler(nodeDragMoveHandlerArgumentCaptor.capture());
verify(view, times(1)).registerNodeMouseDoubleClickHandler(nodeMouseDoubleClickHandlerArgumentCaptor.capture());
final NodeDragMoveHandler nodeDragMoveHandler = nodeDragMoveHandlerArgumentCaptor.getValue();
final NodeMouseDoubleClickHandler nodeMouseDoubleClickHandler = nodeMouseDoubleClickHandlerArgumentCaptor.getValue();
assertNotNull(nodeDragMoveHandler);
assertNotNull(nodeMouseDoubleClickHandler);
}
Aggregations