Search in sources :

Example 1 with NameChangeHandler

use of org.guvnor.common.services.project.client.NameChangeHandler 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)

Aggregations

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 WizardPageStatusChangeEvent (org.uberfire.ext.widgets.core.client.wizards.WizardPageStatusChangeEvent)1