Search in sources :

Example 1 with ButtonItem

use of org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem in project kie-wb-common by kiegroup.

the class CommonActionsToolboxViewTest method testAddButtonIntoParent.

@Test
@SuppressWarnings("unchecked")
public void testAddButtonIntoParent() {
    doInit();
    final ButtonItem buttonItem = mock(ButtonItem.class);
    tested.addButton(buttonItem);
    verify(toolboxView, times(1)).add(eq(buttonItem));
}
Also used : ButtonItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem) Test(org.junit.Test)

Example 2 with ButtonItem

use of org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem in project kie-wb-common by kiegroup.

the class AbstractActionsToolboxView method addButton.

@Override
public V addButton(Glyph glyph, String title, Consumer<MouseClickEvent> clickEventConsumer) {
    final ButtonItem button = toolboxFactory.buttons().button(renderGlyph(glyph, getGlyphSize())).decorate(createDecorator()).tooltip(tooltip.createItem(title)).onMouseEnter(event -> onMouseEnter()).onMouseExit(event -> onMouseExit()).onClick(event -> clickEventConsumer.accept(new MouseClickEvent(event.getX(), event.getY(), event.getMouseEvent().getClientX(), event.getMouseEvent().getClientY())));
    addButton(button);
    return cast();
}
Also used : ButtonItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem) DecoratorItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.DecoratorItem) Text(com.ait.lienzo.client.core.shape.Text) ToolboxTextTooltip(org.kie.workbench.common.stunner.lienzo.toolbox.items.tooltip.ToolboxTextTooltip) Group(com.ait.lienzo.client.core.shape.Group) AbstractCanvas(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas) WiresCanvas(org.kie.workbench.common.stunner.client.lienzo.canvas.wires.WiresCanvas) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) Consumer(java.util.function.Consumer) MouseClickEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent) Layer(com.ait.lienzo.client.core.shape.Layer) LienzoGlyphRenderers(org.kie.workbench.common.stunner.client.lienzo.components.glyph.LienzoGlyphRenderers) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) ActionsToolboxView(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolboxView) WiresShapeToolbox(org.kie.workbench.common.stunner.lienzo.toolbox.items.impl.WiresShapeToolbox) ToolboxFactory(org.kie.workbench.common.stunner.lienzo.toolbox.items.impl.ToolboxFactory) WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) ButtonItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem) MouseClickEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent)

Example 3 with ButtonItem

use of org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem in project kie-wb-common by kiegroup.

the class FlowActionsToolboxViewTest method testAddButtonIntoParent.

@Test
@SuppressWarnings("unchecked")
public void testAddButtonIntoParent() {
    doInit();
    final ButtonItem buttonItem = mock(ButtonItem.class);
    tested.addButton(buttonItem);
    verify(toolboxView, times(1)).add(eq(buttonItem));
}
Also used : ButtonItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem) Test(org.junit.Test)

Example 4 with ButtonItem

use of org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem in project kie-wb-common by kiegroup.

the class MorphActionsToolboxViewTest method testAddButtonIntoParent.

@Test
@SuppressWarnings("unchecked")
public void testAddButtonIntoParent() {
    doInit();
    final ButtonItem buttonItem = mock(ButtonItem.class);
    tested.addButton(buttonItem);
    verify(toolboxView, times(1)).add(eq(buttonGridItem));
    verify(buttonGridItem, times(1)).add(buttonItem);
}
Also used : ButtonItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem) Test(org.junit.Test)

Aggregations

ButtonItem (org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem)4 Test (org.junit.Test)3 Group (com.ait.lienzo.client.core.shape.Group)1 Layer (com.ait.lienzo.client.core.shape.Layer)1 Text (com.ait.lienzo.client.core.shape.Text)1 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)1 Consumer (java.util.function.Consumer)1 WiresCanvas (org.kie.workbench.common.stunner.client.lienzo.canvas.wires.WiresCanvas)1 LienzoGlyphRenderers (org.kie.workbench.common.stunner.client.lienzo.components.glyph.LienzoGlyphRenderers)1 AbstractCanvas (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas)1 ActionsToolbox (org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox)1 ActionsToolboxView (org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolboxView)1 MouseClickEvent (org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent)1 Glyph (org.kie.workbench.common.stunner.core.definition.shape.Glyph)1 DecoratorItem (org.kie.workbench.common.stunner.lienzo.toolbox.items.DecoratorItem)1 ToolboxFactory (org.kie.workbench.common.stunner.lienzo.toolbox.items.impl.ToolboxFactory)1 WiresShapeToolbox (org.kie.workbench.common.stunner.lienzo.toolbox.items.impl.WiresShapeToolbox)1 ToolboxTextTooltip (org.kie.workbench.common.stunner.lienzo.toolbox.items.tooltip.ToolboxTextTooltip)1