use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class InformationItemPropertyConverter method wbFromDMN.
public static InformationItem wbFromDMN(final JSITInformationItem dmn) {
if (Objects.isNull(dmn)) {
return null;
}
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final Name name = new Name(dmn.getName());
final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
final InformationItem result = new InformationItem(id, description, name, typeRef);
return result;
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class DeleteRelationColumnCommandTest method setup.
@Before
public void setup() {
this.relation = new Relation();
this.informationItem = new InformationItem();
this.relation.getColumn().add(informationItem);
this.uiModel = new BaseGridData();
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiModelColumn);
doReturn(ruleManager).when(handler).getRuleManager();
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiModelColumn).getIndex();
this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector, DEFAULT_HEIGHT);
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class ParametersPopoverImplTest method testShowNonNullControlWithParameters.
@Test
public void testShowNonNullControlWithParameters() {
parameters.add(new InformationItem());
presenter.bind(control, ROW_INDEX, COLUMN_INDEX);
presenter.show();
verify(view).show(eq(Optional.ofNullable(presenter.getPopoverTitle())));
verify(view).focusParameter(0);
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class InvocationUIModelMapperTest method setup.
@SuppressWarnings("unchecked")
public void setup(final boolean isOnlyVisualChangeAllowedSupplier) {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiNameColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
when(uiRowNumberColumn.getIndex()).thenReturn(0);
when(uiNameColumn.getIndex()).thenReturn(1);
when(uiExpressionEditorColumn.getIndex()).thenReturn(2);
when(gridWidget.getModel()).thenReturn(uiModel);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
when(literalExpressionEditorDefinition.getModelClass()).thenReturn(Optional.of(literalExpression));
when(literalExpressionEditor.getExpression()).thenReturn(() -> Optional.of(literalExpression));
when(literalExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(literalExpressionEditor));
final LiteralExpression invocationExpression = new LiteralExpression();
invocationExpression.getText().setValue("invocation-expression");
final LiteralExpression bindingExpression = new LiteralExpression();
bindingExpression.getText().setValue("binding-expression");
final Binding binding = new Binding();
final InformationItem parameter = new InformationItem();
parameter.setName(new Name("p0"));
binding.setParameter(parameter);
binding.setExpression(bindingExpression);
this.invocation = new Invocation();
this.invocation.setExpression(invocationExpression);
this.invocation.getBinding().add(binding);
this.mapper = new InvocationUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(invocation), () -> isOnlyVisualChangeAllowedSupplier, expressionEditorDefinitionsSupplier, listSelector, 0);
this.cellValueSupplier = Optional::empty;
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class ParametersPopoverViewImplTest method testUpdateParameterName.
@Test
public void testUpdateParameterName() {
final InformationItem parameter1 = new InformationItem();
final InformationItem parameter2 = new InformationItem();
view.setParameters(Arrays.asList(parameter1, parameter2));
view.updateParameterName(0, PARAMETER1_NAME);
verify(parameterView1).setName(PARAMETER1_NAME);
view.updateParameterName(1, PARAMETER2_NAME);
verify(parameterView2).setName(PARAMETER2_NAME);
reset(parameterView1, parameterView2);
view.updateParameterName(-1, "cheese");
verify(parameterView1, never()).setName(Mockito.<String>any());
verify(parameterView2, never()).setName(Mockito.<String>any());
view.updateParameterName(2, "cheese");
verify(parameterView1, never()).setName(Mockito.<String>any());
verify(parameterView2, never()).setName(Mockito.<String>any());
}
Aggregations