@Test @SuppressWarnings("unchecked") public void testHandleHeaderCell_EditableColumn_NotEditableRow() { when(gridColumn.getHeaderMetaData()).thenReturn(Collections.singletonList(new BaseHeaderMetaData("column"))); assertThat(handler.handleHeaderCell(gridWidget, relativeLocation, 0, 0, clickEvent)).isFalse(); verify(editableHeaderMetaData, never()).edit(any(GridBodyCellEditContext.class)); }
@Override public boolean handleHeaderCell(final GridWidget gridWidget, final Point2D relativeLocation, final int uiHeaderRowIndex, final int uiHeaderColumnIndex, final AbstractNodeMouseEvent event) { final List<GridColumn<?>> gridColumns = gridWidget.getModel().getColumns(); final GridColumn<?> gridColumn = gridColumns.get(uiHeaderColumnIndex); final List<GridColumn.HeaderMetaData> gridColumnHeaderMetaData = gridColumn.getHeaderMetaData(); if (Objects.isNull(gridColumnHeaderMetaData) || gridColumnHeaderMetaData.isEmpty()) { return false; } if (!EditableHeaderUtilities.hasEditableHeader(gridColumn)) { return false; } if (!EditableHeaderUtilities.isEditableHeader(gridColumn, uiHeaderRowIndex)) { return false; } final EditableHeaderMetaData editableHeaderMetaData = (EditableHeaderMetaData) gridColumn.getHeaderMetaData().get(uiHeaderRowIndex); if (Objects.equals(editableHeaderMetaData.getSupportedEditAction(), GridCellEditAction.getSupportedEditAction(event))) { final Point2D gridWidgetComputedLocation = gridWidget.getComputedLocation(); CellContextUtilities.editSelectedCell(gridWidget, relativeLocation.add(gridWidgetComputedLocation)); return true; } return false; }
EditableHeaderGridWidgetEditCellMouseEventHandler extends DefaultGridWidgetEditCellMouseEventHandler { @Override public boolean handleHeaderCell(final GridWidget gridWidget, final Point2D relativeLocation, final int uiHeaderRowIndex, final int uiHeaderColumnIndex, final AbstractNodeMouseEvent event) { final List<GridColumn<?>> gridColumns = gridWidget.getModel().getColumns(); final GridColumn<?> gridColumn = gridColumns.get(uiHeaderColumnIndex); final List<GridColumn.HeaderMetaData> gridColumnHeaderMetaData = gridColumn.getHeaderMetaData(); if (Objects.isNull(gridColumnHeaderMetaData) || gridColumnHeaderMetaData.isEmpty()) { return false; } if (!EditableHeaderUtilities.hasEditableHeader(gridColumn)) { return false; } if (!EditableHeaderUtilities.isEditableHeader(gridColumn, uiHeaderRowIndex)) { return false; } final EditableHeaderMetaData editableHeaderMetaData = (EditableHeaderMetaData) gridColumn.getHeaderMetaData().get(uiHeaderRowIndex); if (Objects.equals(editableHeaderMetaData.getSupportedEditAction(), GridCellEditAction.getSupportedEditAction(event))) { final Point2D gridWidgetComputedLocation = gridWidget.getComputedLocation(); CellContextUtilities.editSelectedCell(gridWidget, relativeLocation.add(gridWidgetComputedLocation)); return true; } return false; } }
EditableHeaderGridWidgetEditCellMouseEventHandler extends DefaultGridWidgetEditCellMouseEventHandler { @Override public boolean handleHeaderCell(final GridWidget gridWidget, final Point2D relativeLocation, final int uiHeaderRowIndex, final int uiHeaderColumnIndex, final AbstractNodeMouseEvent event) { final List<GridColumn<?>> gridColumns = gridWidget.getModel().getColumns(); final GridColumn<?> gridColumn = gridColumns.get(uiHeaderColumnIndex); final List<GridColumn.HeaderMetaData> gridColumnHeaderMetaData = gridColumn.getHeaderMetaData(); if (Objects.isNull(gridColumnHeaderMetaData) || gridColumnHeaderMetaData.isEmpty()) { return false; } if (!EditableHeaderUtilities.hasEditableHeader(gridColumn)) { return false; } if (!EditableHeaderUtilities.isEditableHeader(gridColumn, uiHeaderRowIndex)) { return false; } final EditableHeaderMetaData editableHeaderMetaData = (EditableHeaderMetaData) gridColumn.getHeaderMetaData().get(uiHeaderRowIndex); if (Objects.equals(editableHeaderMetaData.getSupportedEditAction(), GridCellEditAction.getSupportedEditAction(event))) { final Point2D gridWidgetComputedLocation = gridWidget.getComputedLocation(); CellContextUtilities.editSelectedCell(gridWidget, relativeLocation.add(gridWidgetComputedLocation)); return true; } return false; }  }
EditableHeaderGridWidgetEditCellMouseEventHandler extends DefaultGridWidgetEditCellMouseEventHandler { @Override public boolean handleHeaderCell(final GridWidget gridWidget, final Point2D relativeLocation, final int uiHeaderRowIndex, final int uiHeaderColumnIndex, final AbstractNodeMouseEvent event) { final List<GridColumn<?>> gridColumns = gridWidget.getModel().getColumns(); final GridColumn<?> gridColumn = gridColumns.get(uiHeaderColumnIndex); final List<GridColumn.HeaderMetaData> gridColumnHeaderMetaData = gridColumn.getHeaderMetaData(); if (Objects.isNull(gridColumnHeaderMetaData) || gridColumnHeaderMetaData.isEmpty()) { return false; } if (!EditableHeaderUtilities.hasEditableHeader(gridColumn)) { return false; } if (!EditableHeaderUtilities.isEditableHeader(gridColumn, uiHeaderRowIndex)) { return false; } final EditableHeaderMetaData editableHeaderMetaData = (EditableHeaderMetaData) gridColumn.getHeaderMetaData().get(uiHeaderRowIndex); if (Objects.equals(editableHeaderMetaData.getSupportedEditAction(), GridCellEditAction.getSupportedEditAction(event))) { final Point2D gridWidgetComputedLocation = gridWidget.getComputedLocation(); CellContextUtilities.editSelectedCell(gridWidget, relativeLocation.add(gridWidgetComputedLocation)); return true; } return false; }  @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); @Override boolean handleHeaderCell(final GridWidget gridWidget,
                                    final Point2D relativeLocation,
                                    final int uiHeaderRowIndex,
                                    final int uiHeaderColumnIndex,
                                    final AbstractNodeMouseEvent event); }
