class BS3PaletteWidgetImpl extends AbstractPalette<DefaultPaletteDefinition> implements BS3PaletteWidget,
                   IsElement {

    @Override
    @SuppressWarnings("unchecked")
    protected AbstractPalette<DefaultPaletteDefinition> bind() {
        if (null != paletteDefinition) {
            final StunnerPreferences preferences = preferencesRegistries.get(paletteDefinition.getDefinitionSetId(), StunnerPreferences.class);
            final boolean autoHidePanel = preferences.getDiagramEditorPreferences().isAutoHidePalettePanel();
            paletteDefinition.getItems().forEach(item -> {
                BS3PaletteWidgetPresenter widget;
                if (item instanceof DefaultPaletteCategory) {
                    DefinitionPaletteCategoryWidget categoryWidget = newDefinitionPaletteCategoryWidget();
                    categoryWidget.setOnOpenCallback(category -> onOpenCategory(category.getId()));
                    categoryWidget.setOnCloseCallback(category -> onCloseCategory(category.getId()));
                    categoryWidget.setAutoHidePanel(autoHidePanel);
                    categoryWidgets.put(item.getId(),
                                        categoryWidget);
                    widget = categoryWidget;
                } else if (item instanceof CollapsedDefaultPaletteItem) {
                    widget = newCollapsedDefinitionPaletteItemWidget();
                } else {
                    widget = newDefinitionPaletteItemWidget();
                }
                final Consumer<PaletteItemMouseEvent> itemMouseEventHandler =
                        event -> handleMouseDownEvent(item,
                                                      event);
                widget.initialize(item,
                                  getShapeFactory(),
                                  itemMouseEventHandler);
                view.add(widget);
            });
        }
        return this;
    }

    @Inject public  BS3PaletteWidgetImpl(final ShapeManager shapeManager,
                                final ClientFactoryService clientFactoryServices,
                                final BS3PaletteWidgetView view,
                                final ShapeGlyphDragHandler shapeGlyphDragHandler,
                                final StunnerPreferencesRegistries preferencesRegistries,
                                final ManagedInstance<DefinitionPaletteCategoryWidget> categoryWidgetInstance,
                                final ManagedInstance<DefinitionPaletteItemWidget> definitionPaletteItemWidgets,
                                final ManagedInstance<CollapsedDefinitionPaletteItemWidget> collapsedDefinitionPaletteItemWidgets);

}