private int findMaxRowIndex(final int rowIndex, final int columnIndex, final int maxRowIndex, final GridCell<?> currentRowCell) { int maxBlockRowIndex = rowIndex + 1; boolean foundBottomSplitMarker = false; while (maxBlockRowIndex < maxRowIndex) { final GridRow nextRow = gridData.getRow(maxBlockRowIndex); final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex); if (nextRowCell == null) { break; } if (nextRowCell.isCollapsed() && foundBottomSplitMarker) { maxBlockRowIndex--; break; } if (!nextRowCell.equals(currentRowCell)) { break; } if (nextRowCell.getMergedCellCount() > 0) { foundBottomSplitMarker = true; } maxBlockRowIndex++; } return maxBlockRowIndex; }
private int findMaxRowIndex(final int rowIndex, final int columnIndex, final int maxRowIndex, final GridCell<?> currentRowCell) { int maxBlockRowIndex = rowIndex + 1; boolean foundBottomSplitMarker = false; while (maxBlockRowIndex < maxRowIndex) { final GridRow nextRow = gridData.getRow(maxBlockRowIndex); final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex); if (nextRowCell == null) { break; } if (nextRowCell.isCollapsed() && foundBottomSplitMarker) { maxBlockRowIndex--; break; } if (!nextRowCell.equals(currentRowCell)) { break; } if (nextRowCell.getMergedCellCount() > 0) { foundBottomSplitMarker = true; } maxBlockRowIndex++; } return maxBlockRowIndex; }
private int findMaxRowIndexForCellUpdate(final int rowIndex, final int columnIndex) { int maxRowIndex = rowIndex + 1; final GridRow currentRow = getRow(rowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex); //Find maximum row with a cell containing the same value as that being updated boolean foundBottomSplitMarker = false; while (maxRowIndex < rows.size()) { final GridRow nextRow = rows.get(maxRowIndex); final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex); if (!nextRow.isCollapsed()) { if (nextRowCell == null) { break; } if (nextRowCell.isCollapsed() && foundBottomSplitMarker) { maxRowIndex--; break; } if (!nextRowCell.equals(currentRowCell)) { break; } if (nextRowCell.getMergedCellCount() > 0) { foundBottomSplitMarker = true; } } maxRowIndex++; } return maxRowIndex - 1; }
private int findMaxRowIndexForCellUpdate(final int rowIndex, final int columnIndex) { int maxRowIndex = rowIndex + 1; final GridRow currentRow = getRow(rowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex); //Find maximum row with a cell containing the same value as that being updated boolean foundBottomSplitMarker = false; while (maxRowIndex < rows.size()) { final GridRow nextRow = rows.get(maxRowIndex); final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex); if (!nextRow.isCollapsed()) { if (nextRowCell == null) { break; } if (nextRowCell.isCollapsed() && foundBottomSplitMarker) { maxRowIndex--; break; } if (!nextRowCell.equals(currentRowCell)) { break; } if (nextRowCell.getMergedCellCount() > 0) { foundBottomSplitMarker = true; } } maxRowIndex++; } return maxRowIndex - 1; }
private int findMinRowIndex(final int rowIndex, final int columnIndex, final int minRowIndex, final GridCell<?> currentRowCell) { int minBlockRowIndex = rowIndex; if (currentRowCell != null) { boolean foundTopSplitMarker = currentRowCell.getMergedCellCount() > 0; while (minBlockRowIndex > minRowIndex) { final GridRow previousRow = gridData.getRow(minBlockRowIndex - 1); final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex); if (previousRowCell == null) { break; } if (previousRowCell.isCollapsed() && foundTopSplitMarker) { break; } if (!previousRowCell.equals(currentRowCell)) { break; } if (previousRowCell.getMergedCellCount() > 0) { foundTopSplitMarker = true; } minBlockRowIndex--; } } return minBlockRowIndex; }
private int findMinRowIndex(final int rowIndex, final int columnIndex, final int minRowIndex, final GridCell<?> currentRowCell) { int minBlockRowIndex = rowIndex; if (currentRowCell != null) { boolean foundTopSplitMarker = currentRowCell.getMergedCellCount() > 0; while (minBlockRowIndex > minRowIndex) { final GridRow previousRow = gridData.getRow(minBlockRowIndex - 1); final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex); if (previousRowCell == null) { break; } if (previousRowCell.isCollapsed() && foundTopSplitMarker) { break; } if (!previousRowCell.equals(currentRowCell)) { break; } if (previousRowCell.getMergedCellCount() > 0) { foundTopSplitMarker = true; } minBlockRowIndex--; } } return minBlockRowIndex; }
private int findMinRowIndexForCellUpdate(final int rowIndex, final int columnIndex) { int minRowIndex = rowIndex; final GridRow currentRow = getRow(rowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex); //Find minimum row with a cell containing the same value as that being updated boolean foundTopSplitMarker = currentRowCell != null && currentRowCell.getMergedCellCount() > 0; while (minRowIndex > 0) { final GridRow previousRow = rows.get(minRowIndex - 1); final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex); if (!(previousRow.isCollapsed() && currentRow.isCollapsed())) { if (previousRowCell == null) { break; } if (previousRowCell.isCollapsed() && foundTopSplitMarker) { break; } if (!previousRowCell.equals(currentRowCell)) { break; } if (previousRowCell.getMergedCellCount() > 0) { foundTopSplitMarker = true; } } minRowIndex--; } return minRowIndex; }
private int findMinRowIndexForCellUpdate(final int rowIndex, final int columnIndex) { int minRowIndex = rowIndex; final GridRow currentRow = getRow(rowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex); //Find minimum row with a cell containing the same value as that being updated boolean foundTopSplitMarker = currentRowCell != null && currentRowCell.getMergedCellCount() > 0; while (minRowIndex > 0) { final GridRow previousRow = rows.get(minRowIndex - 1); final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex); if (!(previousRow.isCollapsed() && currentRow.isCollapsed())) { if (previousRowCell == null) { break; } if (previousRowCell.isCollapsed() && foundTopSplitMarker) { break; } if (!previousRowCell.equals(currentRowCell)) { break; } if (previousRowCell.getMergedCellCount() > 0) { foundTopSplitMarker = true; } } minRowIndex--; } return minRowIndex; }
private int findMinRowIndex(final int rowIndex, final int columnIndex) { int minRowIndex = rowIndex; final GridRow currentRow = gridData.getRow(rowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex); //Find minimum row with a cell containing the same value as that being updated boolean foundTopSplitMarker = currentRowCell != null && currentRowCell.getMergedCellCount() > 0; while (minRowIndex > 0) { final GridRow previousRow = gridData.getRow(minRowIndex - 1); final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex); if (!(previousRow.isCollapsed() && currentRow.isCollapsed())) { if (previousRowCell == null) { break; } if (previousRowCell.isCollapsed() && foundTopSplitMarker) { break; } if (!previousRowCell.equals(currentRowCell)) { break; } if (previousRowCell.getMergedCellCount() > 0) { foundTopSplitMarker = true; } } minRowIndex--; } return minRowIndex; }
private int findMaxRowIndex(final int rowIndex, final int columnIndex) { int maxRowIndex = rowIndex + 1; final GridRow currentRow = gridData.getRow(rowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex); //Find maximum row with a cell containing the same value as that being updated boolean foundBottomSplitMarker = false; while (maxRowIndex < gridData.getRowCount()) { final GridRow nextRow = gridData.getRow(maxRowIndex); final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex); if (!nextRow.isCollapsed()) { if (nextRowCell == null) { break; } if (nextRowCell.isCollapsed() && foundBottomSplitMarker) { maxRowIndex--; break; } if (!nextRowCell.equals(currentRowCell)) { break; } if (nextRowCell.getMergedCellCount() > 0) { foundBottomSplitMarker = true; } } maxRowIndex++; } return maxRowIndex - 1; }
private int findMaxRowIndex(final int rowIndex, final int columnIndex) { int maxRowIndex = rowIndex + 1; final GridRow currentRow = gridData.getRow(rowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex); //Find maximum row with a cell containing the same value as that being updated boolean foundBottomSplitMarker = false; while (maxRowIndex < gridData.getRowCount()) { final GridRow nextRow = gridData.getRow(maxRowIndex); final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex); if (!nextRow.isCollapsed()) { if (nextRowCell == null) { break; } if (nextRowCell.isCollapsed() && foundBottomSplitMarker) { maxRowIndex--; break; } if (!nextRowCell.equals(currentRowCell)) { break; } if (nextRowCell.getMergedCellCount() > 0) { foundBottomSplitMarker = true; } } maxRowIndex++; } return maxRowIndex - 1; }
private int findMinRowIndex(final int rowIndex, final int columnIndex) { int minRowIndex = rowIndex; final GridRow currentRow = gridData.getRow(rowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex); //Find minimum row with a cell containing the same value as that being updated boolean foundTopSplitMarker = currentRowCell != null && currentRowCell.getMergedCellCount() > 0; while (minRowIndex > 0) { final GridRow previousRow = gridData.getRow(minRowIndex - 1); final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex); if (!(previousRow.isCollapsed() && currentRow.isCollapsed())) { if (previousRowCell == null) { break; } if (previousRowCell.isCollapsed() && foundTopSplitMarker) { break; } if (!previousRowCell.equals(currentRowCell)) { break; } if (previousRowCell.getMergedCellCount() > 0) { foundTopSplitMarker = true; } } minRowIndex--; } return minRowIndex; }
@Test @SuppressWarnings("unchecked") public void testMergedCellNotOnHotSpot() { when(uiModel.getCell(eq(0), eq(0))).thenReturn(gridCell); when(uiModel.getCell(eq(1), eq(0))).thenReturn(nextGridCell); when(uiModel.getColumns()).thenReturn(Collections.singletonList(gridColumn)); when(uiModel.getRow(eq(0))).thenReturn(gridRow); when(gridCell.getMergedCellCount()).thenReturn(2); when(nextGridCell.isCollapsed()).thenReturn(false); when(gridWidget.onGroupingToggle(anyDouble(), anyDouble(), anyDouble(), anyDouble())).thenReturn(false); assertThat(handler.onNodeMouseEvent(gridWidget, relativeLocation, Optional.empty(), Optional.empty(), Optional.of(0), Optional.of(0), event)).isFalse(); verify(handler, never()).collapseRows(any(GridWidget.class), anyInt(), anyInt(), anyInt()); verify(handler, never()).expandRows(any(GridWidget.class), anyInt(), anyInt(), anyInt()); }
@Test @SuppressWarnings("unchecked") public void testMergedCellNotOnHotSpot() { when(uiModel.getCell(eq(0), eq(0))).thenReturn(gridCell); when(uiModel.getCell(eq(1), eq(0))).thenReturn(nextGridCell); when(uiModel.getColumns()).thenReturn(Collections.singletonList(gridColumn)); when(uiModel.getRow(eq(0))).thenReturn(gridRow); when(gridCell.getMergedCellCount()).thenReturn(2); when(nextGridCell.isCollapsed()).thenReturn(false); when(gridWidget.onGroupingToggle(anyDouble(), anyDouble(), anyDouble(), anyDouble())).thenReturn(false); assertThat(handler.onNodeMouseEvent(gridWidget, relativeLocation, Optional.empty(), Optional.empty(), Optional.of(0), Optional.of(0), event)).isFalse(); verify(handler, never()).collapseRows(any(GridWidget.class), anyInt(), anyInt(), anyInt()); verify(handler, never()).expandRows(any(GridWidget.class), anyInt(), anyInt(), anyInt()); }
when(uiModel.getRow(eq(0))).thenReturn(gridRow); when(gridCell.getMergedCellCount()).thenReturn(2); when(nextGridCell.isCollapsed()).thenReturn(true); when(gridWidget.onGroupingToggle(anyDouble(), anyDouble(),
@Test @SuppressWarnings("unchecked") public void testMergedCellCollapseOnHotSpot() { when(uiModel.getCell(eq(0), eq(0))).thenReturn(gridCell); when(uiModel.getCell(eq(1), eq(0))).thenReturn(nextGridCell); when(uiModel.getColumns()).thenReturn(Collections.singletonList(gridColumn)); when(uiModel.getRow(eq(0))).thenReturn(gridRow); when(gridCell.getMergedCellCount()).thenReturn(2); when(nextGridCell.isCollapsed()).thenReturn(false); when(gridWidget.onGroupingToggle(anyDouble(), anyDouble(), anyDouble(), anyDouble())).thenReturn(true); assertThat(handler.onNodeMouseEvent(gridWidget, relativeLocation, Optional.empty(), Optional.empty(), Optional.of(0), Optional.of(0), event)).isTrue(); verify(handler).collapseRows(eq(gridWidget), eq(0), eq(0), eq(2)); verify(handler, never()).expandRows(any(GridWidget.class), anyInt(), anyInt(), anyInt()); }
when(uiModel.getRow(eq(0))).thenReturn(gridRow); when(gridCell.getMergedCellCount()).thenReturn(2); when(nextGridCell.isCollapsed()).thenReturn(true); when(gridWidget.onGroupingToggle(anyDouble(), anyDouble(),
@Test @SuppressWarnings("unchecked") public void testMergedCellCollapseOnHotSpot() { when(uiModel.getCell(eq(0), eq(0))).thenReturn(gridCell); when(uiModel.getCell(eq(1), eq(0))).thenReturn(nextGridCell); when(uiModel.getColumns()).thenReturn(Collections.singletonList(gridColumn)); when(uiModel.getRow(eq(0))).thenReturn(gridRow); when(gridCell.getMergedCellCount()).thenReturn(2); when(nextGridCell.isCollapsed()).thenReturn(false); when(gridWidget.onGroupingToggle(anyDouble(), anyDouble(), anyDouble(), anyDouble())).thenReturn(true); assertThat(handler.onNodeMouseEvent(gridWidget, relativeLocation, Optional.empty(), Optional.empty(), Optional.of(0), Optional.of(0), event)).isTrue(); verify(handler).collapseRows(eq(gridWidget), eq(0), eq(0), eq(2)); verify(handler, never()).expandRows(any(GridWidget.class), anyInt(), anyInt(), anyInt()); }
if (!nextRowCell.isCollapsed()) { collapseRows(gridWidget, uiRowIndex,
if (!nextRowCell.isCollapsed()) { collapseRows(gridWidget, uiRowIndex,