Search in sources :

Example 1 with ProviderTypeItemPresenter

use of org.guvnor.ala.ui.client.wizard.providertype.item.ProviderTypeItemPresenter in project kie-wb-common by kiegroup.

the class EnableProviderTypePagePresenter method setup.

public void setup(final List<Pair<ProviderType, ProviderTypeStatus>> providerTypeStatus) {
    view.clear();
    clearProviderTypes();
    final ContentChangeHandler contentChangeHandler = this::onProviderTypeSelectionChange;
    providerTypeStatus.forEach(pair -> {
        final ProviderTypeItemPresenter presenter = newProviderTypeItemPresenter();
        presenter.setup(pair.getK1(), pair.getK2());
        presenter.addContentChangeHandler(contentChangeHandler);
        itemPresenters.add(presenter);
        view.addProviderType(presenter.getView());
    });
}
Also used : ProviderTypeItemPresenter(org.guvnor.ala.ui.client.wizard.providertype.item.ProviderTypeItemPresenter) ContentChangeHandler(org.guvnor.ala.ui.client.util.ContentChangeHandler)

Example 2 with ProviderTypeItemPresenter

use of org.guvnor.ala.ui.client.wizard.providertype.item.ProviderTypeItemPresenter in project kie-wb-common by kiegroup.

the class EnableProviderTypePagePresenterTest method testSetup.

@Test
public void testSetup() {
    presenter.setup(providerTypeStatus);
    verify(view, times(1)).clear();
    assertEquals(providerTypeStatus.size(), presenter.getItemPresenters().size());
    for (int i = 0; i < presenter.getItemPresenters().size(); i++) {
        ProviderTypeItemPresenter itemPresenter = presenter.getItemPresenters().get(i);
        Pair<ProviderType, ProviderTypeStatus> pair = providerTypeStatus.get(i);
        verify(itemPresenter, times(1)).setup(pair.getK1(), pair.getK2());
        verify(itemPresenter, times(1)).addContentChangeHandler(any(ContentChangeHandler.class));
        verify(view, times(1)).addProviderType(itemPresenter.getView());
    }
    verify(providerTypeItemPresenterInstance, times(providerTypeStatus.size())).get();
}
Also used : ProviderTypeItemPresenter(org.guvnor.ala.ui.client.wizard.providertype.item.ProviderTypeItemPresenter) ProviderTypeStatus(org.guvnor.ala.ui.model.ProviderTypeStatus) ContentChangeHandler(org.guvnor.ala.ui.client.util.ContentChangeHandler) ProviderType(org.guvnor.ala.ui.model.ProviderType) Test(org.junit.Test)

Aggregations

ContentChangeHandler (org.guvnor.ala.ui.client.util.ContentChangeHandler)2 ProviderTypeItemPresenter (org.guvnor.ala.ui.client.wizard.providertype.item.ProviderTypeItemPresenter)2 ProviderType (org.guvnor.ala.ui.model.ProviderType)1 ProviderTypeStatus (org.guvnor.ala.ui.model.ProviderTypeStatus)1 Test (org.junit.Test)1