use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class RelationGridTest method testOnItemSelectedDeleteRowEnabled.
@Test
public void testOnItemSelectedDeleteRowEnabled() {
setupGrid(0);
// Grid has one row that cannot be deleted.
assertListSelectorItemEnabled(0, 0, DELETE_ROW, false);
// Grid has two rows. Rows 1 and 2 can be deleted.
grid.getModel().appendRow(new BaseGridRow());
assertListSelectorItemEnabled(0, 0, DELETE_ROW, true);
assertListSelectorItemEnabled(1, 0, DELETE_ROW, true);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class ListUIModelMapperTest method setup.
@SuppressWarnings("unchecked")
public void setup(final Expression expression, final boolean isOnlyVisualChangeAllowedSupplier) {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
when(uiRowNumberColumn.getIndex()).thenReturn(0);
when(uiExpressionEditorColumn.getIndex()).thenReturn(1);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
when(literalExpressionEditor.getExpression()).thenReturn(() -> Optional.of(literalExpression));
when(literalExpressionEditorDefinition.getModelClass()).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));
when(undefinedExpressionEditor.getExpression()).thenReturn(Optional::empty);
when(undefinedExpressionEditorDefinition.getModelClass()).thenReturn(Optional.empty());
when(undefinedExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(undefinedExpressionEditor));
this.list = new List();
this.list.getExpression().add(HasExpression.wrap(list, expression));
this.mapper = new ListUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(list), () -> 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 LiteralExpressionUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
uiModel = new BaseGridData();
uiModel.appendRow(new BaseGridRow());
uiModel.appendColumn(uiLiteralExpressionColumn);
doReturn(0).when(uiLiteralExpressionColumn).getIndex();
literalExpression = new LiteralExpression();
mapper = getMapper();
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class UndefinedExpressionUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.uiModel = new BaseGridData();
this.uiModel.appendColumn(uiColumn);
this.uiModel.appendRow(new BaseGridRow());
this.mapper = new UndefinedExpressionUIModelMapper(() -> uiModel, () -> Optional.ofNullable(expression), listSelector, translationService, hasExpression);
this.cellValueSupplier = () -> Optional.of(new ExpressionCellValue(Optional.of(editor)));
when(hasExpression.asDMNModelInstrumentedBase()).thenReturn(hasExpressionDMNModelInstrumentedBase);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class SelectionUtilsTest method setup.
@Before
public void setup() {
this.uiModel = new DMNGridData();
this.uiModel.appendColumn(uiColumn0);
this.uiModel.appendColumn(uiColumn1);
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendRow(new BaseGridRow());
when(uiColumn0.getIndex()).thenReturn(0);
when(uiColumn1.getIndex()).thenReturn(1);
when(uiColumn0.getHeaderMetaData()).thenReturn(Collections.singletonList(headerMetaData));
when(uiColumn1.getHeaderMetaData()).thenReturn(Collections.singletonList(headerMetaData));
}
Aggregations