use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class ExecuteGlobalActionsCommand method performOperation.
protected void performOperation() {
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "api/system/refresh/globalActions";
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
requestBuilder.setHeader("accept", "text/plain");
requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
requestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// showError(exception);
}
public void onResponseReceived(Request request, Response response) {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("info"), Messages.getString("globalActionsExecutedSuccessfully"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.center();
}
});
} catch (RequestException e) {
Window.alert(e.getMessage());
// showError(e);
}
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class SolutionBrowserPanel method editFile.
public void editFile() {
if (filesListPanel.getSelectedFileItems() == null || filesListPanel.getSelectedFileItems().size() != 1) {
return;
}
RepositoryFile file = filesListPanel.getSelectedFileItems().get(0).getRepositoryFile();
if (file.getName().endsWith(".analysisview.xaction")) {
// $NON-NLS-1$
openFile(file, COMMAND.RUN);
} else {
// check to see if a plugin supports editing
ContentTypePlugin plugin = PluginOptionsHelper.getContentTypePlugin(file.getName());
if (plugin != null && plugin.hasCommand(COMMAND.EDIT)) {
// load the editor for this plugin
String editUrl = getPath() + "api/repos/" + pathToId(file.getPath()) + "/" + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
(plugin != null && (plugin.getCommandPerspective(COMMAND.EDIT) != null) ? plugin.getCommandPerspective(COMMAND.EDIT) : "editor");
// See if it's already loaded
for (int i = 0; i < contentTabPanel.getTabCount(); i++) {
Widget w = contentTabPanel.getTab(i).getContent();
if (w instanceof IFrameTabPanel && ((IFrameTabPanel) w).getUrl().endsWith(editUrl)) {
// Already up, select and exit
contentTabPanel.selectTab(i);
return;
}
}
contentTabPanel.showNewURLTab(Messages.getString("editingColon") + file.getTitle(), Messages.getString("editingColon") + file.getTitle(), editUrl, // $NON-NLS-1$ //$NON-NLS-2$
true);
} else {
MessageDialogBox dialogBox = new // $NON-NLS-1$
MessageDialogBox(// $NON-NLS-1$
Messages.getString("error"), // $NON-NLS-1$
Messages.getString("cannotEditFileType"), true, false, true);
dialogBox.center();
}
}
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class SolutionBrowserPanel method executeActionSequence.
public void executeActionSequence(final FileCommand.COMMAND mode) {
if (filesListPanel.getSelectedFileItems() == null || filesListPanel.getSelectedFileItems().size() != 1) {
return;
}
// open in content panel
AbstractCommand authCmd = new AbstractCommand() {
protected void performOperation() {
performOperation(false);
}
protected void performOperation(boolean feedback) {
final FileItem selectedFileItem = filesListPanel.getSelectedFileItems().get(0);
String url = null;
url = // $NON-NLS-1$ //$NON-NLS-2$
"api/repo/files/" + SolutionBrowserPanel.pathToId(filesListPanel.getSelectedFileItems().get(0).getRepositoryFile().getPath()) + "/generatedContent";
url = getPath() + url;
if (mode == FileCommand.COMMAND.BACKGROUND) {
MessageDialogBox dialogBox = new // $NON-NLS-1$
MessageDialogBox(// $NON-NLS-1$
Messages.getString("info"), // $NON-NLS-1$
Messages.getString("backgroundExecutionWarning"), true, false, true);
dialogBox.center();
// $NON-NLS-1$
url += "&background=true";
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
try {
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("couldNotBackgroundExecute"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.center();
}
public void onResponseReceived(Request request, Response response) {
}
});
} catch (RequestException e) {
// ignored
}
} else if (mode == FileCommand.COMMAND.NEWWINDOW) {
// popup blockers might attack this
// $NON-NLS-1$ //$NON-NLS-2$
Window.open(url, "_blank", "menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no");
} else if (mode == FileCommand.COMMAND.SUBSCRIBE) {
// $NON-NLS-1$
final String myurl = url + "&subscribepage=yes";
contentTabPanel.showNewURLTab(selectedFileItem.getLocalizedName(), selectedFileItem.getLocalizedName(), myurl, true);
} else {
contentTabPanel.showNewURLTab(selectedFileItem.getLocalizedName(), selectedFileItem.getLocalizedName(), url, true);
}
}
};
authCmd.execute();
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class SelectUserOrRoleDialog method fetchAllRoles.
public void fetchAllRoles(final ArrayList<String> existing, final Document fileInfo) {
try {
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "api/userrolelist/permission-roles";
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
// This header is required to force Internet Explorer to not cache values from the GET response.
requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
requestBuilder.setHeader("accept", "application/json");
requestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable caught) {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), Messages.getString("couldNotGetRoles"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.center();
}
public void onResponseReceived(Request request, Response response) {
JsArrayString roles = parseRolesJson(JsonUtils.escapeJsonForEval(response.getText()));
// filter out existing
rolesListBox.clear();
PermissionsPanel permPanel = new PermissionsPanel(null);
for (int i = 0; i < roles.length(); i++) {
String role = roles.get(i);
if (!existing.contains(role)) {
rolesListBox.addItem(role);
} else {
if (!permPanel.getNames(fileInfo, 1).contains(role) && permPanel.getNames(fileInfo, 0).contains(role)) {
// we have equal user/role pair(s) and user already in existing list
rolesListBox.addItem(role);
}
}
}
}
});
} catch (RequestException e) {
Window.alert(e.getMessage());
}
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class RefreshSystemSettingsCommand method performOperation.
protected void performOperation() {
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "api/system/refresh/systemSettings";
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
requestBuilder.setHeader("accept", "text/plain");
requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
requestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// showError(exception);
}
public void onResponseReceived(Request request, Response response) {
MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("info"), Messages.getString("refreshSystemSettingsSuccess"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.center();
}
});
} catch (RequestException e) {
Window.alert(e.getMessage());
// showError(e);
}
}
Aggregations