use of org.drools.workbench.screens.guided.dtable.client.widget.table.popovers.definitions.ColumnDefinitionBuilder 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(0).setHeader("#");
this.model.getExpandedColumns().get(1).setHeader("description");
this.uiColumn1 = new RowNumberColumn();
this.uiColumn2 = new BaseGridColumn<>(new BaseHeaderMetaData("description"), columnRenderer, 100.0);
this.uiModel = new BaseGridData() {
{
setHeaderRowCount(2);
}
};
uiModel.appendColumn(uiColumn1);
uiModel.appendColumn(uiColumn2);
serviceCaller = new CallerMock<>(service);
when(service.toSource(any(Path.class), 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());
final BaseGridRendererHelper.RenderingInformation ri = new BaseGridRendererHelper.RenderingInformation(bounds, uiModel.getColumns(), new BaseGridRendererHelper.RenderingBlockInformation(new ArrayList<GridColumn<?>>() {
{
add(uiColumn2);
}
}, 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.<Double>emptyList(), false, false, 0, 2, 0);
when(rendererHelper.getRenderingInformation()).thenReturn(ri);
final ColumnHeaderPopOver wrapped = new ColumnHeaderPopOverImpl(view, columnDefinitionFactory);
this.popOver = spy(wrapped);
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.popovers.definitions.ColumnDefinitionBuilder in project drools-wb by kiegroup.
the class ColumnHeaderPopOverImplTest method makeBuildersInstance.
private Instance<ColumnDefinitionBuilder> makeBuildersInstance() {
final List<ColumnDefinitionBuilder> builders = new ArrayList<>();
builders.add(new ConditionCol52DefinitionBuilder(serviceCaller));
builders.add(new ColumnDefinitionBuilder() {
@Override
public Class getSupportedColumnType() {
return RowNumberCol52.class;
}
@Override
public void generateDefinition(final GuidedDecisionTableView.Presenter dtPresenter, final BaseColumn column, final Callback<String> afterGenerationCallback) {
afterGenerationCallback.callback(column.getHeader());
}
});
builders.add(new ColumnDefinitionBuilder() {
@Override
public Class getSupportedColumnType() {
return DescriptionCol52.class;
}
@Override
public void generateDefinition(final GuidedDecisionTableView.Presenter dtPresenter, final BaseColumn column, final Callback<String> afterGenerationCallback) {
afterGenerationCallback.callback(column.getHeader());
}
});
return new MockInstanceImpl<>(builders);
}
Aggregations