use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project kie-wb-common by kiegroup.
the class ListUIModelMapperTest method setup.
@SuppressWarnings("unchecked")
public void setup(final Expression expression, final boolean isOnlyVisualChangeAllowedSupplier) {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
when(uiRowNumberColumn.getIndex()).thenReturn(0);
when(uiExpressionEditorColumn.getIndex()).thenReturn(1);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
when(literalExpressionEditor.getExpression()).thenReturn(() -> Optional.of(literalExpression));
when(literalExpressionEditorDefinition.getModelClass()).thenReturn(Optional.of(literalExpression));
when(literalExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(literalExpressionEditor));
when(undefinedExpressionEditor.getExpression()).thenReturn(Optional::empty);
when(undefinedExpressionEditorDefinition.getModelClass()).thenReturn(Optional.empty());
when(undefinedExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(undefinedExpressionEditor));
this.list = new List();
this.list.getExpression().add(HasExpression.wrap(list, expression));
this.mapper = new ListUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(list), () -> isOnlyVisualChangeAllowedSupplier, expressionEditorDefinitionsSupplier, listSelector, 0);
this.cellValueSupplier = Optional::empty;
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project kie-wb-common by kiegroup.
the class LiteralExpressionUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
uiModel = new BaseGridData();
uiModel.appendRow(new BaseGridRow());
uiModel.appendColumn(uiLiteralExpressionColumn);
doReturn(0).when(uiLiteralExpressionColumn).getIndex();
literalExpression = new LiteralExpression();
mapper = getMapper();
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project kie-wb-common by kiegroup.
the class UndefinedExpressionGridTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
when(sessionManager.getCurrentSession()).thenReturn(session);
when(session.getGridPanel()).thenReturn(gridPanel);
when(session.getGridLayer()).thenReturn(gridLayer);
when(session.getCellEditorControls()).thenReturn(cellEditorControls);
expressionGridCache = spy(new ExpressionGridCacheImpl());
when(sessionManager.getCurrentSession()).thenReturn(session);
when(session.getExpressionGridCache()).thenReturn(expressionGridCache);
definition = new UndefinedExpressionEditorDefinition(definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, editorSelectedEvent, refreshFormPropertiesEvent, domainObjectSelectionEvent, listSelector, translationService, undefinedExpressionSelector, expressionEditorDefinitionsSupplier, readOnlyProvider);
expression = definition.getModelClass();
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(definition);
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
when(literalExpressionEditorDefinition.getType()).thenReturn(ExpressionType.LITERAL_EXPRESSION);
when(literalExpressionEditorDefinition.getName()).thenReturn(LiteralExpression.class.getSimpleName());
doCallRealMethod().when(literalExpressionEditor).selectFirstCell();
when(literalExpressionEditor.getLayer()).thenReturn(gridLayer);
final GridData literalExpressionUiModel = new BaseGridData();
literalExpressionUiModel.appendColumn(mock(GridColumn.class));
literalExpressionUiModel.appendRow(mock(GridRow.class));
when(literalExpressionEditor.getModel()).thenReturn(literalExpressionUiModel);
when(literalExpressionEditorDefinition.getModelClass()).thenReturn(Optional.of(literalExpression));
when(literalExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(literalExpressionEditor));
when(session.getCanvasHandler()).thenReturn(canvasHandler);
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(diagram.getGraph()).thenReturn(graph);
when(graph.nodes()).thenReturn(Collections.singletonList(node));
when(parentGridWidget.getModel()).thenReturn(parentGridUiModel);
setupParent();
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project kie-wb-common by kiegroup.
the class UndefinedExpressionUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.uiModel = new BaseGridData();
this.uiModel.appendColumn(uiColumn);
this.uiModel.appendRow(new BaseGridRow());
this.mapper = new UndefinedExpressionUIModelMapper(() -> uiModel, () -> Optional.ofNullable(expression), listSelector, translationService, hasExpression);
this.cellValueSupplier = () -> Optional.of(new ExpressionCellValue(Optional.of(editor)));
when(hasExpression.asDMNModelInstrumentedBase()).thenReturn(hasExpressionDMNModelInstrumentedBase);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerPresenterTest method setup.
@Before
public void setup() {
when(gridLayer.addNodeMouseMoveHandler(any())).thenReturn(mock(HandlerRegistration.class));
when(gridLayer.addNodeMouseOutHandler(any())).thenReturn(mock(HandlerRegistration.class));
when(view.addKeyDownHandler(any())).thenReturn(mock(HandlerRegistration.class));
when(view.addContextMenuHandler(any())).thenReturn(mock(HandlerRegistration.class));
when(view.addMouseDownHandler(any())).thenReturn(mock(HandlerRegistration.class));
when(view.getGridLayerView()).thenReturn(gridLayer);
when(view.getBounds()).thenReturn(bounds);
final GuidedDecisionTableModellerPresenter wrapped = new GuidedDecisionTableModellerPresenter(view, dtablePresenterProvider, contextMenuSupport, updateRadarEvent, pinnedEvent, columnHeaderPopOver);
presenter = spy(wrapped);
when(dtablePresenterProvider.get()).thenReturn(dtablePresenter);
when(dtablePresenter.getView()).thenReturn(dtableView);
when(dtableView.getModel()).thenReturn(new BaseGridData());
}
Aggregations