Search in sources :

Example 51 with BaseGridData

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

the class GuidedDecisionTablePresenterTest method linkTables.

@SuppressWarnings("unchecked")
private void linkTables() {
    final GridData uiModel1 = spy(new BaseGridData());
    final GridData uiModel2 = spy(new BaseGridData());
    final GridData uiModel3 = spy(new BaseGridData());
    final GuidedDecisionTableView dtView2 = mock(GuidedDecisionTableView.class);
    final GuidedDecisionTableView dtView3 = mock(GuidedDecisionTableView.class);
    final GuidedDecisionTableView.Presenter dtPresenter2 = setupPresenter();
    final GuidedDecisionTableView.Presenter dtPresenter3 = setupPresenter();
    final Set<GuidedDecisionTableView.Presenter> dtPresenters = new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter);
            add(dtPresenter2);
            add(dtPresenter3);
        }
    };
    when(dtPresenter.getModel()).thenReturn(model1);
    when(dtPresenter2.getModel()).thenReturn(model2);
    when(dtPresenter3.getModel()).thenReturn(model3);
    when(dtPresenter2.getView()).thenReturn(dtView2);
    when(dtPresenter3.getView()).thenReturn(dtView3);
    when(view.getModel()).thenReturn(uiModel1);
    when(dtView2.getModel()).thenReturn(uiModel2);
    when(dtView3.getModel()).thenReturn(uiModel3);
    when(uiModel1.getColumns()).thenReturn(uiModel1Columns);
    when(uiModel2.getColumns()).thenReturn(uiModel2Columns);
    when(uiModel3.getColumns()).thenReturn(uiModel3Columns);
    when(uiModel1Columns.get(anyInt())).thenReturn(uiModel1MockColumn);
    when(uiModel2Columns.get(anyInt())).thenReturn(uiModel2MockColumn);
    when(uiModel3Columns.get(anyInt())).thenReturn(uiModel3MockColumn);
    dtPresenter.link(dtPresenters);
    dtPresenter2.link(dtPresenters);
    dtPresenter3.link(dtPresenters);
}
Also used : 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) HashSet(java.util.HashSet)

Example 52 with BaseGridData

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

the class GridRowComparatorTest method setUp.

@Before
public void setUp() throws Exception {
    baseGridData = new BaseGridData();
    doReturn(0).when(column).getIndex();
    comparator = new GridRowComparator(column);
}
Also used : BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 53 with BaseGridData

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

the class EditableHeaderGridWidgetMouseDoubleClickHandlerTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.uiModel = new BaseGridData(false);
    when(gridWidget.getModel()).thenReturn(uiModel);
    when(gridWidget.getRendererHelper()).thenReturn(rendererHelper);
    when(gridWidget.getRenderer()).thenReturn(renderer);
    when(gridWidget.getHeader()).thenReturn(gridWidgetHeader);
    when(gridWidget.getViewport()).thenReturn(viewport);
    when(rendererHelper.getRenderingInformation()).thenReturn(renderingInformation);
    when(rendererHelper.getColumnInformation(anyDouble())).thenReturn(columnInformation);
    when(columnInformation.getColumn()).thenReturn(gridColumn);
    when(renderingInformation.getBodyBlockInformation()).thenReturn(renderingBlockInformation);
    when(renderingInformation.getFloatingBlockInformation()).thenReturn(renderingBlockInformation);
    when(renderer.getHeaderHeight()).thenReturn(0.0);
    this.handler = new EditableHeaderGridWidgetMouseDoubleClickHandler(gridWidget, selectionManager, pinnedModeManager, renderer);
}
Also used : BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 54 with BaseGridData

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

the class BaseContextUIModelMapperTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.uiModel = new BaseGridData();
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModel.appendColumn(uiNameColumn);
    this.uiModel.appendColumn(uiExpressionEditorColumn);
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiNameColumn).getIndex();
    doReturn(2).when(uiExpressionEditorColumn).getIndex();
    final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
    expressionEditorDefinitions.add(literalExpressionEditorDefinition);
    expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
    doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
    doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass();
    doReturn(Optional.of(literalExpression)).when(literalExpressionEditor).getExpression();
    doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
    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.context = new Context();
    this.context.getContextEntry().add(new ContextEntry() {

        {
            setVariable(new InformationItem() {

                {
                    setName(new Name("ii1"));
                }
            });
        }
    });
    this.context.getContextEntry().add(new ContextEntry() {

        {
            setExpression(new LiteralExpression());
        }
    });
    this.mapper = getMapper();
    this.cellValueSupplier = Optional::empty;
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) 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) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) 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)

Example 55 with BaseGridData

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

the class FunctionUIModelMapperTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.uiModel = new BaseGridData();
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendColumn(uiExpressionEditorColumn);
    doReturn(0).when(uiExpressionEditorColumn).getIndex();
    doReturn(uiModel).when(gridWidget).getModel();
    // Core Editor definitions
    final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
    expressionEditorDefinitions.add(literalExpressionEditorDefinition);
    doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
    doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass();
    doReturn(Optional.of(literalExpression)).when(literalExpressionEditor).getExpression();
    doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
    // Supplementary Editor definitions
    final ExpressionEditorDefinitions supplementaryEditorDefinitions = new ExpressionEditorDefinitions();
    supplementaryEditorDefinitions.add(supplementaryEditorDefinition);
    doReturn(supplementaryEditorDefinitions).when(supplementaryEditorDefinitionsSupplier).get();
    doReturn(Optional.of(context)).when(supplementaryEditorDefinition).getModelClass();
    doReturn(Optional.of(context)).when(supplementaryEditor).getExpression();
    doReturn(Optional.of(supplementaryEditor)).when(supplementaryEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
    this.function = new FunctionDefinition();
    this.mapper = new FunctionUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(function), expressionEditorDefinitionsSupplier, supplementaryEditorDefinitionsSupplier, listSelector, 0);
    this.cellValueSupplier = Optional::empty;
}
Also used : 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) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Aggregations

BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)56 Before (org.junit.Before)41 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)24 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)23 Optional (java.util.Optional)20 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)19 ExpressionEditorDefinitions (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions)18 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)13 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)10 HasName (org.kie.workbench.common.dmn.api.definition.HasName)7 InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)7 Element (org.kie.workbench.common.stunner.core.graph.Element)7 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)7 Test (org.junit.Test)6 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)6 UpdateElementPropertyCommand (org.kie.workbench.common.stunner.core.client.canvas.command.UpdateElementPropertyCommand)6 List (org.kie.workbench.common.dmn.api.definition.model.List)5 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)5 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)5 BaseBounds (org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds)5