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);
}
});
}
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());
}
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();
}
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));
}
});
}
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));
}
});
}
Aggregations