Search in sources :

Example 1 with BaseHeaderMetaData

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

the class ActionWorkItemInsertFactColumnConverter method makeHeaderMetaData.

@Override
public List<GridColumn.HeaderMetaData> makeHeaderMetaData(final BaseColumn column) {
    final String workItemName = ((ActionWorkItemInsertFactCol52) column).getWorkItemName();
    return new ArrayList<GridColumn.HeaderMetaData>() {

        {
            add(new BaseHeaderMetaData(workItemName, ActionCol52.class.getName()));
            add(new BaseHeaderMetaData(column.getHeader(), workItemName + "-set"));
        }
    };
}
Also used : ActionWorkItemInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemInsertFactCol52) ArrayList(java.util.ArrayList) BaseHeaderMetaData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn)

Example 2 with BaseHeaderMetaData

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

the class ActionWorkItemSetFieldColumnConverter method makeHeaderMetaData.

@Override
public List<GridColumn.HeaderMetaData> makeHeaderMetaData(final BaseColumn column) {
    final String workItemName = ((ActionWorkItemSetFieldCol52) column).getWorkItemName();
    return new ArrayList<GridColumn.HeaderMetaData>() {

        {
            add(new BaseHeaderMetaData(workItemName, ActionCol52.class.getName()));
            add(new BaseHeaderMetaData(column.getHeader(), workItemName + "-set"));
        }
    };
}
Also used : ArrayList(java.util.ArrayList) BaseHeaderMetaData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) ActionWorkItemSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52)

Example 3 with BaseHeaderMetaData

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

the class ConditionColumnConverter method makeHeaderMetaData.

@Override
public List<GridColumn.HeaderMetaData> makeHeaderMetaData(final BaseColumn column) {
    final String patternHeader = getPatternHeader(column);
    final String conditionHeader = getConditionHeader(column);
    return new ArrayList<GridColumn.HeaderMetaData>() {

        {
            add(new BaseHeaderMetaData(patternHeader, ConditionCol52.class.getName()));
            add(new BaseHeaderMetaData(conditionHeader, patternHeader));
        }
    };
}
Also used : ArrayList(java.util.ArrayList) BaseHeaderMetaData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn)

Example 4 with BaseHeaderMetaData

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData 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);
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) Path(org.uberfire.backend.vfs.Path) 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)

Example 5 with BaseHeaderMetaData

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

Aggregations

BaseHeaderMetaData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData)18 ArrayList (java.util.ArrayList)10 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)9 Test (org.junit.Test)6 RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)5 Before (org.junit.Before)4 ExpressionEditorColumn (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn)4 List (java.util.List)3 Optional (java.util.Optional)3 BaseExpressionGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid)3 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)3 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)3 DMNGridLayer (org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer)3 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)3 LienzoMockitoTestRunner (com.ait.lienzo.test.LienzoMockitoTestRunner)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 Function (java.util.function.Function)2 IntStream (java.util.stream.IntStream)2 Assertions (org.assertj.core.api.Assertions)2