use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project drools-wb by kiegroup.
the class RowSynchronizerTest method testMoveRowsMoveUp.
@Test
public void testMoveRowsMoveUp() throws VetoException {
modelSynchronizer.appendRow();
modelSynchronizer.appendRow();
modelSynchronizer.appendRow();
final GridRow uiRow0 = uiModel.getRow(0);
final GridRow uiRow1 = uiModel.getRow(1);
final GridRow uiRow2 = uiModel.getRow(2);
final List<DTCellValue52> row0 = model.getData().get(0);
final List<DTCellValue52> row1 = model.getData().get(1);
final List<DTCellValue52> row2 = model.getData().get(2);
uiModel.moveRowsTo(0, new ArrayList<GridRow>() {
{
add(uiRow1);
add(uiRow2);
}
});
assertEquals(uiRow1, uiModel.getRow(0));
assertEquals(uiRow2, uiModel.getRow(1));
assertEquals(uiRow0, uiModel.getRow(2));
assertEquals(row1, model.getData().get(0));
assertEquals(row2, model.getData().get(1));
assertEquals(row0, model.getData().get(2));
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project drools-wb by kiegroup.
the class ScenarioGridTest method testShowContextMenuGivenOrExpect.
@Test
public void testShowContextMenuGivenOrExpect() {
final String columnGroup = "grp";
final ScenarioHeaderMetaData scenarioHeaderMetaDataMock = mock(ScenarioHeaderMetaData.class);
when(scenarioHeaderMetaDataMock.getColumnGroup()).thenReturn(columnGroup);
final int uiColumnIndex = 0;
final int uiRowIndex = 0;
final double columnWidth = 100.0;
final GridColumn columnMock = mock(ScenarioGridColumn.class);
when(columnMock.getIndex()).thenReturn(uiColumnIndex);
when(columnMock.getWidth()).thenReturn(columnWidth);
when(((ScenarioGridColumn) columnMock).getFactIdentifier()).thenReturn(FactIdentifier.EMPTY);
when(columnMock.getHeaderMetaData()).thenReturn(Collections.singletonList(scenarioHeaderMetaDataMock));
when(((ScenarioGridColumn) columnMock).getInformationHeaderMetaData()).thenReturn(scenarioHeaderMetaDataMock);
when(scenarioGridModelMock.getColumns()).thenReturn(Collections.singletonList(columnMock));
final double rowHeight = 40.0;
final GridRow gridRow = mock(ScenarioGridRow.class);
when(gridRow.getHeight()).thenReturn(rowHeight);
when(scenarioGridModelMock.getRow(uiRowIndex)).thenReturn(gridRow);
when(rendererHelperMock.getColumnInformation(50.0)).thenReturn(columnInformationMock);
when(columnInformationMock.getColumn()).thenReturn(columnMock);
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project drools-wb by kiegroup.
the class ScenarioGridTest method testShowContextMenuDescription.
@Test
public void testShowContextMenuDescription() {
final int uiColumnIndex = 0;
final int uiRowIndex = 0;
final double columnWidth = 100.0;
final GridColumn columnMock = mock(ScenarioGridColumn.class);
when(columnMock.getIndex()).thenReturn(uiColumnIndex);
when(columnMock.getWidth()).thenReturn(columnWidth);
when(((ScenarioGridColumn) columnMock).getFactIdentifier()).thenReturn(FactIdentifier.DESCRIPTION);
when(columnMock.getHeaderMetaData()).thenReturn(Collections.singletonList(mock(GridColumn.HeaderMetaData.class)));
when(scenarioGridModelMock.getColumns()).thenReturn(Collections.singletonList(columnMock));
final double rowHeight = 40.0;
final GridRow gridRow = mock(ScenarioGridRow.class);
when(gridRow.getHeight()).thenReturn(rowHeight);
when(scenarioGridModelMock.getRow(uiRowIndex)).thenReturn(gridRow);
when(rendererHelperMock.getColumnInformation(50.0)).thenReturn(columnInformationMock);
when(columnInformationMock.getColumn()).thenReturn(columnMock);
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project drools-wb by kiegroup.
the class GuidedDecisionTableGridHighlightHelperTest method testOnFound.
@Test
public void testOnFound() {
final GridHighlightHelper highlightHelper = mock(GridHighlightHelper.class);
final GridData model = mock(GridData.class);
final GridColumn<?> column1 = mock(GridColumn.class);
final GridColumn<?> column2 = mock(GridColumn.class);
final GridRow gridRow1 = mock(GridRow.class);
final GridRow gridRow2 = mock(GridRow.class);
final GridRow gridRow3 = mock(GridRow.class);
final GridRow gridRow4 = mock(GridRow.class);
final double gridRow1Height = 100;
final double gridRow2Height = 101;
final double gridRow3Height = 102;
final double gridRow4Height = 103;
final double column1Width = 90;
final double column2Width = 110;
final int row = 3;
final int column = 1;
final GuidedDecisionTableView widget = mock(GuidedDecisionTableView.class);
final double paddingX = 310;
final double paddingY = 406;
doReturn(highlightHelper).when(helper).highlightHelper(modeller, widget);
when(gridWidget2.getModel()).thenReturn(model);
when(model.getColumns()).thenReturn(asList(column1, column2));
when(model.getRows()).thenReturn(asList(gridRow1, gridRow2, gridRow3, gridRow4));
when(gridRow1.getHeight()).thenReturn(gridRow1Height);
when(gridRow2.getHeight()).thenReturn(gridRow2Height);
when(gridRow3.getHeight()).thenReturn(gridRow3Height);
when(gridRow4.getHeight()).thenReturn(gridRow4Height);
when(column1.getWidth()).thenReturn(column1Width);
when(column2.getWidth()).thenReturn(column2Width);
when(highlightHelper.withPaddingX(paddingX)).thenReturn(highlightHelper);
when(highlightHelper.withPaddingY(paddingY)).thenReturn(highlightHelper);
doReturn(paddingX).when(helper).getPaddingX(column, modeller, widget);
doReturn(paddingY).when(helper).getPaddingY(row, modeller, widget);
helper.highlight(row, column, widget, modeller);
verify(highlightHelper).highlight(row, column);
}
Aggregations