use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class InvocationGridTest method testOnItemSelectedDeleteParameterEnabled.
@Test
public void testOnItemSelectedDeleteParameterEnabled() {
setupGrid(0);
// Grid has one row from Invocation model. It cannot be deleted.
assertDeleteParameterEnabled(0, false);
// Grid has two rows. Rows 1 and 2 can be deleted.
grid.getModel().appendRow(new BaseGridRow());
assertDeleteParameterEnabled(0, true);
assertDeleteParameterEnabled(1, true);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class ListGridTest method testOnItemSelectedDeleteRowEnabled.
@Test
public void testOnItemSelectedDeleteRowEnabled() {
setupGrid();
// Grid has one row from List model. It cannot be deleted.
assertDeleteRowEnabled(0, false);
// Grid has two rows. Rows 1 or 2 can be deleted.
grid.getModel().appendRow(new BaseGridRow());
assertDeleteRowEnabled(0, true);
assertDeleteRowEnabled(1, true);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class FunctionUIModelMapperTest method setup.
@SuppressWarnings("unchecked")
public void setup(final boolean isOnlyVisualChangeAllowedSupplier) {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendColumn(uiExpressionEditorColumn);
when(uiExpressionEditorColumn.getIndex()).thenReturn(0);
when(gridWidget.getModel()).thenReturn(uiModel);
// Core Editor definitions
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
when(literalExpressionEditorDefinition.getModelClass()).thenReturn(Optional.of(literalExpression));
when(literalExpressionEditor.getExpression()).thenReturn(() -> Optional.of(literalExpression));
when(literalExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(literalExpressionEditor));
// Supplementary Editor definitions
final ExpressionEditorDefinitions supplementaryEditorDefinitions = new ExpressionEditorDefinitions();
supplementaryEditorDefinitions.add(supplementaryEditorDefinition);
when(supplementaryEditorDefinitionsSupplier.get()).thenReturn(supplementaryEditorDefinitions);
when(supplementaryEditorDefinition.getModelClass()).thenReturn(Optional.of(context));
when(supplementaryEditor.getExpression()).thenReturn(() -> Optional.of(context));
when(supplementaryEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(supplementaryEditor));
this.function = new FunctionDefinition();
this.mapper = new FunctionUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(function), () -> isOnlyVisualChangeAllowedSupplier, expressionEditorDefinitionsSupplier, supplementaryEditorDefinitionsSupplier, listSelector, 1);
this.cellValueSupplier = Optional::empty;
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class InvocationUIModelMapperTest method setup.
@SuppressWarnings("unchecked")
public void setup(final boolean isOnlyVisualChangeAllowedSupplier) {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiNameColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
when(uiRowNumberColumn.getIndex()).thenReturn(0);
when(uiNameColumn.getIndex()).thenReturn(1);
when(uiExpressionEditorColumn.getIndex()).thenReturn(2);
when(gridWidget.getModel()).thenReturn(uiModel);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
when(literalExpressionEditorDefinition.getModelClass()).thenReturn(Optional.of(literalExpression));
when(literalExpressionEditor.getExpression()).thenReturn(() -> Optional.of(literalExpression));
when(literalExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(literalExpressionEditor));
final LiteralExpression invocationExpression = new LiteralExpression();
invocationExpression.getText().setValue("invocation-expression");
final LiteralExpression bindingExpression = new LiteralExpression();
bindingExpression.getText().setValue("binding-expression");
final Binding binding = new Binding();
final InformationItem parameter = new InformationItem();
parameter.setName(new Name("p0"));
binding.setParameter(parameter);
binding.setExpression(bindingExpression);
this.invocation = new Invocation();
this.invocation.setExpression(invocationExpression);
this.invocation.getBinding().add(binding);
this.mapper = new InvocationUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(invocation), () -> isOnlyVisualChangeAllowedSupplier, expressionEditorDefinitionsSupplier, listSelector, 0);
this.cellValueSupplier = Optional::empty;
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testAdjustSelectionHandling_HeaderCells.
@Test
public void testAdjustSelectionHandling_HeaderCells() {
grid.getModel().appendColumn(new RowNumberColumn());
grid.getModel().appendRow(new BaseGridRow());
grid.selectCell(0, 0, false, false);
reset(grid);
grid.adjustSelection(SelectionExtension.UP, false);
verify(grid).doAfterHeaderSelectionChange(0, 0);
}
Aggregations