Search in sources :

Example 6 with AbstractScesimData

use of org.drools.scenariosimulation.api.model.AbstractScesimData in project drools-wb by kiegroup.

the class SetGridCellValueCommand method internalExecute.

@Override
protected void internalExecute(ScenarioSimulationContext context) {
    final ScenarioSimulationContext.Status status = context.getStatus();
    AbstractScesimModel<AbstractScesimData> abstractScesimModel = context.getAbstractScesimModelByGridWidget(gridWidget);
    int columnIndex = status.getColumnIndex();
    FactMapping factMapping = abstractScesimModel.getScesimModelDescriptor().getFactMappingByIndex(columnIndex);
    ScenarioGridColumn selectedColumn = (ScenarioGridColumn) context.getAbstractScesimGridModelByGridWidget(gridWidget).getColumns().get(columnIndex);
    String placeholder = ScenarioSimulationUtils.getPlaceHolder(selectedColumn.isInstanceAssigned(), selectedColumn.isPropertyAssigned(), factMapping.getFactMappingValueType(), factMapping.getClassName());
    context.getAbstractScesimGridModelByGridWidget(gridWidget).setCellValue(status.getRowIndex(), columnIndex, new ScenarioGridCellValue(status.getGridCellValue(), placeholder));
    context.getAbstractScesimGridModelByGridWidget(gridWidget).resetError(status.getRowIndex(), columnIndex);
}
Also used : ScenarioSimulationContext(org.drools.workbench.screens.scenariosimulation.client.commands.ScenarioSimulationContext) FactMapping(org.drools.scenariosimulation.api.model.FactMapping) AbstractScesimData(org.drools.scenariosimulation.api.model.AbstractScesimData) ScenarioGridColumn(org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn) ScenarioGridCellValue(org.drools.workbench.screens.scenariosimulation.client.values.ScenarioGridCellValue)

Aggregations

AbstractScesimData (org.drools.scenariosimulation.api.model.AbstractScesimData)6 FactMapping (org.drools.scenariosimulation.api.model.FactMapping)5 AbstractScesimModel (org.drools.scenariosimulation.api.model.AbstractScesimModel)3 ScenarioSimulationContext (org.drools.workbench.screens.scenariosimulation.client.commands.ScenarioSimulationContext)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 FactMappingType (org.drools.scenariosimulation.api.model.FactMappingType)2 FactMappingValue (org.drools.scenariosimulation.api.model.FactMappingValue)2 ScenarioSimulationModel (org.drools.scenariosimulation.api.model.ScenarioSimulationModel)2 VALUE (org.drools.scenariosimulation.api.utils.ConstantsHolder.VALUE)2 AbstractScesimGridModel (org.drools.workbench.screens.scenariosimulation.client.models.AbstractScesimGridModel)2 ScenarioGridColumn (org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ContextMenuEvent (com.google.gwt.event.dom.client.ContextMenuEvent)1 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)1 MouseWheelEvent (com.google.gwt.event.dom.client.MouseWheelEvent)1 Collections (java.util.Collections)1