Search in sources :

Example 41 with GridRow

use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.

the class LiteralExpressionGridRowTest method testEmptyRow.

@Test
public void testEmptyRow() {
    final GridRow row = new LiteralExpressionGridRow();
    assertThat(row.getHeight()).isEqualTo(DEFAULT_HEIGHT);
}
Also used : GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) Test(org.junit.Test)

Example 42 with GridRow

use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.

the class LiteralExpressionGridRowTest method testGetHeightWithHasDynamicHeightCell.

@Test
public void testGetHeightWithHasDynamicHeightCell() {
    final GridRow row = spy(new LiteralExpressionGridRow());
    final Map<Integer, GridCell> cells = new HashMap<Integer, GridCell>() {

        {
            put(0, new MockHasDynamicHeightCell<>(new BaseGridCellValue<>("cheese")));
            put(1, new BaseGridCell<>(new BaseGridCellValue<>("cheese")));
        }
    };
    doReturn(cells).when(row).getCells();
    assertThat(row.getHeight()).isEqualTo(CELL_HEIGHT);
}
Also used : HashMap(java.util.HashMap) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) GridCell(org.uberfire.ext.wires.core.grids.client.model.GridCell) BaseGridCell(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell) BaseGridCellValue(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue) Test(org.junit.Test)

Example 43 with GridRow

use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.

the class LiteralExpressionGridRowTest method testGetHeightWithoutHasDynamicHeightCell.

@Test
public void testGetHeightWithoutHasDynamicHeightCell() {
    final GridRow row = spy(new LiteralExpressionGridRow());
    final Map<Integer, GridCell> cells = new HashMap<Integer, GridCell>() {

        {
            put(0, new BaseGridCell<>(new BaseGridCellValue<>("cheese")));
        }
    };
    doReturn(cells).when(row).getCells();
    assertThat(row.getHeight()).isEqualTo(DEFAULT_HEIGHT);
}
Also used : HashMap(java.util.HashMap) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) GridCell(org.uberfire.ext.wires.core.grids.client.model.GridCell) BaseGridCell(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell) BaseGridCellValue(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue) Test(org.junit.Test)

Example 44 with GridRow

use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project drools-wb by kiegroup.

the class RowSynchronizer method insert.

@Override
public void insert(final RowMetaData metaData) throws VetoException {
    if (!handlesAppend(metaData)) {
        return;
    }
    final int rowIndex = metaData.getRowIndex();
    final List<DTCellValue52> modelRow = new ArrayList<DTCellValue52>();
    model.getData().add(rowIndex, modelRow);
    final GridRow uiModelRow = new BaseGridRow(GuidedDecisionTableView.ROW_HEIGHT);
    uiModel.insertRow(rowIndex, uiModelRow);
    initialiseRowData(rowIndex);
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) ArrayList(java.util.ArrayList) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow)

Example 45 with GridRow

use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project drools-wb by kiegroup.

the class ScenarioContextMenuRegistryTest method testManageBodyRightClick.

@Test
public void testManageBodyRightClick() {
    final int clickPointX = 5;
    final int clickPointY = 11;
    final double widgetHeight = 50.0;
    final double rowHeight = widgetHeight - HEADER_HEIGHT;
    doReturn(clickPointX).when(contextNativeEventMock).getClientX();
    doReturn(clickPointY).when(contextNativeEventMock).getClientY();
    doReturn(widgetHeight).when(scenarioGridMock).getHeight();
    doReturn(1).when(scenarioGridModelMock).getRowCount();
    final GridRow gridRowMock = mock(GridRow.class);
    doReturn(gridRowMock).when(scenarioGridModelMock).getRow(0);
    doReturn(rowHeight).when(gridRowMock).getHeight();
    assertThat(scenarioContextMenuRegistry.manageRightClick(scenarioGridMock, contextMenuEventMock)).as("Click to expect/given body cell").isTrue();
    verify(scenarioGridMock, times(1)).clearSelections();
    verify(gridContextMenuMock).show(GridWidget.SIMULATION, clickPointX, clickPointY, 0);
    verify(scenarioGridMock, times(1)).setSelectedCell(eq(0), eq(0));
}
Also used : GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) Test(org.junit.Test) AbstractScenarioSimulationGridHandlerTest(org.drools.workbench.screens.scenariosimulation.client.handlers.AbstractScenarioSimulationGridHandlerTest)

Aggregations

GridRow (org.uberfire.ext.wires.core.grids.client.model.GridRow)54 Test (org.junit.Test)31 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)22 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)10 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)10 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)10 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)8 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)6 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)6 BaseGridCell (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell)6 ArrayList (java.util.ArrayList)4 DecisionRule (org.kie.workbench.common.dmn.api.definition.model.DecisionRule)4 BaseExpressionGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid)4 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)3 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)3 HashMap (java.util.HashMap)2 Maps (org.kie.soup.commons.util.Maps)2 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)2 List (org.kie.workbench.common.dmn.api.definition.model.List)2 BaseUIModelMapper (org.kie.workbench.common.dmn.client.widgets.grid.model.BaseUIModelMapper)2