Search in sources :

Example 11 with MultiPath

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

the class GuidedDecisionTableViewImpl method makeHeaderCaption.

private Group makeHeaderCaption() {
    final Group g = GWT.create(Group.class);
    final double captionWidth = ((GuidedDecisionTableRenderer) renderer).getHeaderCaptionWidth();
    final GuidedDecisionTableTheme theme = (GuidedDecisionTableTheme) renderer.getTheme();
    final Rectangle r = theme.getBaseRectangle(GuidedDecisionTableTheme.ModelColumnType.CAPTION);
    r.setWidth(captionWidth);
    r.setHeight(HEADER_CAPTION_HEIGHT);
    final MultiPath border = theme.getBodyGridLine();
    border.M(0.5, HEADER_CAPTION_HEIGHT + 0.5);
    border.L(0.5, 0.5);
    border.L(captionWidth + 0.5, 0.5);
    border.L(captionWidth + 0.5, HEADER_CAPTION_HEIGHT + 0.5);
    border.L(0.5, HEADER_CAPTION_HEIGHT + 0.5);
    final Text caption = theme.getHeaderText();
    caption.setText(model.getTableName());
    caption.setX(captionWidth / 2);
    caption.setY(HEADER_CAPTION_HEIGHT / 2);
    // Clip Caption Group
    final BoundingBox bb = new BoundingBox(0, 0, captionWidth + border.getStrokeWidth(), HEADER_CAPTION_HEIGHT + 0.5);
    final IPathClipper clipper = getPathClipper(bb);
    g.setPathClipper(clipper);
    clipper.setActive(true);
    g.add(r);
    g.add(caption);
    g.add(border);
    return g;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) MultiPath(com.ait.lienzo.client.core.shape.MultiPath) IPathClipper(com.ait.lienzo.client.core.shape.IPathClipper) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) GuidedDecisionTableTheme(org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableTheme) Text(com.ait.lienzo.client.core.shape.Text) GuidedDecisionTableRenderer(org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableRenderer)

Example 12 with MultiPath

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

the class GuidedDecisionTableRenderer method renderSelector.

@Override
public RendererCommand renderSelector(final double width, final double height, final BaseGridRendererHelper.RenderingInformation renderingInformation) {
    return (RenderSelectorCommand) (rc) -> {
        if (!rc.isSelectionLayer()) {
            final double captionWidth = getHeaderCaptionWidth();
            final Bounds bounds = getSelectorBounds(width, height, renderingInformation);
            final MultiPath selector = theme.getSelector().M(bounds.getX() + 0.5, bounds.getY() + 0.5).L(bounds.getX() + 0.5, height).L(width, height).L(width, bounds.getY() + GuidedDecisionTableViewImpl.HEADER_CAPTION_HEIGHT).L(bounds.getX() + captionWidth, bounds.getY() + GuidedDecisionTableViewImpl.HEADER_CAPTION_HEIGHT).L(bounds.getX() + captionWidth, bounds.getY() + 0.5).L(bounds.getX() + GuidedDecisionTableViewImpl.HEADER_CAPTION_WIDTH, bounds.getY() + 0.5).L(bounds.getX() + 0.5, bounds.getY() + 0.5).setListening(false);
            rc.getGroup().add(selector);
        }
    };
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) BaseBounds(org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds) Bounds(org.uberfire.ext.wires.core.grids.client.model.Bounds)

Example 13 with MultiPath

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

the class AssociationView method createLine.

private static Object[] createLine(final double x1, final double y1, final double x2, final double y2) {
    final MultiPath head = new MultiPath();
    final MultiPath tail = new MultiPath();
    final DirectionalLine line = new DirectionalLine(x1, y1, x2, y2);
    line.setDashArray(new DashArray(2, 6));
    line.setDraggable(true);
    line.setSelectionStrokeOffset(SELECTION_OFFSET);
    line.setHeadOffset(head.getBoundingBox().getHeight());
    line.setTailOffset(tail.getBoundingBox().getHeight());
    final MultiPathDecorator headDecorator = new MultiPathDecorator(head);
    final MultiPathDecorator tailDecorator = new MultiPathDecorator(tail);
    return new Object[] { line, headDecorator, tailDecorator };
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) MultiPathDecorator(com.ait.lienzo.client.core.shape.MultiPathDecorator) DashArray(com.ait.lienzo.client.core.types.DashArray)

