use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class MantleSettingsManager method getMantleSettings.
private void getMantleSettings(final AsyncCallback<HashMap<String, String>> callback) {
final RequestCallback internalCallback = new RequestCallback() {
public void onError(Request request, Throwable exception) {
MessageDialogBox dialog = new MessageDialogBox(Messages.getString("error"), Messages.getString("couldNotGetUserSettings"), true, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialog.center();
}
public void onResponseReceived(Request request, Response response) {
JsArray<JsSetting> jsSettings = null;
try {
jsSettings = JsSetting.parseSettingsJson(response.getText());
} catch (Throwable t) {
// happens when there are no settings
}
for (int i = 0; i < jsSettings.length(); i++) {
settings.put(jsSettings.get(i).getName(), jsSettings.get(i).getValue());
}
settings.put("is-administrator", "" + isAdministrator);
if (callback != null) {
callback.onSuccess(settings);
}
EventBusUtil.EVENT_BUS.fireEvent(new MantleSettingsLoadedEvent(settings));
}
};
final RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, GWT.getHostPageBaseURL() + "api/mantle/settings");
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
builder.setHeader("accept", "application/json");
try {
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "api/repo/files/canAdminister";
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
requestBuilder.setHeader("accept", "text/plain");
requestBuilder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable caught) {
try {
builder.sendRequest(null, internalCallback);
} catch (RequestException e) {
// ignored
}
// CHECKSTYLE IGNORE Indentation FOR NEXT 1 LINES
MantleSettingsManager.getInstance().isAdministrator = false;
}
public void onResponseReceived(Request request, Response response) {
try {
builder.sendRequest(null, internalCallback);
} catch (RequestException e) {
// ignored
}
// CHECKSTYLE IGNORE Indentation FOR NEXT 1 LINES
MantleSettingsManager.getInstance().isAdministrator = isAdministrator;
}
});
} catch (RequestException e) {
Window.alert(e.getMessage());
}
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class ScheduleCallback method okPressed.
@Override
public void okPressed() {
// $NON-NLS-1$
String extension = "";
if (repositoryFile.getPath().lastIndexOf(".") > 0) {
// $NON-NLS-1$
// $NON-NLS-1$
extension = repositoryFile.getPath().substring(repositoryFile.getPath().lastIndexOf(".") + 1);
}
if (SolutionBrowserPanel.getInstance().getExecutableFileExtensions().contains(extension)) {
IDialogCallback callback = new IDialogCallback() {
@Override
public void okPressed() {
ScheduleCreateStatusDialog dialog = new ScheduleCreateStatusDialog();
dialog.center();
}
@Override
public void cancelPressed() {
}
};
ScheduleHelper.showScheduleDialog(repositoryFile.getPath(), callback);
} else {
final MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("open"), Messages.getString("scheduleInvalidFileType", repositoryFile.getPath()), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.setCallback(new IDialogCallback() {
public void cancelPressed() {
}
public void okPressed() {
dialogBox.hide();
}
});
dialogBox.center();
return;
}
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class SolutionBrowserPanel method editFile.
public void editFile(final RepositoryFile file) {
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 SchedulesPanel method showValidateOutputLocationError.
private void showValidateOutputLocationError() {
String title = Messages.getString("outputLocationErrorTitle");
String message = Messages.getString("outputLocationErrorMessage");
MessageDialogBox dialogBox = // $NON-NLS-1$
new MessageDialogBox(title, message, false, false, true, Messages.getString("close"), null, null);
dialogBox.addStyleName("pentaho-dialog-small");
dialogBox.center();
}
use of org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox in project pentaho-platform by pentaho.
the class SelectUserOrRoleDialog method fetchAllUsers.
public void fetchAllUsers(final ArrayList<String> existing, final Document fileInfo) {
try {
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "api/userrolelist/permission-users";
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("couldNotGetUsers"), false, false, // $NON-NLS-1$ //$NON-NLS-2$
true);
dialogBox.center();
}
public void onResponseReceived(Request request, Response response) {
JsArrayString users = parseUsersJson(JsonUtils.escapeJsonForEval(response.getText()));
// filter out existing
usersListBox.clear();
PermissionsPanel permPanel = new PermissionsPanel(null);
for (int i = 0; i < users.length(); i++) {
String user = users.get(i);
if (!existing.contains(user)) {
usersListBox.addItem(user);
} else {
if (!permPanel.getNames(fileInfo, 0).contains(user) && permPanel.getNames(fileInfo, 1).contains(user)) {
// we have equal user/role pair(s) and role already in existing list
usersListBox.addItem(user);
}
}
}
}
});
} catch (RequestException e) {
Window.alert(e.getMessage());
}
}
Aggregations