use of net.sourceforge.nattable.config.IEditableRule in project translationstudio8 by heartsome.
the class EditUtils method allCellsEditable.
public static boolean allCellsEditable(SelectionLayer selectionLayer, IConfigRegistry configRegistry) {
PositionCoordinate[] selectedCells = selectionLayer.getSelectedCells();
for (PositionCoordinate cell : selectedCells) {
LabelStack labelStack = selectionLayer.getConfigLabelsByPosition(cell.columnPosition, cell.rowPosition);
IEditableRule editableRule = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, DisplayMode.EDIT, labelStack.getLabels());
int columnIndex = selectionLayer.getColumnIndexByPosition(cell.columnPosition);
int rowIndex = selectionLayer.getRowIndexByPosition(cell.rowPosition);
if (!editableRule.isEditable(columnIndex, rowIndex)) {
return false;
}
}
return true;
}
use of net.sourceforge.nattable.config.IEditableRule in project translationstudio8 by heartsome.
the class TickUpdateCommandHandler method updateSingleCell.
private void updateSingleCell(TickUpdateCommand command, PositionCoordinate selectedPosition) {
LayerCell cell = selectionLayer.getCellByPosition(selectedPosition.columnPosition, selectedPosition.rowPosition);
IEditableRule editableRule = command.getConfigRegistry().getConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, DisplayMode.EDIT, cell.getConfigLabels().getLabels());
if (editableRule.isEditable(selectedPosition.columnPosition, selectedPosition.rowPosition)) {
selectionLayer.doCommand(new UpdateDataCommand(selectionLayer, selectedPosition.columnPosition, selectedPosition.rowPosition, getNewCellValue(command, cell)));
}
}
Aggregations