Example 14 with MultiPath

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

the class KnowledgeRequirementView method createLine.

private static Object[] createLine(final double x1, final double y1, final double x2, final double y2) {
    final MultiPath head = new MultiPath();
    final MultiPath tail = new MultiPath().M(0, DECORATOR_HEIGHT).L(DECORATOR_WIDTH / 2, 0).L(DECORATOR_WIDTH, DECORATOR_HEIGHT).setFillColor(ColorName.BLACK).setFillAlpha(1);
    final DirectionalLine line = new DirectionalLine(x1, y1, x2, y2);
    line.setDashArray(new DashArray(4, 4));
    line.setDraggable(true);
    line.setSelectionStrokeOffset(SELECTION_OFFSET);
    line.setHeadOffset(head.getBoundingBox().getHeight());
    line.setTailOffset(tail.getBoundingBox().getHeight());
    final MultiPathDecorator headDecorator = new MultiPathDecorator(head);
    final MultiPathDecorator tailDecorator = new MultiPathDecorator(tail);
    return new Object[] { line, headDecorator, tailDecorator };
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) MultiPathDecorator(com.ait.lienzo.client.core.shape.MultiPathDecorator) DashArray(com.ait.lienzo.client.core.types.DashArray)

Example 15 with MultiPath

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

the class OrthogonalPolyLineConnectorViewTest method testCreateLine.

@Test
public void testCreateLine() {
    double[] points = new double[] { 0, 0, 10, 10 };
    OrthogonalPolyLineConnectorFactory factory = new OrthogonalPolyLineConnectorFactory();
    Object[] line = PolylineConnectorView.createLine(factory, ConnectorShapeDef.Direction.ONE, points);
    MultiPathDecorator head = (MultiPathDecorator) line[1];
    MultiPath headPath = head.getPath();
    BoundingBox headBoundingBox = headPath.getBoundingBox();
    MultiPathDecorator tail = (MultiPathDecorator) line[2];
    MultiPath tailPath = tail.getPath();
    BoundingBox tailBoundingBox = tailPath.getBoundingBox();
    assertEquals(0, headBoundingBox.getWidth(), 0);
    assertEquals(0, headBoundingBox.getHeight(), 0);
    assertNotEquals(0, tailBoundingBox.getWidth(), 0);
    assertNotEquals(0, tailBoundingBox.getHeight(), 0);
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) OrthogonalPolyLineConnectorFactory(org.kie.workbench.common.stunner.shapes.client.factory.OrthogonalPolyLineConnectorFactory) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) MultiPathDecorator(com.ait.lienzo.client.core.shape.MultiPathDecorator) Test(org.junit.Test)

Aggregations

MultiPath (com.ait.lienzo.client.core.shape.MultiPath)39 Test (org.junit.Test)16 WiresShapeView (org.kie.workbench.common.stunner.client.lienzo.shape.view.wires.WiresShapeView)10 MultiPathDecorator (com.ait.lienzo.client.core.shape.MultiPathDecorator)9 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)9 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)7 Point2D (com.ait.lienzo.client.core.types.Point2D)7 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)4 Before (org.junit.Before)4 Layer (com.ait.lienzo.client.core.shape.Layer)3 PickerPart (com.ait.lienzo.client.core.shape.wires.PickerPart)3 DashArray (com.ait.lienzo.client.core.types.DashArray)3 PictureShapeView (org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)3 Group (com.ait.lienzo.client.core.shape.Group)2 WiresConnection (com.ait.lienzo.client.core.shape.wires.WiresConnection)2 WiresConnector (com.ait.lienzo.client.core.shape.wires.WiresConnector)2 WiresMagnet (com.ait.lienzo.client.core.shape.wires.WiresMagnet)2 NFastArrayList (com.ait.tooling.nativetools.client.collection.NFastArrayList)2 SafeUri (com.google.gwt.safehtml.shared.SafeUri)2 Edge (org.kie.workbench.common.stunner.core.graph.Edge)2