use of org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn in project drools-wb by kiegroup.
the class AbstractSelectedColumnCommandTest method insertNewColumnCommon.
protected void insertNewColumnCommon(int columnIndex, boolean cloneInstance) {
int instanceNum = simulationDescriptorMock.getUnmodifiableFactMappings().size();
ScenarioGridColumn createdColumn = ((AbstractSelectedColumnCommand) commandSpy).insertNewColumn(scenarioSimulationContextLocal, gridColumnMock, columnIndex, cloneInstance);
String columnGroup = gridColumnMock.getInformationHeaderMetaData().getColumnGroup();
String originalInstanceTitle = gridColumnMock.getInformationHeaderMetaData().getTitle();
String instanceTitle = cloneInstance ? originalInstanceTitle : "INSTANCE " + instanceNum;
String propertyTitle = "PROPERTY " + instanceNum;
final FactMappingType factMappingType = FactMappingType.valueOf(columnGroup.toUpperCase());
verify(commandSpy, times(1)).getScenarioGridColumnLocal(eq(instanceTitle), eq(propertyTitle), anyString(), eq(columnGroup), eq(factMappingType), eq(scenarioHeaderTextBoxSingletonDOMElementFactorySpy), eq(scenarioCellTextAreaSingletonDOMElementFactorySpy), eq(ScenarioSimulationEditorConstants.INSTANCE.defineValidType()));
if (cloneInstance) {
verify(createdColumn, times(1)).setFactIdentifier(eq(gridColumnMock.getFactIdentifier()));
} else {
verify(createdColumn, never()).setFactIdentifier(any());
}
verify(createdColumn, times(1)).setInstanceAssigned(eq(cloneInstance));
verify(scenarioGridModelMock, times(1)).insertColumn(COLUMN_INDEX, createdColumn);
}
use of org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn in project drools-wb by kiegroup.
the class ScenarioSimulationEventHandler method onEvent.
@Override
public void onEvent(SetInstanceHeaderEvent event) {
if (context.getAbstractScesimGridModelByGridWidget(event.getGridWidget()).isSameInstanceType(event.getClassName())) {
return;
}
context.getStatus().setFullPackage(event.getFullPackage());
context.getStatus().setClassName(event.getClassName());
if (((ScenarioGridColumn) context.getAbstractScesimGridModelByGridWidget(event.getGridWidget()).getSelectedColumn()).isInstanceAssigned()) {
org.uberfire.mvp.Command okPreserveCommand = () -> commonExecution(new SetInstanceHeaderCommand(event.getGridWidget()), true);
deletePopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.changeTypeMainTitle(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeMainQuestion(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeText1(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeTextQuestion(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeTextDanger(), ScenarioSimulationEditorConstants.INSTANCE.changeType(), okPreserveCommand);
} else {
commonExecution(new SetInstanceHeaderCommand(event.getGridWidget()), true);
}
}
use of org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn in project drools-wb by kiegroup.
the class ScenarioSimulationEventHandler method onEvent.
@Override
public void onEvent(DuplicateInstanceEvent event) {
context.getStatus().setColumnId(String.valueOf(new Date().getTime()));
context.getStatus().setColumnIndex(event.getColumnIndex());
context.getStatus().setRight(true);
context.getStatus().setAsProperty(false);
context.getStatus().setFullPackage(((ScenarioGridColumn) context.getAbstractScesimGridModelByGridWidget(event.getGridWidget()).getSelectedColumn()).getFactIdentifier().getPackageWithoutClassName());
commonExecution(new DuplicateInstanceCommand(event.getGridWidget()), true);
}
use of org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn in project drools-wb by kiegroup.
the class ScenarioSimulationUtilsTest method getScenarioGridColumn2.
@Test
public void getScenarioGridColumn2() {
final ScenarioGridColumn retrieved = ScenarioSimulationUtils.getScenarioGridColumn(COLUMN_INSTANCE_TITLE_FIRST, COLUMN_PROPERTY_TITLE_FIRST, COLUMN_ID, COLUMN_GROUP_FIRST, factMappingType, scenarioHeaderTextBoxSingletonDOMElementFactoryMock, scenarioCellTextAreaSingletonDOMElementFactoryMock, PLACEHOLDER);
assertNotNull(retrieved);
}
use of org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn in project drools-wb by kiegroup.
the class ScenarioSimulationUtilsTest method getScenarioGridColumn4.
@Test
public void getScenarioGridColumn4() {
final ScenarioGridColumn retrieved = ScenarioSimulationUtils.getScenarioGridColumn(headerBuilderMock, scenarioCellTextAreaSingletonDOMElementFactoryMock, PLACEHOLDER);
assertNotNull(retrieved);
}
Aggregations