Search in sources :

Example 6 with LienzoPanel

use of com.ait.lienzo.client.widget.LienzoPanel in project kie-wb-common by kiegroup.

the class ShapeGlyphDragHandlerImpl method show.

@Override
public DragProxy<AbstractCanvas, Item, DragProxyCallback> show(Item item, int x, int y, DragProxyCallback dragProxyCallback) {
    int width = item.getWidth();
    int height = item.getHeight();
    final Group dragShape = glyphLienzoGlyphRenderer.render(item.getShape(), width, height);
    dragShape.setX(0);
    dragShape.setY(0);
    this.dragProxyPanel = new LienzoPanel((width * 2), (height * 2));
    dragProxyPanel.getElement().getStyle().setCursor(Style.Cursor.AUTO);
    final Layer dragProxyLayer = new Layer();
    dragProxyLayer.add(dragShape);
    dragProxyPanel.add(dragProxyLayer);
    dragProxyLayer.batch();
    setDragProxyPosition(dragProxyPanel, width, height, x, y);
    attachDragProxyHandlers(dragProxyPanel, dragProxyCallback);
    addKeyboardEscHandler();
    RootPanel.get().add(dragProxyPanel);
    return this;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) LienzoPanel(com.ait.lienzo.client.widget.LienzoPanel) Layer(com.ait.lienzo.client.core.shape.Layer)

Example 7 with LienzoPanel

use of com.ait.lienzo.client.widget.LienzoPanel in project kie-wb-common by kiegroup.

the class WiresCanvasViewTest method setup.

@Before
public void setup() {
    this.wiresManagerFactory = spy(new WiresManagerFactoryImpl(new StunnerWiresControlFactory(), new StunnerWiresHandlerFactory()));
    this.canvas = new WiresCanvasView(this.wiresManagerFactory);
    this.panel = new LienzoPanel(100, 100);
    this.layer = new LienzoLayer();
    this.canvas.init();
    this.canvas.show(panel, 100, 100, layer);
}
Also used : LienzoLayer(org.kie.workbench.common.stunner.client.lienzo.canvas.LienzoLayer) LienzoPanel(com.ait.lienzo.client.widget.LienzoPanel) StunnerWiresControlFactory(org.kie.workbench.common.stunner.client.lienzo.wires.StunnerWiresControlFactory) StunnerWiresHandlerFactory(org.kie.workbench.common.stunner.client.lienzo.wires.StunnerWiresHandlerFactory) WiresManagerFactoryImpl(org.kie.workbench.common.stunner.client.lienzo.wires.WiresManagerFactoryImpl) Before(org.junit.Before)

Example 8 with LienzoPanel

use of com.ait.lienzo.client.widget.LienzoPanel in project kie-wb-common by kiegroup.

the class LienzoElementGlyphRenderer method newPanel.

private LienzoPanel newPanel(final G glyph, final int width, final int height) {
    final Group glyphGroup = getLienzoGlyphRenderer().render(glyph, width, height);
    final LienzoPanel panel = new LienzoPanel(width, height);
    final Layer layer = new Layer();
    panel.add(layer.setTransformable(true));
    layer.add(glyphGroup);
    return panel;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) LienzoPanel(com.ait.lienzo.client.widget.LienzoPanel) Layer(com.ait.lienzo.client.core.shape.Layer)

Example 9 with LienzoPanel

use of com.ait.lienzo.client.widget.LienzoPanel in project drools-wb by kiegroup.

the class NodeLabel method setLabel.

public void setLabel(final String label) {
    final Layer scratchLayer = new Layer();
    final LienzoPanel scratchPanel = new LienzoPanel(100, 100);
    scratchPanel.add(scratchLayer);
    text.setText(label);
    final TextMetrics tm = text.measure(scratchLayer.getContext());
    final double cw = tm.getWidth() + 10;
    final double ch = tm.getHeight() + 10;
    container.setWidth(cw);
    container.setHeight(ch);
    container.setLocation(new Point2D(-cw / 2, -ch / 2));
}
Also used : LienzoPanel(com.ait.lienzo.client.widget.LienzoPanel) Point2D(com.ait.lienzo.client.core.types.Point2D) TextMetrics(com.ait.lienzo.client.core.types.TextMetrics) Layer(com.ait.lienzo.client.core.shape.Layer)

Example 10 with LienzoPanel

use of com.ait.lienzo.client.widget.LienzoPanel in project drools-wb by kiegroup.

the class BaseGuidedDecisionTreeNodeFactory method getDragProxyWidth.

private double getDragProxyWidth(final Text nodeLabel) {
    final LienzoPanel panel = new LienzoPanel(100, 100);
    final Layer layer = new Layer();
    panel.add(layer);
    final TextMetrics tm = nodeLabel.measure(layer.getContext());
    return Math.max(getWidth(), tm.getWidth());
}
Also used : LienzoPanel(com.ait.lienzo.client.widget.LienzoPanel) TextMetrics(com.ait.lienzo.client.core.types.TextMetrics) Layer(com.ait.lienzo.client.core.shape.Layer)

Aggregations

LienzoPanel (com.ait.lienzo.client.widget.LienzoPanel)10 Layer (com.ait.lienzo.client.core.shape.Layer)7 Group (com.ait.lienzo.client.core.shape.Group)3 TextMetrics (com.ait.lienzo.client.core.types.TextMetrics)3 Point2D (com.ait.lienzo.client.core.types.Point2D)1 Before (org.junit.Before)1 LienzoLayer (org.kie.workbench.common.stunner.client.lienzo.canvas.LienzoLayer)1 StunnerWiresControlFactory (org.kie.workbench.common.stunner.client.lienzo.wires.StunnerWiresControlFactory)1 StunnerWiresHandlerFactory (org.kie.workbench.common.stunner.client.lienzo.wires.StunnerWiresHandlerFactory)1 WiresManagerFactoryImpl (org.kie.workbench.common.stunner.client.lienzo.wires.WiresManagerFactoryImpl)1 WidgetElementRendererView (org.kie.workbench.common.stunner.core.client.components.views.WidgetElementRendererView)1 FocusableLienzoPanel (org.uberfire.ext.wires.core.client.canvas.FocusableLienzoPanel)1 PaletteShape (org.uberfire.ext.wires.core.client.palette.PaletteShape)1