use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.
the class JavaFunctionEditorDefinitionTest method testEditor.
@Test
public void testEditor() {
final Optional<Context> expression = definition.getModelClass();
final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
assertTrue(oEditor.isPresent());
final GridWidget editor = oEditor.get();
assertTrue(editor instanceof FunctionSupplementaryGrid);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.
the class PMMLFunctionEditorDefinitionTest method testEditor.
@Test
public void testEditor() {
final Optional<Context> expression = definition.getModelClass();
final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
assertTrue(oEditor.isPresent());
final GridWidget editor = oEditor.get();
assertTrue(editor instanceof FunctionSupplementaryGrid);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.
the class RelationEditorDefinitionTest method testEditor.
@Test
public void testEditor() {
final Optional<Relation> expression = definition.getModelClass();
final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
assertThat(oEditor).isPresent();
final GridWidget editor = oEditor.get();
assertThat(editor).isInstanceOf(RelationGrid.class);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.
the class InvocationGrid method getItems.
@Override
@SuppressWarnings("unused")
public List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) {
final List<ListSelectorItem> items = new ArrayList<>();
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.InvocationEditor_InsertParameterAbove), true, () -> {
cellEditorControls.hide();
expression.ifPresent(e -> addParameterBinding(uiRowIndex));
}));
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.InvocationEditor_InsertParameterBelow), true, () -> {
cellEditorControls.hide();
expression.ifPresent(e -> addParameterBinding(uiRowIndex + 1));
}));
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.InvocationEditor_DeleteParameter), model.getRowCount() > 1, () -> {
cellEditorControls.hide();
deleteParameterBinding(uiRowIndex);
}));
// If not ExpressionEditor column don't add extra items
if (uiColumnIndex != InvocationUIModelMapper.BINDING_EXPRESSION_COLUMN_INDEX) {
return items;
}
// If cell editor is UndefinedExpressionGrid don't add extra items
final GridCell<?> cell = model.getCell(uiRowIndex, uiColumnIndex);
final ExpressionCellValue ecv = (ExpressionCellValue) cell.getValue();
if (!ecv.getValue().isPresent()) {
return items;
}
final BaseExpressionGrid grid = ecv.getValue().get();
if (grid instanceof UndefinedExpressionGrid) {
return items;
}
items.add(new ListSelectorDividerItem());
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ExpressionEditor_Clear), true, () -> {
cellEditorControls.hide();
clearExpressionType(uiRowIndex);
}));
return items;
}
use of org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid in project kie-wb-common by kiegroup.
the class DMNGridColumn method updateWidthOfPeers.
public void updateWidthOfPeers() {
if (gridWidget instanceof BaseExpressionGrid) {
final BaseExpressionGrid beg = (BaseExpressionGrid) gridWidget;
final int parentColumnIndex = beg.getParentInformation().getColumnIndex();
final GridData parentGridData = beg.getParentInformation().getGridWidget().getModel();
if (parentGridData != null) {
final GridColumn<?> parentColumn = parentGridData.getColumns().get(parentColumnIndex);
parentColumn.setWidth(beg.getWidth() + beg.getPadding() * 2);
}
}
}
Aggregations