Search in sources :

Example 1 with ActionsToolbox

use of org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox in project kie-wb-common by kiegroup.

the class MorphActionsToolboxView method configureDropDown.

private void configureDropDown(final ActionsToolbox toolbox) {
    final Point2DGrid grid = createFixedGrid(GRID_BUTTON_SIZE, GRID_BUTTON_PADDING, toolbox.size());
    final Group glyphView = renderGlyph(MORPH_BUTTON_GLYPH, BUTTON_SIZE);
    gridItem = getToolboxFactory().buttons().dropRight(glyphView).grid(grid).decorate(getToolboxFactory().decorators().button().setPadding(BUTTON_PADDING).configure(path -> path.setFillColor(ColorName.LIGHTGREY))).decorateGrid(getToolboxFactory().decorators().button().setPadding(GRID_DECORATOR_PADDING).configure(path -> path.setFillColor("#e6e6e6")));
    getToolboxView().add(gridItem);
}
Also used : Point2DGrid(org.kie.workbench.common.stunner.lienzo.toolbox.grid.Point2DGrid) ToolboxVisibilityExecutors(org.kie.workbench.common.stunner.lienzo.toolbox.ToolboxVisibilityExecutors) ColorName(com.ait.lienzo.shared.core.types.ColorName) ButtonItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem) FixedLayoutGrid(org.kie.workbench.common.stunner.lienzo.toolbox.grid.FixedLayoutGrid) Point2DGrid(org.kie.workbench.common.stunner.lienzo.toolbox.grid.Point2DGrid) ToolboxTextTooltip(org.kie.workbench.common.stunner.lienzo.toolbox.items.tooltip.ToolboxTextTooltip) Group(com.ait.lienzo.client.core.shape.Group) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) Inject(javax.inject.Inject) StunnerCommonImageResources(org.kie.workbench.common.stunner.core.client.resources.StunnerCommonImageResources) LienzoGlyphRenderers(org.kie.workbench.common.stunner.client.lienzo.components.glyph.LienzoGlyphRenderers) Dependent(javax.enterprise.context.Dependent) MorphActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.MorphActionsToolbox) ToolboxFactory(org.kie.workbench.common.stunner.lienzo.toolbox.items.impl.ToolboxFactory) Direction(com.ait.lienzo.shared.core.types.Direction) SvgDataUriGlyph(org.kie.workbench.common.stunner.core.client.shape.SvgDataUriGlyph) ButtonGridItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonGridItem) Group(com.ait.lienzo.client.core.shape.Group)

Example 2 with ActionsToolbox

use of org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox in project kie-wb-common by kiegroup.

the class DMNCommonActionsToolboxFactoryTest method testBuildToolboxForNoDecisionType.

@Test
@SuppressWarnings("unchecked")
public void testBuildToolboxForNoDecisionType() {
    final Optional<Toolbox<?>> _toolbox = tested.build(canvasHandler, element);
    assertTrue(_toolbox.isPresent());
    Toolbox<?> toolbox = _toolbox.get();
    assertTrue(toolbox instanceof ActionsToolbox);
    final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox;
    assertEquals(E_UUID, actionsToolbox.getElementUUID());
    assertEquals(1, actionsToolbox.size());
    assertEquals(deleteNodeAction, actionsToolbox.iterator().next());
    verify(view, times(1)).init(eq(actionsToolbox));
    verify(view, times(1)).addButton(any(Glyph.class), anyString(), any(Consumer.class));
}
Also used : Consumer(java.util.function.Consumer) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) Toolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.Toolbox) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) Test(org.junit.Test)

Example 3 with ActionsToolbox

use of org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox in project kie-wb-common by kiegroup.

the class DMNCommonActionsToolboxFactoryTest method testBuildToolboxForBusinessKnowledgeModelType.

@Test
@SuppressWarnings("unchecked")
public void testBuildToolboxForBusinessKnowledgeModelType() {
    final Node<View<BusinessKnowledgeModel>, Edge> bkmNode = new NodeImpl<>("bkmNode1");
    final BusinessKnowledgeModel bkm = new BusinessKnowledgeModel();
    final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
    final View<BusinessKnowledgeModel> nodeContent = new ViewImpl<>(bkm, bounds);
    bkmNode.setContent(nodeContent);
    final Optional<Toolbox<?>> _toolbox = tested.build(canvasHandler, bkmNode);
    assertTrue(_toolbox.isPresent());
    Toolbox<?> toolbox = _toolbox.get();
    assertTrue(toolbox instanceof ActionsToolbox);
    final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox;
    assertEquals("bkmNode1", actionsToolbox.getElementUUID());
    assertEquals(2, actionsToolbox.size());
    final Iterator<ToolboxAction> actionsIt = actionsToolbox.iterator();
    assertEquals(deleteNodeAction, actionsIt.next());
    assertEquals(editBusinessKnowledgeModelToolboxAction, actionsIt.next());
    assertFalse(actionsIt.hasNext());
    verify(view, times(1)).init(eq(actionsToolbox));
    verify(view, times(2)).addButton(any(Glyph.class), anyString(), any(Consumer.class));
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ActionsToolboxView(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolboxView) Consumer(java.util.function.Consumer) ToolboxAction(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ToolboxAction) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.v1_1.BusinessKnowledgeModel) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) Toolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.Toolbox) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Test(org.junit.Test)

