use of com.google.gwt.user.client.Command in project rstudio by rstudio.
the class PackagesPane method setActions.
@Override
public void setActions(ArrayList<Packages.Action> actions) {
// command that manages the layout of the packages list and action center
Command manageActionCenterLayout = new Command() {
@Override
public void execute() {
resizeActionCenter();
}
};
if (actions == null || actions.size() == 0) {
if (actionCenter_ != null) {
packagesTableContainer_.remove(actionCenter_);
actionCenter_ = null;
layoutPackagesTable();
packagesTableContainer_.animate(ACTION_CENTER_ANIMATION_MS);
}
} else {
// in a non-collapsed center, raise the packages pane
if (actionCenter_ == null || ((!actionCenter_.collapsed()) && (actionCenter_.getActionCount() != actions.size()))) {
events_.fireEvent(new RaisePackagePaneEvent());
}
// create the action center if it doesn't already exist
if (actionCenter_ == null) {
actionCenter_ = new ActionCenter(manageActionCenterLayout);
packagesTableContainer_.add(actionCenter_);
}
actionCenter_.setActions(actions);
resizeActionCenter();
}
}
use of com.google.gwt.user.client.Command in project rstudio by rstudio.
the class FilesUpload method completeFileUploadOperation.
private Operation completeFileUploadOperation(final FileUploadToken token, final boolean commit) {
return new Operation() {
public void execute() {
String msg = (commit ? "Completing" : "Cancelling") + " file upload...";
final Command dismissProgress = globalDisplay_.showProgress(msg);
server_.completeUpload(token, commit, new ServerRequestCallback<Void>() {
@Override
public void onResponseReceived(Void response) {
dismissProgress.execute();
}
@Override
public void onError(ServerError error) {
dismissProgress.execute();
globalDisplay_.showErrorMessage("File Upload Error", error.getUserMessage());
}
});
}
};
}
use of com.google.gwt.user.client.Command in project rstudio by rstudio.
the class RSConnectPublishButton method renderThenPublish.
// for static content only: perform a just-in-time render if necessary and
// then publish the content
private void renderThenPublish(final String target, final RSConnectDeploymentRecord previous) {
// prevent re-entrancy
if (rmdInfoPending_)
return;
final Command renderCommand = new Command() {
@Override
public void execute() {
publishAfterRmdRender_ = previous;
rmdRenderPending_ = true;
anyRmdRenderPending_ = true;
if (commands_.knitDocument().isEnabled())
commands_.knitDocument().execute();
else if (commands_.previewHTML().isEnabled())
commands_.previewHTML().execute();
else
display_.showErrorMessage("Can't Render Document", "RStudio cannot render " + target + " for publishing.");
}
};
rmdInfoPending_ = true;
rmdServer_.getRmdOutputInfo(target, new ServerRequestCallback<RmdOutputInfo>() {
@Override
public void onResponseReceived(RmdOutputInfo response) {
if (response.isCurrent()) {
RenderedDocPreview preview = new RenderedDocPreview(target, response.getOutputFile(), true);
events_.fireEvent(RSConnectActionEvent.DeployDocEvent(preview, RSConnect.CONTENT_TYPE_DOCUMENT, previous));
} else {
renderCommand.execute();
}
rmdInfoPending_ = false;
}
@Override
public void onError(ServerError error) {
// if we failed to figure out whether we need to do a re-render,
// assume one is necessary
Debug.logError(error);
renderCommand.execute();
rmdInfoPending_ = false;
}
});
}
use of com.google.gwt.user.client.Command in project drools-wb by kiegroup.
the class ScoreCardXLSEditorViewImpl method submit.
private void submit(final Path path) {
uploadWidget.submit(path, getServletUrl(), new Command() {
@Override
public void execute() {
BusyPopup.close();
notifySuccess();
}
}, new Command() {
@Override
public void execute() {
BusyPopup.close();
}
});
concurrentUpdateSessionInfo = null;
}
use of com.google.gwt.user.client.Command 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();
}
});
}
Aggregations