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);
}
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));
}
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));
}
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));
}
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();
}
Aggregations