EditableHeaderGridWidgetEditCellMouseEventHandler extends DefaultGridWidgetEditCellMouseEventHandler { @Override public boolean handleHeaderCell(final GridWidget gridWidget, final Point2D relativeLocation, final int uiHeaderRowIndex, final int uiHeaderColumnIndex, final AbstractNodeMouseEvent event) { final List<GridColumn<?>> gridColumns = gridWidget.getModel().getColumns(); final GridColumn<?> gridColumn = gridColumns.get(uiHeaderColumnIndex); final List<GridColumn.HeaderMetaData> gridColumnHeaderMetaData = gridColumn.getHeaderMetaData(); if (Objects.isNull(gridColumnHeaderMetaData) || gridColumnHeaderMetaData.isEmpty()) { return false; } if (!EditableHeaderUtilities.hasEditableHeader(gridColumn)) { return false; } if (!EditableHeaderUtilities.isEditableHeader(gridColumn, uiHeaderRowIndex)) { return false; } final EditableHeaderMetaData editableHeaderMetaData = (EditableHeaderMetaData) gridColumn.getHeaderMetaData().get(uiHeaderRowIndex); if (Objects.equals(editableHeaderMetaData.getSupportedEditAction(), GridCellEditAction.getSupportedEditAction(event))) { final Point2D gridWidgetComputedLocation = gridWidget.getComputedLocation(); CellContextUtilities.editSelectedCell(gridWidget, relativeLocation.add(gridWidgetComputedLocation)); return true; } return false; }  @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); @Override boolean handleHeaderCell(final GridWidget gridWidget,
                                    final Point2D relativeLocation,
                                    final int uiHeaderRowIndex,
                                    final int uiHeaderColumnIndex,
                                    final AbstractNodeMouseEvent event);  }