use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project drools-wb by kiegroup.
the class RowSynchronizer method insert.
@Override
public void insert(final RowMetaData metaData) throws VetoException {
if (!handlesAppend(metaData)) {
return;
}
final int rowIndex = metaData.getRowIndex();
final List<DTCellValue52> modelRow = new ArrayList<DTCellValue52>();
model.getData().add(rowIndex, modelRow);
final GridRow uiModelRow = new BaseGridRow(GuidedDecisionTableView.ROW_HEIGHT);
uiModel.insertRow(rowIndex, uiModelRow);
initialiseRowData(rowIndex);
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project drools-wb by kiegroup.
the class RowSynchronizerTest method testMoveRowMoveUpTopBlock.
@Test
public void testMoveRowMoveUpTopBlock() 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(uiRow2);
}
});
assertEquals(uiRow2, uiModel.getRow(0));
assertEquals(uiRow0, uiModel.getRow(1));
assertEquals(uiRow1, uiModel.getRow(2));
assertEquals(row2, model.getData().get(0));
assertEquals(row0, model.getData().get(1));
assertEquals(row1, model.getData().get(2));
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project drools-wb by kiegroup.
the class RowSynchronizerTest method testMoveRowsMoveDownCheckRowNumbers.
@Test
public void testMoveRowsMoveDownCheckRowNumbers() throws VetoException {
modelSynchronizer.appendRow();
modelSynchronizer.appendRow();
modelSynchronizer.appendRow();
final GridRow uiRow0 = uiModel.getRow(0);
final GridRow uiRow1 = uiModel.getRow(1);
uiModel.moveRowsTo(2, new ArrayList<GridRow>() {
{
add(uiRow0);
add(uiRow1);
}
});
assertEquals(1, uiModel.getRow(0).getCells().get(0).getValue().getValue());
assertEquals(2, uiModel.getRow(1).getCells().get(0).getValue().getValue());
assertEquals(3, uiModel.getRow(2).getCells().get(0).getValue().getValue());
assertEquals(1, model.getData().get(0).get(0).getNumericValue());
assertEquals(2, model.getData().get(1).get(0).getNumericValue());
assertEquals(3, model.getData().get(2).get(0).getNumericValue());
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project drools-wb by kiegroup.
the class RowSynchronizerTest method testMoveRowsMoveUpCheckRowNumbers.
@Test
public void testMoveRowsMoveUpCheckRowNumbers() throws VetoException {
modelSynchronizer.appendRow();
modelSynchronizer.appendRow();
modelSynchronizer.appendRow();
final GridRow uiRow1 = uiModel.getRow(1);
final GridRow uiRow2 = uiModel.getRow(2);
uiModel.moveRowsTo(0, new ArrayList<GridRow>() {
{
add(uiRow1);
add(uiRow2);
}
});
assertEquals(1, uiModel.getRow(0).getCells().get(0).getValue().getValue());
assertEquals(2, uiModel.getRow(1).getCells().get(0).getValue().getValue());
assertEquals(3, uiModel.getRow(2).getCells().get(0).getValue().getValue());
assertEquals(1, model.getData().get(0).get(0).getNumericValue());
assertEquals(2, model.getData().get(1).get(0).getNumericValue());
assertEquals(3, model.getData().get(2).get(0).getNumericValue());
}
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));
}
Aggregations