Search in sources :

Example 1 with LiteralExpressionGrid

use of org.kie.workbench.common.dmn.client.editors.expressions.types.literal.LiteralExpressionGrid in project kie-wb-common by kiegroup.

the class DMNGridLayer method addGhost.

void addGhost(final ExpressionContainerGrid container, final GridWidget gridWidget) {
    // Rectangle the size of the ExpressionContainerGrid
    final Rectangle r = getGhostRectangle();
    r.setWidth(container.getWidth() + BaseExpressionGridTheme.STROKE_WIDTH);
    r.setHeight(container.getHeight() + BaseExpressionGridTheme.STROKE_WIDTH);
    r.setFillColor(ColorName.WHITE);
    r.setAlpha(0.50);
    r.setListening(false);
    final Group g = GWT.create(Group.class);
    final Transform transform = getViewport().getTransform();
    g.setX(container.getX() + transform.getTranslateX());
    g.setY(container.getY() + transform.getTranslateY());
    g.add(r);
    // LiteralExpression and UndefinedExpression are not handled as grids in
    // their own right. In these circumstances use their parent GridWidget.
    GridWidget gw = gridWidget;
    if (gw instanceof LiteralExpressionGrid) {
        gw = ((LiteralExpressionGrid) gw).getParentInformation().getGridWidget();
    } else if (gw instanceof UndefinedExpressionGrid) {
        gw = ((UndefinedExpressionGrid) gw).getParentInformation().getGridWidget();
    }
    // Clip the inner GridWidget so everything outside of it is ghosted
    final IPathClipper clipper = new InverseGridWidgetClipper(container, gw);
    clipper.setActive(true);
    g.setPathClipper(clipper);
    g.drawWithTransforms(getContext(), 1.0, getStorageBounds());
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) UndefinedExpressionGrid(org.kie.workbench.common.dmn.client.editors.expressions.types.undefined.UndefinedExpressionGrid) IPathClipper(com.ait.lienzo.client.core.shape.IPathClipper) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) Transform(com.ait.lienzo.client.core.types.Transform) LiteralExpressionGrid(org.kie.workbench.common.dmn.client.editors.expressions.types.literal.LiteralExpressionGrid)

Example 2 with LiteralExpressionGrid

use of org.kie.workbench.common.dmn.client.editors.expressions.types.literal.LiteralExpressionGrid in project kie-wb-common by kiegroup.

the class DMNGridLayerTest method testGhostRenderingLiteralExpression.

@Test
public void testGhostRenderingLiteralExpression() {
    final LiteralExpressionGrid literalExpressionGrid = mock(LiteralExpressionGrid.class);
    final GridCellTuple parentGridCellTuple = new GridCellTuple(0, 0, container);
    GwtMockito.useProviderForType(Group.class, clazz -> ghostGroup);
    doReturn(new HashSet<>(Arrays.asList(container, literalExpressionGrid))).when(gridLayer).getGridWidgets();
    doReturn(ghostRectangle).when(gridLayer).getGhostRectangle();
    doReturn(parentGridCellTuple).when(literalExpressionGrid).getParentInformation();
    gridLayer.select(literalExpressionGrid);
    gridLayer.doBatch();
    assertGhostRendering();
}
Also used : GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) LiteralExpressionGrid(org.kie.workbench.common.dmn.client.editors.expressions.types.literal.LiteralExpressionGrid) Test(org.junit.Test)

Aggregations

LiteralExpressionGrid (org.kie.workbench.common.dmn.client.editors.expressions.types.literal.LiteralExpressionGrid)2 Group (com.ait.lienzo.client.core.shape.Group)1 IPathClipper (com.ait.lienzo.client.core.shape.IPathClipper)1 Rectangle (com.ait.lienzo.client.core.shape.Rectangle)1 Transform (com.ait.lienzo.client.core.types.Transform)1 Test (org.junit.Test)1 UndefinedExpressionGrid (org.kie.workbench.common.dmn.client.editors.expressions.types.undefined.UndefinedExpressionGrid)1 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)1 GridWidget (org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget)1