Search in sources :

Example 36 with Group

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

the class ColumnHeaderPopOverHandler method isMouseOverTableHeader.

private boolean isMouseOverTableHeader(final GridWidget gridWidget, final double cy) {
    final Group header = gridWidget.getHeader();
    final GridRenderer renderer = gridWidget.getRenderer();
    final double headerHeight = renderer.getHeaderHeight();
    final double headerRowsYOffset = getHeaderRowsYOffset(gridWidget);
    final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);
    final double headerMaxY = (header == null ? headerHeight : headerHeight + header.getY());
    return headerMinY < cy && cy < headerMaxY;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) GridRenderer(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)

Example 37 with Group

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

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

the class GroupItemTest method testShow.

@Test
public void testShow() {
    when(group.getAlpha()).thenReturn(0d);
    final Command before = mock(Command.class);
    final Command after = mock(Command.class);
    tested.show(before, after);
    verify(before, times(1)).execute();
    verify(showExecutor, times(1)).accept(eq(group), eq(after));
    verify(hideExecutor, never()).accept(any(Group.class), any(Command.class));
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Example 39 with Group

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

the class ItemImplTest method testFocusExecutorDoingFocus.

@Test
public void testFocusExecutorDoingFocus() {
    final AbstractDecoratorItem decorator = mock(AbstractDecoratorItem.class);
    final Group decPrimitive = mock(Group.class);
    when(decorator.asPrimitive()).thenReturn(decPrimitive);
    final TooltipItem<?> tooltip = mock(TooltipItem.class);
    tested = new ItemImpl(groupItem, shape).setFocusDelay(0).setUnFocusDelay(0).decorate(decorator).tooltip(tooltip);
    final AbstractFocusableGroupItem<ItemImpl>.FocusGroupExecutor focusExecutor = spy(tested.getFocusGroupExecutor());
    doAnswer(invocationOnMock -> {
        ((Command) invocationOnMock.getArguments()[1]).execute();
        return null;
    }).when(focusExecutor).accept(any(Group.class), any(Command.class));
    focusExecutor.focus();
    verify(focusExecutor, times(1)).setAlpha(AbstractFocusableGroupItem.ALPHA_FOCUSED);
    verify(decorator, times(1)).show();
    verify(decPrimitive, times(1)).moveToBottom();
    verify(tooltip, times(1)).show();
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Command(org.uberfire.mvp.Command) AbstractDecoratorItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.AbstractDecoratorItem) Test(org.junit.Test)

Example 40 with Group

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

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