Search in sources :

Example 1 with BaseGridColumn

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn 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)

Example 2 with BaseGridColumn

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

the class CellContextMenuTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    model = new GuidedDecisionTable52();
    uiModel = new GuidedDecisionTableUiModel(mock(ModelSynchronizer.class));
    clipboard = new DefaultClipboard();
    when(dtPresenter.getView()).thenReturn(dtPresenterView);
    when(dtPresenter.getModel()).thenReturn(model);
    when(dtPresenter.getAccess()).thenReturn(access);
    when(dtPresenterView.getModel()).thenReturn(uiModel);
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendRow(new BaseGridRow());
    menu = spy(new CellContextMenu(view, clipboard));
    menu.setup();
}
Also used : DefaultClipboard(org.drools.workbench.screens.guided.dtable.client.editor.clipboard.impl.DefaultClipboard) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) GuidedDecisionTableUiModel(org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) Before(org.junit.Before)

Example 3 with BaseGridColumn

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

the class ColumnHeaderPopOverImplTest method showColumnServiceInvocation.

@Test
public void showColumnServiceInvocation() {
    final Pattern52 p = new Pattern52();
    p.getChildColumns().add(new ConditionCol52());
    this.model.getConditions().add(p);
    final BaseGridColumn<String> uiColumn3 = new BaseGridColumn<>(new BaseHeaderMetaData("condition"), columnRenderer, 100.0);
    uiModel.appendColumn(uiColumn3);
    when(transform.getScaleX()).thenReturn(1.0);
    when(transform.getScaleY()).thenReturn(1.0);
    popOver.show(modellerView, dtPresenter, 2);
    verify(view, times(1)).show(contentProviderArgumentCaptor.capture());
    popOver.show(modellerView, dtPresenter, 2);
    verify(view, times(2)).show(contentProviderArgumentCaptor.capture());
    // Emulate Timer execution
    final PopOverView.ContentProvider contentProvider = contentProviderArgumentCaptor.getValue();
    contentProvider.getContent((PopOverView.Content content) -> {
        assertEquals("source", content.getContent());
    });
    verify(service, times(1)).toSource(any(Path.class), any(GuidedDecisionTable52.class));
}
Also used : Path(org.uberfire.backend.vfs.Path) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) BaseHeaderMetaData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) Test(org.junit.Test)

Example 4 with BaseGridColumn

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn 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 5 with BaseGridColumn

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

the class RowContextMenuTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    model = new GuidedDecisionTable52();
    uiModel = new GuidedDecisionTableUiModel(mock(ModelSynchronizer.class));
    clipboard = new DefaultClipboard();
    when(dtPresenter.getView()).thenReturn(dtPresenterView);
    when(dtPresenter.getModel()).thenReturn(model);
    when(dtPresenter.getAccess()).thenReturn(access);
    when(dtPresenterView.getModel()).thenReturn(uiModel);
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendColumn(new BaseGridColumn<String>(mock(GridColumn.HeaderMetaData.class), mock(GridColumnRenderer.class), 100));
    uiModel.appendRow(new BaseGridRow());
    menu = spy(new RowContextMenu(view, clipboard));
    menu.setup();
}
Also used : DefaultClipboard(org.drools.workbench.screens.guided.dtable.client.editor.clipboard.impl.DefaultClipboard) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) GuidedDecisionTableUiModel(org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel) BaseGridColumn(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) Before(org.junit.Before)

Aggregations

BaseGridColumn (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn)5 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)4 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)3 Test (org.junit.Test)3 ContextMenuHandler (com.google.gwt.event.dom.client.ContextMenuHandler)2 DefaultClipboard (org.drools.workbench.screens.guided.dtable.client.editor.clipboard.impl.DefaultClipboard)2 GuidedDecisionTableUiModel (org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiModel)2 Before (org.junit.Before)2 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)2 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)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 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)1 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)1 Path (org.uberfire.backend.vfs.Path)1 BaseHeaderMetaData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData)1