@Test public void testInitialization3() { presenter.init(BUBBLECHART, null); verify(subtypeView, never()).show(any(DisplayerType.class), any(DisplayerSubType.class)); verify(subtypeView).showDefault(BUBBLECHART); }
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); 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); } } }
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); 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); } } } }
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); 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  DisplayerSubtypeSelector(View view,
                                    RendererManager rendererManager,
                                    Event<DisplayerSubtypeSelectedEvent> selectEvent); }
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); 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  DisplayerSubtypeSelector(View view,
                                    RendererManager rendererManager,
                                    Event<DisplayerSubtypeSelectedEvent> selectEvent); @Override Widget asWidget(); DisplayerSubType getSelectedSubtype(); void init(DisplayerType type, DisplayerSubType selectedSubType); }
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); 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  DisplayerSubtypeSelector(View view,
                                    RendererManager rendererManager,
                                    Event<DisplayerSubtypeSelectedEvent> selectEvent); @Override Widget asWidget(); DisplayerSubType getSelectedSubtype(); void init(DisplayerType type, DisplayerSubType selectedSubType);  }