use of org.kie.workbench.common.dmn.client.editors.expressions.types.undefined.UndefinedExpressionGrid in project kie-wb-common by kiegroup.
the class ListGrid method getItems.
@Override
public java.util.List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) {
final java.util.List<ListSelectorItem> items = new ArrayList<>();
final boolean isMultiRow = SelectionUtils.isMultiRow(model);
final boolean isMultiSelect = SelectionUtils.isMultiSelect(model);
items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.ListEditor_HeaderRows)));
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ListEditor_InsertRowAbove), !isMultiRow, () -> {
cellEditorControls.hide();
getExpression().get().ifPresent(e -> addRow(uiRowIndex));
}));
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ListEditor_InsertRowBelow), !isMultiRow, () -> {
cellEditorControls.hide();
getExpression().get().ifPresent(e -> addRow(uiRowIndex + 1));
}));
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ListEditor_DeleteRow), !isMultiRow && model.getRowCount() > 1, () -> {
cellEditorControls.hide();
getExpression().get().ifPresent(e -> deleteRow(uiRowIndex));
}));
// If not ExpressionEditor column don't add extra items
if (ListUIModelMapperHelper.getSection(uiColumnIndex) != ListUIModelMapperHelper.ListSection.EXPRESSION) {
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;
}
if (items.size() > 0) {
items.add(new ListSelectorDividerItem());
}
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ExpressionEditor_Clear), !isMultiSelect, () -> {
cellEditorControls.hide();
clearExpressionType(uiRowIndex);
}));
return items;
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.undefined.UndefinedExpressionGrid 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<>();
final boolean isMultiRow = SelectionUtils.isMultiRow(model);
final boolean isMultiSelect = SelectionUtils.isMultiSelect(model);
items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.InvocationEditor_Header)));
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.InvocationEditor_InsertParameterAbove), !isMultiRow, () -> {
cellEditorControls.hide();
getExpression().get().ifPresent(e -> addParameterBinding(uiRowIndex));
}));
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.InvocationEditor_InsertParameterBelow), !isMultiRow, () -> {
cellEditorControls.hide();
getExpression().get().ifPresent(e -> addParameterBinding(uiRowIndex + 1));
}));
items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.InvocationEditor_DeleteParameter), !isMultiRow && 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), !isMultiSelect, () -> {
cellEditorControls.hide();
clearExpressionType(uiRowIndex);
}));
return items;
}
Aggregations