Search in sources :

Example 1 with GridCellEditAction

use of org.uberfire.ext.wires.core.grids.client.model.GridCellEditAction in project kie-wb-common by kiegroup.

the class DelegatingGridWidgetEditCellMouseEventHandler method delegatedHandleBodyCell.

private boolean delegatedHandleBodyCell(final GridWidget gridWidget, final Point2D relativeLocation, final int uiRowIndex, final int uiColumnIndex, final AbstractNodeMouseEvent event) {
    final GridCellTuple parent = parentSupplier.get();
    final GridWidget parentGridWidget = parent.getGridWidget();
    final GridData parentGridData = parentGridWidget.getModel();
    if (parentGridData.getSelectedCells().size() == 1) {
        final GridData gridData = gridWidget.getModel();
        final GridCell<?> cell = gridData.getCell(uiRowIndex, uiColumnIndex);
        final GridCellEditAction cellEditAction = cell == null ? GridCell.DEFAULT_EDIT_ACTION : cell.getSupportedEditAction();
        if (isEventHandled(cellEditAction, event)) {
            return gridWidget.startEditingCell(relativeLocation);
        }
    }
    return false;
}
Also used : GridCellEditAction(org.uberfire.ext.wires.core.grids.client.model.GridCellEditAction) GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData)

Example 2 with GridCellEditAction

use of org.uberfire.ext.wires.core.grids.client.model.GridCellEditAction in project drools-wb by kiegroup.

the class ScenarioSimulationGridWidgetMouseEventHandler method handleBodyCell.

/**
 * Checks if a {@link AbstractNodeMouseEvent} happened within a {@link GridCell}. If the
 * {@link AbstractNodeMouseEvent} is found to have happened within a cell, the {@link GridCell#getSupportedEditAction()}
 * is checked to {@link Object#equals(Object)} that for the {@link AbstractNodeMouseEvent}. If they equal then the
 * {@link GridCell} is put into "edit" mode via {@link GridWidget#startEditingCell(Point2D)}.
 */
@Override
public boolean handleBodyCell(final GridWidget gridWidget, final Point2D relativeLocation, final int uiRowIndex, final int uiColumnIndex, final AbstractNodeMouseEvent event) {
    final GridData gridData = gridWidget.getModel();
    if (gridData.getSelectedCells().size() == 1) {
        final GridCell<?> cell = gridData.getCell(uiRowIndex, uiColumnIndex);
        final GridCellEditAction cellEditAction = cell == null ? GridCell.DEFAULT_EDIT_ACTION : cell.getSupportedEditAction();
        if (editSupportedLocal(cellEditAction, event)) {
            ScenarioGridColumn scenarioGridColumn = (ScenarioGridColumn) gridWidget.getModel().getColumns().get(uiColumnIndex);
            return startEditLocal((ScenarioGrid) gridWidget, uiColumnIndex, scenarioGridColumn, uiRowIndex, false);
        }
    }
    return false;
}
Also used : GridCellEditAction(org.uberfire.ext.wires.core.grids.client.model.GridCellEditAction) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) ScenarioGridColumn(org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn)

Aggregations

GridCellEditAction (org.uberfire.ext.wires.core.grids.client.model.GridCellEditAction)2 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)2 ScenarioGridColumn (org.drools.workbench.screens.scenariosimulation.client.widgets.ScenarioGridColumn)1 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)1 GridWidget (org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget)1