Search in sources :

Example 1 with NewResourcePresenter

use of org.kie.workbench.common.widgets.client.handlers.NewResourcePresenter in project kie-wb-common by kiegroup.

the class NewFormDefinitionlHandler method create.

@Override
public void create(org.guvnor.common.services.project.model.Package pkg, String baseFileName, final NewResourcePresenter presenter) {
    BusyPopup.showMessage(translationService.getTranslation(FormEditorConstants.NewFormDefinitionlHandlerSelectFormUse));
    modelerService.call(path -> {
        BusyPopup.close();
        presenter.complete();
        notifySuccess();
        PlaceRequest place = new PathPlaceRequest((Path) path, "FormEditor");
        placeManager.goTo(place);
    }, (message, throwable) -> {
        BusyPopup.close();
        ErrorPopup.showMessage(CommonConstants.INSTANCE.SorryAnItemOfThatNameAlreadyExistsInTheRepositoryPleaseChooseAnother());
        return false;
    }).createForm(pkg.getPackageMainResourcesPath(), buildFileName(baseFileName, resourceType), formModelsPresenter.getFormModel());
}
Also used : FormEditorConstants(org.kie.workbench.common.forms.editor.client.resources.i18n.FormEditorConstants) ResourceTypeDefinition(org.uberfire.workbench.type.ResourceTypeDefinition) PlaceManager(org.uberfire.client.mvp.PlaceManager) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) FormDefinitionResourceType(org.kie.workbench.common.forms.editor.client.type.FormDefinitionResourceType) Inject(javax.inject.Inject) CommonConstants(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants) NewResourcePresenter(org.kie.workbench.common.widgets.client.handlers.NewResourcePresenter) FormModelsPresenter(org.kie.workbench.common.forms.editor.client.handler.formModel.FormModelsPresenter) IsWidget(com.google.gwt.user.client.ui.IsWidget) Pair(org.uberfire.commons.data.Pair) FormEditorService(org.kie.workbench.common.forms.editor.service.shared.FormEditorService) Path(org.uberfire.backend.vfs.Path) Event(javax.enterprise.event.Event) TranslationService(org.jboss.errai.ui.client.local.spi.TranslationService) ErrorPopup(org.uberfire.ext.widgets.common.client.common.popups.errors.ErrorPopup) PlaceRequest(org.uberfire.mvp.PlaceRequest) List(java.util.List) Caller(org.jboss.errai.common.client.api.Caller) PostConstruct(javax.annotation.PostConstruct) ApplicationScoped(javax.enterprise.context.ApplicationScoped) DefaultNewResourceHandler(org.kie.workbench.common.widgets.client.handlers.DefaultNewResourceHandler) ValidatorWithReasonCallback(org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback) BusyPopup(org.uberfire.ext.widgets.common.client.common.BusyPopup) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) Path(org.uberfire.backend.vfs.Path) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest)

Aggregations

IsWidget (com.google.gwt.user.client.ui.IsWidget)1 List (java.util.List)1 PostConstruct (javax.annotation.PostConstruct)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Event (javax.enterprise.event.Event)1 Inject (javax.inject.Inject)1 Caller (org.jboss.errai.common.client.api.Caller)1 TranslationService (org.jboss.errai.ui.client.local.spi.TranslationService)1 FormModelsPresenter (org.kie.workbench.common.forms.editor.client.handler.formModel.FormModelsPresenter)1 FormEditorConstants (org.kie.workbench.common.forms.editor.client.resources.i18n.FormEditorConstants)1 FormDefinitionResourceType (org.kie.workbench.common.forms.editor.client.type.FormDefinitionResourceType)1 FormEditorService (org.kie.workbench.common.forms.editor.service.shared.FormEditorService)1 DefaultNewResourceHandler (org.kie.workbench.common.widgets.client.handlers.DefaultNewResourceHandler)1 NewResourcePresenter (org.kie.workbench.common.widgets.client.handlers.NewResourcePresenter)1 CommonConstants (org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants)1 Path (org.uberfire.backend.vfs.Path)1 PlaceManager (org.uberfire.client.mvp.PlaceManager)1 Pair (org.uberfire.commons.data.Pair)1 ValidatorWithReasonCallback (org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback)1 BusyPopup (org.uberfire.ext.widgets.common.client.common.BusyPopup)1