use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class MoveColumnsCommandTest method addUiModelRow.
@Override
protected void addUiModelRow(final int rowIndex) {
final GridRow uiRow = new BaseGridRow();
uiModel.appendRow(uiRow);
uiModel.setCellValue(rowIndex, 0, new BaseGridCellValue<>(rowIndex + 1));
uiModel.setCellValue(rowIndex, 1, new BaseGridCellValue<>("value0"));
uiModel.setCellValue(rowIndex, 2, new BaseGridCellValue<>("value1"));
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumn method getMinimumWidth.
@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<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> 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;
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumn method updateWidthOfChildren.
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<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = ecv.getValue();
if (editor.isPresent()) {
final BaseExpressionGrid beg = editor.get();
updateWidthOfLastColumn(beg, columnWidth);
}
}
}
}
}
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class DecisionTableGrid method addDecisionRule.
void addDecisionRule(final int index) {
getExpression().get().ifPresent(dtable -> {
final GridRow decisionTableRow = new LiteralExpressionGridRow();
final DecisionRule decisionRule = DecisionRuleFactory.makeDecisionRule(dtable);
sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddDecisionRuleCommand(dtable, decisionRule, model, decisionTableRow, index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING)));
});
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class ContextGrid method isRowDragPermitted.
@Override
public boolean isRowDragPermitted(final GridWidgetDnDHandlersState state) {
final GridWidgetHandlersOperation operation = state.getOperation();
if (operation == GridWidgetHandlersOperation.ROW_MOVE_PENDING) {
final int lastRowIndex = model.getRowCount() - 1;
final List<GridRow> rows = state.getActiveGridRows();
return !rows.contains(model.getRow(lastRowIndex));
}
return true;
}
Aggregations