Search in sources :

Example 11 with HasBusyIndicatorDefaultErrorCallback

use of org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback in project kie-wb-common by kiegroup.

the class ImportPresenter method ok.

public void ok() {
    final List<ExampleProject> projects = projectWidgetsByName.entrySet().stream().filter(p -> p.getValue().isSelected()).map(Map.Entry::getKey).collect(Collectors.toList());
    if (projects.isEmpty()) {
        notificationEvent.fire(new NotificationEvent(view.getNoProjectsSelectedMessage(), NotificationEvent.NotificationType.ERROR));
        return;
    }
    view.showBusyIndicator(view.getImportingMessage());
    importProjects(projects, event -> {
        view.hideBusyIndicator();
        notificationEvent.fire(new NotificationEvent(view.getImportProjectsSuccessMessage(), NotificationEvent.NotificationType.SUCCESS));
        projectContextChangeEvent.fire(event);
    }, new HasBusyIndicatorDefaultErrorCallback(view));
}
Also used : HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) ExampleProject(org.kie.workbench.common.screens.examples.model.ExampleProject) HashMap(java.util.HashMap) Map(java.util.Map)

Example 12 with HasBusyIndicatorDefaultErrorCallback

use of org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback in project kie-wb-common by kiegroup.

the class NewJavaFileTextHandler method create.

@Override
public void create(final org.guvnor.common.services.project.model.Package pkg, final String baseFileName, final NewResourcePresenter presenter) {
    busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
    Map<String, Object> params = new HashMap<String, Object>();
    for (ResourceOptions options : resourceOptions) {
        params.putAll(options.getOptions());
    }
    dataModelerService.call(getSuccessCallback(presenter), new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).createJavaFile(pkg.getPackageMainSrcPath(), buildFileName(baseFileName, resourceType), "", params);
}
Also used : ResourceOptions(org.kie.workbench.common.screens.datamodeller.client.widgets.common.domain.ResourceOptions) HashMap(java.util.HashMap) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)

Example 13 with HasBusyIndicatorDefaultErrorCallback

use of org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback in project drools-wb by kiegroup.

the class NewGuidedDecisionTableHandler method createEmptyDecisionTable.

private void createEmptyDecisionTable(final Path contextPath, final String baseFileName) {
    final GuidedDecisionTable52 model = new GuidedDecisionTable52();
    model.setTableFormat(options.getTableFormat());
    model.setHitPolicy(options.getHitPolicy());
    if (GuidedDecisionTable52.HitPolicy.RESOLVED_HIT.equals(options.getHitPolicy())) {
        final MetadataCol52 metadataCol52 = new MetadataCol52();
        metadataCol52.setMetadata(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT_METADATA_NAME);
        model.getMetadataCols().add(metadataCol52);
    }
    model.setTableName(baseFileName);
    final RemoteCallback<Path> onSaveSuccessCallback = getSuccessCallback(newResourcePresenter);
    busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
    service.call((Path path) -> {
        busyIndicatorView.hideBusyIndicator();
        onSaveSuccessCallback.callback(path);
    }, new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(contextPath, buildFileName(baseFileName, resourceType), model, "");
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) Path(org.uberfire.backend.vfs.Path) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)

Example 14 with HasBusyIndicatorDefaultErrorCallback

use of org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback in project drools-wb by kiegroup.

the class NewGlobalHandler method create.

@Override
public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) {
    final GlobalsModel model = new GlobalsModel();
    busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
    globalsService.call(getSuccessCallback(presenter), new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageMainResourcesPath(), buildFileName(baseFileName, resourceType), model, "");
}
Also used : GlobalsModel(org.drools.workbench.screens.globals.model.GlobalsModel) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)

Example 15 with HasBusyIndicatorDefaultErrorCallback

use of org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback in project drools-wb by kiegroup.

the class NewGuidedRuleTemplateHandler method create.

@Override
public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) {
    final TemplateModel templateModel = new TemplateModel();
    templateModel.name = baseFileName;
    busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
    service.call(getSuccessCallback(presenter), new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageMainResourcesPath(), buildFileName(baseFileName, resourceType), templateModel, "");
}
Also used : HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback) TemplateModel(org.drools.workbench.models.guided.template.shared.TemplateModel)

Aggregations

HasBusyIndicatorDefaultErrorCallback (org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)17 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)3 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)3 HashMap (java.util.HashMap)2 ObservablePath (org.uberfire.backend.vfs.ObservablePath)2 Path (org.uberfire.backend.vfs.Path)2 ClientResourceType (org.uberfire.client.workbench.type.ClientResourceType)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1 Map (java.util.Map)1 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)1 MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)1 GuidedDecisionTree (org.drools.workbench.models.guided.dtree.shared.model.GuidedDecisionTree)1 ScoreCardModel (org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel)1 TemplateModel (org.drools.workbench.models.guided.template.shared.TemplateModel)1 Scenario (org.drools.workbench.models.testscenarios.shared.Scenario)1 GlobalsModel (org.drools.workbench.screens.globals.model.GlobalsModel)1 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)1