use of org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer in project kie-wb-common by kiegroup.
the class ExpressionContainerGridTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.expressionGridCache = new ExpressionGridCacheImpl();
this.gridLayer = spy(new DMNGridLayer());
this.grid = new ExpressionContainerGrid(gridLayer, cellEditorControls, translationService, listSelector, sessionManager, sessionCommandManager, canvasCommandFactory, expressionEditorDefinitionsSupplier, () -> expressionGridCache, onHasExpressionChanged, onHasNameChanged, refreshFormPropertiesEvent, domainObjectSelectionEvent) {
@Override
public CellSelectionManager getCellSelectionManager() {
return cellSelectionManager;
}
};
this.gridLayer.add(grid);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
when(literalExpressionEditor.isCacheable()).thenReturn(true);
when(literalExpressionEditor.getParentInformation()).thenReturn(parent);
when(literalExpressionEditor.getModel()).thenReturn(new BaseGridData());
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.getParentInformation()).thenReturn(parent);
when(undefinedExpressionEditor.getModel()).thenReturn(new BaseGridData());
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));
when(sessionManager.getCurrentSession()).thenReturn(session);
when(session.getCanvasHandler()).thenReturn(canvasHandler);
when(canvasHandler.getGraphExecutionContext()).thenReturn(graphExecutionContext);
doReturn(mock(Bounds.class)).when(gridLayer).getVisibleBounds();
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(diagram.getGraph()).thenReturn(graph);
when(graph.nodes()).thenReturn(Collections.singletonList(node));
when(parent.getGridWidget()).thenReturn(grid);
when(parent.getRowIndex()).thenReturn(0);
when(parent.getColumnIndex()).thenReturn(0);
doAnswer((i) -> i.getArguments()[0].toString()).when(translationService).format(Mockito.<String>any());
}
use of org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer in project kie-wb-common by kiegroup.
the class DMNGridPanelControlImpl method bind.
@Override
public void bind(final DMNSession session) {
final DMNGridLayer gridLayer = session.getGridLayer();
final CellEditorControlsView.Presenter cellEditorControls = session.getCellEditorControls();
final RestrictedMousePanMediator mousePanMediator = session.getMousePanMediator();
final DMNGridPanelCellSelectionHandler selectionHandler = new DMNGridPanelCellSelectionHandlerImpl(gridLayer);
final ContextMenuHandler contextMenuHandler = new DMNGridPanelContextMenuHandler(gridLayer, cellEditorControls, selectionHandler);
this.panel = new DMNGridPanel(gridLayer, mousePanMediator, contextMenuHandler);
}
use of org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer in project kie-wb-common by kiegroup.
the class BaseDelegatingExpressionGrid method selectFirstCell.
@Override
public void selectFirstCell() {
if (nesting == 0) {
super.selectFirstCell();
return;
}
final GridCellTuple parent = getParentInformation();
final GridWidget parentGridWidget = parent.getGridWidget();
final GridData parentGridData = parentGridWidget.getModel();
parentGridData.clearSelections();
parentGridData.selectCell(parent.getRowIndex(), parent.getColumnIndex());
doAfterSelectionChange(0, 0);
final DMNGridLayer gridLayer = (DMNGridLayer) getLayer();
gridLayer.select(parentGridWidget);
}
Aggregations