Search in sources :

Example 1 with Line

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

the class LienzoGridLayerBuilder method getLienzoGridFor.

public static GridLayer getLienzoGridFor(final CanvasGrid canvasGrid) {
    final CanvasGrid.GridLine line1 = canvasGrid.getLine1();
    final CanvasGrid.GridLine line2 = canvasGrid.getLine2();
    final Line gridLine1 = createLine(line1);
    final Line gridLine2 = null != line2 ? createLine(line2) : null;
    if (null != gridLine2) {
        return new GridLayer(line1.getDistance(), gridLine1, line2.getDistance(), gridLine2);
    } else {
        return new GridLayer(line1.getDistance(), gridLine1);
    }
}
Also used : Line(com.ait.lienzo.client.core.shape.Line) GridLayer(com.ait.lienzo.client.core.shape.GridLayer) CanvasGrid(org.kie.workbench.common.stunner.core.client.canvas.CanvasGrid)

Example 2 with Line

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

the class LienzoCanvasDecoratorFactory method axis.

public static IPrimitive<?> axis(final int width, final int height, final double dAlpha, final double dWidth, final String dColor) {
    final Line h = line(width, 0, dAlpha, dWidth, dColor);
    final Line v = line(0, height, dAlpha, dWidth, dColor);
    return group().add(h).add(v);
}
Also used : Line(com.ait.lienzo.client.core.shape.Line)

Example 3 with Line

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

the class GuidedDecisionTableRenderer method renderHeaderBodyDivider.

@Override
public RendererCommand renderHeaderBodyDivider(final double width) {
    return (RenderHeaderGridLinesCommand) (rc) -> {
        if (!rc.isSelectionLayer()) {
            final Group g = new Group();
            final Line dividerLine1 = theme.getGridHeaderBodyDivider();
            final Line dividerLine2 = theme.getGridHeaderBodyDivider();
            dividerLine1.setPoints(new Point2DArray(new Point2D(0, getHeaderHeight() - 1.5), new Point2D(width, getHeaderHeight() - 1.5)));
            dividerLine2.setPoints(new Point2DArray(new Point2D(0, getHeaderHeight() + 0.5), new Point2D(width, getHeaderHeight() + 0.5)));
            g.add(dividerLine1);
            g.add(dividerLine2);
            rc.getGroup().add(g);
        }
    };
}
Also used : Line(com.ait.lienzo.client.core.shape.Line) Point2DArray(com.ait.lienzo.client.core.types.Point2DArray) Group(com.ait.lienzo.client.core.shape.Group) Point2D(com.ait.lienzo.client.core.types.Point2D)

Example 4 with Line

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

the class LienzoCanvasDecoratorFactoryTest method testAuthoringDecorator.

@Test
public void testAuthoringDecorator() {
    IPrimitive<?> decorator = LienzoCanvasDecoratorFactory.AUTHORING.apply(20, 33);
    assertNotNull(decorator);
    assertTrue(decorator instanceof Group);
    Group group = (Group) decorator;
    IPrimitive<?> child0 = group.getChildNodes().get(0);
    assertNotNull(child0);
    assertTrue(child0 instanceof Line);
    Line line0 = (Line) child0;
    assertFalse(line0.isDraggable());
    assertFalse(line0.isListening());
    assertEquals(0, line0.getFillAlpha(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_ALPHA, line0.getStrokeAlpha(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_AUTHORING_WIDTH, line0.getStrokeWidth(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_AUTHORING_COLOR, line0.getStrokeColor());
    IPrimitive<?> child1 = group.getChildNodes().get(1);
    assertNotNull(child1);
    assertTrue(child1 instanceof Line);
    Line line1 = (Line) child1;
    assertFalse(line1.isDraggable());
    assertFalse(line1.isListening());
    assertEquals(0, line1.getFillAlpha(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_ALPHA, line1.getStrokeAlpha(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_AUTHORING_WIDTH, line1.getStrokeWidth(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_AUTHORING_COLOR, line1.getStrokeColor());
}
Also used : Line(com.ait.lienzo.client.core.shape.Line) Group(com.ait.lienzo.client.core.shape.Group) Test(org.junit.Test)

Example 5 with Line

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

the class LienzoCanvasDecoratorFactoryTest method testPreviewDecorator.

@Test
public void testPreviewDecorator() {
    IPrimitive<?> decorator = LienzoCanvasDecoratorFactory.PREVIEW.apply(20, 33);
    assertNotNull(decorator);
    assertTrue(decorator instanceof Group);
    Group group = (Group) decorator;
    IPrimitive<?> child0 = group.getChildNodes().get(0);
    assertNotNull(child0);
    assertTrue(child0 instanceof Line);
    Line line0 = (Line) child0;
    assertFalse(line0.isDraggable());
    assertFalse(line0.isListening());
    assertEquals(0, line0.getFillAlpha(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_ALPHA, line0.getStrokeAlpha(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_PREVIEW_WIDTH, line0.getStrokeWidth(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_PREVIEW_COLOR, line0.getStrokeColor());
    IPrimitive<?> child1 = group.getChildNodes().get(1);
    assertNotNull(child1);
    assertTrue(child1 instanceof Line);
    Line line1 = (Line) child1;
    assertFalse(line1.isDraggable());
    assertFalse(line1.isListening());
    assertEquals(0, line1.getFillAlpha(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_ALPHA, line1.getStrokeAlpha(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_PREVIEW_WIDTH, line1.getStrokeWidth(), 0d);
    assertEquals(LienzoCanvasDecoratorFactory.DECORATOR_PREVIEW_COLOR, line1.getStrokeColor());
}
Also used : Line(com.ait.lienzo.client.core.shape.Line) Group(com.ait.lienzo.client.core.shape.Group) Test(org.junit.Test)

Aggregations

Line (com.ait.lienzo.client.core.shape.Line)5 Group (com.ait.lienzo.client.core.shape.Group)3 Test (org.junit.Test)2 GridLayer (com.ait.lienzo.client.core.shape.GridLayer)1 Point2D (com.ait.lienzo.client.core.types.Point2D)1 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)1 CanvasGrid (org.kie.workbench.common.stunner.core.client.canvas.CanvasGrid)1