Search in sources :

Example 1 with BaseGridData

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

the class GuidedDecisionTableModellerContextMenuSupportTest method makeDecisionTable.

private GuidedDecisionTableView.Presenter makeDecisionTable(final double x, final double y) {
    final GridData uiModel = spy(new BaseGridData());
    final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
    final GuidedDecisionTableView dtView = mock(GuidedDecisionTableView.class);
    final GridRenderer renderer = mock(GridRenderer.class);
    final BaseGridRendererHelper helper = mock(BaseGridRendererHelper.class);
    uiModel.appendRow(new BaseGridRow());
    when(dtPresenter.getView()).thenReturn(dtView);
    when(dtPresenter.getAccess()).thenReturn(mock(GuidedDecisionTablePresenter.Access.class));
    when(dtPresenter.getModel()).thenReturn(mock(GuidedDecisionTable52.class));
    when(dtView.getViewport()).thenReturn(viewport);
    when(dtView.getLayer()).thenReturn(layer);
    when(dtView.getLocation()).thenReturn(new Point2D(x, y));
    when(dtView.getAbsoluteX()).thenReturn(x);
    when(dtView.getAbsoluteY()).thenReturn(y);
    when(dtView.getWidth()).thenReturn(50.0);
    when(dtView.getHeight()).thenReturn(52.0);
    when(dtView.getModel()).thenReturn(uiModel);
    when(dtView.getRenderer()).thenReturn(renderer);
    when(renderer.getHeaderHeight()).thenReturn(32.0);
    when(dtView.getRendererHelper()).thenReturn(helper);
    when(helper.getColumnInformation(any(Double.class))).thenReturn(columnInformation);
    return dtPresenter;
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Point2D(com.ait.lienzo.client.core.types.Point2D) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) GridRenderer(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer) BaseGridRendererHelper(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper)

Example 2 with BaseGridData

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

the class GuidedDecisionTableModellerPresenterTest method makeDecisionTable.

private GuidedDecisionTableView.Presenter makeDecisionTable() {
    final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
    final GuidedDecisionTableView dtView = mock(GuidedDecisionTableView.class);
    final GridData dtData = new BaseGridData();
    when(dtPresenter.getView()).thenReturn(dtView);
    when(dtPresenter.getAccess()).thenReturn(mock(GuidedDecisionTablePresenter.Access.class));
    when(dtPresenter.getModel()).thenReturn(mock(GuidedDecisionTable52.class));
    when(dtView.getModel()).thenReturn(dtData);
    return dtPresenter;
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)

Example 3 with BaseGridData

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

the class ListBoxSingletonDOMElementFactoryTest method setup.

@Before
public void setup() {
    when(listBox.getElement()).thenReturn(listBoxElement);
    when(listBoxElement.getStyle()).thenReturn(mock(Style.class));
    when(domElementContainer.iterator()).thenReturn(Collections.<Widget>emptyList().iterator());
    when(gridLayer.getDomElementContainer()).thenReturn(domElementContainer);
    when(gridWidget.getModel()).thenReturn(new BaseGridData());
    doAnswer((i) -> {
        final PrioritizedCommand command = (PrioritizedCommand) i.getArguments()[0];
        command.execute();
        return null;
    }).when(gridLayer).batch(any(PrioritizedCommand.class));
    factory = spy(new ListBoxSingletonDOMElementFactoryMock(gridLienzoPanel, gridLayer, gridWidget));
}
Also used : PrioritizedCommand(org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLayerRedrawManager.PrioritizedCommand) Widget(com.google.gwt.user.client.ui.Widget) Style(com.google.gwt.dom.client.Style) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 4 with BaseGridData

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

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project kie-wb-common by kiegroup.

the class AddContextEntryCommandTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.context = new Context();
    this.contextEntry = new ContextEntry() {

        {
            setVariable(new InformationItem() {

                {
                    setName(new Name("variable"));
                }
            });
        }
    };
    this.defaultResultContextEntry = new ContextEntry();
    this.context.getContextEntry().add(defaultResultContextEntry);
    this.uiModel = new BaseGridData();
    this.uiModelRow = new DMNGridRow();
    this.uiDefaultResultModelRow = new DMNGridRow();
    this.uiModel.appendRow(uiDefaultResultModelRow);
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModel.appendColumn(uiNameColumn);
    this.uiModel.appendColumn(uiExpressionEditorColumn);
    doReturn(uiModel).when(gridWidget).getModel();
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiNameColumn).getIndex();
    doReturn(2).when(uiExpressionEditorColumn).getIndex();
    this.uiModel.setCellValue(0, 2, new ExpressionCellValue(Optional.of(undefinedExpressionEditor)));
    final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
    expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
    doReturn(parent).when(undefinedExpressionEditor).getParentInformation();
    doReturn(Optional.empty()).when(undefinedExpressionEditorDefinition).getModelClass();
    doReturn(Optional.of(undefinedExpressionEditor)).when(undefinedExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
    this.uiModelMapper = new ContextUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(context), () -> expressionEditorDefinitions, listSelector, 0);
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) GraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext) ContextUIModelMapper(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextUIModelMapper) ExpressionEditorDefinitions(org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions) HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Optional(java.util.Optional) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Before(org.junit.Before)

Aggregations

BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)43 Before (org.junit.Before)34 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)15 Optional (java.util.Optional)13 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)13 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)10 ExpressionEditorDefinitions (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions)10 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)8 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)7 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)6 Test (org.junit.Test)5 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)5 Relation (org.kie.workbench.common.dmn.api.definition.v1_1.Relation)5 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)5 BaseGridCellValue (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue)5 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)4 RelationUIModelMapper (org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper)4 UpdateElementPropertyCommand (org.kie.workbench.common.stunner.core.client.canvas.command.UpdateElementPropertyCommand)4 Element (org.kie.workbench.common.stunner.core.graph.Element)4 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)4