Search in sources :

Example 1 with ExpressionEditorColumn

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

the class FunctionGrid method initialiseUiColumns.

@Override
protected void initialiseUiColumns() {
    final GridColumn expressionColumn = new ExpressionEditorColumn(gridLayer, Arrays.asList(new FunctionColumnNameHeaderMetaData(() -> hasName.orElse(HasName.NOP).getName().getValue(), (s) -> hasName.orElse(HasName.NOP).getName().setValue(s), getHeaderHasNameTextBoxFactory()), new FunctionColumnParametersHeaderMetaData(expression::get, cellEditorControls, parametersEditor, this)), this);
    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) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn)

Example 2 with ExpressionEditorColumn

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

the class FunctionSupplementaryGrid method initialiseUiColumns.

@Override
public void initialiseUiColumns() {
    final NameColumn nameColumn = new NameColumn(this);
    final ExpressionEditorColumn expressionColumn = new ExpressionEditorColumn(gridLayer, new BaseHeaderMetaData("", EXPRESSION_COLUMN_GROUP), this);
    model.appendColumn(new 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) BaseHeaderMetaData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData)

Example 3 with ExpressionEditorColumn

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

the class InvocationGrid method initialiseUiColumns.

@Override
protected void initialiseUiColumns() {
    final TextBoxSingletonDOMElementFactory headerFactory = getHeaderHasNameTextBoxFactory();
    final InvocationColumnExpressionHeaderMetaData expressionHeaderMetaData = new InvocationColumnExpressionHeaderMetaData(this::getExpressionText, this::setExpressionText, headerFactory);
    final NameColumn nameColumn = new NameColumn(Arrays.asList(new NameColumnHeaderMetaData(() -> hasName.orElse(HasName.NOP).getName().getValue(), (s) -> hasName.orElse(HasName.NOP).getName().setValue(s), headerFactory), expressionHeaderMetaData), getBodyTextBoxFactory(), this);
    final ExpressionEditorColumn expressionColumn = new ExpressionEditorColumn(gridLayer, Arrays.asList(new BaseHeaderMetaData("", EXPRESSION_COLUMN_GROUP), expressionHeaderMetaData), this);
    model.appendColumn(new 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) NameColumnHeaderMetaData(org.kie.workbench.common.dmn.client.editors.expressions.types.context.NameColumnHeaderMetaData) BaseHeaderMetaData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData) TextBoxSingletonDOMElementFactory(org.kie.workbench.common.dmn.client.widgets.grid.columns.factory.TextBoxSingletonDOMElementFactory)

Example 4 with ExpressionEditorColumn

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

the class CommandUtils method updateParentInformation.

public static void updateParentInformation(final GridData uiModel) {
    final Optional<ExpressionEditorColumn> expressionColumn = uiModel.getColumns().stream().filter(c -> c instanceof ExpressionEditorColumn).map(c -> (ExpressionEditorColumn) c).findFirst();
    expressionColumn.ifPresent(c -> {
        final int columnIndex = uiModel.getColumns().indexOf(c);
        for (int rowIndex = 0; rowIndex < uiModel.getRowCount(); rowIndex++) {
            final GridCell<?> cell = uiModel.getCell(rowIndex, columnIndex);
            if (cell != null) {
                final GridCellValue<?> value = cell.getValue();
                if (value instanceof ExpressionCellValue) {
                    final ExpressionCellValue ecv = (ExpressionCellValue) value;
                    if (ecv.getValue().isPresent()) {
                        final BaseExpressionGrid beg = ecv.getValue().get();
                        beg.getParentInformation().setRowIndex(rowIndex);
                        beg.getParentInformation().setColumnIndex(columnIndex);
                    }
                }
            }
        }
    });
}
Also used : IntStream(java.util.stream.IntStream) GridCell(org.uberfire.ext.wires.core.grids.client.model.GridCell) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) List(java.util.List) RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) BaseGridCellValue(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue) GridCellValue(org.uberfire.ext.wires.core.grids.client.model.GridCellValue) GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) Optional(java.util.Optional) ExpressionEditorColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn) ExpressionEditorColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)

Example 5 with ExpressionEditorColumn

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

the class InvocationGridTest method testInitialSetupFromDefinition.

@Test
public void testInitialSetupFromDefinition() {
    setupGrid(0);
    final GridData uiModel = grid.getModel();
    assertTrue(uiModel instanceof InvocationGridData);
    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(1, uiModel.getRowCount());
    assertEquals(1, uiModel.getCell(0, 0).getValue().getValue());
    assertEquals("p0", uiModel.getCell(0, 1).getValue().getValue());
    assertTrue(uiModel.getCell(0, 2).getValue() instanceof ExpressionCellValue);
    final ExpressionCellValue dcv0 = (ExpressionCellValue) uiModel.getCell(0, 2).getValue();
    assertEquals(undefinedExpressionEditor, dcv0.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) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) Test(org.junit.Test)

Aggregations

ExpressionEditorColumn (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn)9 RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)7 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)6 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)6 Test (org.junit.Test)5 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)4 BaseHeaderMetaData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData)4 List (java.util.List)3 Optional (java.util.Optional)3 IntStream (java.util.stream.IntStream)3 BaseExpressionGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid)3 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)3 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)3 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)3 GridCellValue (org.uberfire.ext.wires.core.grids.client.model.GridCellValue)3 BaseGridCellValue (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue)3 LienzoMockitoTestRunner (com.ait.lienzo.test.LienzoMockitoTestRunner)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2