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;
}
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;
}
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));
}
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);
}
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);
}
Aggregations