Search in sources :

Example 6 with GridRow

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);
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) ArrayList(java.util.ArrayList) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow)

Example 7 with GridRow

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));
}
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 8 with GridRow

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());
}
Also used : GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) Test(org.junit.Test)

Example 9 with GridRow

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());
}
Also used : GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) Test(org.junit.Test)

Example 10 with GridRow

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