Search in sources :

Example 21 with WizardPageStatusChangeEvent

use of org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent in project kie-wb-common by kiegroup.

the class POMWizardPage method addChangeHandlers.

private void addChangeHandlers() {
    this.pomEditor.addNameChangeHandler(new NameChangeHandler() {

        @Override
        public void onChange(String newName) {
            validateName(pomEditor.getPom().getName());
            if (pomEditor.getPom().getGav().getArtifactId() == null || pomEditor.getPom().getGav().getArtifactId().isEmpty()) {
                userModifiedArtifactId = false;
            }
            // TODO Move to PomBuilder
            final String sanitizedProjectName = NewWorkspaceProjectUtils.sanitizeProjectName(pomEditor.getPom().getName());
            if (!userModifiedArtifactId) {
                pomEditor.setArtifactID(sanitizedProjectName);
                validateArtifactId(sanitizedProjectName);
            }
            final WizardPageStatusChangeEvent event = new WizardPageStatusChangeEvent(POMWizardPage.this);
            POMWizardPage.this.wizardPageStatusChangeEvent.fire(event);
        }
    });
    this.pomEditor.addGroupIdChangeHandler(new GroupIdChangeHandler() {

        @Override
        public void onChange(String newGroupId) {
            validateGroupId(pomEditor.getPom().getGav().getGroupId());
            final WizardPageStatusChangeEvent event = new WizardPageStatusChangeEvent(POMWizardPage.this);
            POMWizardPage.this.wizardPageStatusChangeEvent.fire(event);
        }
    });
    this.pomEditor.addArtifactIdChangeHandler(new ArtifactIdChangeHandler() {

        @Override
        public void onChange(String newArtifactId) {
            userModifiedArtifactId = true;
            validateArtifactId(pomEditor.getPom().getGav().getArtifactId());
            final WizardPageStatusChangeEvent event = new WizardPageStatusChangeEvent(POMWizardPage.this);
            POMWizardPage.this.wizardPageStatusChangeEvent.fire(event);
        }
    });
    this.pomEditor.addVersionChangeHandler(new VersionChangeHandler() {

        @Override
        public void onChange(String newVersion) {
            validateVersion(pomEditor.getPom().getGav().getVersion());
            final WizardPageStatusChangeEvent event = new WizardPageStatusChangeEvent(POMWizardPage.this);
            POMWizardPage.this.wizardPageStatusChangeEvent.fire(event);
        }
    });
}
Also used : ArtifactIdChangeHandler(org.guvnor.common.services.project.client.ArtifactIdChangeHandler) GroupIdChangeHandler(org.guvnor.common.services.project.client.GroupIdChangeHandler) WizardPageStatusChangeEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent) NameChangeHandler(org.guvnor.common.services.project.client.NameChangeHandler) VersionChangeHandler(org.guvnor.common.services.project.client.VersionChangeHandler)

Example 22 with WizardPageStatusChangeEvent

use of org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent in project kie-wb-common by kiegroup.

the class NewContainerFormPresenterTest method testOnDependencyPathSelectedEvent.

@Test
public void testOnDependencyPathSelectedEvent() {
    final String path = "org:kie:1.0";
    final GAV gav = new GAV(path);
    when(m2RepoService.loadGAVFromJar(path)).thenReturn(gav);
    when(view.getContainerName()).thenReturn("containerName");
    when(view.getContainerAlias()).thenReturn("containerAlias");
    when(view.getGroupId()).thenReturn(gav.getGroupId());
    when(view.getArtifactId()).thenReturn(gav.getArtifactId());
    when(view.getVersion()).thenReturn(gav.getVersion());
    presenter.asWidget();
    presenter.onDependencyPathSelectedEvent(new DependencyPathSelectedEvent(artifactListWidgetPresenter, path));
    verify(m2RepoService).loadGAVFromJar(path);
    verify(view).setGroupId(gav.getGroupId());
    verify(view).setArtifactId(gav.getArtifactId());
    verify(view).setVersion(gav.getVersion());
    verify(wizardPageStatusChangeEvent).fire(any(WizardPageStatusChangeEvent.class));
    final ContainerSpec containerSpec = presenter.buildContainerSpec("templateId", Collections.<Capability, ContainerConfig>emptyMap());
    assertEquals(new ReleaseId(gav.getGroupId(), gav.getArtifactId(), gav.getVersion()), containerSpec.getReleasedId());
    assertEquals(KieContainerStatus.STOPPED, containerSpec.getStatus());
    assertEquals("containerAlias", containerSpec.getContainerName());
    assertEquals("containerName", containerSpec.getId());
}
Also used : ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) WizardPageStatusChangeEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent) ReleaseId(org.kie.server.api.model.ReleaseId) GAV(org.guvnor.common.services.project.model.GAV) DependencyPathSelectedEvent(org.kie.workbench.common.screens.server.management.client.events.DependencyPathSelectedEvent) Test(org.junit.Test)

