Search in sources :

Example 1 with NodeMouseDoubleClickHandler

use of com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenterTest method checkRegisteredNodeMouseDoubleClickHandlerNotOverHeader.

@Test
@SuppressWarnings("unchecked")
public void checkRegisteredNodeMouseDoubleClickHandlerNotOverHeader() {
    final ArgumentCaptor<NodeMouseDoubleClickHandler> nodeMouseDoubleClickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseDoubleClickHandler.class);
    // dtPresenter.setContent(...) is called by the base tests @Before method
    verify(view, times(1)).registerNodeMouseDoubleClickHandler(nodeMouseDoubleClickHandlerArgumentCaptor.capture());
    final NodeMouseDoubleClickHandler nodeMouseDoubleClickHandler = nodeMouseDoubleClickHandlerArgumentCaptor.getValue();
    assertNotNull(nodeMouseDoubleClickHandler);
    // Mouse not over Header
    final NodeMouseDoubleClickEvent event = mock(NodeMouseDoubleClickEvent.class);
    when(view.isNodeMouseEventOverCaption(eq(event))).thenReturn(false);
    nodeMouseDoubleClickHandler.onNodeMouseDoubleClick(event);
    verify(dtPresenter, never()).enterPinnedMode(any(GridWidget.class), any(Command.class));
    verify(dtPresenter, never()).enterPinnedMode(any(GridWidget.class), any(Command.class));
}
Also used : GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) Command(com.google.gwt.user.client.Command) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) NodeMouseDoubleClickEvent(com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent) NodeMouseDoubleClickHandler(com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler) Test(org.junit.Test)

Example 2 with NodeMouseDoubleClickHandler

use of com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler 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);
}
Also used : NodeDragMoveHandler(com.ait.lienzo.client.core.event.NodeDragMoveHandler) NodeMouseDoubleClickHandler(com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler) Test(org.junit.Test)

Example 3 with NodeMouseDoubleClickHandler

use of com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler in project kie-wb-common by kiegroup.

the class ViewEventHandlerManagerTest method testTextDoubleClickHandler.

@Test
@SuppressWarnings("unchecked")
public void testTextDoubleClickHandler() {
    final ViewHandler<ViewEvent> clickHandler = mock(ViewHandler.class);
    final HandlerRegistration handlerRegistration = mock(HandlerRegistration.class);
    when(node.addNodeMouseDoubleClickHandler(any(NodeMouseDoubleClickHandler.class))).thenReturn(handlerRegistration);
    tested.addHandler(ViewEventType.TEXT_DBL_CLICK, clickHandler);
    final ArgumentCaptor<NodeMouseDoubleClickHandler> clickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseDoubleClickHandler.class);
    verify(node, times(1)).addNodeMouseDoubleClickHandler(clickHandlerArgumentCaptor.capture());
    final NodeMouseDoubleClickHandler nodeCLickHandler = clickHandlerArgumentCaptor.getValue();
    final NodeMouseDoubleClickEvent clickEvent = mock(NodeMouseDoubleClickEvent.class);
    final MouseEvent mouseEvent = mock(MouseEvent.class);
    final int x = 102;
    final int y = 410;
    when(clickEvent.getX()).thenReturn(x);
    when(clickEvent.getY()).thenReturn(y);
    when(clickEvent.isShiftKeyDown()).thenReturn(true);
    when(clickEvent.isAltKeyDown()).thenReturn(true);
    when(clickEvent.isMetaKeyDown()).thenReturn(true);
    when(clickEvent.getMouseEvent()).thenReturn(mouseEvent);
    when(mouseEvent.getClientX()).thenReturn(x);
    when(mouseEvent.getClientY()).thenReturn(y);
    nodeCLickHandler.onNodeMouseDoubleClick(clickEvent);
    final ArgumentCaptor<ViewEvent> eventArgumentCaptor = ArgumentCaptor.forClass(ViewEvent.class);
    verify(clickHandler, times(1)).handle(eventArgumentCaptor.capture());
    final TextDoubleClickEvent viewEvent = (TextDoubleClickEvent) eventArgumentCaptor.getValue();
    assertEquals(x, viewEvent.getX(), 0d);
    assertEquals(y, viewEvent.getY(), 0d);
    assertEquals(x, viewEvent.getClientX(), 0d);
    assertEquals(y, viewEvent.getClientY(), 0d);
    assertTrue(viewEvent.isAltKeyDown());
    assertTrue(viewEvent.isMetaKeyDown());
    assertTrue(viewEvent.isShiftKeyDown());
    assertNotNull(tested.getRegistrationMap().get(ViewEventType.TEXT_DBL_CLICK));
}
Also used : HandlerRegistration(com.google.gwt.event.shared.HandlerRegistration) MouseEvent(com.google.gwt.event.dom.client.MouseEvent) ViewEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.ViewEvent) TextDoubleClickEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.TextDoubleClickEvent) NodeMouseDoubleClickEvent(com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent) NodeMouseDoubleClickHandler(com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler) Test(org.junit.Test)

Example 4 with NodeMouseDoubleClickHandler

use of com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler in project kie-wb-common by kiegroup.

the class ViewEventHandlerManagerTest method testDoubleClickHandler.

