GridWidgetDnDMouseUpHandler implements NodeMouseUpHandler { @Override public void onNodeMouseUp(final NodeMouseUpEvent event) { switch (state.getOperation()) { case NONE: case COLUMN_MOVE_PENDING: case COLUMN_RESIZE_PENDING: case ROW_MOVE_PENDING: case COLUMN_RESIZE: break; case COLUMN_MOVE: case COLUMN_MOVE_INITIATED: case ROW_MOVE: case ROW_MOVE_INITIATED: layer.remove(state.getEventColumnHighlight()); layer.batch(); break; } scheduleDeferred(() -> { state.reset(); layer.getViewport().getElement().getStyle().setCursor(state.getCursor()); }); } GridWidgetDnDMouseUpHandler(final GridLayer layer,
                                       final GridWidgetDnDHandlersState state); @Override void onNodeMouseUp(final NodeMouseUpEvent event);  }
@Test public void stateIsResetOnMouseUpWhenStateIsNone() { state.setOperation(GridWidgetHandlersOperation.NONE); handler.onNodeMouseUp(event); verify(state, times(1)).reset(); }
@Test public void stateIsResetOnMouseUpWhenStateIsColumnMovePending() { state.setOperation(GridWidgetHandlersOperation.COLUMN_MOVE_PENDING); handler.onNodeMouseUp(event); verify(state, times(1)).reset(); }
@Test public void stateIsResetOnMouseUpWhenStateIsColumnResizePending() { state.setOperation(GridWidgetHandlersOperation.COLUMN_RESIZE_PENDING); handler.onNodeMouseUp(event); verify(state, times(1)).reset(); }
@Test public void stateIsResetOnMouseUpWhenStateIsColumnResize() { state.setOperation(GridWidgetHandlersOperation.COLUMN_RESIZE); handler.onNodeMouseUp(event); verify(state, times(1)).reset(); }
@Test public void stateIsResetOnMouseUpWhenStateIsColumnMove() { state.setOperation(GridWidgetHandlersOperation.COLUMN_MOVE); handler.onNodeMouseUp(event); verify(state, times(1)).reset(); verify(layer, times(1)).remove(any(IPrimitive.class)); verify(layer, times(1)).batch(); }
@Test public void stateIsResetOnMouseUpWhenStateIsRowMove() { state.setOperation(GridWidgetHandlersOperation.ROW_MOVE); handler.onNodeMouseUp(event); verify(state, times(1)).reset(); verify(layer, times(1)).remove(any(IPrimitive.class)); verify(layer, times(1)).batch(); }
@Test public void stateIsResetOnMouseUpWhenStateIsColumnMoveInitiated() { state.setOperation(GridWidgetHandlersOperation.COLUMN_MOVE_INITIATED); handler.onNodeMouseUp(event); verify(state, times(1)).reset(); verify(layer, times(1)).remove(any(IPrimitive.class)); verify(layer, times(1)).batch(); }
@Test public void stateIsResetOnMouseUpWhenStateIsRowMoveInitiated() { state.setOperation(GridWidgetHandlersOperation.ROW_MOVE_INITIATED); handler.onNodeMouseUp(event); verify(state, times(1)).reset(); verify(layer, times(1)).remove(any(IPrimitive.class)); verify(layer, times(1)).batch(); }