Search in sources :

Example 11 with GridRow

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

the class RowSynchronizerTest method testMoveRowsMoveDown.

@Test
public void testMoveRowsMoveDown() 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(2, new ArrayList<GridRow>() {

        {
            add(uiRow0);
            add(uiRow1);
        }
    });
    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));
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) Test(org.junit.Test)

Example 12 with GridRow

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

the class RowSynchronizerTest method testMoveRowMoveDownMidBlock.

@Test
public void testMoveRowMoveDownMidBlock() 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(1, new ArrayList<GridRow>() {

        {
            add(uiRow0);
        }
    });
    assertEquals(uiRow1, uiModel.getRow(0));
    assertEquals(uiRow0, uiModel.getRow(1));
    assertEquals(uiRow2, uiModel.getRow(2));
    assertEquals(row1, model.getData().get(0));
    assertEquals(row0, model.getData().get(1));
    assertEquals(row2, model.getData().get(2));
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) Test(org.junit.Test)

Aggregations

GridRow (org.uberfire.ext.wires.core.grids.client.model.GridRow)12 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)10 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)3 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)3 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)1 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)1 ModelSynchronizer (org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer)1 Synchronizer (org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer)1 MoveRowToMetaData (org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.impl.ConditionColumnSynchronizer.MoveRowToMetaData)1 MoveRowToMetaDataImpl (org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.impl.ConditionColumnSynchronizer.MoveRowToMetaDataImpl)1