Search in sources :

Example 26 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 testRemove.

@Test
@SuppressWarnings("unchecked")
public void testRemove() {
    final GridWidget gridWidget = mock(GridWidget.class);
    when(gridWidget.getModel()).thenReturn(new BaseGridData(false));
    when(expressionGrid.getModel()).thenReturn(new BaseGridData(false));
    when(gridWidget.asNode()).thenReturn(mock(Node.class));
    when(expressionGrid.asNode()).thenReturn(mock(Node.class));
    gridLayer.add(gridWidget);
    gridLayer.add(expressionGrid);
    gridLayer.select(expressionGrid);
    gridLayer.remove(gridWidget);
    assertThat(gridLayer.getSelectedGridWidget().isPresent()).isTrue();
    assertThat(gridLayer.getSelectedGridWidget().get()).isEqualTo(expressionGrid);
    gridLayer.remove(expressionGrid);
    assertThat(gridLayer.getSelectedGridWidget().isPresent()).isFalse();
}
Also used : GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) Node(com.ait.lienzo.client.core.shape.Node) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Test(org.junit.Test)

Example 27 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 testRemoveAll.

@Test
@SuppressWarnings("unchecked")
public void testRemoveAll() {
    final GridWidget gridWidget = mock(GridWidget.class);
    when(gridWidget.getModel()).thenReturn(new BaseGridData(false));
    when(expressionGrid.getModel()).thenReturn(new BaseGridData(false));
    when(gridWidget.asNode()).thenReturn(mock(Node.class));
    when(expressionGrid.asNode()).thenReturn(mock(Node.class));
    gridLayer.add(gridWidget);
    gridLayer.add(expressionGrid);
    gridLayer.select(expressionGrid);
    gridLayer.removeAll();
    assertThat(gridLayer.getSelectedGridWidget().isPresent()).isFalse();
}
Also used : GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) Node(com.ait.lienzo.client.core.shape.Node) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Test(org.junit.Test)

Example 28 with BaseGridData

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

the class GridCellTupleTest method setup.

@Before
public void setup() {
    tuple = new GridCellTuple(0, 0, gridWidget);
    gridData = new BaseGridData(false);
    gridData.appendColumn(gridColumn);
    gridData.appendRow(new BaseGridRow());
    when(gridWidget.getModel()).thenReturn(gridData);
}
Also used : 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 29 with BaseGridData

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

the class BaseDOMElementTest method setup.

@Before
public void setup() {
    widget = getWidget();
    when(widget.getElement()).thenReturn(widgetElement);
    when(widgetElement.getStyle()).thenReturn(widgetElementStyle);
    when(sessionManager.getCurrentSession()).thenReturn(session);
    when(session.getCanvasHandler()).thenReturn(canvasHandler);
    when(context.getRowIndex()).thenReturn(0);
    when(context.getColumnIndex()).thenReturn(1);
    when(gridWidget.getModel()).thenReturn(new BaseGridData());
    domElement = getDomElement();
    domElement.setContext(context);
}
Also used : BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 30 with BaseGridData

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

the class BaseSingletonDOMElementFactoryTest method setup.

@Before
public void setup() {
    when(context.getTransform()).thenReturn(new Transform());
    when(gridLayer.getDomElementContainer()).thenReturn(new AbsolutePanel());
    when(sessionManager.getCurrentSession()).thenReturn(session);
    when(session.getCanvasHandler()).thenReturn(canvasHandler);
    when(gridWidget.getModel()).thenReturn(new BaseGridData());
}
Also used : AbsolutePanel(com.google.gwt.user.client.ui.AbsolutePanel) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Transform(com.ait.lienzo.client.core.types.Transform) Before(org.junit.Before)

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