private void reset() { final List<GridRow> rows = gridData.getRows(); for (GridRow row : rows) { row.reset(); } }
private void reset() { final List<GridRow> rows = gridData.getRows(); for (GridRow row : rows) { row.reset(); } }
/** * Get the y-offset for a given Row. * @param row The GridRow. * @return */ public double getRowOffset(final GridRow row) { final GridData model = view.getModel(); final int rowIndex = model.getRows().indexOf(row); return getRowOffset(rowIndex); }
/** * Get the y-offset for a given Row. * @param row The GridRow. * @return */ public double getRowOffset(final GridRow row) { final GridData model = view.getModel(); final int rowIndex = model.getRows().indexOf(row); return getRowOffset(rowIndex); }
private Set<GridWidget> collectGridWidgets(final GridWidget gridWidget) { final Set<GridWidget> allGridWidgets = new HashSet<>(); allGridWidgets.add(gridWidget); gridWidget.getModel() .getRows() .stream() .forEach(row -> row.getCells().values() .stream() .filter(cell -> cell != null && cell.getValue() != null) .map(GridCell::getValue) .filter(value -> value instanceof ExpressionCellValue) .map(value -> (ExpressionCellValue) value) .filter(value -> value.getValue().isPresent()) .map(value -> value.getValue().get()) .forEach(editor -> allGridWidgets.addAll(collectGridWidgets(editor)))); return allGridWidgets; }
private double getRequiredParentColumnWidth(final double proposedWidth, final Function<BaseExpressionGrid, Double> requiredWidthSupplier) { double width = proposedWidth; final GridData uiModel = gridWidget.getModel(); for (GridRow row : uiModel.getRows()) { final GridCell<?> cell = row.getCells().get(columnIndex); if (cell != null) { final GridCellValue<?> value = cell.getValue(); if (value instanceof ExpressionCellValue) { final ExpressionCellValue ecv = (ExpressionCellValue) value; final Optional<BaseExpressionGrid> editor = ecv.getValue(); if (editor.isPresent()) { final BaseExpressionGrid beg = editor.get(); width = Math.max(width, requiredWidthSupplier.apply(beg)); } } } } return width; }
private GridData.Range selectCellNotMerged(final int rowIndex, final int columnIndex) { final List<GridRow> rows = gridData.getRows(); final List<GridColumn<?>> columns = gridData.getColumns(); final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells(); final GridData.Range range = new GridData.Range(rowIndex); if (rowIndex < 0 || rowIndex > rows.size() - 1) { return range; } if (columnIndex < 0 || columnIndex > columns.size() - 1) { return range; } final int _columnIndex = columns.get(columnIndex).getIndex(); final GridData.SelectedCell selectedCell = new GridData.SelectedCell(rowIndex, _columnIndex); if (!selectedCells.contains(selectedCell)) { selectedCells.add(selectedCell); } return range; }
@Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { final int rowIndex = uiModel.getRows().indexOf(uiModelRow); uiModel.deleteRow(rowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } };
@Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { final int rowIndex = uiModel.getRows().indexOf(uiModelRow); uiModel.deleteRow(rowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } };
private GridData.Range selectCellNotMerged(final int rowIndex, final int columnIndex) { final List<GridRow> rows = gridData.getRows(); final List<GridColumn<?>> columns = gridData.getColumns(); final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells(); final GridData.Range range = new GridData.Range(rowIndex); if (rowIndex < 0 || rowIndex > rows.size() - 1) { return range; } if (columnIndex < 0 || columnIndex > columns.size() - 1) { return range; } final int _columnIndex = columns.get(columnIndex).getIndex(); final GridData.SelectedCell selectedCell = new GridData.SelectedCell(rowIndex, _columnIndex); if (!selectedCells.contains(selectedCell)) { selectedCells.add(selectedCell); } return range; }
@Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { final int rowIndex = uiModel.getRows().indexOf(uiModelRow); uiModel.deleteRow(rowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } };
@Override public Double getMinimumWidth() { double minimumWidth = super.getMinimumWidth(); final GridData model = gridWidget.getModel(); final int columnIndex = getLogicalColumnIndex(model); if (columnIndex != -1) { for (GridRow row : model.getRows()) { final GridCell<?> cell = row.getCells().get(columnIndex); if (cell != null) { final GridCellValue<?> value = cell.getValue(); if (value instanceof ExpressionCellValue) { final ExpressionCellValue ecv = (ExpressionCellValue) value; final Optional<BaseExpressionGrid> editor = ecv.getValue(); final double padding = editor.map(BaseExpressionGrid::getPadding).orElse(0.0); minimumWidth = Math.max(minimumWidth, ecv.getMinimumWidth().orElse(0.0) + padding * 2); } } } } return minimumWidth; }
final int width, final int height) { final List<GridRow> rows = gridData.getRows(); final List<GridColumn<?>> columns = gridData.getColumns(); final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();
final int width, final int height) { final List<GridRow> rows = gridData.getRows(); final List<GridColumn<?>> columns = gridData.getColumns(); final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();
protected void updateWidthOfChildren() { final double columnWidth = getWidth(); final GridData model = gridWidget.getModel(); final int columnIndex = getLogicalColumnIndex(model); if (columnIndex != -1) { for (GridRow row : model.getRows()) { final GridCell<?> cell = row.getCells().get(columnIndex); if (cell != null) { final GridCellValue<?> value = cell.getValue(); if (value instanceof ExpressionCellValue) { final ExpressionCellValue ecv = (ExpressionCellValue) value; final Optional<BaseExpressionGrid> editor = ecv.getValue(); if (editor.isPresent()) { final BaseExpressionGrid beg = editor.get(); updateWidthOfLastColumn(beg, columnWidth); } } } } } }
int minRowIndex = rowIndex; int maxRowIndex = rowIndex + 1; final List<GridRow> rows = gridData.getRows(); final List<GridColumn<?>> columns = gridData.getColumns(); final GridRow currentRow = rows.get(rowIndex);
public void indexColumn(final int columnIndex) { final List<GridRow> rows = gridData.getRows(); for (int rowIndex = 0; rowIndex < rows.size(); rowIndex++) { final GridCell<?> currentRowCell = gridData.getCell(rowIndex,
public void indexColumn(final int columnIndex) { final List<GridRow> rows = gridData.getRows(); for (int rowIndex = 0; rowIndex < rows.size(); rowIndex++) { final GridCell<?> currentRowCell = gridData.getCell(rowIndex,
final int columnIndex) { final List<GridRow> rows = gridData.getRows(); final GridRow currentRow = gridData.getRow(expandMinRowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);
final int columnIndex) { final List<GridRow> rows = gridData.getRows(); final GridRow currentRow = gridData.getRow(expandMinRowIndex); final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);