Search in sources :

Example 16 with GridData

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

the class GuidedDecisionTablePresenterTest method onDeleteSelectedColumnsWithSelections.

@Test
public void onDeleteSelectedColumnsWithSelections() throws VetoException {
    final AttributeCol52 column = new AttributeCol52() {

        {
            setAttribute("attribute1");
        }
    };
    dtPresenter.appendColumn(column);
    final GridData uiModel = dtPresenter.getUiModel();
    uiModel.selectCell(0, 2);
    dtPresenter.onDeleteSelectedColumns();
    verify(synchronizer, times(1)).deleteColumn(eq(column));
    checkDTSelectionsChangedEventFired(2);
}
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)

Example 17 with GridData

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

the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenu_CellContextMenu.

@Test
@SuppressWarnings("unchecked")
public void onContextMenu_CellContextMenu() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GridData uiModel = dtPresenter.getView().getModel();
    final GridColumn uiColumn = new BaseGridColumn(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100.0);
    uiModel.appendColumn(uiColumn);
    when(columnInformation.getColumn()).thenReturn(uiColumn);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter);
        }
    });
    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
    handler.onContextMenu(event);
    verify(rowContextMenu, never()).show(any(Integer.class), any(Integer.class));
    verify(cellContextMenu, times(1)).show(any(Integer.class), any(Integer.class));
}
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)

Example 18 with GridData

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

the class GuidedDecisionTableModellerContextMenuSupportTest method testContextMenuCellIsSelectedCell.

@Test
@SuppressWarnings("unchecked")
public void testContextMenuCellIsSelectedCell() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GridData uiModel = dtPresenter.getView().getModel();
    final GridColumn uiColumn = new RowNumberColumn();
    uiModel.appendColumn(uiColumn);
    // Cell associated with Mock onContextMenu Event has indices (0,0)
    uiModel.selectCells(0, 0, 1, 1);
    when(columnInformation.getColumn()).thenReturn(uiColumn);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter);
        }
    });
    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
    handler.onContextMenu(event);
    // this method is called if the handler does a selectCell, which should not occur for this test case
    verify(cellSelectionStrategy, never()).handleSelection(any(GridData.class), any(Integer.class), any(Integer.class), any(Boolean.class), any(Boolean.class));
    verify(rowContextMenu, times(1)).show(any(Integer.class), any(Integer.class));
    verify(cellContextMenu, never()).show(any(Integer.class), any(Integer.class));
}
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 19 with GridData

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

the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenu_RowContextMenu.

@Test
@SuppressWarnings("unchecked")
public void onContextMenu_RowContextMenu() {
    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);
        }
    });
    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
    handler.onContextMenu(event);
    verify(rowContextMenu, times(1)).show(any(Integer.class), any(Integer.class));
    verify(cellContextMenu, never()).show(any(Integer.class), any(Integer.class));
}
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 20 with GridData

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

the class GuidedDecisionTableModellerContextMenuSupportTest method onContextMenuWithoutCellSelectionManager.

@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithoutCellSelectionManager() {
    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);
        }
    });
    final GridCell uiCell = mock(GridCell.class);
    when(uiModel.getCell(any(Integer.class), any(Integer.class))).thenReturn(uiCell);
    when(uiCell.getSelectionStrategy()).thenReturn(null);
    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);
    handler.onContextMenu(event);
    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) GridCell(org.uberfire.ext.wires.core.grids.client.model.GridCell) 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