Search in sources :

Example 1 with RowNumberColumn

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();
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) Test(org.junit.Test)

Example 2 with RowNumberColumn

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);
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition) RefreshFormPropertiesEvent(org.kie.workbench.common.stunner.forms.client.event.RefreshFormPropertiesEvent) Test(org.junit.Test)

Example 3 with RowNumberColumn

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());
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Test(org.junit.Test)

Example 4 with RowNumberColumn

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;
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) DMNGridLayer(org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer) Layer(com.ait.lienzo.client.core.shape.Layer) BaseGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseGrid)

Example 5 with RowNumberColumn

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));
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) ExpressionEditorColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn) ArrayList(java.util.ArrayList) HasName(org.kie.workbench.common.dmn.api.definition.HasName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Aggregations

RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)24 Test (org.junit.Test)17 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)11 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)9 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)9 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)9 ContextMenuHandler (com.google.gwt.event.dom.client.ContextMenuHandler)6 BaseGridColumn (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn)6 ArrayList (java.util.ArrayList)4 Before (org.junit.Before)4 ExpressionEditorColumn (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn)4 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)3 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)3 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)2 BaseExpressionGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid)2 BaseGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseGrid)2 DMNGridLayer (org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer)2 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)2 Layer (com.ait.lienzo.client.core.shape.Layer)1 Point2D (com.ait.lienzo.client.core.types.Point2D)1