Search in sources :

Example 41 with Group

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

the class ShapeGlyphDragHandlerImplTest method setUp.

@Before
public void setUp() throws Exception {
    shapeGlyphDragHandler = new ShapeGlyphDragHandlerImpl(glyphLienzoGlyphRenderer);
    when(item.getHeight()).thenReturn(0);
    when(item.getWidth()).thenReturn(0);
    when(item.getShape()).thenReturn(glyph);
    when(glyphLienzoGlyphRenderer.render(glyph, 0, 0)).thenReturn(new Group());
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Before(org.junit.Before)

Example 42 with Group

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

the class EditableHeaderGridWidgetMouseDoubleClickHandler method handleHeaderCellDoubleClick.

@Override
protected boolean handleHeaderCellDoubleClick(final NodeMouseDoubleClickEvent event) {
    // Convert Canvas co-ordinate to Grid co-ordinate
    final Point2D rp = CoordinateUtilities.convertDOMToGridCoordinate(gridWidget, new Point2D(event.getX(), event.getY()));
    final double cx = rp.getX();
    final double cy = rp.getY();
    final Group header = gridWidget.getHeader();
    final double headerRowsYOffset = getHeaderRowsYOffset();
    final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);
    final double headerMaxY = (header == null ? renderer.getHeaderHeight() : renderer.getHeaderHeight() + header.getY());
    if (cx < 0 || cx > gridWidget.getWidth()) {
        return false;
    }
    if (cy < headerMinY || cy > headerMaxY) {
        return false;
    }
    // Get column information
    final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
    final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation();
    if (ri == null) {
        return false;
    }
    final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(cx);
    final GridColumn<?> column = ci.getColumn();
    if (column == null) {
        return false;
    }
    if (!hasEditableHeader(column)) {
        return false;
    }
    // Get row index
    final Integer uiHeaderRowIndex = EditableHeaderUtilities.getUiHeaderRowIndex(gridWidget, column, cy);
    if (uiHeaderRowIndex == null) {
        return false;
    }
    if (!isEditableHeader(column, uiHeaderRowIndex)) {
        return false;
    }
    // Get rendering information
    final EditableHeaderMetaData headerMetaData = (EditableHeaderMetaData) column.getHeaderMetaData().get(uiHeaderRowIndex);
    final GridBodyCellEditContext context = EditableHeaderUtilities.makeRenderContext(gridWidget, ri, ci, rp, uiHeaderRowIndex);
    headerMetaData.edit(context);
    return true;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Point2D(com.ait.lienzo.client.core.types.Point2D) GridBodyCellEditContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext) BaseGridRendererHelper(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper)

Example 43 with Group

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

the class WiresConnector method setWiresConnectorHandler.

public void setWiresConnectorHandler(final HandlerRegistrationManager m_registrationManager, final WiresConnectorHandler handler) {
    final Group group = getGroup();
    m_registrationManager.register(group.addNodeDragStartHandler(handler));
    m_registrationManager.register(group.addNodeDragMoveHandler(handler));
    m_registrationManager.register(group.addNodeDragEndHandler(handler));
    m_wiresConnectorHandler = handler;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group)

Example 44 with Group

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

the class ExpressionEditorColumnRenderer method renderCell.

@Override
public Group renderCell(final GridCell<Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>>> cell, final GridBodyCellRenderContext context) {
    if (cell == null || cell.getValue() == null) {
        return null;
    }
    final Group g = GWT.create(Group.class);
    if (cell.getValue() != null && cell.getValue() instanceof ExpressionCellValue) {
        final ExpressionCellValue ecv = (ExpressionCellValue) cell.getValue();
        ecv.getValue().ifPresent(editor -> {
            g.add(editor.setX(editor.getPadding()).setY(editor.getPadding()));
            registry.register(editor);
        });
    }
    return g;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group)

Example 45 with Group

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

the class RendererUtils method getEditableHeaderText.

public static Group getEditableHeaderText(final EditableHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context, final double blockWidth, final double blockHeight) {
    final Group headerGroup = GWT.create(Group.class);
    final GridRenderer renderer = context.getRenderer();
    final GridRendererTheme theme = renderer.getTheme();
    final Text text = theme.getHeaderText();
    final String value = headerMetaData.getTitle();
    text.setX(blockWidth / 2);
    text.setY(blockHeight / 2);
    text.setText(value);
    text.setListening(false);
    headerGroup.add(text);
    return headerGroup;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) GridRendererTheme(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme) Text(com.ait.lienzo.client.core.shape.Text) GridRenderer(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)

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