Search in sources :

Example 1 with DisableTestToolsEvent

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

the class ScenarioSimulationEventHandlerTest method onDisableTestToolsEvent.

@Test
public void onDisableTestToolsEvent() {
    DisableTestToolsEvent event = new DisableTestToolsEvent();
    scenarioSimulationEventHandler.onEvent(event);
    verify(scenarioSimulationEventHandler).commonExecution(isA(DisableTestToolsCommand.class), eq(false));
}
Also used : DisableTestToolsEvent(org.drools.workbench.screens.scenariosimulation.client.events.DisableTestToolsEvent) DisableTestToolsCommand(org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.DisableTestToolsCommand) Test(org.junit.Test) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)

Example 2 with DisableTestToolsEvent

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

the class ScenarioSimulationMainGridPanelClickHandler method manageBodyCoordinates.

/**
 * This method check if the click happened on an column of a <b>grid row</b>. If it is so, select the cell,
 * otherwise returns <code>false</code>
 * @param uiRowIndex
 * @param uiColumnIndex
 * @return
 */
@Override
protected boolean manageBodyCoordinates(Integer uiRowIndex, Integer uiColumnIndex) {
    final GridCell<?> cell = scenarioGrid.getModel().getCell(uiRowIndex, uiColumnIndex);
    if (cell == null) {
        return false;
    } else {
        scenarioGrid.getModel().selectCell(uiRowIndex, uiColumnIndex);
        eventBus.fireEvent(new DisableTestToolsEvent());
        return true;
    }
}
Also used : DisableTestToolsEvent(org.drools.workbench.screens.scenariosimulation.client.events.DisableTestToolsEvent)

Example 3 with DisableTestToolsEvent

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

the class ScenarioSimulationMainGridPanelClickHandler method onClick.

@Override
public void onClick(ClickEvent event) {
    clickReceived.getAndIncrement();
    final int canvasX = getRelativeXOfEvent(event);
    final int canvasY = getRelativeYOfEvent(event);
    scenarioContextMenuRegistry.hideMenus();
    scenarioContextMenuRegistry.hideErrorReportPopover();
    if (!manageCoordinates(canvasX, canvasY)) {
        // It was not a grid click
        eventBus.fireEvent(new DisableTestToolsEvent());
    }
}
Also used : DisableTestToolsEvent(org.drools.workbench.screens.scenariosimulation.client.events.DisableTestToolsEvent)

Example 4 with DisableTestToolsEvent

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

the class ScenarioGrid method signalTestTools.

protected void signalTestTools() {
    eventBus.fireEvent(new DisableTestToolsEvent());
    if (!model.getSelectedHeaderCells().isEmpty()) {
        final GridData.SelectedCell cell = model.getSelectedHeaderCells().get(0);
        final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(model.getColumns(), cell.getColumnIndex());
        final int uiRowIndex = cell.getRowIndex();
        setSelectedColumn(uiColumnIndex);
        final GridColumn column = model.getColumns().get(uiColumnIndex);
        if (uiRowIndex > 0 && column instanceof ScenarioGridColumn) {
            signalTestToolsHeaderCellSelected((ScenarioGridColumn) column, cell, uiColumnIndex);
        }
    }
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) DisableTestToolsEvent(org.drools.workbench.screens.scenariosimulation.client.events.DisableTestToolsEvent) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn)

Aggregations

DisableTestToolsEvent (org.drools.workbench.screens.scenariosimulation.client.events.DisableTestToolsEvent)4 AbstractScenarioSimulationTest (org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)1 DisableTestToolsCommand (org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.DisableTestToolsCommand)1 Test (org.junit.Test)1 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)1 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)1