Search in sources :

Example 11 with BaseExpressionGrid

use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.

the class DecisionTableEditorDefinitionTest method testEditor.

@Test
public void testEditor() {
    final Optional<DecisionTable> expression = definition.getModelClass();
    final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
    assertThat(oEditor).isPresent();
    final GridWidget editor = oEditor.get();
    assertThat(editor).isInstanceOf(DecisionTableGrid.class);
}
Also used : DecisionTable(org.kie.workbench.common.dmn.api.definition.v1_1.DecisionTable) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) Test(org.junit.Test)

Example 12 with BaseExpressionGrid

use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.

the class FunctionEditorDefinitionTest method testEditor.

@Test
public void testEditor() {
    final Optional<FunctionDefinition> expression = definition.getModelClass();
    final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
    assertTrue(oEditor.isPresent());
    final GridWidget editor = oEditor.get();
    assertTrue(editor instanceof FunctionGrid);
}
Also used : GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition) Test(org.junit.Test)

Example 13 with BaseExpressionGrid

use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.

the class InvocationEditorDefinitionTest method testEditor.

@Test
public void testEditor() {
    final Optional<Invocation> expression = definition.getModelClass();
    final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
    assertTrue(oEditor.isPresent());
    final GridWidget editor = oEditor.get();
    assertTrue(editor instanceof InvocationGrid);
}
Also used : Invocation(org.kie.workbench.common.dmn.api.definition.v1_1.Invocation) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) Test(org.junit.Test)

Example 14 with BaseExpressionGrid

use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.

the class InvocationGridTest method testOnItemSelectedExpressionColumnDefinedExpressionType.

@Test
public void testOnItemSelectedExpressionColumnDefinedExpressionType() {
    setupGrid(0);
    // Set an editor for expression at (0, 2)
    final BaseExpressionGrid editor = mock(BaseExpressionGrid.class);
    grid.getModel().setCellValue(0, 2, new ExpressionCellValue(Optional.of(editor)));
    final List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, 2);
    assertThat(items.size()).isEqualTo(5);
    assertDefaultListItems(items.subList(0, 3));
    assertThat(items.get(DIVIDER)).isInstanceOf(HasListSelectorControl.ListSelectorDividerItem.class);
    assertListSelectorItem(items.get(CLEAR_EXPRESSION_TYPE), DMNEditorConstants.ExpressionEditor_Clear);
    ((HasListSelectorControl.ListSelectorTextItem) items.get(CLEAR_EXPRESSION_TYPE)).getCommand().execute();
    verify(cellEditorControls).hide();
    verify(sessionCommandManager).execute(eq(canvasHandler), any(ClearExpressionTypeCommand.class));
}
Also used : ClearExpressionTypeCommand(org.kie.workbench.common.dmn.client.commands.general.ClearExpressionTypeCommand) HasListSelectorControl(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) Test(org.junit.Test)

Example 15 with BaseExpressionGrid

use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.

the class LiteralExpressionEditorDefinitionTest method testEditor.

@Test
public void testEditor() {
    final Optional<LiteralExpression> expression = definition.getModelClass();
    final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
    assertThat(oEditor).isPresent();
    final GridWidget editor = oEditor.get();
    assertThat(editor).isInstanceOf(LiteralExpressionGrid.class);
}
Also used : GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) Test(org.junit.Test)

Aggregations

BaseExpressionGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid)32 Test (org.junit.Test)15 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)13 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)13 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)11 GridWidget (org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget)11 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)8 List (java.util.List)7 Optional (java.util.Optional)7 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)7 Expression (org.kie.workbench.common.dmn.api.definition.v1_1.Expression)7 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)7 ArrayList (java.util.ArrayList)6 HasName (org.kie.workbench.common.dmn.api.definition.HasName)6 HasListSelectorControl (org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl)6 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)6 DMNGridLayer (org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer)6 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)5 ExpressionEditorDefinition (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinition)5 ExpressionEditorColumn (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn)5