Search in sources :

Example 1 with SetHeaderCellValueEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.SetHeaderCellValueEvent in project drools-wb by kiegroup.

the class ScenarioHeaderTextAreaDOMElement method internalFlush.

@Override
protected void internalFlush(final String value) {
    final int rowIndex = context.getRowIndex();
    final int columnIndex = context.getColumnIndex();
    try {
        boolean isInstanceHeader = scenarioHeaderMetaData != null && Objects.equals(scenarioHeaderMetaData.getMetadataType(), ScenarioHeaderMetaData.MetadataType.INSTANCE);
        boolean isPropertyHeader = scenarioHeaderMetaData != null && Objects.equals(scenarioHeaderMetaData.getMetadataType(), ScenarioHeaderMetaData.MetadataType.PROPERTY);
        ((ScenarioGrid) gridWidget).getEventBus().fireEvent(new SetHeaderCellValueEvent(((ScenarioGrid) gridWidget).getGridWidget(), rowIndex, columnIndex, value, isInstanceHeader, isPropertyHeader));
        ((ScenarioGrid) gridWidget).getEventBus().fireEvent(new ReloadTestToolsEvent(true));
    } catch (Exception e) {
        throw new IllegalArgumentException(new StringBuilder().append("Impossible to update header (").append(rowIndex).append(") of column ").append(columnIndex).toString(), e);
    }
}
Also used : ReloadTestToolsEvent(org.drools.workbench.screens.scenariosimulation.client.events.ReloadTestToolsEvent) ScenarioGrid(org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGrid) SetHeaderCellValueEvent(org.drools.workbench.screens.scenariosimulation.client.events.SetHeaderCellValueEvent)

Example 2 with SetHeaderCellValueEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.SetHeaderCellValueEvent in project drools-wb by kiegroup.

the class ScenarioSimulationEventHandlerTest method onSetHeaderCellValueEventInstanceHeader.

@Test
public void onSetHeaderCellValueEventInstanceHeader() {
    SetHeaderCellValueEvent event = new SetHeaderCellValueEvent(GridWidget.SIMULATION, ROW_INDEX, COLUMN_INDEX, MULTIPART_VALUE, true, false);
    scenarioSimulationEventHandler.onEvent(event);
    verify(scenarioSimulationEventHandler).commonExecution(isA(SetHeaderCellValueCommand.class), eq(false));
}
Also used : SetHeaderCellValueCommand(org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.SetHeaderCellValueCommand) SetHeaderCellValueEvent(org.drools.workbench.screens.scenariosimulation.client.events.SetHeaderCellValueEvent) Test(org.junit.Test) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)

Example 3 with SetHeaderCellValueEvent

use of org.drools.workbench.screens.scenariosimulation.client.events.SetHeaderCellValueEvent in project drools-wb by kiegroup.

the class ScenarioSimulationEventHandlerTest method onSetHeaderCellValueEventPropertyHeader.

@Test
public void onSetHeaderCellValueEventPropertyHeader() {
    SetHeaderCellValueEvent event = new SetHeaderCellValueEvent(GridWidget.SIMULATION, ROW_INDEX, COLUMN_INDEX, MULTIPART_VALUE, false, true);
    scenarioSimulationEventHandler.onEvent(event);
    verify(scenarioSimulationEventHandler).commonExecution(isA(SetHeaderCellValueCommand.class), eq(false));
}
Also used : SetHeaderCellValueCommand(org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.SetHeaderCellValueCommand) SetHeaderCellValueEvent(org.drools.workbench.screens.scenariosimulation.client.events.SetHeaderCellValueEvent) Test(org.junit.Test) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)

Aggregations

SetHeaderCellValueEvent (org.drools.workbench.screens.scenariosimulation.client.events.SetHeaderCellValueEvent)3 AbstractScenarioSimulationTest (org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)2 SetHeaderCellValueCommand (org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.SetHeaderCellValueCommand)2 Test (org.junit.Test)2 ReloadTestToolsEvent (org.drools.workbench.screens.scenariosimulation.client.events.ReloadTestToolsEvent)1 ScenarioGrid (org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGrid)1