use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn in project kie-wb-common by kiegroup.
the class FunctionGrid method initialiseUiColumns.
@Override
protected void initialiseUiColumns() {
final GridColumn expressionColumn = new ExpressionEditorColumn(gridLayer, Arrays.asList(new FunctionColumnNameHeaderMetaData(() -> hasName.orElse(HasName.NOP).getName().getValue(), (s) -> hasName.orElse(HasName.NOP).getName().setValue(s), getHeaderHasNameTextBoxFactory()), new FunctionColumnParametersHeaderMetaData(expression::get, cellEditorControls, parametersEditor, this)), this);
model.appendColumn(expressionColumn);
getRenderer().setColumnRenderConstraint((isSelectionLayer, gridColumn) -> !isSelectionLayer || gridColumn.equals(expressionColumn));
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn in project kie-wb-common by kiegroup.
the class FunctionSupplementaryGrid method initialiseUiColumns.
@Override
public void initialiseUiColumns() {
final NameColumn nameColumn = new NameColumn(this);
final ExpressionEditorColumn expressionColumn = new ExpressionEditorColumn(gridLayer, new BaseHeaderMetaData("", EXPRESSION_COLUMN_GROUP), this);
model.appendColumn(new RowNumberColumn());
model.appendColumn(nameColumn);
model.appendColumn(expressionColumn);
getRenderer().setColumnRenderConstraint((isSelectionLayer, gridColumn) -> !isSelectionLayer || gridColumn.equals(expressionColumn));
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn in project kie-wb-common by kiegroup.
the class InvocationGrid method initialiseUiColumns.
@Override
protected void initialiseUiColumns() {
final TextBoxSingletonDOMElementFactory headerFactory = getHeaderHasNameTextBoxFactory();
final InvocationColumnExpressionHeaderMetaData expressionHeaderMetaData = new InvocationColumnExpressionHeaderMetaData(this::getExpressionText, this::setExpressionText, headerFactory);
final NameColumn nameColumn = new NameColumn(Arrays.asList(new NameColumnHeaderMetaData(() -> hasName.orElse(HasName.NOP).getName().getValue(), (s) -> hasName.orElse(HasName.NOP).getName().setValue(s), headerFactory), expressionHeaderMetaData), getBodyTextBoxFactory(), this);
final ExpressionEditorColumn expressionColumn = new ExpressionEditorColumn(gridLayer, Arrays.asList(new BaseHeaderMetaData("", EXPRESSION_COLUMN_GROUP), expressionHeaderMetaData), this);
model.appendColumn(new RowNumberColumn());
model.appendColumn(nameColumn);
model.appendColumn(expressionColumn);
getRenderer().setColumnRenderConstraint((isSelectionLayer, gridColumn) -> !isSelectionLayer || gridColumn.equals(expressionColumn));
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn in project kie-wb-common by kiegroup.
the class CommandUtils method updateParentInformation.
public static void updateParentInformation(final GridData uiModel) {
final Optional<ExpressionEditorColumn> expressionColumn = uiModel.getColumns().stream().filter(c -> c instanceof ExpressionEditorColumn).map(c -> (ExpressionEditorColumn) c).findFirst();
expressionColumn.ifPresent(c -> {
final int columnIndex = uiModel.getColumns().indexOf(c);
for (int rowIndex = 0; rowIndex < uiModel.getRowCount(); rowIndex++) {
final GridCell<?> cell = uiModel.getCell(rowIndex, columnIndex);
if (cell != null) {
final GridCellValue<?> value = cell.getValue();
if (value instanceof ExpressionCellValue) {
final ExpressionCellValue ecv = (ExpressionCellValue) value;
if (ecv.getValue().isPresent()) {
final BaseExpressionGrid beg = ecv.getValue().get();
beg.getParentInformation().setRowIndex(rowIndex);
beg.getParentInformation().setColumnIndex(columnIndex);
}
}
}
}
});
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn in project kie-wb-common by kiegroup.
the class InvocationGridTest method testInitialSetupFromDefinition.
@Test
public void testInitialSetupFromDefinition() {
setupGrid(0);
final GridData uiModel = grid.getModel();
assertTrue(uiModel instanceof InvocationGridData);
assertEquals(3, uiModel.getColumnCount());
assertTrue(uiModel.getColumns().get(0) instanceof RowNumberColumn);
assertTrue(uiModel.getColumns().get(1) instanceof NameColumn);
assertTrue(uiModel.getColumns().get(2) instanceof ExpressionEditorColumn);
assertEquals(1, uiModel.getRowCount());
assertEquals(1, uiModel.getCell(0, 0).getValue().getValue());
assertEquals("p0", uiModel.getCell(0, 1).getValue().getValue());
assertTrue(uiModel.getCell(0, 2).getValue() instanceof ExpressionCellValue);
final ExpressionCellValue dcv0 = (ExpressionCellValue) uiModel.getCell(0, 2).getValue();
assertEquals(undefinedExpressionEditor, dcv0.getValue().get());
}
Aggregations