Search in sources :

Example 26 with Group

use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.

the class AbstractLienzoShapeGlyphRenderer method render.

@Override
public Group render(final G glyph, final double width, final double height) {
    final Group group = new Group();
    final Rectangle decorator = new Rectangle(width, height).setCornerRadius(5).setFillColor(ColorName.LIGHTGREY).setFillAlpha(0.7d);
    group.add(decorator);
    getShape(glyph, width, height, shape -> {
        group.add(shape);
        scaleShape(shape, width, height);
        group.remove(decorator);
    });
    return group;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Rectangle(com.ait.lienzo.client.core.shape.Rectangle)

Example 27 with Group

use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.

the class ElementShapeGlyphRendererTest method setup.

@Before
public void setup() throws Exception {
    when(viewSupplier.get()).thenReturn(view);
    when(lienzoShapeGlyphRenderer.render(any(ShapeGlyph.class), anyDouble(), anyDouble())).thenReturn(new Group());
    this.tested = new ElementShapeGlyphRenderer(lienzoShapeGlyphRenderer, viewSupplier, viewDestroyer);
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) ShapeGlyph(org.kie.workbench.common.stunner.core.definition.shape.ShapeGlyph) Before(org.junit.Before)

Example 28 with Group

use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.

the class SVGChildViewHandlerTest method setup.

@Before
public void setup() throws Exception {
    this.svgGroup = new Group().setID("svgGroup1");
    this.group = new Group().setID("parent");
    this.rectangle = new Rectangle(10d, 10d);
    when(svgChild.getContainer()).thenReturn(svgGroup);
    this.parentShape = new SVGContainer("parent", group, false, null);
    this.tested = new SVGChildViewHandler(shapeView);
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) SVGContainer(org.kie.workbench.common.stunner.svg.client.shape.view.SVGContainer) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) Before(org.junit.Before)

Example 29 with Group

use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.

the class SVGBasicShapeViewImplTest method setup.

@Before
public void setup() throws Exception {
    this.parent = new SVGContainer("parent", new Group().setID("parent"), false, null);
    rectangle = new Rectangle(10d, 10d);
    this.shape = new SVGPrimitiveShape(rectangle);
    this.childShape = new SVGPrimitiveShape(new Rectangle(10d, 10d));
    this.child = new SVGBasicShapeViewImpl("svgChild1", childShape, 50d, 23d);
    this.tested = new SVGBasicShapeViewImpl("svg-test1", shape, 100, 340);
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) SVGContainer(org.kie.workbench.common.stunner.svg.client.shape.view.SVGContainer) SVGPrimitiveShape(org.kie.workbench.common.stunner.svg.client.shape.view.SVGPrimitiveShape) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) Before(org.junit.Before)

Example 30 with Group

use of com.ait.lienzo.client.core.shape.Group in project drools-wb by kiegroup.

the class BaseGuidedDecisionTreeNodeFactory method getDragProxy.

@Override
public ShapeDragProxy getDragProxy(final FactoryHelper helper, final ShapeDragProxyPreviewCallback dragPreviewCallback, final ShapeDragProxyCompleteCallback dragEndCallBack) {
    final T shape = makeShape();
    final Group group = new Group();
    group.add(shape);
    // Add a label to the drag proxy if needed
    double dragProxyWidth = getWidth();
    double dragProxyHeight = getHeight();
    final String description = getNodeLabel(helper);
    if (description != null) {
        final Text nodeLabel = new Text(description, ShapeFactoryUtil.FONT_FAMILY_DESCRIPTION, ShapeFactoryUtil.FONT_SIZE_DESCRIPTION);
        nodeLabel.setTextAlign(TextAlign.CENTER);
        nodeLabel.setTextBaseLine(TextBaseLine.MIDDLE);
        nodeLabel.setFillColor(Color.rgbToBrowserHexColor(0, 0, 0));
        dragProxyWidth = getDragProxyWidth(nodeLabel);
        dragProxyHeight = getDragProxyHeight(nodeLabel);
        group.add(nodeLabel);
    }
    final double _dragProxyWidth = dragProxyWidth;
    final double _dragProxyHeight = dragProxyHeight;
    return new ShapeDragProxy() {

        @Override
        public Group getDragGroup() {
            return group;
        }

        @Override
        public void onDragPreview(final double x, final double y) {
            dragPreviewCallback.callback(x, y);
        }

        @Override
        public void onDragComplete(final double x, final double y) {
            dragEndCallBack.callback(x, y);
        }

        @Override
        public double getWidth() {
            return _dragProxyWidth;
        }

        @Override
        public double getHeight() {
            return _dragProxyHeight;
        }
    };
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) ShapeDragProxy(org.uberfire.ext.wires.core.api.factories.ShapeDragProxy) Text(com.ait.lienzo.client.core.shape.Text)

Aggregations

Group (com.ait.lienzo.client.core.shape.Group)66 Test (org.junit.Test)17 Rectangle (com.ait.lienzo.client.core.shape.Rectangle)10 Before (org.junit.Before)10 Text (com.ait.lienzo.client.core.shape.Text)9 GridRenderer (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)8 Layer (com.ait.lienzo.client.core.shape.Layer)7 Point2D (com.ait.lienzo.client.core.types.Point2D)7 Command (org.uberfire.mvp.Command)6 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)4 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)4 Line (com.ait.lienzo.client.core.shape.Line)3 ArrayList (java.util.ArrayList)3 SVGContainer (org.kie.workbench.common.stunner.svg.client.shape.view.SVGContainer)3 GridWidget (org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget)3 GridRendererTheme (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme)3 IPathClipper (com.ait.lienzo.client.core.shape.IPathClipper)2 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)2 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)2 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)2