use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSelectHeaderWithCoordinate.
@Test
public void testSelectHeaderWithCoordinate() {
grid.getModel().appendColumn(new RowNumberColumn());
grid.getModel().appendColumn(new RowNumberColumn());
grid.selectHeaderCell(0, 1, false, false);
assertHeaderSelection();
assertDomainObjectEventFiring();
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSelectHeaderCellWithDomainObjectInStunnerGraph.
@Test
public void testSelectHeaderCellWithDomainObjectInStunnerGraph() {
grid.getModel().appendColumn(new RowNumberColumn());
grid.getModel().appendColumn(new RowNumberColumn());
// Mock graph to contain decision
final Definition definition = mock(Definition.class);
when(node.getUUID()).thenReturn(NODE_UUID);
when(node.getContent()).thenReturn(definition);
when(definition.getDefinition()).thenReturn(decision);
// Mock grid to dispatch header selection as a DomainObject
doAnswer(i -> {
grid.fireDomainObjectSelectionEvent(decision);
return null;
}).when(grid).doAfterHeaderSelectionChange(anyInt(), anyInt());
grid.selectHeaderCell(0, 1, false, false);
assertHeaderSelection();
verify(refreshFormPropertiesEvent).fire(refreshFormPropertiesEventCaptor.capture());
final RefreshFormPropertiesEvent refreshFormPropertiesEvent = refreshFormPropertiesEventCaptor.getValue();
assertThat(refreshFormPropertiesEvent.getUuid()).isEqualTo(NODE_UUID);
assertThat(refreshFormPropertiesEvent.getSession()).isEqualTo(session);
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testAdjustSelectionHandling_MoveUpWhenOnTopAlready.
@Test
public void testAdjustSelectionHandling_MoveUpWhenOnTopAlready() {
grid.getModel().appendColumn(new RowNumberColumn());
grid.getModel().appendRow(new BaseGridRow());
grid.selectHeaderCell(0, 0, false, false);
reset(grid);
grid.adjustSelection(SelectionExtension.UP, false);
verify(grid, never()).doAfterHeaderSelectionChange(anyInt(), anyInt());
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.
the class DMNGridPanelContextMenuHandlerTest method mockGridWidget.
private BaseGrid mockGridWidget() {
final BaseGrid gridWidget = spy(new BaseGrid(gridLayer, new BaseGridData(false), renderer, sessionManager, sessionCommandManager, canvasCommandFactory, refreshFormPropertiesEvent, domainObjectSelectionEvent, cellEditorControls, translationService) {
@Override
public Layer getLayer() {
return gridLayer;
}
});
gridWidget.getModel().appendColumn(new RowNumberColumn());
gridWidget.getModel().appendColumn(gridColumn);
gridWidget.getModel().appendRow(new BaseGridRow());
gridWidget.getModel().appendRow(new BaseGridRow());
return gridWidget;
}
use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.
the class InvocationGrid method initialiseUiColumns.
@Override
protected void initialiseUiColumns() {
final List<GridColumn.HeaderMetaData> headerMetaData = new ArrayList<>();
final RowNumberColumn rowNumberColumn = new RowNumberColumn();
rowNumberColumn.setWidth(getAndSetInitialWidth(0, rowNumberColumn.getWidth()));
if (nesting == 0) {
headerMetaData.add(new InvocationColumnHeaderMetaData(hasExpression, hasName, clearValueConsumer(true, new Name()), setValueConsumer(true), setTypeRefConsumer(), translationService, cellEditorControls, headerEditor, listSelector, this::getHeaderItems, this::onItemSelected));
}
headerMetaData.add(new InvocationColumnExpressionHeaderMetaData(this::getExpressionText, this::setExpressionText, getHeaderTextBoxFactory(), Optional.of(translationService.getTranslation(DMNEditorConstants.InvocationEditor_EnterFunction)), listSelector, this::getHeaderItems, this::onItemSelected));
final InvocationParameterColumn nameColumn = new InvocationParameterColumn(headerMetaData, getAndSetInitialWidth(1, DMNGridColumn.DEFAULT_WIDTH), this, rowIndex -> true, clearValueConsumer(false, new Name()), setValueConsumer(false), setTypeRefConsumer(), translationService, cellEditorControls, headerEditor);
final ExpressionEditorColumn expressionColumn = new ExpressionEditorColumn(gridLayer, headerMetaData, getAndSetInitialWidth(2, UndefinedExpressionColumn.DEFAULT_WIDTH), this);
model.appendColumn(rowNumberColumn);
model.appendColumn(nameColumn);
model.appendColumn(expressionColumn);
getRenderer().setColumnRenderConstraint((isSelectionLayer, gridColumn) -> !isSelectionLayer || gridColumn.equals(expressionColumn));
}
Aggregations