Search in sources :

Example 16 with BaseGridRow

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

the class ExpressionEditorColumnTest method testMinimalWidthDefaultWidthWithPadding.

/**
 * (10)[99](10)
 * (10)[30][30][30](10)
 * (10)[49][50](10)
 */
@Test
public void testMinimalWidthDefaultWidthWithPadding() {
    gridData.appendColumn(column);
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    mockCellsWithPadding(0, 0, PADDING, 99);
    mockCellsWithPadding(1, 0, PADDING, 30, 30, 30);
    mockCellsWithPadding(2, 0, PADDING, 49, 50);
    assertThat(column.getMinimumWidth()).isEqualTo(119);
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Test(org.junit.Test)

Example 17 with BaseGridRow

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

the class ExpressionEditorColumnTest method testMinimalWidthThreeCellsSum.

/**
 * [100]
 * [50][60]
 * [50][60][10]
 */
@Test
public void testMinimalWidthThreeCellsSum() {
    gridData.appendColumn(column);
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    mockCells(0, 0, 100);
    mockCells(1, 0, 50, 60);
    mockCells(2, 0, 50, 60, 10);
    assertThat(column.getMinimumWidth()).isEqualTo(120);
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Test(org.junit.Test)

Example 18 with BaseGridRow

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

the class ExpressionEditorColumnTest method testUpdateInternalWidth.

@Test
public void testUpdateInternalWidth() {
    gridData.appendColumn(column);
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    gridData.appendRow(new BaseGridRow());
    mockCells(0, 0, 100);
    mockCells(1, 0, 110);
    mockCells(2, 0, 50, 60);
    column.setWidthInternal(200D);
    assertThat(getColumnWidth(0, 0, 0)).isEqualTo(200D);
    assertThat(getColumnWidth(1, 0, 0)).isEqualTo(200D);
    assertThat(getColumnWidth(2, 0, 0)).isEqualTo(50D);
    assertThat(getColumnWidth(2, 0, 1)).isEqualTo(150D);
}
Also used : BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Test(org.junit.Test)

Example 19 with BaseGridRow

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

the class RelationColumnTest method setUp.

@Before
public void setUp() throws Exception {
    parentUiModel = new BaseGridData();
    parentUiModel.appendRow(new BaseGridRow());
    parentUiModel.appendRow(new BaseGridRow());
    parentUiModel.appendRow(new BaseGridRow());
    parentUiModel.appendColumn(mock(ExpressionEditorColumn.class));
    final GridCellTuple parent = new GridCellTuple(0, 0, parentGridWidget);
    doReturn(parentUiModel).when(parentGridWidget).getModel();
    doReturn(widget).when(domElement).getWidget();
    doReturn(parent).when(gridWidget).getParentInformation();
    doReturn(100.0).when(gridWidget).getWidth();
}
Also used : ExpressionEditorColumn(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionEditorColumn) GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 20 with BaseGridRow

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

the class RelationUIModelMapperTest method setup.

@Before
public void setup() {
    this.uiModel = new BaseGridData();
    this.uiModel.appendRow(new BaseGridRow());
    this.uiModel.appendRow(new BaseGridRow());
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModel.appendColumn(uiRelationColumn1);
    this.uiModel.appendColumn(uiRelationColumn2);
    when(uiRowNumberColumn.getIndex()).thenReturn(0);
    when(uiRelationColumn1.getIndex()).thenReturn(1);
    when(uiRelationColumn2.getIndex()).thenReturn(2);
    this.relation = new Relation();
    this.relation.getColumn().add(new InformationItem());
    this.relation.getColumn().add(new InformationItem());
    final List rowList1 = new List();
    rowList1.getExpression().add(HasExpression.wrap(rowList1, new LiteralExpression() {

        {
            getText().setValue("le(1,0)");
        }
    }));
    rowList1.getExpression().add(HasExpression.wrap(rowList1, new LiteralExpression() {

        {
            getText().setValue("le(2,0)");
        }
    }));
    final List rowList2 = new List();
    rowList2.getExpression().add(HasExpression.wrap(rowList2, new LiteralExpression() {

        {
            getText().setValue("le(1,1)");
        }
    }));
    rowList2.getExpression().add(HasExpression.wrap(rowList2, new LiteralExpression() {

        {
            getText().setValue("le(2,1)");
        }
    }));
    this.relation.getRow().add(rowList1);
    this.relation.getRow().add(rowList2);
    this.mapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector, DEFAULT_HEIGHT);
    this.cellValueSupplier = Optional::empty;
}
Also used : Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Optional(java.util.Optional) LiteralExpression(org.kie.workbench.common.dmn.api.definition.model.LiteralExpression) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) 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)

Aggregations

BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)104 Test (org.junit.Test)57 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)25 Before (org.junit.Before)24 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)19 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)18 GridRow (org.uberfire.ext.wires.core.grids.client.model.GridRow)18 List (org.kie.workbench.common.dmn.api.definition.model.List)14 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)14 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)11 Optional (java.util.Optional)10 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)10 InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)10 DecisionRule (org.kie.workbench.common.dmn.api.definition.model.DecisionRule)9 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)9 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)9 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)9 RowNumberColumn (org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn)9 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)8 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)8