Example 23 with WizardPageStatusChangeEvent

use of org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent in project kie-wb-common by kiegroup.

the class NewContainerFormPresenterTest method testInit.

@Test
public void testInit() {
    presenter.init();
    final ContentChangeHandler contentChangeHandler = mock(ContentChangeHandler.class);
    presenter.addContentChangeHandler(contentChangeHandler);
    view.setVersion("1.0");
    view.setArtifactId("artifact");
    view.setGroupId("group");
    verify(view).init(presenter);
    verify(wizardPageStatusChangeEvent, times(3)).fire(any(WizardPageStatusChangeEvent.class));
    verify(contentChangeHandler, times(3)).onContentChange();
}
Also used : ContentChangeHandler(org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler) WizardPageStatusChangeEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent) Test(org.junit.Test)

Example 24 with WizardPageStatusChangeEvent

use of org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent in project kie-wb-common by kiegroup.

the class NewTemplatePresenter method addContentChangeHandler.

public void addContentChangeHandler(final ContentChangeHandler contentChangeHandler) {
    checkNotNull("contentChangeHandler", contentChangeHandler);
    view.addContentChangeHandler(new ContentChangeHandler() {

        @Override
        public void onContentChange() {
            contentChangeHandler.onContentChange();
            wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewTemplatePresenter.this));
        }
    });
}
Also used : ContentChangeHandler(org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler) WizardPageStatusChangeEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent)

Example 25 with WizardPageStatusChangeEvent

use of org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent in project kie-wb-common by kiegroup.

the class NewContainerFormPresenter method init.

@PostConstruct
public void init() {
    view.init(this);
    view.addContentChangeHandler(new ContentChangeHandler() {

        @Override
        public void onContentChange() {
            wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this));
        }
    });
}
Also used : ContentChangeHandler(org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler) WizardPageStatusChangeEvent(org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent) PostConstruct(javax.annotation.PostConstruct)

Aggregations

WizardPageStatusChangeEvent (org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent)27 Test (org.junit.Test)8 ContentChangeHandler (org.kie.workbench.common.screens.server.management.client.util.ContentChangeHandler)5 Entity (javax.persistence.Entity)2 GAV (org.guvnor.common.services.project.model.GAV)2 DataModelerService (org.kie.workbench.common.screens.datamodeller.service.DataModelerService)2 AnnotationDefinitionRequest (org.kie.workbench.common.services.datamodeller.driver.model.AnnotationDefinitionRequest)2 AnnotationDefinitionResponse (org.kie.workbench.common.services.datamodeller.driver.model.AnnotationDefinitionResponse)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 Answer (org.mockito.stubbing.Answer)2 PostConstruct (javax.annotation.PostConstruct)1 PipelineParamsPagePresenter (org.guvnor.ala.ui.client.wizard.pipeline.params.PipelineParamsPagePresenter)1 ArtifactIdChangeHandler (org.guvnor.common.services.project.client.ArtifactIdChangeHandler)1 GroupIdChangeHandler (org.guvnor.common.services.project.client.GroupIdChangeHandler)1 NameChangeHandler (org.guvnor.common.services.project.client.NameChangeHandler)1 VersionChangeHandler (org.guvnor.common.services.project.client.VersionChangeHandler)1 M2RepoService (org.guvnor.m2repo.service.M2RepoService)1 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)1 Before (org.junit.Before)1 ReleaseId (org.kie.server.api.model.ReleaseId)1