Search in sources :

Example 21 with GridData

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

the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenuWithCellSelectionManagerWithoutChangeInSelection.

@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithCellSelectionManagerWithoutChangeInSelection() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GridData uiModel = dtPresenter.getView().getModel();
    final GridColumn uiColumn = new RowNumberColumn();
    uiModel.appendColumn(uiColumn);
    when(columnInformation.getColumn()).thenReturn(uiColumn);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter);
        }
    });
    when(uiModel.getCell(any(Integer.class), any(Integer.class))).thenReturn(uiCell);
    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
    handler.onContextMenu(event);
    verify(cellSelectionStrategy, times(1)).handleSelection(eq(uiModel), eq(0), eq(0), eq(false), eq(false));
    verify(layer, never()).batch();
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) 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) ContextMenuHandler(com.google.gwt.event.dom.client.ContextMenuHandler) Test(org.junit.Test)

Example 22 with GridData

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

the class ColumnHeaderPopOverHandler method getHeaderRowsYOffset.

private double getHeaderRowsYOffset(final GridWidget gridWidget) {
    final GridData model = gridWidget.getModel();
    final int headerRowCount = model.getHeaderRowCount();
    final GridRenderer renderer = gridWidget.getRenderer();
    final double headerHeight = renderer.getHeaderHeight();
    final double headerRowHeight = renderer.getHeaderRowHeight();
    final double headerRowsHeight = headerRowHeight * headerRowCount;
    final double headerRowsYOffset = headerHeight - headerRowsHeight;
    return headerRowsYOffset;
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) GridRenderer(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)

Example 23 with GridData

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

the class GuidedDecisionTablePresenterTest method onDeleteSelectedRowsWithSelections.

@Test
public void onDeleteSelectedRowsWithSelections() throws VetoException {
    final GridData uiModel = dtPresenter.getUiModel();
    uiModel.selectCell(0, 0);
    uiModel.selectCell(2, 0);
    dtPresenter.onDeleteSelectedRows();
    verify(synchronizer, times(1)).deleteRow(eq(0));
    verify(synchronizer, times(1)).deleteRow(eq(1));
    checkDTSelectionsChangedEventFired(4);
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Test(org.junit.Test)

Example 24 with GridData

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

the class GuidedDecisionTablePresenterTest method onInsertRowBelowMultipleRowsSelected.

@Test
public void onInsertRowBelowMultipleRowsSelected() throws VetoException {
    final GridData uiModel = dtPresenter.getUiModel();
    uiModel.selectCell(0, 0);
    uiModel.selectCell(1, 0);
    dtPresenter.onInsertRowBelow();
    verify(synchronizer, never()).insertRow(any(Integer.class));
}
Also used : GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Test(org.junit.Test)

Example 25 with GridData

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

the class GuidedDecisionTablePresenterTest method onDeleteSelectedCellsWithSelectionsWithBooleanColumn.

@Test
public void onDeleteSelectedCellsWithSelectionsWithBooleanColumn() {
    final AttributeCol52 column = new AttributeCol52() {

        {
            setAttribute(RuleAttributeWidget.ENABLED_ATTR);
        }
    };
    dtPresenter.appendColumn(column);
    final GridData uiModel = dtPresenter.getUiModel();
    uiModel.selectCell(0, 1);
    uiModel.selectCell(0, 2);
    final ArgumentCaptor<Integer> columnIndexCaptor = ArgumentCaptor.forClass(Integer.class);
    final ArgumentCaptor<GridData.Range> rowRangeCaptor = ArgumentCaptor.forClass(GridData.Range.class);
    dtPresenter.onDeleteSelectedCells();
    verify(synchronizer, times(1)).deleteCell(rowRangeCaptor.capture(), columnIndexCaptor.capture());
    verify(synchronizer, never()).deleteCell(any(GridData.Range.class), eq(2));
    checkDTSelectionsChangedEventFired(3);
    final GridCell<?> booleanCell = uiModel.getCell(0, 2);
    assertNotNull(booleanCell);
    assertFalse((Boolean) booleanCell.getValue().getValue());
    final Integer columnIndex = columnIndexCaptor.getValue();
    final GridData.Range rowRange = rowRangeCaptor.getValue();
    assertEquals(0, rowRange.getMinRowIndex());
    assertEquals(0, rowRange.getMaxRowIndex());
    assertEquals(1, columnIndex.intValue());
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) 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