Search in sources :

Example 1 with ContextGridRowNumberColumn

use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn in project kie-wb-common by kiegroup.

the class ListGridTest method testInitialSetupFromDefinition.

@Test
public void testInitialSetupFromDefinition() {
    setupGrid();
    final GridData uiModel = grid.getModel();
    assertTrue(uiModel instanceof ListGridData);
    assertEquals(2, uiModel.getColumnCount());
    assertTrue(uiModel.getColumns().get(ROW_COLUMN_INDEX) instanceof ContextGridRowNumberColumn);
    assertTrue(uiModel.getColumns().get(EXPRESSION_COLUMN_INDEX) instanceof ExpressionEditorColumn);
    assertEquals(1, uiModel.getRowCount());
    assertEquals(1, uiModel.getCell(0, ROW_COLUMN_INDEX).getValue().getValue());
    assertTrue(uiModel.getCell(0, EXPRESSION_COLUMN_INDEX).getValue() instanceof ExpressionCellValue);
    final ExpressionCellValue dcv0 = (ExpressionCellValue) uiModel.getCell(0, EXPRESSION_COLUMN_INDEX).getValue();
    assertEquals(literalExpressionEditor, dcv0.getValue().get());
}
Also used : ExpressionEditorColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) 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)

Example 2 with ContextGridRowNumberColumn

use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn in project kie-wb-common by kiegroup.

the class ListGrid method initialiseUiColumns.

@Override
public void initialiseUiColumns() {
    final ContextGridRowNumberColumn rowNumberColumn = new ContextGridRowNumberColumn(Collections.emptyList(), getAndSetInitialWidth(ListUIModelMapperHelper.ROW_COLUMN_INDEX, ContextGridRowNumberColumn.DEFAULT_WIDTH));
    final GridColumn listColumn = new ListExpressionEditorColumn(gridLayer, getAndSetInitialWidth(ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, ExpressionEditorColumn.DEFAULT_WIDTH), this);
    model.appendColumn(rowNumberColumn);
    model.appendColumn(listColumn);
    getRenderer().setColumnRenderConstraint((isSelectionLayer, gridColumn) -> true);
}
Also used : GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) ContextGridRowNumberColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn)

Example 3 with ContextGridRowNumberColumn

use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn in project kie-wb-common by kiegroup.

the class FunctionSupplementaryGrid method initialiseUiColumns.

@Override
public void initialiseUiColumns() {
    final ContextGridRowNumberColumn rowNumberColumn = new ContextGridRowNumberColumn(Collections.emptyList(), getAndSetInitialWidth(0, ContextGridRowNumberColumn.DEFAULT_WIDTH));
    final NameColumn nameColumn = new NameColumn(getAndSetInitialWidth(1, DMNGridColumn.DEFAULT_WIDTH), this);
    final ExpressionEditorColumn expressionColumn = new ExpressionEditorColumn(gridLayer, Collections.emptyList(), getAndSetInitialWidth(2, ExpressionEditorColumn.DEFAULT_WIDTH), this);
    model.appendColumn(rowNumberColumn);
    model.appendColumn(nameColumn);
    model.appendColumn(expressionColumn);
    getRenderer().setColumnRenderConstraint((isSelectionLayer, gridColumn) -> !isSelectionLayer || gridColumn.equals(expressionColumn));
}
Also used : ExpressionEditorColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn) ContextGridRowNumberColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn)

Example 4 with ContextGridRowNumberColumn

use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn 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 5 with ContextGridRowNumberColumn

use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn 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

ContextGridRowNumberColumn (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextGridRowNumberColumn)5 ExpressionEditorColumn (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn)4 Test (org.junit.Test)3 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)3 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)3 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 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)1 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)1