use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.InformationItemCell in project kie-wb-common by kiegroup.
the class InvocationUIModelMapper method fromDMNModel.
@Override
public void fromDMNModel(final int rowIndex, final int columnIndex) {
dmnModel.get().ifPresent(invocation -> {
switch(columnIndex) {
case ROW_NUMBER_COLUMN_INDEX:
uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector));
uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE);
break;
case BINDING_PARAMETER_COLUMN_INDEX:
final InformationItem variable = invocation.getBinding().get(rowIndex).getParameter();
uiModel.get().setCell(rowIndex, columnIndex, () -> new InformationItemCell(() -> InformationItemCell.HasNameAndDataTypeCell.wrap(variable), listSelector));
break;
case BINDING_EXPRESSION_COLUMN_INDEX:
final Binding binding = invocation.getBinding().get(rowIndex);
final Optional<Expression> expression = Optional.ofNullable(binding.getExpression());
final boolean isOnlyVisualChangeAllowed = this.isOnlyVisualChangeAllowedSupplier.get();
final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression);
expressionEditorDefinition.ifPresent(ed -> {
final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = ed.getEditor(new GridCellTuple(rowIndex, columnIndex, gridWidget), Optional.empty(), binding, Optional.ofNullable(binding.getParameter()), isOnlyVisualChangeAllowed, nesting + 1);
uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new ExpressionCellValue(editor), listSelector));
});
}
});
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.InformationItemCell in project kie-wb-common by kiegroup.
the class RendererUtilsTest method testRenderHeaderContentWithInformationItemCell.
@Test
public void testRenderHeaderContentWithInformationItemCell() {
final InformationItemCell.HasNameAndDataTypeCell informationItemCell = mock(InformationItemCell.HasNameAndDataTypeCell.class);
final Name name = new Name(TITLE);
when(informationItemCell.getName()).thenReturn(name);
when(informationItemCell.getTypeRef()).thenReturn(TYPE_REF);
when(informationItemCell.hasData()).thenReturn(true);
RendererUtils.getNameAndDataTypeCellText(informationItemCell, bodyContext);
assertHasNameAndDataTypeRendering();
}
Aggregations