Search in sources :

Example 1 with NewResourceSuccessEvent

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

the class NewScoreCardXLSHandler method create.

@Override
public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) {
    busyIndicatorView.showBusyIndicator(ScoreCardXLSEditorConstants.INSTANCE.Uploading());
    final Path path = pkg.getPackageMainResourcesPath();
    final String fileName = buildFileName(baseFileName, resourceType);
    // Package Path is already encoded, fileName needs to be encoded
    final Path newPath = PathFactory.newPathBasedOn(fileName, path.toURI() + "/" + encode(fileName), path);
    uploadWidget.submit(path, fileName, getServletUrl(), new Command() {

        @Override
        public void execute() {
            busyIndicatorView.hideBusyIndicator();
            presenter.complete();
            notifySuccess();
            newResourceSuccessEvent.fire(new NewResourceSuccessEvent(path));
            placeManager.goTo(newPath);
        }
    }, new Command() {

        @Override
        public void execute() {
            busyIndicatorView.hideBusyIndicator();
        }
    });
}
Also used : Path(org.uberfire.backend.vfs.Path) Command(com.google.gwt.user.client.Command) NewResourceSuccessEvent(org.kie.workbench.common.widgets.client.handlers.NewResourceSuccessEvent)

Example 2 with NewResourceSuccessEvent

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

the class NewDecisionTableXLSHandler method create.

@Override
public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) {
    busyIndicatorView.showBusyIndicator(DecisionTableXLSEditorConstants.INSTANCE.Uploading());
    final Path path = pkg.getPackageMainResourcesPath();
    final String fileName = buildFileName(baseFileName, fileExtensionSelector.getResourceType());
    // Package Path is already encoded, fileName needs to be encoded
    final Path newPath = PathFactory.newPathBasedOn(fileName, path.toURI() + "/" + encode(fileName), path);
    uploadWidget.submit(path, fileName, getServletUrl(), new Command() {

        @Override
        public void execute() {
            busyIndicatorView.hideBusyIndicator();
            presenter.complete();
            notifySuccess();
            newResourceSuccessEvent.fire(new NewResourceSuccessEvent(path));
            placeManager.goTo(newPath);
        }
    }, new Command() {

        @Override
        public void execute() {
            busyIndicatorView.hideBusyIndicator();
        }
    });
}
Also used : Path(org.uberfire.backend.vfs.Path) Command(com.google.gwt.user.client.Command) NewResourceSuccessEvent(org.kie.workbench.common.widgets.client.handlers.NewResourceSuccessEvent)

Aggregations

Command (com.google.gwt.user.client.Command)2 NewResourceSuccessEvent (org.kie.workbench.common.widgets.client.handlers.NewResourceSuccessEvent)2 Path (org.uberfire.backend.vfs.Path)2