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