Search in sources :

Example 1 with NameColumn

use of org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.NameColumn in project kie-wb-common by kiegroup.

the class JavaFunctionSupplementaryGridTest 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 ContextGridRowNumberColumn);
    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], ((InformationItemCell.HasNameAndDataTypeCell) uiModel.getCell(i, 1).getValue().getValue()).getName().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 : FunctionSupplementaryGridData(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.FunctionSupplementaryGridData) ExpressionEditorColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn) NameColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.NameColumn) FunctionSupplementaryGridData(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.FunctionSupplementaryGridData) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) ContextGridRowNumberColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn) Test(org.junit.Test) BaseFunctionSupplementaryGridTest(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.BaseFunctionSupplementaryGridTest)

Example 2 with NameColumn

use of org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.NameColumn in project kie-wb-common by kiegroup.

the class PMMLFunctionSupplementaryGridTest 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 ContextGridRowNumberColumn);
    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], ((InformationItemCell.HasNameAndDataTypeCell) uiModel.getCell(i, 1).getValue().getValue()).getName().getValue());
        assertTrue(uiModel.getCell(i, 2).getValue() instanceof ExpressionCellValue);
    }
    final ExpressionCellValue dcv0 = (ExpressionCellValue) uiModel.getCell(0, 2).getValue();
    assertEquals(literalExpressionPMMLDocumentEditor, dcv0.getValue().get());
    final ExpressionCellValue dcv1 = (ExpressionCellValue) uiModel.getCell(1, 2).getValue();
    assertEquals(literalExpressionPMMLDocumentModelEditor, dcv1.getValue().get());
}
Also used : FunctionSupplementaryGridData(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.FunctionSupplementaryGridData) ExpressionEditorColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn) NameColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.NameColumn) FunctionSupplementaryGridData(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.FunctionSupplementaryGridData) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) ContextGridRowNumberColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn) Test(org.junit.Test) BaseFunctionSupplementaryGridTest(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.BaseFunctionSupplementaryGridTest)

Aggregations

Test (org.junit.Test)2 ContextGridRowNumberColumn (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn)2 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)2 ExpressionEditorColumn (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn)2 BaseFunctionSupplementaryGridTest (org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.BaseFunctionSupplementaryGridTest)2 FunctionSupplementaryGridData (org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.FunctionSupplementaryGridData)2 NameColumn (org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.NameColumn)2 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)2