Search in sources :

Example 1 with GridData

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

the class DeleteAndEditCell method perform.

@Override
public boolean perform(final GridWidget gridWidget, final boolean isShiftKeyDown, final boolean isControlKeyDown) {
    final GridData gridModel = gridWidget.getModel();
    final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
    if (origin == null) {
        return false;
    }
    if (!(gridWidget instanceof GuidedDecisionTableView)) {
        return false;
    }
    final GuidedDecisionTableView view = (GuidedDecisionTableView) gridWidget;
    final GuidedDecisionTableView.Presenter dtPresenter = view.getPresenter();
    dtPresenter.onDeleteSelectedCells();
    return super.perform(gridWidget, isShiftKeyDown, isControlKeyDown);
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)

Example 2 with GridData

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

the class GotoEndOfRow method selectRightMostCell.

protected boolean selectRightMostCell(final GridWidget gridWidget) {
    final GridData gridModel = gridWidget.getModel();
    final int rowCount = gridModel.getRowCount();
    final int columnCount = gridModel.getColumnCount();
    if (rowCount == 0 || columnCount == 0) {
        return false;
    }
    final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
    if (origin == null) {
        return false;
    }
    return gridWidget.selectCell(origin.getRowIndex(), columnCount - 1, false, false);
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData)

Example 3 with GridData

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

the class SelectionCut method perform.

@Override
public boolean perform(final GridWidget gridWidget, final boolean isShiftKeyDown, final boolean isControlKeyDown) {
    final GridData gridModel = gridWidget.getModel();
    final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
    if (origin == null) {
        return false;
    }
    if (!(gridWidget instanceof GuidedDecisionTableView)) {
        return false;
    }
    final GuidedDecisionTableView view = (GuidedDecisionTableView) gridWidget;
    final GuidedDecisionTableView.Presenter dtPresenter = view.getPresenter();
    dtPresenter.onCut();
    return false;
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)

Example 4 with GridData

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

the class SelectionPaste method perform.

@Override
public boolean perform(final GridWidget gridWidget, final boolean isShiftKeyDown, final boolean isControlKeyDown) {
    final GridData gridModel = gridWidget.getModel();
    final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
    if (origin == null) {
        return false;
    }
    if (!(gridWidget instanceof GuidedDecisionTableView)) {
        return false;
    }
    final GuidedDecisionTableView view = (GuidedDecisionTableView) gridWidget;
    final GuidedDecisionTableView.Presenter dtPresenter = view.getPresenter();
    dtPresenter.onPaste();
    return false;
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)

Example 5 with GridData

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

the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenuWithMultipleTables.

@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithMultipleTables() {
    final GuidedDecisionTableView.Presenter dtPresenter1 = makeDecisionTable(0, 0);
    final GuidedDecisionTableView.Presenter dtPresenter2 = makeDecisionTable(200, 200);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter1);
            add(dtPresenter2);
        }
    });
    final GridData uiModel1 = dtPresenter1.getView().getModel();
    final GridData uiModel2 = dtPresenter2.getView().getModel();
    final GridColumn uiColumn = new BaseGridColumn(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100.0);
    uiModel1.appendColumn(uiColumn);
    uiModel2.appendColumn(uiColumn);
    when(uiModel1.getCell(any(Integer.class), any(Integer.class))).thenReturn(uiCell);
    when(uiModel2.getCell(any(Integer.class), any(Integer.class))).thenReturn(uiCell);
    when(columnInformation.getColumn()).thenReturn(uiColumn);
    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
    when(nativeEvent.getClientX()).thenReturn(50);
    when(nativeEvent.getClientY()).thenReturn(50);
    handler.onContextMenu(event);
    verify(cellSelectionStrategy, times(1)).handleSelection(uiModelCaptor.capture(), any(Integer.class), any(Integer.class), any(Boolean.class), any(Boolean.class));
    assertEquals(uiModel1, uiModelCaptor.getValue());
    when(nativeEvent.getClientX()).thenReturn(250);
    when(nativeEvent.getClientY()).thenReturn(250);
    handler.onContextMenu(event);
    verify(cellSelectionStrategy, times(2)).handleSelection(uiModelCaptor.capture(), any(Integer.class), any(Integer.class), any(Boolean.class), any(Boolean.class));
    assertEquals(uiModel2, uiModelCaptor.getValue());
}
Also used : GridColumnRenderer(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) ContextMenuHandler(com.google.gwt.event.dom.client.ContextMenuHandler) Test(org.junit.Test)

Aggregations

GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)30 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)22 Test (org.junit.Test)19 ContextMenuHandler (com.google.gwt.event.dom.client.ContextMenuHandler)8 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)8 BaseGridColumn (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn)8 RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)6 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)5 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)3 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)2 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)2 GridColumnRenderer (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer)2 GridRenderer (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)2 Point2D (com.ait.lienzo.client.core.types.Point2D)1 HashSet (java.util.HashSet)1 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)1 BaseGridRendererHelper (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper)1