Search in sources :

Example 6 with Layer

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

the class DMNGridPanelContextMenuHandlerTest method mockGridWidget.

private GridWidget mockGridWidget() {
    final GridWidget gridWidget = spy(new BaseGridWidget(new BaseGridData(false), selectionManager, pinnedModeManager, renderer) {

        @Override
        public Layer getLayer() {
            return gridLayer;
        }
    });
    final GridColumn gridColumn = mock(GridColumn.class);
    when(gridColumn.getWidth()).thenReturn(100.0);
    when(gridColumn.isVisible()).thenReturn(true);
    gridWidget.getModel().appendColumn(new RowNumberColumn());
    gridWidget.getModel().appendColumn(gridColumn);
    gridWidget.getModel().appendRow(new BaseGridRow());
    gridWidget.getModel().appendRow(new BaseGridRow());
    return gridWidget;
}
Also used : RowNumberColumn(org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn) BaseGridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidget) BaseGridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidget) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) DMNGridLayer(org.kie.workbench.common.dmn.client.widgets.layer.DMNGridLayer) Layer(com.ait.lienzo.client.core.shape.Layer)

Example 7 with Layer

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

the class CaseManagementContainmentControlTest method setup.

@Before
public void setup() {
    layer = spy(new Layer());
    shape = spy(new MockCaseManagementShape());
    final Group shapeGroup = mock(Group.class);
    when(shapeGroup.getLayer()).thenReturn(layer);
    when(shape.getGroup()).thenReturn(shapeGroup);
    when(shape.getWiresManager()).thenReturn(wiresManager);
    when(shape.getGhost()).thenReturn(ghost);
    when(wiresManager.getContainmentAcceptor()).thenReturn(containmentAcceptor);
    when(parentPickerControl.getPickerOptions()).thenReturn(PICKER_OPTIONS);
    when(parentPickerControl.getShapeLocationControl()).thenReturn(shapeLocationControl);
    when(containmentControl.getParentPickerControl()).thenReturn(parentPickerControl);
    when(containmentControl.getShape()).thenReturn(shape);
    when(containmentControl.getParent()).thenReturn(parent);
    final NFastArrayList<WiresShape> children = new NFastArrayList<>();
    children.add(shape);
    children.add(ghost);
    when(parent.getChildShapes()).thenReturn(children);
    when(parent.getLayoutHandler()).thenReturn(parentLayoutHandler);
    when(parent.getIndex(eq(shape))).thenReturn(0);
    when(parent.getGroup()).thenReturn(new Group());
    when(state.getGhost()).thenReturn(Optional.of(ghost));
    when(state.getOriginalParent()).thenReturn(Optional.of(parent));
    when(state.getOriginalIndex()).thenReturn(Optional.of(0));
    control = new CaseManagementContainmentControl(containmentControl, state);
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) NFastArrayList(com.ait.tooling.nativetools.client.collection.NFastArrayList) Layer(com.ait.lienzo.client.core.shape.Layer) Before(org.junit.Before)

Example 8 with Layer

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

the class WiresShapeToolboxTest method testGetLayer.

@Test
public void testGetLayer() {
    Layer layer = mock(Layer.class);
    when(group.getLayer()).thenReturn(layer);
    assertEquals(layer, tested.getLayer());
}
Also used : Layer(com.ait.lienzo.client.core.shape.Layer) Test(org.junit.Test)

Example 9 with Layer

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

the class PrimitivePopup method reset.

protected void reset() {
    this.clear();
    canvasLayer = new Layer();
    lienzoPanel = null;
}
Also used : Layer(com.ait.lienzo.client.core.shape.Layer)

Example 10 with Layer

use of com.ait.lienzo.client.core.shape.Layer 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)

Aggregations

Layer (com.ait.lienzo.client.core.shape.Layer)17 LienzoPanel (com.ait.lienzo.client.widget.LienzoPanel)7 Group (com.ait.lienzo.client.core.shape.Group)5 Test (org.junit.Test)4 TextMetrics (com.ait.lienzo.client.core.types.TextMetrics)3 WiresLayer (com.ait.lienzo.client.core.shape.wires.WiresLayer)2 GridWidget (org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget)2 RGBIgnoreAlphaImageDataFilter (com.ait.lienzo.client.core.image.filter.RGBIgnoreAlphaImageDataFilter)1 IPathClipper (com.ait.lienzo.client.core.shape.IPathClipper)1 Rectangle (com.ait.lienzo.client.core.shape.Rectangle)1 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)1 Point2D (com.ait.lienzo.client.core.types.Point2D)1 Transform (com.ait.lienzo.client.core.types.Transform)1 ColorName (com.ait.lienzo.shared.core.types.ColorName)1 NFastArrayList (com.ait.tooling.nativetools.client.collection.NFastArrayList)1 GWT (com.google.gwt.core.client.GWT)1 Command (com.google.gwt.user.client.Command)1 HashSet (java.util.HashSet)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1