Example 4 with ActionsToolbox

use of org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox in project kie-wb-common by kiegroup.

the class DMNCommonActionsToolboxFactoryTest method testBuildToolboxForDecisionType.

@Test
@SuppressWarnings("unchecked")
public void testBuildToolboxForDecisionType() {
    final Node<View<Decision>, Edge> decisionNode = new NodeImpl<>("decisionNode1");
    final Decision decision = new Decision();
    final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
    final View<Decision> nodeContent = new ViewImpl<>(decision, bounds);
    decisionNode.setContent(nodeContent);
    final Optional<Toolbox<?>> _toolbox = tested.build(canvasHandler, decisionNode);
    assertTrue(_toolbox.isPresent());
    Toolbox<?> toolbox = _toolbox.get();
    assertTrue(toolbox instanceof ActionsToolbox);
    final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox;
    assertEquals("decisionNode1", actionsToolbox.getElementUUID());
    assertEquals(2, actionsToolbox.size());
    final Iterator<ToolboxAction> actionsIt = actionsToolbox.iterator();
    assertEquals(deleteNodeAction, actionsIt.next());
    assertEquals(editDecisionToolboxAction, actionsIt.next());
    assertFalse(actionsIt.hasNext());
    verify(view, times(1)).init(eq(actionsToolbox));
    verify(view, times(2)).addButton(any(Glyph.class), anyString(), any(Consumer.class));
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ActionsToolboxView(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolboxView) Decision(org.kie.workbench.common.dmn.api.definition.v1_1.Decision) Consumer(java.util.function.Consumer) ToolboxAction(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ToolboxAction) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) Toolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.Toolbox) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Test(org.junit.Test)

Example 5 with ActionsToolbox

use of org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox in project kie-wb-common by kiegroup.

the class DMNFlowActionsToolboxFactoryTest method testBuildToolbox.

@Test
@SuppressWarnings("unchecked")
public void testBuildToolbox() {
    final Optional<Toolbox<?>> toolbox = tested.build(canvasHandler, element);
    assertTrue(toolbox.isPresent());
    assertTrue(toolbox.get() instanceof ActionsToolbox);
    final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox.get();
    assertEquals(E_UUID, actionsToolbox.getElementUUID());
    assertEquals(2, actionsToolbox.size());
    final Iterator actionIt = actionsToolbox.iterator();
    assertEquals(createConnectorAction, actionIt.next());
    assertEquals(createNodeAction, actionIt.next());
    verify(createConnectorAction, times(1)).setEdgeId(eq(EDGE_ID));
    verify(createNodeAction, times(1)).setEdgeId(eq(EDGE_ID));
    verify(createNodeAction, times(1)).setNodeId(eq(NODE_ID));
    verify(view, times(1)).init(eq(actionsToolbox));
    verify(view, times(2)).addButton(any(Glyph.class), anyString(), any(Consumer.class));
}
Also used : Consumer(java.util.function.Consumer) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) Toolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.Toolbox) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) Iterator(java.util.Iterator) Test(org.junit.Test)

Aggregations

ActionsToolbox (org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox)5 Consumer (java.util.function.Consumer)4 Test (org.junit.Test)4 Toolbox (org.kie.workbench.common.stunner.core.client.components.toolbox.Toolbox)4 Glyph (org.kie.workbench.common.stunner.core.definition.shape.Glyph)4 ActionsToolboxView (org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolboxView)2 ToolboxAction (org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ToolboxAction)2 Edge (org.kie.workbench.common.stunner.core.graph.Edge)2 Bounds (org.kie.workbench.common.stunner.core.graph.content.Bounds)2 BoundImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl)2 BoundsImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl)2 View (org.kie.workbench.common.stunner.core.graph.content.view.View)2 ViewImpl (org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl)2 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)2 Group (com.ait.lienzo.client.core.shape.Group)1 ColorName (com.ait.lienzo.shared.core.types.ColorName)1 Direction (com.ait.lienzo.shared.core.types.Direction)1 Iterator (java.util.Iterator)1 Dependent (javax.enterprise.context.Dependent)1 Inject (javax.inject.Inject)1