use of org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition 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);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition in project kie-wb-common by kiegroup.
the class RemoveParameterCommandTest method setup.
@Before
public void setup() {
this.function = new FunctionDefinition();
this.parameter = new InformationItem();
this.function.getFormalParameter().add(parameter);
this.command = new RemoveParameterCommand(function, parameter, canvasOperation);
doReturn(ruleManager).when(handler).getRuleManager();
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition in project kie-wb-common by kiegroup.
the class SetKindCommandTest method setup.
@Before
public void setup() {
this.function = new FunctionDefinition();
this.function.getAdditionalAttributes().put(FunctionDefinition.KIND_QNAME, originalKind.code());
this.function.setExpression(originalExpression);
this.uiModel = new BaseGridData();
this.uiModel.appendColumn(mockColumn);
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.setCellValue(0, 0, new ExpressionCellValue(Optional.of(originalEditor)));
doReturn(uiModel).when(gridWidget).getModel();
doReturn(ruleManager).when(handler).getRuleManager();
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition in project kie-wb-common by kiegroup.
the class FunctionUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendColumn(uiExpressionEditorColumn);
doReturn(0).when(uiExpressionEditorColumn).getIndex();
doReturn(uiModel).when(gridWidget).getModel();
// Core Editor definitions
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass();
doReturn(Optional.of(literalExpression)).when(literalExpressionEditor).getExpression();
doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
// Supplementary Editor definitions
final ExpressionEditorDefinitions supplementaryEditorDefinitions = new ExpressionEditorDefinitions();
supplementaryEditorDefinitions.add(supplementaryEditorDefinition);
doReturn(supplementaryEditorDefinitions).when(supplementaryEditorDefinitionsSupplier).get();
doReturn(Optional.of(context)).when(supplementaryEditorDefinition).getModelClass();
doReturn(Optional.of(context)).when(supplementaryEditor).getExpression();
doReturn(Optional.of(supplementaryEditor)).when(supplementaryEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
this.function = new FunctionDefinition();
this.mapper = new FunctionUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(function), expressionEditorDefinitionsSupplier, supplementaryEditorDefinitionsSupplier, listSelector, 0);
this.cellValueSupplier = Optional::empty;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition in project kie-wb-common by kiegroup.
the class FunctionEditorDefinition method getModelClass.
@Override
public Optional<FunctionDefinition> getModelClass() {
final FunctionDefinition function = new FunctionDefinition();
KindUtilities.setKind(function, FunctionDefinition.Kind.FEEL);
function.setExpression(new LiteralExpression());
return Optional.of(function);
}
Aggregations