Search in sources :

Example 1 with Point2DGrid

use of com.ait.lienzo.client.core.shape.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(StunnerCommonIconsGlyphFactory.GEARS, 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(com.ait.lienzo.client.core.shape.toolbox.grid.Point2DGrid) Point2DGrid(com.ait.lienzo.client.core.shape.toolbox.grid.Point2DGrid) ButtonGridItem(com.ait.lienzo.client.core.shape.toolbox.items.ButtonGridItem) ColorName(com.ait.lienzo.shared.core.types.ColorName) ToolboxTextTooltip(com.ait.lienzo.client.core.shape.toolbox.items.tooltip.ToolboxTextTooltip) Group(com.ait.lienzo.client.core.shape.Group) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) StunnerCommonIconsGlyphFactory(org.kie.workbench.common.stunner.core.client.resources.StunnerCommonIconsGlyphFactory) Inject(javax.inject.Inject) FixedLayoutGrid(com.ait.lienzo.client.core.shape.toolbox.grid.FixedLayoutGrid) 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) Direction(com.ait.lienzo.shared.core.types.Direction) ToolboxVisibilityExecutors(com.ait.lienzo.client.core.shape.toolbox.ToolboxVisibilityExecutors) ButtonItem(com.ait.lienzo.client.core.shape.toolbox.items.ButtonItem) ToolboxFactory(com.ait.lienzo.client.core.shape.toolbox.items.impl.ToolboxFactory) Group(com.ait.lienzo.client.core.shape.Group)

Example 2 with Point2DGrid

use of com.ait.lienzo.client.core.shape.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(com.ait.lienzo.client.core.shape.toolbox.grid.Point2DGrid) FixedLayoutGrid(com.ait.lienzo.client.core.shape.toolbox.grid.FixedLayoutGrid)

Example 3 with Point2DGrid

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

the class CommonActionsToolboxViewTest method testInit.

@Test
public void testInit() {
    final CommonActionsToolboxView cascade = doInit();
    assertEquals(tested, cascade);
    verify(toolboxFactory, times(1)).forWiresShape(eq(shape));
    verify(toolboxView, times(1)).attachTo(eq(topLayer));
    // Verify toolbox settings.
    verify(toolboxView, times(1)).at(eq(CommonActionsToolboxView.TOOLBOX_AT));
    final ArgumentCaptor<Point2DGrid> gridCaptor = ArgumentCaptor.forClass(Point2DGrid.class);
    verify(toolboxView, times(1)).grid(gridCaptor.capture());
    final AutoGrid grid = (AutoGrid) gridCaptor.getValue();
    assertEquals(AbstractActionsToolboxView.BUTTON_SIZE, grid.getIconSize(), 0);
    assertEquals(AbstractActionsToolboxView.BUTTON_PADDING, grid.getPadding(), 0);
    assertEquals(CommonActionsToolboxView.GRID_TOWARDS, grid.getDirection());
    // Verify toolbip.
    verify(toolboxTooltip, times(1)).at(CommonActionsToolboxView.TOOLTIP_AT);
    verify(toolboxTooltip, times(1)).towards(CommonActionsToolboxView.TOOLTIP_TOWARDS);
}
Also used : Point2DGrid(com.ait.lienzo.client.core.shape.toolbox.grid.Point2DGrid) AutoGrid(com.ait.lienzo.client.core.shape.toolbox.grid.AutoGrid) Test(org.junit.Test)

Example 4 with Point2DGrid

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

the class MorphActionsToolboxViewTest method assertConfigureToolbox.

private void assertConfigureToolbox() {
    verify(toolboxView, times(1)).at(eq(MorphActionsToolboxView.TOOLBOX_AT));
    final ArgumentCaptor<Point2DGrid> gridCaptor = ArgumentCaptor.forClass(Point2DGrid.class);
    verify(toolboxView, times(1)).grid(gridCaptor.capture());
    final FixedLayoutGrid grid = (FixedLayoutGrid) gridCaptor.getValue();
    assertEquals(1, grid.getRows());
    assertEquals(1, grid.getCols());
    assertEquals(AbstractActionsToolboxView.BUTTON_SIZE, grid.getIconSize(), 0);
    assertEquals(AbstractActionsToolboxView.BUTTON_PADDING, grid.getPadding(), 0);
}
Also used : Point2DGrid(com.ait.lienzo.client.core.shape.toolbox.grid.Point2DGrid) FixedLayoutGrid(com.ait.lienzo.client.core.shape.toolbox.grid.FixedLayoutGrid)

Example 5 with Point2DGrid

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

the class FlowActionsToolboxViewTest method testInit.

@Test
public void testInit() {
    final FlowActionsToolboxView cascade = doInit();
    assertEquals(tested, cascade);
    verify(toolboxFactory, times(1)).forWiresShape(eq(shape));
    verify(toolboxView, times(1)).attachTo(eq(topLayer));
    // Verify toolbox settings.
    verify(toolboxView, times(1)).at(eq(FlowActionsToolboxView.TOOLBOX_AT));
    final ArgumentCaptor<Point2DGrid> gridCaptor = ArgumentCaptor.forClass(Point2DGrid.class);
    verify(toolboxView, times(1)).grid(gridCaptor.capture());
    final AutoGrid grid = (AutoGrid) gridCaptor.getValue();
    assertEquals(AbstractActionsToolboxView.BUTTON_SIZE, grid.getIconSize(), 0);
    assertEquals(AbstractActionsToolboxView.BUTTON_PADDING, grid.getPadding(), 0);
    assertEquals(FlowActionsToolboxView.GRID_TOWARDS, grid.getDirection());
}
Also used : Point2DGrid(com.ait.lienzo.client.core.shape.toolbox.grid.Point2DGrid) AutoGrid(com.ait.lienzo.client.core.shape.toolbox.grid.AutoGrid) Test(org.junit.Test)

Aggregations

Point2DGrid (com.ait.lienzo.client.core.shape.toolbox.grid.Point2DGrid)5 FixedLayoutGrid (com.ait.lienzo.client.core.shape.toolbox.grid.FixedLayoutGrid)3 AutoGrid (com.ait.lienzo.client.core.shape.toolbox.grid.AutoGrid)2 Test (org.junit.Test)2 Group (com.ait.lienzo.client.core.shape.Group)1 ToolboxVisibilityExecutors (com.ait.lienzo.client.core.shape.toolbox.ToolboxVisibilityExecutors)1 ButtonGridItem (com.ait.lienzo.client.core.shape.toolbox.items.ButtonGridItem)1 ButtonItem (com.ait.lienzo.client.core.shape.toolbox.items.ButtonItem)1 ToolboxFactory (com.ait.lienzo.client.core.shape.toolbox.items.impl.ToolboxFactory)1 ToolboxTextTooltip (com.ait.lienzo.client.core.shape.toolbox.items.tooltip.ToolboxTextTooltip)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 StunnerCommonIconsGlyphFactory (org.kie.workbench.common.stunner.core.client.resources.StunnerCommonIconsGlyphFactory)1