use of org.drools.workbench.screens.scenariosimulation.client.renderers.ScenarioGridRenderer in project drools-wb by kiegroup.
the class ScenarioGridPanelProducer method initializeGrid.
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);
// Hack to enable PINNED MODE i.e. not draggable
scenarioGridLayer.enterPinnedMode(scenarioGrid, () -> {
});
}
Aggregations