Search in sources :

Example 6 with RemoteCallback

use of org.jboss.errai.common.client.api.RemoteCallback in project drools-wb by kiegroup.

the class GuidedScoreCardEditorPresenter method getModelSuccessCallback.

private RemoteCallback<ScoreCardModelContent> getModelSuccessCallback() {
    return new RemoteCallback<ScoreCardModelContent>() {

        @Override
        public void callback(final ScoreCardModelContent content) {
            // Path is set to null when the Editor is closed (which can happen before async calls complete).
            if (versionRecordManager.getCurrentPath() == null) {
                return;
            }
            model = content.getModel();
            final PackageDataModelOracleBaselinePayload dataModel = content.getDataModel();
            oracle = oracleFactory.makeAsyncPackageDataModelOracle(versionRecordManager.getCurrentPath(), model, dataModel);
            resetEditorPages(content.getOverview());
            addSourcePage();
            addImportsTab(importsWidget);
            view.setContent(model, oracle);
            importsWidget.setContent(oracle, model.getImports(), isReadOnly);
            createOriginalHash(model);
            view.hideBusyIndicator();
        }
    };
}
Also used : ScoreCardModelContent(org.drools.workbench.screens.guided.scorecard.model.ScoreCardModelContent) PackageDataModelOracleBaselinePayload(org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Example 7 with RemoteCallback

use of org.jboss.errai.common.client.api.RemoteCallback in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenter method onValidate.

@Override
public void onValidate(final GuidedDecisionTableView.Presenter dtPresenter) {
    final ObservablePath path = dtPresenter.getCurrentPath();
    final GuidedDecisionTable52 model = dtPresenter.getModel();
    service.call(new RemoteCallback<List<ValidationMessage>>() {

        @Override
        public void callback(final List<ValidationMessage> results) {
            if (results == null || results.isEmpty()) {
                notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemValidatedSuccessfully(), NotificationEvent.NotificationType.SUCCESS));
            } else {
                showValidationPopup(results);
            }
        }
    }).validate(path, model);
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) List(java.util.List) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Example 8 with RemoteCallback

use of org.jboss.errai.common.client.api.RemoteCallback in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenter method getRefreshContentSuccessCallback.

private RemoteCallback<GuidedDecisionTableEditorContent> getRefreshContentSuccessCallback(final GuidedDecisionTableView.Presenter dtPresenter) {
    final ObservablePath path = dtPresenter.getLatestPath();
    final PlaceRequest place = dtPresenter.getPlaceRequest();
    final boolean isReadOnly = dtPresenter.isReadOnly();
    return (content) -> {
        // Refresh Decision Table in modeller
        modeller.refreshDecisionTable(dtPresenter, path, place, content, isReadOnly);
        activateDocument(dtPresenter);
        view.hideBusyIndicator();
    };
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTableEditorService(org.drools.workbench.screens.guided.dtable.service.GuidedDecisionTableEditorService) AlertsButtonMenuItemBuilder(org.guvnor.messageconsole.client.console.widget.button.AlertsButtonMenuItemBuilder) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) GuidedDecisionTableModellerView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView) ChangeTitleWidgetEvent(org.uberfire.client.workbench.events.ChangeTitleWidgetEvent) ClientResourceType(org.uberfire.client.workbench.type.ClientResourceType) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) KieEditorView(org.kie.workbench.common.widgets.metadata.client.KieEditorView) UpdatedLockStatusEvent(org.uberfire.client.mvp.UpdatedLockStatusEvent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) IsWidget(com.google.gwt.user.client.ui.IsWidget) Set(java.util.Set) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) MultiPageEditor(org.uberfire.client.workbench.widgets.multipage.MultiPageEditor) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) WorkspaceProjectContext(org.guvnor.common.services.project.client.context.WorkspaceProjectContext) RegisteredDocumentsMenuBuilder(org.kie.workbench.common.widgets.metadata.client.menu.RegisteredDocumentsMenuBuilder) PlaceRequest(org.uberfire.mvp.PlaceRequest) List(java.util.List) RadarMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.RadarMenuBuilder) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Caller(org.jboss.errai.common.client.api.Caller) Optional(java.util.Optional) AssetUpdateValidator(org.kie.workbench.common.widgets.metadata.client.validation.AssetUpdateValidator) ProvidesResize(com.google.gwt.user.client.ui.ProvidesResize) GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) SavePopUpPresenter(org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter) RequiresResize(com.google.gwt.user.client.ui.RequiresResize) PlaceManager(org.uberfire.client.mvp.PlaceManager) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) MenuItems(org.uberfire.ext.editor.commons.client.menu.MenuItems) ViewMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.ViewMenuBuilder) EditMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.EditMenuBuilder) MenuItem(org.uberfire.workbench.model.menu.MenuItem) Page(org.uberfire.client.workbench.widgets.multipage.Page) CommonConstants(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback) Event(javax.enterprise.event.Event) ColumnsPage(org.drools.workbench.screens.guided.dtable.client.editor.page.ColumnsPage) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) OverviewWidgetPresenter(org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter) VersionRecordManager(org.uberfire.ext.editor.commons.client.history.VersionRecordManager) ValidationPopup(org.kie.workbench.common.widgets.client.popups.validation.ValidationPopup) KieMultipleDocumentEditorWrapperView(org.kie.workbench.common.widgets.metadata.client.KieMultipleDocumentEditorWrapperView) ImportsWidgetPresenter(org.kie.workbench.common.widgets.configresource.client.widget.bound.ImportsWidgetPresenter) FileMenuBuilder(org.kie.workbench.common.widgets.client.menu.FileMenuBuilder) KieMultipleDocumentEditor(org.kie.workbench.common.widgets.metadata.client.KieMultipleDocumentEditor) InsertMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.InsertMenuBuilder) SyncBeanManager(org.jboss.errai.ioc.client.container.SyncBeanManager) DefaultFileNameValidator(org.uberfire.ext.editor.commons.client.validation.DefaultFileNameValidator) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Example 9 with RemoteCallback

