Search in sources :

Example 1 with DecoratedItem

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

the class ButtonGridItemImpl method add.

@Override
public ButtonGridItemImpl add(final DecoratedItem... items) {
    toolbox.add(items);
    for (final DecoratedItem item : items) {
        try {
            final AbstractDecoratedItem primitiveItem = (AbstractDecoratedItem) item;
            registerItemFocusHandler(primitiveItem, itemFocusCallback);
            registerItemUnFocusHandler(primitiveItem, itemUnFocusCallback);
        } catch (final ClassCastException e) {
            throw new UnsupportedOperationException("The button only supports subtypes " + "of " + AbstractDecoratedItem.class.getName());
        }
    }
    return this;
}
Also used : AbstractDecoratedItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.AbstractDecoratedItem) DecoratedItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.DecoratedItem) AbstractDecoratedItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.AbstractDecoratedItem)

Example 2 with DecoratedItem

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

the class ItemGridImpl method hide.

@Override
public ItemGridImpl hide(final Command before, final Command after) {
    return super.hide(before, () -> {
        for (final DecoratedItem button : items) {
            button.hide();
        }
        after.execute();
        fireRefresh();
    });
}
Also used : AbstractDecoratedItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.AbstractDecoratedItem) DecoratedItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.DecoratedItem)

Example 3 with DecoratedItem

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

the class ItemGridImpl method show.

@Override
public ItemGridImpl show(final Command before, final Command after) {
    return super.show(() -> {
        repositionItems();
        for (final DecoratedItem button : items) {
            button.show();
        }
        before.execute();
    }, after);
}
Also used : AbstractDecoratedItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.AbstractDecoratedItem) DecoratedItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.DecoratedItem)

Example 4 with DecoratedItem

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

the class WiresShapeToolboxTest method testAddItem.

@Test
@SuppressWarnings("unchecked")
public void testAddItem() {
    DecoratedItem item = mock(DecoratedItem.class);
    tested.add(item);
    verify(toolbox, times(1)).add(eq(item));
}
Also used : DecoratedItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.DecoratedItem) Test(org.junit.Test)

Example 5 with DecoratedItem

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

the class ToolboxImplTest method testAddItem.

@Test
@SuppressWarnings("unchecked")
public void testAddItem() {
    DecoratedItem item = mock(DecoratedItem.class);
    tested.add(item);
    verify(wrapped, times(1)).add(eq(item));
}
Also used : DecoratedItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.DecoratedItem) Test(org.junit.Test)

Aggregations

DecoratedItem (org.kie.workbench.common.stunner.lienzo.toolbox.items.DecoratedItem)5 AbstractDecoratedItem (org.kie.workbench.common.stunner.lienzo.toolbox.items.AbstractDecoratedItem)3 Test (org.junit.Test)2