class DisplayerSubtypeSelector implements IsWidget {

    public void init(DisplayerType type, DisplayerSubType selectedSubType) {
        view.clear();

        RendererLibrary rendererLibrary = rendererManager.getRendererForType(type);
        if (rendererLibrary != null) {
            List<DisplayerSubType> supportedSubTypes = rendererLibrary.getSupportedSubtypes(type);
            if (supportedSubTypes != null && !supportedSubTypes.isEmpty()) {
                for (int i = 0; i < supportedSubTypes.size(); i++) {
                    DisplayerSubType subtype = supportedSubTypes.get(i);

                    // Double check the renderer library for invalid subtypes for this type
                    if (!type.getSubTypes().contains(subtype)) {
                        throw new RuntimeException("Wrong subtype (" + subtype + ") indicated for type " + type + " by renderer library " + rendererLibrary.getUUID());
                    }

                    boolean initiallySelected = selectedSubType != null ? subtype == selectedSubType : i == 0;
                    view.show(type, subtype);
                    if (initiallySelected) {
                        view.select(subtype);
                    }
                }
            } else {
                view.showDefault(type);
            }
        }
    }

    @Inject public  DisplayerSubtypeSelector(View view,
                                    RendererManager rendererManager,
                                    Event<DisplayerSubtypeSelectedEvent> selectEvent);

}