Search in sources :

Example 21 with BaseGridData

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project kie-wb-common by kiegroup.

the class AddRelationColumnCommandTest method setup.

@Before
public void setup() {
    this.relation = new Relation();
    this.informationItem = new InformationItem();
    this.uiModel = new BaseGridData();
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector, DEFAULT_HEIGHT);
    makeCommand(1);
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiModelColumn).getIndex();
}
Also used : RelationUIModelMapper(org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper) Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 22 with BaseGridData

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project kie-wb-common by kiegroup.

the class AddRelationRowCommandTest method setup.

@Before
public void setup() {
    this.relation = new Relation();
    this.row = new List();
    this.uiModelRow = new BaseGridRow();
    this.uiModel = new BaseGridData();
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector, DEFAULT_HEIGHT);
    makeCommand(0);
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiModelColumn).getIndex();
}
Also used : RelationUIModelMapper(org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper) Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) List(org.kie.workbench.common.dmn.api.definition.model.List) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 23 with BaseGridData

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project kie-wb-common by kiegroup.

the class DeleteRelationRowCommandTest method setup.

@Before
public void setup() {
    this.relation = new Relation();
    this.rowList = new List();
    this.relation.getRow().add(rowList);
    this.uiModel = new BaseGridData();
    this.uiModel.appendRow(new BaseGridRow());
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector, DEFAULT_HEIGHT);
    makeCommand(0);
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiModelColumn).getIndex();
}
Also used : RelationUIModelMapper(org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper) Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) List(org.kie.workbench.common.dmn.api.definition.model.List) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 24 with BaseGridData

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project kie-wb-common by kiegroup.

the class SetKindCommandTest method setup.

@Before
public void setup() {
    this.function = new FunctionDefinition();
    this.function.setKind(originalKind);
    this.function.setExpression(originalExpression);
    this.uiModel = new BaseGridData();
    this.uiModel.appendColumn(mockColumn);
    this.uiModel.appendRow(new BaseGridRow());
    this.uiModel.setCellValue(0, 0, new ExpressionCellValue(Optional.of(originalEditor)));
    doReturn(uiModel).when(gridWidget).getModel();
    doReturn(ruleManager).when(handler).getRuleManager();
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 25 with BaseGridData

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData in project kie-wb-common by kiegroup.

the class DMNGridLayerTest method testSelectGridWidget.

@Test
public void testSelectGridWidget() {
    when(expressionGrid.getModel()).thenReturn(new BaseGridData(false));
    when(expressionGrid.asNode()).thenReturn(mock(Node.class));
    assertThat(gridLayer.getSelectedGridWidget().isPresent()).isFalse();
    gridLayer.add(expressionGrid);
    gridLayer.select(expressionGrid);
    assertThat(gridLayer.getSelectedGridWidget().isPresent()).isTrue();
    assertThat(gridLayer.getSelectedGridWidget().get()).isEqualTo(expressionGrid);
    verify(expressionGrid).select();
}
Also used : Node(com.ait.lienzo.client.core.shape.Node) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Test(org.junit.Test)

Aggregations

BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)56 Before (org.junit.Before)41 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)24 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)23 Optional (java.util.Optional)20 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)19 ExpressionEditorDefinitions (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions)18 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)13 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)10 HasName (org.kie.workbench.common.dmn.api.definition.HasName)7 InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)7 Element (org.kie.workbench.common.stunner.core.graph.Element)7 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)7 Test (org.junit.Test)6 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)6 UpdateElementPropertyCommand (org.kie.workbench.common.stunner.core.client.canvas.command.UpdateElementPropertyCommand)6 List (org.kie.workbench.common.dmn.api.definition.model.List)5 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)5 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)5 BaseBounds (org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds)5