Search in sources :

Example 1 with Point2DGrid

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

the class ButtonGridItemImplTest method testGrid.

@Test
public void testGrid() {
    Point2DGrid grid = mock(Point2DGrid.class);
    ButtonGridItemImpl cascade = tested.grid(grid);
    assertEquals(tested, cascade);
    verify(toolbox, times(1)).grid(eq(grid));
}
Also used : Point2DGrid(org.kie.workbench.common.stunner.lienzo.toolbox.grid.Point2DGrid) Test(org.junit.Test)

Example 2 with Point2DGrid

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

the class ToolboxImplTest method testGrid.

@Test
public void testGrid() {
    Point2DGrid grid = mock(Point2DGrid.class);
    when(wrapped.getGrid()).thenReturn(grid);
    ToolboxImpl cascade = tested.grid(grid);
    assertEquals(tested, cascade);
    verify(wrapped, times(1)).grid(eq(grid));
}
Also used : Point2DGrid(org.kie.workbench.common.stunner.lienzo.toolbox.grid.Point2DGrid) Test(org.junit.Test)

Example 3 with Point2DGrid

use of org.kie.workbench.common.stunner.lienzo.toolbox.grid.Point2DGrid 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 4 with Point2DGrid

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

the class MorphActionsToolboxViewTest method assertConfigureButtonGridItem.

private void assertConfigureButtonGridItem() {
    final ArgumentCaptor<Point2DGrid> gridCaptor = ArgumentCaptor.forClass(Point2DGrid.class);
    verify(buttonGridItem, times(1)).grid(gridCaptor.capture());
    final FixedLayoutGrid grid = (FixedLayoutGrid) gridCaptor.getValue();
    assertEquals(1, grid.getRows());
    assertEquals(2, grid.getCols());
    assertEquals(AbstractActionsToolboxView.BUTTON_SIZE, grid.getIconSize(), 0);
    assertEquals(AbstractActionsToolboxView.BUTTON_PADDING, grid.getPadding(), 0);
    verify(buttonGridItem, times(1)).decorate(eq(buttonDecorator));
    verify(buttonGridItem, times(1)).decorateGrid(eq(buttonDecorator));
    verify(toolboxView, times(1)).add(eq(buttonGridItem));
}
Also used : Point2DGrid(org.kie.workbench.common.stunner.lienzo.toolbox.grid.Point2DGrid) FixedLayoutGrid(org.kie.workbench.common.stunner.lienzo.toolbox.grid.FixedLayoutGrid)

Example 5 with Point2DGrid

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

the class WiresShapeToolboxTest method testGrid.

@Test
public void testGrid() {
    Point2DGrid grid = mock(Point2DGrid.class);
    when(toolbox.getAt()).thenReturn(Direction.EAST);
    when(toolbox.getGrid()).thenReturn(grid);
    WiresShapeToolbox cascade = tested.grid(grid);
    assertEquals(tested, cascade);
    verify(toolbox, times(1)).grid(eq(grid));
}
Also used : Point2DGrid(org.kie.workbench.common.stunner.lienzo.toolbox.grid.Point2DGrid) Test(org.junit.Test)

Aggregations

Point2DGrid (org.kie.workbench.common.stunner.lienzo.toolbox.grid.Point2DGrid)8 Test (org.junit.Test)5 FixedLayoutGrid (org.kie.workbench.common.stunner.lienzo.toolbox.grid.FixedLayoutGrid)3 AutoGrid (org.kie.workbench.common.stunner.lienzo.toolbox.grid.AutoGrid)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 Dependent (javax.enterprise.context.Dependent)1 Inject (javax.inject.Inject)1 LienzoGlyphRenderers (org.kie.workbench.common.stunner.client.lienzo.components.glyph.LienzoGlyphRenderers)1 ActionsToolbox (org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox)1 MorphActionsToolbox (org.kie.workbench.common.stunner.core.client.components.toolbox.actions.MorphActionsToolbox)1 StunnerCommonImageResources (org.kie.workbench.common.stunner.core.client.resources.StunnerCommonImageResources)1 SvgDataUriGlyph (org.kie.workbench.common.stunner.core.client.shape.SvgDataUriGlyph)1 ToolboxVisibilityExecutors (org.kie.workbench.common.stunner.lienzo.toolbox.ToolboxVisibilityExecutors)1 ButtonGridItem (org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonGridItem)1 ButtonItem (org.kie.workbench.common.stunner.lienzo.toolbox.items.ButtonItem)1 ToolboxFactory (org.kie.workbench.common.stunner.lienzo.toolbox.items.impl.ToolboxFactory)1 ToolboxTextTooltip (org.kie.workbench.common.stunner.lienzo.toolbox.items.tooltip.ToolboxTextTooltip)1