use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.
the class BaseContextUIModelMapperTest 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(uiRowNumberColumn);
this.uiModel.appendColumn(uiNameColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiNameColumn).getIndex();
doReturn(2).when(uiExpressionEditorColumn).getIndex();
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
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());
doReturn(Optional.empty()).when(undefinedExpressionEditorDefinition).getModelClass();
doReturn(Optional.of(undefinedExpressionEditor)).when(undefinedExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
this.context = new Context();
this.context.getContextEntry().add(new ContextEntry() {
{
setVariable(new InformationItem() {
{
setName(new Name("ii1"));
}
});
}
});
this.context.getContextEntry().add(new ContextEntry() {
{
setExpression(new LiteralExpression());
}
});
this.mapper = getMapper();
this.cellValueSupplier = Optional::empty;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.
the class InformationItemNameCellTest method setup.
@Before
public void setup() {
this.informationItem = new InformationItem();
this.cell = new InformationItemNameCell(() -> informationItem, listSelector);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.
the class RelationGridTest method testInitialiseUiColumns.
@Test
public void testInitialiseUiColumns() throws Exception {
final String columnHeader = "first column";
relation.getColumn().add(new InformationItem() {
{
getName().setValue(columnHeader);
}
});
expression = Optional.of(relation);
setupGrid(0);
assertEquals(2, grid.getModel().getColumns().size());
assertTrue(grid.getModel().getColumns().get(0) instanceof RowNumberColumn);
assertEquals(columnHeader, grid.getModel().getColumns().get(1).getHeaderMetaData().get(0).getTitle());
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.
the class FunctionGrid method addParameter.
@Override
public void addParameter(final Command onSuccess) {
expression.ifPresent(e -> {
final InformationItem parameter = new InformationItem();
parameter.setName(new Name("p" + e.getFormalParameter().size()));
sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddParameterCommand(e, parameter, () -> {
gridLayer.batch();
onSuccess.execute();
}));
});
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.
the class JavaFunctionEditorDefinition method getModelClass.
@Override
public Optional<Context> getModelClass() {
final Context context = new Context();
final ContextEntry classEntry = new ContextEntry();
final InformationItem classEntryVariable = new InformationItem();
classEntryVariable.setName(new Name(VARIABLE_CLASS));
classEntry.setVariable(classEntryVariable);
classEntry.setExpression(new LiteralExpression());
context.getContextEntry().add(classEntry);
final ContextEntry methodSignatureEntry = new ContextEntry();
final InformationItem methodSignatureEntryVariable = new InformationItem();
methodSignatureEntryVariable.setName(new Name(VARIABLE_METHOD_SIGNATURE));
methodSignatureEntry.setVariable(methodSignatureEntryVariable);
methodSignatureEntry.setExpression(new LiteralExpression());
context.getContextEntry().add(methodSignatureEntry);
return Optional.of(context);
}
Aggregations