use of org.jboss.errai.common.client.api.RemoteCallback in project drools-wb by kiegroup.

the class GuidedDecisionTreeEditorPresenter method getModelSuccessCallback.

private RemoteCallback<GuidedDecisionTreeEditorContent> getModelSuccessCallback() {
    return new RemoteCallback<GuidedDecisionTreeEditorContent>() {

        @Override
        public void callback(final GuidedDecisionTreeEditorContent content) {
            // Path is set to null when the Editor is closed (which can happen before async calls complete).
            if (versionRecordManager.getCurrentPath() == null) {
                return;
            }
            GuidedDecisionTreeEditorPresenter.this.content = content;
            model = content.getModel();
            metadata = content.getOverview().getMetadata();
            final PackageDataModelOracleBaselinePayload dataModel = content.getDataModel();
            oracle = oracleFactory.makeAsyncPackageDataModelOracle(versionRecordManager.getCurrentPath(), model, dataModel);
            resetEditorPages(content.getOverview());
            addSourcePage();
            addImportsTab(importsWidget);
            importsWidget.setContent(oracle, model.getImports(), isReadOnly);
            view.setModel(model, isReadOnly);
            view.setDataModel(oracle, isReadOnly);
            view.hideBusyIndicator();
            // If there were any parsing errors give the User the option to remove the broken DRL or ignore it
            if (!model.getParserErrors().isEmpty()) {
                final ParserMessagesPopup popup = new ParserMessagesPopup(model);
                popup.show();
            }
            createOriginalHash(model);
        }
    };
}
Also used : PackageDataModelOracleBaselinePayload(org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload) ParserMessagesPopup(org.drools.workbench.screens.guided.dtree.client.widget.popups.ParserMessagesPopup) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) GuidedDecisionTreeEditorContent(org.drools.workbench.screens.guided.dtree.model.GuidedDecisionTreeEditorContent)

Example 10 with RemoteCallback

use of org.jboss.errai.common.client.api.RemoteCallback in project drools-wb by kiegroup.

the class GuidedRuleTemplateEditorPresenter method getModelSuccessCallback.

private RemoteCallback<GuidedTemplateEditorContent> getModelSuccessCallback() {
    return new RemoteCallback<GuidedTemplateEditorContent>() {

        @Override
        public void callback(final GuidedTemplateEditorContent content) {
            // Path is set to null when the Editor is closed (which can happen before async calls complete).
            if (versionRecordManager.getCurrentPath() == null) {
                return;
            }
            resetEditorPages(content.getOverview());
            addSourcePage();
            addPage(new PageImpl(dataView, GuidedTemplateEditorConstants.INSTANCE.Data()) {

                @Override
                public void onFocus() {
                    dataView.setContent(model, oracle, eventBus, isReadOnly);
                }

                @Override
                public void onLostFocus() {
                // Nothing to do here
                }
            });
            addImportsTab(importsWidget);
            model = content.getModel();
            final PackageDataModelOracleBaselinePayload dataModel = content.getDataModel();
            oracle = oracleFactory.makeAsyncPackageDataModelOracle(versionRecordManager.getCurrentPath(), model, dataModel);
            view.setContent(model, oracle, ruleNamesService, eventBus, isReadOnly);
            importsWidget.setContent(oracle, model.getImports(), isReadOnly);
            createOriginalHash(model);
            view.hideBusyIndicator();
        }
    };
}
Also used : PageImpl(org.uberfire.client.views.pfly.multipage.PageImpl) GuidedTemplateEditorContent(org.drools.workbench.screens.guided.template.model.GuidedTemplateEditorContent) PackageDataModelOracleBaselinePayload(org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Aggregations

RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)11 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)5 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)4 ObservablePath (org.uberfire.backend.vfs.ObservablePath)4 List (java.util.List)2 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)2 ValidationMessage (org.guvnor.common.services.shared.validation.model.ValidationMessage)2 HasBusyIndicatorDefaultErrorCallback (org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 ProvidesResize (com.google.gwt.user.client.ui.ProvidesResize)1 RequiresResize (com.google.gwt.user.client.ui.RequiresResize)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Event (javax.enterprise.event.Event)1 ConversionMessage (org.drools.workbench.models.guided.dtable.shared.conversion.ConversionMessage)1 ConversionResult (org.drools.workbench.models.guided.dtable.shared.conversion.ConversionResult)1 ConversionMessageWidget (org.drools.workbench.screens.dtablexls.client.widgets.ConversionMessageWidget)1