Search in sources :

Example 11 with Group

use of com.ait.lienzo.client.core.shape.Group in project lienzo-core by ahome-it.

the class AlignAndDistributeControlImpl method removeChildrenIfIndexed.

public void removeChildrenIfIndexed(final IPrimitive<?> prim, final List<ShapePair> pairs) {
    for (final IPrimitive<?> child : prim.asGroup().getChildNodes()) {
        final AlignAndDistributeControl handler = m_alignAndDistribute.getControlForShape(child.uuid());
        if (handler != null) {
            final ShapePair pair = new ShapePair(prim.asGroup(), child, handler);
            pairs.add(pair);
            prim.asGroup().remove(child);
        }
        if (child instanceof Group) {
            removeChildrenIfIndexed(child.asGroup(), pairs);
        }
    }
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) AlignAndDistributeControl(com.ait.lienzo.client.core.shape.wires.handlers.AlignAndDistributeControl)

Example 12 with Group

use of com.ait.lienzo.client.core.shape.Group 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 13 with Group

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

the class FunctionColumnRenderer method renderHeaderContent.

@Override
public Group renderHeaderContent(final List<GridColumn.HeaderMetaData> headerMetaData, final GridHeaderColumnRenderContext context, final int headerRowIndex, final double blockWidth, final double rowHeight) {
    final Group headerGroup = GWT.create(Group.class);
    if (headerRowIndex >= headerMetaData.size()) {
        return headerGroup;
    }
    final GridColumn.HeaderMetaData headerRowMetaData = headerMetaData.get(headerRowIndex);
    if (headerRowMetaData instanceof EditableHeaderMetaData) {
        final EditableHeaderMetaData editableHeaderMetaData = (EditableHeaderMetaData) headerRowMetaData;
        return editableHeaderMetaData.render(context, blockWidth, rowHeight);
    }
    return super.renderHeaderContent(headerMetaData, context, headerRowIndex, blockWidth, rowHeight);
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) EditableHeaderMetaData(org.kie.workbench.common.dmn.client.widgets.grid.columns.EditableHeaderMetaData)

Example 14 with Group

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

the class RendererUtils method getNameAndDataTypeText.

private static Group getNameAndDataTypeText(final GridRendererTheme theme, final String name, final QName typeRef, final double blockWidth, final double blockHeight) {
    final Group headerGroup = GWT.create(Group.class);
    final Text tName = theme.getHeaderText();
    tName.setText(name);
    tName.setListening(false);
    tName.setX(blockWidth / 2);
    tName.setY(blockHeight / 2 - SPACING);
    final Text tTypeRef = theme.getHeaderText();
    tTypeRef.setFontStyle(FONT_STYLE_TYPE_REF);
    tTypeRef.setFontSize(BaseExpressionGridTheme.FONT_SIZE - 2.0);
    tTypeRef.setText("(" + typeRef.toString() + ")");
    tTypeRef.setListening(false);
    tTypeRef.setX(blockWidth / 2);
    tTypeRef.setY(blockHeight / 2 + SPACING);
    headerGroup.add(tName);
    headerGroup.add(tTypeRef);
    return headerGroup;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Text(com.ait.lienzo.client.core.shape.Text)

Example 15 with Group

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

the class RendererUtils method getExpressionText.

private static Group getExpressionText(final GridRendererTheme theme, final String text) {
    final Group g = GWT.create(Group.class);
    final Text t = makeExpressionText(theme);
    t.setText(text);
    t.setListening(false);
    t.setX(EXPRESSION_TEXT_PADDING);
    t.setY(EXPRESSION_TEXT_PADDING);
    t.setTextAlign(TextAlign.LEFT);
    t.setWrapper(new TextLineBreakWrap(t));
    g.add(t);
    return g;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Text(com.ait.lienzo.client.core.shape.Text) TextLineBreakWrap(com.ait.lienzo.client.core.shape.TextLineBreakWrap)

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