Search in sources :

Example 46 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 47 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 48 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 49 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)

Example 50 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)

Aggregations

GridRow (org.uberfire.ext.wires.core.grids.client.model.GridRow)54 Test (org.junit.Test)31 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)22 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)10 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)10 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)10 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)8 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)6 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)6 BaseGridCell (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell)6 ArrayList (java.util.ArrayList)4 DecisionRule (org.kie.workbench.common.dmn.api.definition.model.DecisionRule)4 BaseExpressionGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid)4 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)3 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)3 HashMap (java.util.HashMap)2 Maps (org.kie.soup.commons.util.Maps)2 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)2 List (org.kie.workbench.common.dmn.api.definition.model.List)2 BaseUIModelMapper (org.kie.workbench.common.dmn.client.widgets.grid.model.BaseUIModelMapper)2