ScenarioGridPanelProducer { protected void initializeGrid(ScenarioGridLayer scenarioGridLayer, ScenarioGridPanel scenarioGridPanel, AbstractScesimGridModel abstractScesimGridModel, ScenarioSimulationContext scenarioSimulationContext, int defaultDataCellX, int defaultDataCellY) { final ScenarioGrid scenarioGrid = new ScenarioGrid(abstractScesimGridModel, scenarioGridLayer, new ScenarioGridRenderer(false), scenarioContextMenuRegistry); scenarioGridLayer.addScenarioGrid(scenarioGrid); scenarioGridPanel.add(scenarioGridLayer); scenarioGrid.setScenarioSimulationContext(scenarioSimulationContext); scenarioGrid.setDefaultSelectedDataCell(defaultDataCellX, defaultDataCellY); abstractScesimGridModel.setCollectionEditorSingletonDOMElementFactory( new CollectionEditorSingletonDOMElementFactory(scenarioGridPanel, scenarioGridLayer, scenarioGridLayer.getScenarioGrid(), scenarioSimulationContext, viewsProvider)); abstractScesimGridModel.setScenarioCellTextAreaSingletonDOMElementFactory( new ScenarioCellTextAreaSingletonDOMElementFactory(scenarioGridPanel, scenarioGridLayer, scenarioGridLayer.getScenarioGrid())); abstractScesimGridModel.setScenarioHeaderTextBoxSingletonDOMElementFactory( new ScenarioHeaderTextBoxSingletonDOMElementFactory(scenarioGridPanel, scenarioGridLayer, scenarioGridLayer.getScenarioGrid())); abstractScesimGridModel.setScenarioExpressionCellTextAreaSingletonDOMElementFactory( new ScenarioExpressionCellTextAreaSingletonDOMElementFactory(scenarioGridPanel, scenarioGridLayer, scenarioGridLayer.getScenarioGrid())); final ScenarioSimulationKeyboardEditHandler scenarioSimulationKeyboardEditHandler = new ScenarioSimulationKeyboardEditHandler(scenarioGridLayer); final ScenarioInvokeContextMenuForSelectedCell invokeContextMenuKeyboardOperation = new ScenarioInvokeContextMenuForSelectedCell(scenarioGridLayer, scenarioContextMenuRegistry); final BaseGridWidgetKeyboardHandler handler = new BaseGridWidgetKeyboardHandler(scenarioGridLayer); handler.addOperation(scenarioSimulationKeyboardEditHandler, new KeyboardOperationSelectTopLeftCell(scenarioGridLayer), new KeyboardOperationMoveLeft(scenarioGridLayer), new KeyboardOperationMoveRight(scenarioGridLayer), new KeyboardOperationMoveUp(scenarioGridLayer), new KeyboardOperationMoveDown(scenarioGridLayer), new KeyboardOperationSelectBottomRightCell(scenarioGridLayer), invokeContextMenuKeyboardOperation); scenarioGridPanel.addKeyDownHandler(handler); scenarioGridLayer.enterPinnedMode(scenarioGrid, () -> {}); }  @PostConstruct void init(); ScenarioSimulationContext getScenarioSimulationContext(); ScenarioGridPanel getSimulationGridPanel(); ScenarioGridPanel getBackgroundGridPanel(); ScenarioContextMenuRegistry getScenarioContextMenuRegistry(); ScenarioSimulationView getScenarioSimulationView(final EventBus eventBus); ScenarioGridWidget getBackgroundGridWidget(final EventBus eventBus);  }
@Test public void initializeGrid() { scenarioGridPanelProducer.initializeGrid(scenarioGridLayerMock, scenarioGridPanelMock, scenarioGridModelMock, scenarioSimulationContextLocal, 0, 0); verify(scenarioGridLayerMock, times(1)).addScenarioGrid(isA(ScenarioGrid.class)); verify(scenarioGridLayerMock, times(1)).addScenarioGrid(scenarioGridArgumentCaptor.capture()); verify(scenarioGridLayerMock, times(1)).enterPinnedMode(eq(scenarioGridArgumentCaptor.getValue()), isA(Command.class)); verify(scenarioGridPanelMock, times(1)).add(eq(scenarioGridLayerMock)); verify(scenarioGridPanelMock, times(1)).addKeyDownHandler(isA(BaseGridWidgetKeyboardHandler.class)); assertNotNull(scenarioGridArgumentCaptor.getValue().getScenarioSimulationContext()); assertNotNull(scenarioGridArgumentCaptor.getValue().getModel()); assertNotNull(scenarioGridArgumentCaptor.getValue().getModel().getCollectionEditorSingletonDOMElementFactory()); assertNotNull(scenarioGridArgumentCaptor.getValue().getModel().getScenarioCellTextAreaSingletonDOMElementFactory()); assertNotNull(scenarioGridArgumentCaptor.getValue().getModel().getScenarioHeaderTextBoxSingletonDOMElementFactory()); assertNotNull(scenarioGridArgumentCaptor.getValue().getModel().getScenarioExpressionCellTextAreaSingletonDOMElementFactory()); }