@Test public void testSetup() { final Element container = spy(new Element()); final List<KieSelectOption> options = Arrays.asList(new KieSelectOption("FOO", "foo"), new KieSelectOption("Bar", "bar")); doReturn(options).when(kieEnumSelectElement).buildOptions(any()); kieEnumSelectElement.setup( TestEnum.values(), TestEnum.FOO, value -> { }); assertEquals(TestEnum.class, kieEnumSelectElement.componentType); verify(view).setupKieSelectElement(eq(options), eq("FOO"), any()); }
@SuppressWarnings("unchecked") public void setup(final T[] values, final T initialValue, final Consumer<T> onChange) { componentType = (Class<T>) values.getClass().getComponentType(); view.setupKieSelectElement(buildOptions(values), initialValue.name(), name -> onChange.accept(toEnum(name))); }
KieEnumSelectElement implements IsElement { @SuppressWarnings("unchecked") public void setup(final T[] values, final T initialValue, final Consumer<T> onChange) { componentType = (Class<T>) values.getClass().getComponentType(); view.setupKieSelectElement(buildOptions(values), initialValue.name(), name -> onChange.accept(toEnum(name))); } }
KieEnumSelectElement implements IsElement { @SuppressWarnings("unchecked") public void setup(final T[] values, final T initialValue, final Consumer<T> onChange) { componentType = (Class<T>) values.getClass().getComponentType(); view.setupKieSelectElement(buildOptions(values), initialValue.name(), name -> onChange.accept(toEnum(name))); } @Inject  KieEnumSelectElement(final View view,
                                final KieSelectElement kieSelectElement,
                                final TranslationService translationService); }
KieEnumSelectElement implements IsElement { @SuppressWarnings("unchecked") public void setup(final T[] values, final T initialValue, final Consumer<T> onChange) { componentType = (Class<T>) values.getClass().getComponentType(); view.setupKieSelectElement(buildOptions(values), initialValue.name(), name -> onChange.accept(toEnum(name))); } @Inject  KieEnumSelectElement(final View view,
                                final KieSelectElement kieSelectElement,
                                final TranslationService translationService); @PostConstruct void init(); @SuppressWarnings("unchecked") void setup(final T[] values,
                      final T initialValue,
                      final Consumer<T> onChange); T getValue(); @Override HTMLElement getElement(); }
KieEnumSelectElement implements IsElement { @SuppressWarnings("unchecked") public void setup(final T[] values, final T initialValue, final Consumer<T> onChange) { componentType = (Class<T>) values.getClass().getComponentType(); view.setupKieSelectElement(buildOptions(values), initialValue.name(), name -> onChange.accept(toEnum(name))); } @Inject  KieEnumSelectElement(final View view,
                                final KieSelectElement kieSelectElement,
                                final TranslationService translationService); @PostConstruct void init(); @SuppressWarnings("unchecked") void setup(final T[] values,
                      final T initialValue,
                      final Consumer<T> onChange); T getValue(); @Override HTMLElement getElement();  }