Search in sources :

Example 1 with DefinitionPaletteItemWidget

use of org.kie.workbench.common.stunner.client.widgets.palette.categories.items.DefinitionPaletteItemWidget in project kie-wb-common by kiegroup.

the class DefinitionPaletteCategoryWidget method renderItems.

private void renderItems(final List<DefaultPaletteItem> items, final ShapeFactory<?, ?> shapeFactory) {
    if (items != null && !items.isEmpty()) {
        items.forEach(item -> {
            if (item instanceof PaletteGroup) {
                renderGroup((DefaultPaletteGroup) item, shapeFactory);
            } else {
                DefinitionPaletteItemWidget categoryItemWidget = definitionPaletteItemWidgetInstance.get();
                categoryItemWidget.initialize(item, shapeFactory, itemMouseDownCallback);
                view.addItem(categoryItemWidget);
            }
        });
    }
}
Also used : DefinitionPaletteItemWidget(org.kie.workbench.common.stunner.client.widgets.palette.categories.items.DefinitionPaletteItemWidget) DefaultPaletteGroup(org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteGroup) PaletteGroup(org.kie.workbench.common.stunner.core.client.components.palette.PaletteGroup)

Example 2 with DefinitionPaletteItemWidget

use of org.kie.workbench.common.stunner.client.widgets.palette.categories.items.DefinitionPaletteItemWidget in project kie-wb-common by kiegroup.

the class DefinitionPaletteGroupWidget method loadItems.

private void loadItems(ShapeFactory<?, ?> shapeFactory) {
    view.initView();
    definitionPaletteItemWidgets.destroyAll();
    List<DefaultPaletteItem> items = group.getItems();
    for (int i = 0; i < items.size(); i++) {
        DefaultPaletteItem item = items.get(i);
        DefinitionPaletteItemWidget itemWidget = definitionPaletteItemWidgets.get();
        itemWidget.initialize(item, shapeFactory, itemMouseDownCallback);
        if (i >= COMPACT_ELEMENTS_LIST_SIZE) {
            itemWidget.getElement().getStyle().setProperty("display", "none");
            hiddenList.add(itemWidget);
        }
        view.addItem(itemWidget);
    }
    if (!hiddenList.isEmpty()) {
        view.addAnchors();
        view.showMoreAnchor();
    }
}
Also used : DefaultPaletteItem(org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteItem) DefinitionPaletteItemWidget(org.kie.workbench.common.stunner.client.widgets.palette.categories.items.DefinitionPaletteItemWidget)

Aggregations

DefinitionPaletteItemWidget (org.kie.workbench.common.stunner.client.widgets.palette.categories.items.DefinitionPaletteItemWidget)2 DefaultPaletteGroup (org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteGroup)1 DefaultPaletteItem (org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteItem)1 PaletteGroup (org.kie.workbench.common.stunner.core.client.components.palette.PaletteGroup)1