use of org.kie.workbench.common.dmn.api.definition.HasExpression in project kie-wb-common by kiegroup.
the class LiteralExpressionPMMLDocumentModelEditorDefinitionTest method testEditor.
@Test
public void testEditor() {
when(hasExpression.getExpression()).thenReturn(definition.getModelClass().get());
final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, hasName, false, 0);
assertTrue(oEditor.isPresent());
final GridWidget editor = oEditor.get();
assertTrue(editor instanceof LiteralExpressionPMMLGrid);
}
use of org.kie.workbench.common.dmn.api.definition.HasExpression in project kie-wb-common by kiegroup.
the class InvocationEditorDefinitionTest method testEditor.
@Test
public void testEditor() {
when(hasExpression.getExpression()).thenReturn(definition.getModelClass().get());
final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, hasName, false, 0);
assertTrue(oEditor.isPresent());
final GridWidget editor = oEditor.get();
assertTrue(editor instanceof InvocationGrid);
}
use of org.kie.workbench.common.dmn.api.definition.HasExpression in project kie-wb-common by kiegroup.
the class FunctionEditorDefinitionTest method testEditor.
@Test
public void testEditor() {
when(hasExpression.getExpression()).thenReturn(definition.getModelClass().get());
final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, hasName, false, 0);
assertTrue(oEditor.isPresent());
final GridWidget editor = oEditor.get();
assertTrue(editor instanceof FunctionGrid);
}
use of org.kie.workbench.common.dmn.api.definition.HasExpression in project kie-wb-common by kiegroup.
the class BoxedExpressionHelper method getOptionalHasExpression.
public Optional<HasExpression> getOptionalHasExpression(final Node<View, Edge> node) {
final Object definition = DefinitionUtils.getElementDefinition(node);
final HasExpression expression;
if (definition instanceof BusinessKnowledgeModel) {
expression = ((BusinessKnowledgeModel) definition).asHasExpression();
} else if (definition instanceof Decision) {
expression = (Decision) definition;
} else {
expression = null;
}
return Optional.ofNullable(expression);
}
use of org.kie.workbench.common.dmn.api.definition.HasExpression in project kie-wb-common by kiegroup.
the class DecisionNavigatorNestedItemFactory method makeEditExpressionEvent.
EditExpressionEvent makeEditExpressionEvent(final Node<View, Edge> node) {
final ClientSession currentSession = sessionManager.getCurrentSession();
final Object definition = DefinitionUtils.getElementDefinition(node);
final HasExpression hasExpression = helper.getHasExpression(node);
final Optional<HasName> hasName = Optional.of((HasName) definition);
final boolean isOnlyVisualChangeAllowed = isOnlyVisualChangeAllowed(definition) || readOnlyProvider.isReadOnlyDiagram();
return new EditExpressionEvent(currentSession, node.getUUID(), hasExpression, hasName, isOnlyVisualChangeAllowed);
}
Aggregations