@Test
@SuppressWarnings("unchecked")
public void testDoubleClickHandler() {
    final ViewHandler<ViewEvent> clickHandler = mock(ViewHandler.class);
    final HandlerRegistration handlerRegistration = mock(HandlerRegistration.class);
    when(node.addNodeMouseDoubleClickHandler(any(NodeMouseDoubleClickHandler.class))).thenReturn(handlerRegistration);
    tested.addHandler(ViewEventType.MOUSE_DBL_CLICK, clickHandler);
    final ArgumentCaptor<NodeMouseDoubleClickHandler> clickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseDoubleClickHandler.class);
    verify(node, times(1)).addNodeMouseDoubleClickHandler(clickHandlerArgumentCaptor.capture());
    final NodeMouseDoubleClickHandler nodeCLickHandler = clickHandlerArgumentCaptor.getValue();
    final NodeMouseDoubleClickEvent clickEvent = mock(NodeMouseDoubleClickEvent.class);
    final MouseEvent mouseEvent = mock(MouseEvent.class);
    final int x = 102;
    final int y = 410;
    when(clickEvent.getX()).thenReturn(x);
    when(clickEvent.getY()).thenReturn(y);
    when(clickEvent.isButtonLeft()).thenReturn(true);
    when(clickEvent.isButtonRight()).thenReturn(true);
    when(clickEvent.isButtonMiddle()).thenReturn(true);
    when(clickEvent.isShiftKeyDown()).thenReturn(true);
    when(clickEvent.isAltKeyDown()).thenReturn(true);
    when(clickEvent.isMetaKeyDown()).thenReturn(true);
    when(clickEvent.getMouseEvent()).thenReturn(mouseEvent);
    when(mouseEvent.getClientX()).thenReturn(x);
    when(mouseEvent.getClientY()).thenReturn(y);
    nodeCLickHandler.onNodeMouseDoubleClick(clickEvent);
    final ArgumentCaptor<ViewEvent> eventArgumentCaptor = ArgumentCaptor.forClass(ViewEvent.class);
    verify(clickHandler, times(1)).handle(eventArgumentCaptor.capture());
    final MouseDoubleClickEvent viewEvent = (MouseDoubleClickEvent) eventArgumentCaptor.getValue();
    assertEquals(x, viewEvent.getX(), 0d);
    assertEquals(y, viewEvent.getY(), 0d);
    assertEquals(x, viewEvent.getClientX(), 0d);
    assertEquals(y, viewEvent.getClientY(), 0d);
    assertTrue(viewEvent.isButtonLeft());
    assertTrue(viewEvent.isButtonRight());
    assertTrue(viewEvent.isButtonMiddle());
    assertTrue(viewEvent.isAltKeyDown());
    assertTrue(viewEvent.isMetaKeyDown());
    assertTrue(viewEvent.isShiftKeyDown());
    assertNotNull(tested.getRegistrationMap().get(ViewEventType.MOUSE_DBL_CLICK));
}
Also used : HandlerRegistration(com.google.gwt.event.shared.HandlerRegistration) MouseEvent(com.google.gwt.event.dom.client.MouseEvent) ViewEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.ViewEvent) MouseDoubleClickEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseDoubleClickEvent) NodeMouseDoubleClickEvent(com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent) NodeMouseDoubleClickEvent(com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent) NodeMouseDoubleClickHandler(com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler) Test(org.junit.Test)

Example 5 with NodeMouseDoubleClickHandler

use of com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler in project drools-wb by kiegroup.

the class GuidedDecisionTablePresenterTest method checkRegisteredNodeMouseDoubleClickHandlerOverHeader.

@Test
@SuppressWarnings("unchecked")
public void checkRegisteredNodeMouseDoubleClickHandlerOverHeader() {
    final ArgumentCaptor<NodeMouseDoubleClickHandler> nodeMouseDoubleClickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseDoubleClickHandler.class);
    // dtPresenter.setContent(...) is called by the base tests @Before method
    verify(view, times(1)).registerNodeMouseDoubleClickHandler(nodeMouseDoubleClickHandlerArgumentCaptor.capture());
    final NodeMouseDoubleClickHandler nodeMouseDoubleClickHandler = nodeMouseDoubleClickHandlerArgumentCaptor.getValue();
    assertNotNull(nodeMouseDoubleClickHandler);
    // Mouse over Header, not pinned
    final NodeMouseDoubleClickEvent event = mock(NodeMouseDoubleClickEvent.class);
    when(view.isNodeMouseEventOverCaption(eq(event))).thenReturn(true);
    when(modellerPresenter.isGridPinned()).thenReturn(false);
    nodeMouseDoubleClickHandler.onNodeMouseDoubleClick(event);
    verify(dtPresenter, times(1)).enterPinnedMode(eq(view), any(Command.class));
    // Mouse over Header, pinned
    when(modellerPresenter.isGridPinned()).thenReturn(true);
    nodeMouseDoubleClickHandler.onNodeMouseDoubleClick(event);
    verify(dtPresenter, times(1)).exitPinnedMode(any(Command.class));
}
Also used : Command(com.google.gwt.user.client.Command) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) NodeMouseDoubleClickEvent(com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent) NodeMouseDoubleClickHandler(com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler) Test(org.junit.Test)

Aggregations

NodeMouseDoubleClickHandler (com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler)5 Test (org.junit.Test)5 NodeMouseDoubleClickEvent (com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent)4 MouseEvent (com.google.gwt.event.dom.client.MouseEvent)2 HandlerRegistration (com.google.gwt.event.shared.HandlerRegistration)2 Command (com.google.gwt.user.client.Command)2 ViewEvent (org.kie.workbench.common.stunner.core.client.shape.view.event.ViewEvent)2 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)2 NodeDragMoveHandler (com.ait.lienzo.client.core.event.NodeDragMoveHandler)1 MouseDoubleClickEvent (org.kie.workbench.common.stunner.core.client.shape.view.event.MouseDoubleClickEvent)1 TextDoubleClickEvent (org.kie.workbench.common.stunner.core.client.shape.view.event.TextDoubleClickEvent)1 GridWidget (org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget)1