GridWidgetDnDMouseMoveHandler implements NodeMouseMoveHandler { Optional<GridColumn<?>> getFirstRightAutoColumn(GridColumn<?> target, GridData model) { List<GridColumn<?>> columns = model.getColumns(); int targetIndex = columns.indexOf(target); for (int i = targetIndex + 1; i < columns.size(); i += 1) { GridColumn<?> gridColumn = columns.get(i); if (GridColumn.ColumnWidthMode.isAuto(gridColumn)) { return Optional.of(gridColumn); } } return Optional.empty(); } GridWidgetDnDMouseMoveHandler(final GridLayer layer,
                                         final GridWidgetDnDHandlersState state); @Override @SuppressWarnings("unchecked") void onNodeMouseMove(final NodeMouseMoveEvent event);  }
@Test public void getFirstRightAutoColumn() { assertFalse(handler.getFirstRightAutoColumn(column, uiModel).isPresent()); uiModel.appendColumn(column); assertFalse(handler.getFirstRightAutoColumn(column, uiModel).isPresent()); uiModel.appendColumn(rightColumn); assertFalse(handler.getFirstRightAutoColumn(column, uiModel).isPresent()); rightColumn.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO); assertEquals(rightColumn, handler.getFirstRightAutoColumn(column, uiModel).get()); }