Search in sources :

Example 11 with DMNGridRow

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.

the class BaseExpressionGridGeneralTest method testDeselect.

@Test
public void testDeselect() {
    grid.getModel().appendRow(new DMNGridRow());
    appendColumns(GridColumn.class);
    // Select a cell so we can check deselection clears selections
    grid.getModel().selectCell(0, 0);
    assertFalse(grid.getModel().getSelectedCells().isEmpty());
    grid.deselect();
    assertTrue(grid.getModel().getSelectedCells().isEmpty());
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Test(org.junit.Test)

Example 12 with DMNGridRow

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.

the class BaseExpressionGridGeneralTest method testSelectFirstCellWithRowAndNonRowNumberColumn.

@Test
public void testSelectFirstCellWithRowAndNonRowNumberColumn() {
    grid.getModel().appendRow(new DMNGridRow());
    appendColumns(GridColumn.class);
    grid.selectFirstCell();
    assertThat(grid.getModel().getSelectedCells()).isNotEmpty();
    assertThat(grid.getModel().getSelectedCells()).contains(new GridData.SelectedCell(0, 0));
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) DMNGridData(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) Test(org.junit.Test)

Example 13 with DMNGridRow

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow 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() throws Exception {
    gridData.appendColumn(column);
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    mockCellsWithPadding(0, 0, PADDING, 99);
    mockCellsWithPadding(1, 0, PADDING, 30, 30, 30);
    mockCellsWithPadding(2, 0, PADDING, 49, 50);
    Assertions.assertThat(column.getMinimumWidth()).isEqualTo(119);
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Test(org.junit.Test)

Example 14 with DMNGridRow

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.

the class ExpressionEditorColumnTest method testUpdateInternalWidth.

@Test
public void testUpdateInternalWidth() throws Exception {
    gridData.appendColumn(column);
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    mockCells(0, 0, 100);
    mockCells(1, 0, 110);
    mockCells(2, 0, 50, 60);
    column.setWidthInternal(200D);
    Assertions.assertThat(getColumnWidth(0, 0, 0)).isEqualTo(200D);
    Assertions.assertThat(getColumnWidth(1, 0, 0)).isEqualTo(200D);
    Assertions.assertThat(getColumnWidth(2, 0, 0)).isEqualTo(50D);
    Assertions.assertThat(getColumnWidth(2, 0, 1)).isEqualTo(150D);
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Test(org.junit.Test)

Example 15 with DMNGridRow

use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.

the class ExpressionEditorColumnTest method testUpdateInternalWidthResizedToSmaller.

@Test
public void testUpdateInternalWidthResizedToSmaller() throws Exception {
    gridData.appendColumn(column);
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    gridData.appendRow(new DMNGridRow());
    mockCells(0, 0, 100);
    mockCells(1, 0, 30, 30, 30);
    mockCells(2, 0, 50, 60);
    column.setWidthInternal(80D);
    Assertions.assertThat(getColumnWidth(0, 0, 0)).isEqualTo(80D);
    Assertions.assertThat(getColumnWidth(1, 0, 0)).isEqualTo(30D);
    Assertions.assertThat(getColumnWidth(1, 0, 1)).isEqualTo(30D);
    Assertions.assertThat(getColumnWidth(1, 0, 2)).isEqualTo(20D);
    Assertions.assertThat(getColumnWidth(2, 0, 0)).isEqualTo(50D);
    Assertions.assertThat(getColumnWidth(2, 0, 1)).isEqualTo(30D);
}
Also used : DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Test(org.junit.Test)

Aggregations

DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)67 Test (org.junit.Test)32 Before (org.junit.Before)16 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)13 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)12 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)12 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)12 List (org.kie.workbench.common.dmn.api.definition.v1_1.List)11 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)10 Optional (java.util.Optional)9 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)7 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)6 ContextEntry (org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)6 DecisionRule (org.kie.workbench.common.dmn.api.definition.v1_1.DecisionRule)6 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)6 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)6 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)6 ExpressionEditorDefinitions (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions)5 Binding (org.kie.workbench.common.dmn.api.definition.v1_1.Binding)4 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)4