Search in sources :

Example 1 with ButtonItem

use of com.ait.lienzo.client.core.shape.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(com.ait.lienzo.client.core.shape.toolbox.items.ButtonItem) Test(org.junit.Test)

Example 2 with ButtonItem

use of com.ait.lienzo.client.core.shape.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(com.ait.lienzo.client.core.shape.toolbox.items.ButtonItem) Test(org.junit.Test)

Example 3 with ButtonItem

use of com.ait.lienzo.client.core.shape.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(com.ait.lienzo.client.core.shape.toolbox.items.ButtonItem) Test(org.junit.Test)

Example 4 with ButtonItem

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

the class AbstractActionsToolboxView method addButton.

ButtonItem addButton(final Glyph glyph, final String title) {
    final ButtonItem button = toolboxFactory.buttons().button(renderGlyph(glyph, getGlyphSize())).decorate(createDecorator()).tooltip(tooltip.createItem(title)).onMouseEnter(event -> onMouseEnter()).onMouseExit(event -> onMouseExit());
    addButton(button);
    return button;
}
Also used : IsToolboxActionDraggable(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.IsToolboxActionDraggable) ToolboxAction(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ToolboxAction) ToolboxTextTooltip(com.ait.lienzo.client.core.shape.toolbox.items.tooltip.ToolboxTextTooltip) Text(com.ait.lienzo.client.core.shape.Text) Group(com.ait.lienzo.client.core.shape.Group) AbstractCanvas(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas) MouseMoveEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseMoveEvent) BoxDecorator(com.ait.lienzo.client.core.shape.toolbox.items.decorator.BoxDecorator) WiresCanvas(org.kie.workbench.common.stunner.client.lienzo.canvas.wires.WiresCanvas) AbstractNodeMouseEvent(com.ait.lienzo.client.core.event.AbstractNodeMouseEvent) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) 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) WiresShapeToolbox(com.ait.lienzo.client.core.shape.toolbox.items.impl.WiresShapeToolbox) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) ActionsToolboxView(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolboxView) Optional(java.util.Optional) WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) ButtonItem(com.ait.lienzo.client.core.shape.toolbox.items.ButtonItem) ToolboxFactory(com.ait.lienzo.client.core.shape.toolbox.items.impl.ToolboxFactory) ButtonItem(com.ait.lienzo.client.core.shape.toolbox.items.ButtonItem)

Example 5 with ButtonItem

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

the class AbstractActionsToolboxView method initButtons.

@SuppressWarnings("unchecked")
private void initButtons(final ActionsToolbox<ActionsToolboxView<?>> toolbox) {
    for (ToolboxAction toolboxAction : toolbox) {
        final ButtonItem button = addButton(toolbox.getGlyph(toolboxAction), toolbox.getTitle(toolboxAction));
        button.onClick(event -> {
            onButtonClick(toolbox, toolboxAction, button, event);
        });
        if (toolboxAction instanceof IsToolboxActionDraggable) {
            button.onMoveStart(event -> {
                onButtonMoveStart(toolbox, (IsToolboxActionDraggable) toolboxAction, button, event);
            });
        }
    }
}
Also used : ToolboxAction(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ToolboxAction) ButtonItem(com.ait.lienzo.client.core.shape.toolbox.items.ButtonItem) IsToolboxActionDraggable(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.IsToolboxActionDraggable)

Aggregations

ButtonItem (com.ait.lienzo.client.core.shape.toolbox.items.ButtonItem)5 Test (org.junit.Test)3 IsToolboxActionDraggable (org.kie.workbench.common.stunner.core.client.components.toolbox.actions.IsToolboxActionDraggable)2 ToolboxAction (org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ToolboxAction)2 AbstractNodeMouseEvent (com.ait.lienzo.client.core.event.AbstractNodeMouseEvent)1 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 BoxDecorator (com.ait.lienzo.client.core.shape.toolbox.items.decorator.BoxDecorator)1 ToolboxFactory (com.ait.lienzo.client.core.shape.toolbox.items.impl.ToolboxFactory)1 WiresShapeToolbox (com.ait.lienzo.client.core.shape.toolbox.items.impl.WiresShapeToolbox)1 ToolboxTextTooltip (com.ait.lienzo.client.core.shape.toolbox.items.tooltip.ToolboxTextTooltip)1 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)1 Optional (java.util.Optional)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