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;
}
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);
}
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));
}
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();
}
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;
}
Aggregations