Search in sources :

Example 11 with RowNumberColumn

use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.

the class BaseExpressionGridRenderingTest method setup.

@Before
@Override
public void setup() {
    super.setup();
    doReturn(false).when(context).isSelection();
    doReturn(new BaseBounds(0, 0, 1000, 1000)).when(gridLayer).getVisibleBounds();
    grid.getModel().appendColumn(new RowNumberColumn());
    grid.getModel().appendRow(new DMNGridRow());
    doReturn(renderSelectorCommand).when(renderer).renderSelector(anyDouble(), anyDouble(), any(BaseGridRendererHelper.RenderingInformation.class));
    doReturn(renderSelectedCellsCommand).when(renderer).renderSelectedCells(any(GridData.class), any(GridBodyRenderContext.class), any(BaseGridRendererHelper.class));
    final List<RendererCommand> renderHeaderCommands = new ArrayList<>();
    renderHeaderCommands.add(renderHeaderBackgroundCommand);
    renderHeaderCommands.add(renderHeaderGridLinesCommand);
    renderHeaderCommands.add(renderHeaderContentCommand);
    doReturn(renderHeaderCommands).when(renderer).renderHeader(any(GridData.class), any(GridHeaderRenderContext.class), any(BaseGridRendererHelper.class), any(BaseGridRendererHelper.RenderingInformation.class));
    final List<RendererCommand> renderBodyCommands = new ArrayList<>();
    renderBodyCommands.add(renderBodyGridBackgroundCommand);
    renderBodyCommands.add(renderBodyGridLinesCommand);
    renderBodyCommands.add(renderBodyGridContentCommand);
    doReturn(renderBodyCommands).when(renderer).renderBody(any(GridData.class), any(GridBodyRenderContext.class), any(BaseGridRendererHelper.class), any(BaseGridRendererHelper.RenderingInformation.class));
    doReturn(renderHeaderBodyDividerCommand).when(renderer).renderHeaderBodyDivider(anyDouble());
    doReturn(renderGridBoundaryCommand).when(renderer).renderGridBoundary(any(GridBoundaryRenderContext.class));
    doReturn(BaseExpressionGridRenderer.HEADER_HEIGHT).when(renderer).getHeaderHeight();
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) GridHeaderRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderRenderContext) RendererCommand(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RendererCommand) DMNGridData(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) GridBodyRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyRenderContext) ArrayList(java.util.ArrayList) BaseBounds(org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds) BaseGridRendererHelper(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper) GridBoundaryRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBoundaryRenderContext) Before(org.junit.Before)

Example 12 with RowNumberColumn

use of org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn in project kie-wb-common by kiegroup.

the class BaseFunctionSupplementaryGridTest method testInitialSetupFromDefinition.

@Test
public void testInitialSetupFromDefinition() {
    setupGrid(0);
    final GridData uiModel = grid.getModel();
    assertTrue(uiModel instanceof FunctionSupplementaryGridData);
    assertEquals(3, uiModel.getColumnCount());
    assertTrue(uiModel.getColumns().get(0) instanceof RowNumberColumn);
    assertTrue(uiModel.getColumns().get(1) instanceof NameColumn);
    assertTrue(uiModel.getColumns().get(2) instanceof ExpressionEditorColumn);
    assertEquals(2, uiModel.getRowCount());
    final String[] expectedNames = getExpectedNames();
    for (int i = 0; i < uiModel.getRowCount(); i++) {
        assertEquals(i + 1, uiModel.getCell(i, 0).getValue().getValue());
        assertEquals(expectedNames[i], uiModel.getCell(i, 1).getValue().getValue());
        assertTrue(uiModel.getCell(i, 2).getValue() instanceof ExpressionCellValue);
        final ExpressionCellValue dcv = (ExpressionCellValue) uiModel.getCell(i, 2).getValue();
        assertEquals(literalExpressionEditor, dcv.getValue().get());
    }
}
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) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) Test(org.junit.Test)

Example 13 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_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);
}
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 14 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 testSelectHeaderWithPoint.

@Test
public void testSelectHeaderWithPoint() {
    grid.getModel().appendColumn(new RowNumberColumn());
    grid.getModel().appendColumn(new RowNumberColumn());
    final Point2D point = mock(Point2D.class);
    final double columnOffset = grid.getModel().getColumns().get(0).getWidth();
    final double columnWidth = grid.getModel().getColumns().get(1).getWidth() / 2;
    when(point.getX()).thenReturn(columnOffset + columnWidth);
    when(point.getY()).thenReturn(HEADER_HEIGHT / 2);
    when(grid.getHeader()).thenReturn(header);
    when(header.getY()).thenReturn(0.0);
    when(renderer.getHeaderHeight()).thenReturn(HEADER_HEIGHT);
    when(renderer.getHeaderRowHeight()).thenReturn(HEADER_HEIGHT);
    grid.selectHeaderCell(point, false, false);
    assertHeaderSelection();
    assertDomainObjectEventFiring();
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) Point2D(com.ait.lienzo.client.core.types.Point2D) Test(org.junit.Test)

Example 15 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_DataCells.

@Test
public void testAdjustSelectionHandling_DataCells() {
    grid.getModel().appendColumn(new RowNumberColumn());
    grid.getModel().appendRow(new BaseGridRow());
    grid.selectHeaderCell(0, 0, false, false);
    reset(grid);
    grid.adjustSelection(SelectionExtension.DOWN, false);
    verify(grid).doAfterSelectionChange(0, 0);
}
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)

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