@Test public void testOnNodeMouseEventWhenOnlyVisualChangeAllowed() { when(gridWidget.isOnlyVisualChangeAllowed()).thenReturn(true); setupGrid(() -> null, () -> 0); assertThat(handler.onNodeMouseEvent(gridWidget, relativeLocation, uiHeaderRowIndex, uiHeaderColumnIndex, uiRowIndex, uiColumnIndex, event)).isFalse(); verify(gridWidget, never()).startEditingCell(any(Point2D.class)); }
@Override public boolean onNodeMouseEvent(final GridWidget gridWidget, final Point2D relativeLocation, final Optional<Integer> uiHeaderRowIndex, final Optional<Integer> uiHeaderColumnIndex, final Optional<Integer> uiRowIndex, final Optional<Integer> uiColumnIndex, final AbstractNodeMouseEvent event) { if (DynamicReadOnlyUtils.isOnlyVisualChangeAllowed(gridWidget)) { return false; } if (nestingSupplier.get() == 0) { return doSuperOnNodeMouseEvent(gridWidget, relativeLocation, uiHeaderRowIndex, uiHeaderColumnIndex, uiRowIndex, uiColumnIndex, event); } boolean isHandled = false; if (uiRowIndex.isPresent() && uiColumnIndex.isPresent()) { isHandled = delegatedHandleBodyCell(gridWidget, relativeLocation, uiRowIndex.get(), uiColumnIndex.get(), event); } return isHandled; }
DelegatingGridWidgetEditCellMouseEventHandler extends DefaultGridWidgetEditCellMouseEventHandler { @Override public boolean onNodeMouseEvent(final GridWidget gridWidget, final Point2D relativeLocation, final Optional<Integer> uiHeaderRowIndex, final Optional<Integer> uiHeaderColumnIndex, final Optional<Integer> uiRowIndex, final Optional<Integer> uiColumnIndex, final AbstractNodeMouseEvent event) { if (DynamicReadOnlyUtils.isOnlyVisualChangeAllowed(gridWidget)) { return false; } if (nestingSupplier.get() == 0) { return doSuperOnNodeMouseEvent(gridWidget, relativeLocation, uiHeaderRowIndex, uiHeaderColumnIndex, uiRowIndex, uiColumnIndex, event); } boolean isHandled = false; if (uiRowIndex.isPresent() && uiColumnIndex.isPresent()) { isHandled = delegatedHandleBodyCell(gridWidget, relativeLocation, uiRowIndex.get(), uiColumnIndex.get(), event); } return isHandled; } }
DelegatingGridWidgetEditCellMouseEventHandler extends DefaultGridWidgetEditCellMouseEventHandler { @Override public boolean onNodeMouseEvent(final GridWidget gridWidget, final Point2D relativeLocation, final Optional<Integer> uiHeaderRowIndex, final Optional<Integer> uiHeaderColumnIndex, final Optional<Integer> uiRowIndex, final Optional<Integer> uiColumnIndex, final AbstractNodeMouseEvent event) { if (DynamicReadOnlyUtils.isOnlyVisualChangeAllowed(gridWidget)) { return false; } if (nestingSupplier.get() == 0) { return doSuperOnNodeMouseEvent(gridWidget, relativeLocation, uiHeaderRowIndex, uiHeaderColumnIndex, uiRowIndex, uiColumnIndex, event); } boolean isHandled = false; if (uiRowIndex.isPresent() && uiColumnIndex.isPresent()) { isHandled = delegatedHandleBodyCell(gridWidget, relativeLocation, uiRowIndex.get(), uiColumnIndex.get(), event); } return isHandled; } DelegatingGridWidgetEditCellMouseEventHandler(final Supplier<GridCellTuple> parentSupplier,
                                                         final Supplier<Integer> nestingSupplier); }
DelegatingGridWidgetEditCellMouseEventHandler extends DefaultGridWidgetEditCellMouseEventHandler { @Override public boolean onNodeMouseEvent(final GridWidget gridWidget, final Point2D relativeLocation, final Optional<Integer> uiHeaderRowIndex, final Optional<Integer> uiHeaderColumnIndex, final Optional<Integer> uiRowIndex, final Optional<Integer> uiColumnIndex, final AbstractNodeMouseEvent event) { if (DynamicReadOnlyUtils.isOnlyVisualChangeAllowed(gridWidget)) { return false; } if (nestingSupplier.get() == 0) { return doSuperOnNodeMouseEvent(gridWidget, relativeLocation, uiHeaderRowIndex, uiHeaderColumnIndex, uiRowIndex, uiColumnIndex, event); } boolean isHandled = false; if (uiRowIndex.isPresent() && uiColumnIndex.isPresent()) { isHandled = delegatedHandleBodyCell(gridWidget, relativeLocation, uiRowIndex.get(), uiColumnIndex.get(), event); } return isHandled; } DelegatingGridWidgetEditCellMouseEventHandler(final Supplier<GridCellTuple> parentSupplier,
                                                         final Supplier<Integer> nestingSupplier); @Override boolean onNodeMouseEvent(final GridWidget gridWidget,
                                    final Point2D relativeLocation,
                                    final Optional<Integer> uiHeaderRowIndex,
                                    final Optional<Integer> uiHeaderColumnIndex,
                                    final Optional<Integer> uiRowIndex,
                                    final Optional<Integer> uiColumnIndex,
                                    final AbstractNodeMouseEvent event); }
DelegatingGridWidgetEditCellMouseEventHandler extends DefaultGridWidgetEditCellMouseEventHandler { @Override public boolean onNodeMouseEvent(final GridWidget gridWidget, final Point2D relativeLocation, final Optional<Integer> uiHeaderRowIndex, final Optional<Integer> uiHeaderColumnIndex, final Optional<Integer> uiRowIndex, final Optional<Integer> uiColumnIndex, final AbstractNodeMouseEvent event) { if (DynamicReadOnlyUtils.isOnlyVisualChangeAllowed(gridWidget)) { return false; } if (nestingSupplier.get() == 0) { return doSuperOnNodeMouseEvent(gridWidget, relativeLocation, uiHeaderRowIndex, uiHeaderColumnIndex, uiRowIndex, uiColumnIndex, event); } boolean isHandled = false; if (uiRowIndex.isPresent() && uiColumnIndex.isPresent()) { isHandled = delegatedHandleBodyCell(gridWidget, relativeLocation, uiRowIndex.get(), uiColumnIndex.get(), event); } return isHandled; } DelegatingGridWidgetEditCellMouseEventHandler(final Supplier<GridCellTuple> parentSupplier,
                                                         final Supplier<Integer> nestingSupplier); @Override boolean onNodeMouseEvent(final GridWidget gridWidget,
                                    final Point2D relativeLocation,
                                    final Optional<Integer> uiHeaderRowIndex,
                                    final Optional<Integer> uiHeaderColumnIndex,
                                    final Optional<Integer> uiRowIndex,
                                    final Optional<Integer> uiColumnIndex,
                                    final AbstractNodeMouseEvent event);  }