Search in sources :

Example 21 with Coordinate

use of org.drools.workbench.services.verifier.plugin.client.Coordinate in project drools-wb by kiegroup.

the class DTableUpdateManager method update.

public void update(final GuidedDecisionTable52 model, final List<Coordinate> coordinates) throws UpdateException {
    PortablePreconditions.checkNotNull("model", model);
    PortablePreconditions.checkNotNull("coordinates", coordinates);
    final Set<Integer> canBeUpdated = new HashSet<>();
    for (final Coordinate coordinate : coordinates) {
        if (coordinate.getCol() != ROW_NUMBER_COLUMN && coordinate.getCol() != DESCRIPTION_COLUMN) {
            if (getCellUpdateManager(coordinate, model).update()) {
                canBeUpdated.add(coordinate.getRow());
            }
        }
    }
    boolean hadUpdates = !canBeUpdated.isEmpty();
    if (hadUpdates) {
        analyzer.update(canBeUpdated);
        analyzer.analyze();
    }
}
Also used : Coordinate(org.drools.workbench.services.verifier.plugin.client.Coordinate) HashSet(java.util.HashSet)

Example 22 with Coordinate

use of org.drools.workbench.services.verifier.plugin.client.Coordinate in project drools-wb by kiegroup.

the class DTableUpdateManagerRetractTest method testFillNullAction.

@Test
public void testFillNullAction() throws Exception, UpdateException {
    ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
    Coordinate coordinate = new Coordinate(1, 3);
    coordinates.add(coordinate);
    table52.getData().get(1).get(3).setStringValue("a");
    updateManager.update(table52, coordinates);
    verify(analyzer).update(anySet());
}
Also used : Coordinate(org.drools.workbench.services.verifier.plugin.client.Coordinate) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Coordinate (org.drools.workbench.services.verifier.plugin.client.Coordinate)22 ArrayList (java.util.ArrayList)21 Test (org.junit.Test)19 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)3 Analyzer (org.drools.workbench.services.verifier.core.main.Analyzer)3 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Mockito.anySet (org.mockito.Mockito.anySet)1