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());
}
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();
}
Aggregations