Search in sources :

Example 1 with ColumnDefinitionFactory

use of org.drools.workbench.screens.guided.dtable.client.widget.table.popovers.definitions.ColumnDefinitionFactory in project drools-wb by kiegroup.

the class ColumnHeaderPopOverImplTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.model = new GuidedDecisionTable52();
    this.model.getExpandedColumns().get(GuidedDecisionTable52.RULE_NUMBER_INDEX).setHeader("#");
    this.model.getExpandedColumns().get(GuidedDecisionTable52.RULE_NAME_COLUMN_INDEX).setHeader("");
    this.model.getExpandedColumns().get(GuidedDecisionTable52.RULE_DESCRIPTION_INDEX).setHeader("description");
    this.uiColumn1 = new RowNumberColumn();
    this.uiColumn2 = new BaseGridColumn<>(new BaseHeaderMetaData("rule name"), columnRenderer, 100.0);
    this.uiColumn3 = new BaseGridColumn<>(new BaseHeaderMetaData("description"), columnRenderer, 100.0);
    this.uiModel = new BaseGridData() {

        {
            setHeaderRowCount(2);
        }
    };
    uiModel.appendColumn(uiColumn1);
    uiModel.appendColumn(uiColumn2);
    uiModel.appendColumn(uiColumn3);
    serviceCaller = new CallerMock<>(service);
    when(service.toSource(any(), any(GuidedDecisionTable52.class))).thenReturn("source");
    final Instance<ColumnDefinitionBuilder> buildersInstance = makeBuildersInstance();
    final ColumnDefinitionFactory columnDefinitionFactory = new ColumnDefinitionFactory(buildersInstance);
    when(renderer.getHeaderHeight()).thenReturn(64.0);
    when(renderer.getHeaderRowHeight()).thenReturn(32.0);
    when(dtPresenter.getView()).thenReturn(gridWidget);
    when(dtPresenter.getModel()).thenReturn(model);
    when(dtPresenter.getDataModelOracle()).thenReturn(dmo);
    when(modellerView.getGridLayerView()).thenReturn(gridLayer);
    when(gridLayer.getDomElementContainer()).thenReturn(domElementContainer);
    when(gridLayer.getVisibleBounds()).thenReturn(bounds);
    when(gridLayer.getViewport()).thenReturn(viewport);
    when(gridWidget.getModel()).thenReturn(uiModel);
    when(gridWidget.getViewport()).thenReturn(viewport);
    when(gridWidget.getRenderer()).thenReturn(renderer);
    when(gridWidget.getRendererHelper()).thenReturn(rendererHelper);
    when(gridWidget.getWidth()).thenReturn(150.0);
    when(gridWidget.getHeight()).thenReturn(64.0);
    when(gridWidget.getX()).thenReturn(50.0);
    when(gridWidget.getY()).thenReturn(50.0);
    when(domElementContainer.getAbsoluteLeft()).thenReturn(200);
    when(viewport.getTransform()).thenReturn(transform);
    when(rendererHelper.getColumnOffset(uiColumn1)).thenReturn(0.0);
    when(rendererHelper.getColumnOffset(uiColumn2)).thenReturn(uiColumn1.getWidth());
    when(rendererHelper.getColumnOffset(uiColumn3)).thenReturn(uiColumn1.getWidth());
    final BaseGridRendererHelper.RenderingInformation ri = new BaseGridRendererHelper.RenderingInformation(bounds, uiModel.getColumns(), new BaseGridRendererHelper.RenderingBlockInformation(new ArrayList<GridColumn<?>>() {

        {
            add(uiColumn3);
        }
    }, 0.0, 0.0, 0.0, 100.0), new BaseGridRendererHelper.RenderingBlockInformation(new ArrayList<GridColumn<?>>() {

        {
            add(uiColumn1);
        }
    }, 25.0, 0.0, 0.0, 50.0), 0, 0, Collections.emptyList(), Collections.emptyList(), false, false, 2, 0, 0, 0);
    when(rendererHelper.getRenderingInformation()).thenReturn(ri);
    final ColumnHeaderPopOver wrapped = new ColumnHeaderPopOverImpl(view, columnDefinitionFactory);
    this.popOver = spy(wrapped);
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) ColumnDefinitionBuilder(org.drools.workbench.screens.guided.dtable.client.widget.table.popovers.definitions.ColumnDefinitionBuilder) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ArrayList(java.util.ArrayList) BaseHeaderMetaData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData) ColumnDefinitionFactory(org.drools.workbench.screens.guided.dtable.client.widget.table.popovers.definitions.ColumnDefinitionFactory) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) BaseGridRendererHelper(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper) Before(org.junit.Before)

Aggregations

ArrayList (java.util.ArrayList)1 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)1 ColumnDefinitionBuilder (org.drools.workbench.screens.guided.dtable.client.widget.table.popovers.definitions.ColumnDefinitionBuilder)1 ColumnDefinitionFactory (org.drools.workbench.screens.guided.dtable.client.widget.table.popovers.definitions.ColumnDefinitionFactory)1 Before (org.junit.Before)1 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)1 BaseHeaderMetaData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData)1 RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)1 BaseGridRendererHelper (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper)1