public void passivate(final AsyncCallback<Boolean> callback) { if (newRoleAssignments.size() > 0) { MessageDialogBox dialog = new MessageDialogBox( "ABS", "Save changes? Choosing \"No\" will result is the loss of changes made.", false, true, true, "Yes", "No", "Cancel"); dialog.setCallback( new IThreeButtonDialogCallback() { public void okPressed() { saveSecuritySettings(callback); } public void cancelPressed() { callback.onSuccess(false); } public void notOkPressed() { callback.onSuccess(true); } }); dialog.center(); } else { callback.onSuccess(true); } }
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()) + "/" + (plugin != null && (plugin.getCommandPerspective(COMMAND.EDIT) != null) ? plugin.getCommandPerspective(COMMAND.EDIT) : "editor"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // 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, true); //$NON-NLS-1$ //$NON-NLS-2$ // Store representation of file in the frame for reference later when // save is called contentTabPanel.getCurrentFrame().setFileInfo(filesListPanel.getSelectedFileItems().get(0)); } else { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), // $NON-NLS-1$ Messages.getString("cannotEditFileType"), // $NON-NLS-1$ true, false, true); dialogBox.center(); } } }
public void showErrorDialogBox(SolutionFileActionEvent event) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), Messages.getString("restoreError"), // $NON-NLS-1$ //$NON-NLS-2$ false, false, true); dialogBox.center(); event.setMessage(Messages.getString("restoreError")); EventBusUtil.EVENT_BUS.fireEvent(event); }
private void promptDueToBlockoutConflicts( final boolean alwaysConflict, final boolean conflictsSometimes, final JSONObject schedule, final JsJobTrigger trigger) { StringBuffer conflictMessage = new StringBuffer(); final String updateScheduleButtonText = Messages.getString("blockoutUpdateSchedule"); // $NON-NLS-1$ final String continueButtonText = Messages.getString("blockoutContinueSchedule"); // $NON-NLS-1$ boolean showContinueButton = conflictsSometimes; boolean isScheduleConflict = alwaysConflict || conflictsSometimes; if (conflictsSometimes) { conflictMessage.append(Messages.getString("blockoutPartialConflict")); // $NON-NLS-1$ conflictMessage.append("\n"); // $NON-NLS-1$ conflictMessage.append(Messages.getString("blockoutPartialConflictContinue")); // $NON-NLS-1$ } else { conflictMessage.append(Messages.getString("blockoutTotalConflict")); // $NON-NLS-1$ } if (isScheduleConflict) { final MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("blockoutTimeExists"), // $NON-NLS-1$ conflictMessage.toString(), false, false, true, updateScheduleButtonText, showContinueButton ? continueButtonText : null, null); dialogBox.setCallback( new IDialogCallback() { // If user clicked on 'Continue' we want to add the schedule. Otherwise we dismiss the // dialog // and they have to modify the recurrence schedule public void cancelPressed() { // User clicked on continue, so we need to proceed adding the schedule handleWizardPanels(schedule, trigger); } public void okPressed() { // Update Schedule Button pressed dialogBox.setVisible(false); } }); dialogBox.center(); } }
/** * The passed in URL has all the parameters set for background execution. We simply call GET on * the URL and handle the response object. If the response object contains a particular string * then we display success message box. * * @param url Complete url with all the parameters set for scheduling a job in the background. */ private void runInBackground(final String url) { RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); try { builder.sendRequest( null, new RequestCallback() { public void onError(Request request, Throwable exception) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), Messages.getString("couldNotBackgroundExecute"), false, false, true); //$NON-NLS-1$ //$NON-NLS-2$ dialogBox.center(); } public void onResponseReceived(Request request, Response response) { /* * We are checking for this specific string because if the job was scheduled successfully by QuartzBackgroundExecutionHelper then the response is an * html that contains the specific string. We have coded this way because we did not want to touch the old way. */ if ("true".equals(response.getHeader("background_execution"))) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("info"), Messages.getString("backgroundJobScheduled"), false, false, true); //$NON-NLS-1$ //$NON-NLS-2$ dialogBox.center(); } } }); } catch (RequestException e) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), // $NON-NLS-1$ Messages.getString("couldNotBackgroundExecute"), false, false, true); //$NON-NLS-1$ dialogBox.center(); } }
@SuppressWarnings("unchecked") private void updateUserDetails(final Widget sender) { if (!userDetailsPanel.getPassword().equals(userDetailsPanel.getPasswordConfirmation())) { MessageDialogBox errorDialog = new MessageDialogBox( Messages.getString("updateUser"), Messages.getString("passwordConfirmationFailed"), false, false, true); //$NON-NLS-1$//$NON-NLS-2$ errorDialog.center(); } else { ((Button) sender).setEnabled(false); final ProxyPentahoUser user = userDetailsPanel.getUser(); AsyncCallback callback = new AsyncCallback() { public void onSuccess(Object result) { // Since users are compared by name, removeObject() will remove the old user from the // list // and addObject() will add the new user to the list. usersList.removeObject(user); usersList.addObject(user); usersList.setSelectedObject(user); ((Button) sender).setEnabled(true); } public void onFailure(Throwable caught) { MessageDialogBox messageDialog = new MessageDialogBox( ExceptionParser.getErrorHeader(caught.getMessage()), ExceptionParser.getErrorMessage( caught.getMessage(), Messages.getString("errorUpdatingUser")), false, false, true); //$NON-NLS-1$ messageDialog.center(); ((Button) sender).setEnabled(true); } }; // end AsyncCallback UserAndRoleMgmtService.instance().updateUser(user, callback); } }
private void handleWizardPanels(final JSONObject schedule, final JsJobTrigger trigger) { if (hasParams) { showScheduleParamsDialog(trigger, schedule); } else if (isEmailConfValid) { showScheduleEmailDialog(schedule); } else { // submit JSONObject scheduleRequest = (JSONObject) JSONParser.parseStrict(schedule.toString()); if (editJob != null) { JSONArray scheduleParams = new JSONArray(); for (int i = 0; i < editJob.getJobParams().length(); i++) { JsJobParam param = editJob.getJobParams().get(i); JsArrayString paramValue = (JsArrayString) JavaScriptObject.createArray().cast(); paramValue.push(param.getValue()); JsSchedulingParameter p = (JsSchedulingParameter) JavaScriptObject.createObject().cast(); p.setName(param.getName()); p.setType("string"); // $NON-NLS-1$ p.setStringValue(paramValue); scheduleParams.set(i, new JSONObject(p)); } scheduleRequest.put("jobParameters", scheduleParams); // $NON-NLS-1$ String actionClass = editJob.getJobParamValue("ActionAdapterQuartzJob-ActionClass"); // $NON-NLS-1$ if (!StringUtils.isEmpty(actionClass)) { scheduleRequest.put("actionClass", new JSONString(actionClass)); // $NON-NLS-1$ } } RequestBuilder scheduleFileRequestBuilder = new RequestBuilder(RequestBuilder.POST, contextURL + "api/scheduler/job"); // $NON-NLS-1$ scheduleFileRequestBuilder.setHeader( "Content-Type", "application/json"); // $NON-NLS-1$//$NON-NLS-2$ scheduleFileRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT"); try { scheduleFileRequestBuilder.sendRequest( scheduleRequest.toString(), new RequestCallback() { public void onError(Request request, Throwable exception) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), exception.toString(), false, false, true); //$NON-NLS-1$ dialogBox.center(); setDone(false); } public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == 200) { setDone(true); ScheduleRecurrenceDialog.this.hide(); if (callback != null) { callback.okPressed(); } if (showSuccessDialog) { if (!PerspectiveManager.getInstance() .getActivePerspective() .getId() .equals(PerspectiveManager.SCHEDULES_PERSPECTIVE)) { ScheduleCreateStatusDialog successDialog = new ScheduleCreateStatusDialog(); successDialog.center(); } else { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("scheduleUpdatedTitle"), Messages.getString( "scheduleUpdatedMessage"), //$NON-NLS-1$ //$NON-NLS-2$ false, false, true); dialogBox.center(); } } } else { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), // $NON-NLS-1$ response.getText(), false, false, true); dialogBox.center(); setDone(false); } } }); } catch (RequestException e) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), e.toString(), // $NON-NLS-1$ false, false, true); dialogBox.center(); setDone(false); } setDone(true); } }
private void constructDialog( String filePath, String outputLocation, String scheduleName, boolean hasParams, boolean isEmailConfValid, JsJob jsJob) { this.hasParams = hasParams; this.filePath = filePath; this.isEmailConfValid = isEmailConfValid; this.outputLocation = outputLocation; this.scheduleName = scheduleName; scheduleEditorWizardPanel = new ScheduleEditorWizardPanel(getDialogType()); scheduleEditor = scheduleEditorWizardPanel.getScheduleEditor(); String url = GWT.getHostPageBaseURL() + "api/scheduler/blockout/hasblockouts?ts=" + System.currentTimeMillis(); // $NON-NLS-1$ RequestBuilder hasBlockoutsRequest = new RequestBuilder(RequestBuilder.GET, url); hasBlockoutsRequest.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT"); hasBlockoutsRequest.setHeader("accept", "text/plain"); try { hasBlockoutsRequest.sendRequest( url, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), exception.toString(), false, false, true); //$NON-NLS-1$ dialogBox.center(); } @Override public void onResponseReceived(Request request, Response response) { Boolean hasBlockouts = Boolean.valueOf(response.getText()); if (hasBlockouts) { scheduleEditor.setBlockoutButtonHandler( new ClickHandler() { @Override public void onClick(final ClickEvent clickEvent) { PromptDialogBox box = new PromptDialogBox( Messages.getString("blockoutTimes"), Messages.getString("close"), null, null, false, true, new BlockoutPanel(false)); box.center(); } }); } scheduleEditor.getBlockoutCheckButton().setVisible(hasBlockouts); } }); } catch (RequestException e) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), e.toString(), // $NON-NLS-1$ false, false, true); dialogBox.center(); } IWizardPanel[] wizardPanels = {scheduleEditorWizardPanel}; this.setWizardPanels(wizardPanels); setPixelSize(475, 465); center(); if ((hasParams || isEmailConfValid) && (isBlockoutDialog == false)) { finishButton.setText(Messages.getString("nextStep")); // $NON-NLS-1$ } else { finishButton.setText(Messages.getString("ok")); // $NON-NLS-1$ } setupExisting(jsJob); wizardDeckPanel.getElement().getParentElement().addClassName("schedule-dialog-content"); wizardDeckPanel.getElement().getParentElement().removeClassName("dialog-content"); // setHeight("100%"); //$NON-NLS-1$ setSize("650px", "450px"); addStyleName("schedule-recurrence-dialog"); }
public void onMantleSettingsLoaded(MantleSettingsLoadedEvent event) { final HashMap<String, String> settings = event.getSettings(); final String startupPerspective = Window.Location.getParameter("startupPerspective"); mantleRevisionOverride = settings.get("user-console-revision"); RootPanel.get("pucMenuBar").add(MantleXul.getInstance().getMenubar()); if (!StringUtils.isEmpty(startupPerspective)) { RootPanel.get("pucMenuBar").setVisible(false); } RootPanel.get("pucPerspectives").add(PerspectiveManager.getInstance()); if (!StringUtils.isEmpty(startupPerspective)) { RootPanel.get("pucPerspectives").setVisible(false); } RootPanel.get("pucToolBar").add(MantleXul.getInstance().getToolbar()); if (!StringUtils.isEmpty(startupPerspective)) { RootPanel.get("pucToolBar").setVisible(false); } // update supported file types PluginOptionsHelper.buildEnabledOptionsList(settings); // show stuff we've created/configured contentDeck.add(new Label()); contentDeck.showWidget(0); contentDeck.add(SolutionBrowserPanel.getInstance()); if (!StringUtils.isEmpty(startupPerspective)) { SolutionBrowserPanel.getInstance().setVisible(false); } contentDeck.getElement().setId("applicationShell"); contentDeck.setStyleName("applicationShell"); // menubar=no,location=no,resizable=yes,scrollbars=no,status=no,width=1200,height=800 try { RootPanel.get("pucContent").add(contentDeck); } catch (Throwable t) { // onLoad of something is causing problems } RootPanel.get().add(WaitPopup.getInstance()); // Add in the overlay panel overlayPanel.setVisible(false); overlayPanel.setHeight("100%"); overlayPanel.setWidth("100%"); overlayPanel.getElement().getStyle().setProperty("zIndex", "1000"); overlayPanel.getElement().getStyle().setProperty("position", "absolute"); RootPanel.get().add(overlayPanel, 0, 0); String showAdvancedFeaturesSetting = settings.get("show-advanced-features"); // $NON-NLS-1$ showAdvancedFeatures = showAdvancedFeaturesSetting == null ? showAdvancedFeatures : Boolean.parseBoolean(showAdvancedFeaturesSetting); String submitOnEnterSetting = settings.get("submit-on-enter-key"); submitOnEnter = submitOnEnterSetting == null ? submitOnEnter : Boolean.parseBoolean(submitOnEnterSetting); try { String restUrl = GWT.getHostPageBaseURL() + "api/repo/files/canAdminister"; // $NON-NLS-1$ RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, restUrl); requestBuilder.sendRequest( null, new RequestCallback() { @Override public void onError(Request arg0, Throwable arg1) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), arg1.getLocalizedMessage(), false, false, true); //$NON-NLS-1$ dialogBox.center(); } @SuppressWarnings("deprecation") @Override public void onResponseReceived(Request arg0, Response response) { Boolean isAdministrator = Boolean.parseBoolean(response.getText()); SolutionBrowserPanel.getInstance().setAdministrator(isAdministrator); try { String restUrl2 = GWT.getHostPageBaseURL() + "api/scheduler/canSchedule"; // $NON-NLS-1$ RequestBuilder requestBuilder2 = new RequestBuilder(RequestBuilder.GET, restUrl2); requestBuilder2.sendRequest( null, new RequestCallback() { @Override public void onError(Request arg0, Throwable arg1) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), arg1.getLocalizedMessage(), false, false, true); //$NON-NLS-1$ dialogBox.center(); } public void onResponseReceived(Request arg0, Response response) { Boolean isScheduler = Boolean.parseBoolean(response.getText()); SolutionBrowserPanel.getInstance().setScheduler(isScheduler); String numStartupURLsSetting = settings.get("num-startup-urls"); if (numStartupURLsSetting != null) { int numStartupURLs = Integer.parseInt(numStartupURLsSetting); // $NON-NLS-1$ for (int i = 0; i < numStartupURLs; i++) { String url = settings.get("startup-url-" + (i + 1)); // $NON-NLS-1$ String name = settings.get("startup-name-" + (i + 1)); // $NON-NLS-1$ if (url != null && !"".equals(url)) { // $NON-NLS-1$ SolutionBrowserPanel.getInstance() .getContentTabPanel() .showNewURLTab(name != null ? name : url, url, url, false); } } } if (SolutionBrowserPanel.getInstance().getContentTabPanel().getWidgetCount() > 0) { SolutionBrowserPanel.getInstance().getContentTabPanel().selectTab(0); } // startup-url on the URL for the app, wins over settings String startupURL = Window.Location.getParameter("startup-url"); // $NON-NLS-1$ if (startupURL != null && !"".equals(startupURL)) { // $NON-NLS-1$ String title = Window.Location.getParameter("name"); // $NON-NLS-1$ startupURL = URL.decodeComponent(startupURL); SolutionBrowserPanel.getInstance() .getContentTabPanel() .showNewURLTab(title, title, startupURL, false); } } }); } catch (RequestException e) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), e.getLocalizedMessage(), false, false, true); //$NON-NLS-1$ dialogBox.center(); } } }); } catch (RequestException e) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), e.getLocalizedMessage(), false, false, true); //$NON-NLS-1$ dialogBox.center(); } if (!StringUtils.isEmpty(startupPerspective)) { ICallback<Void> callback = new ICallback<Void>() { public void onHandle(Void nothing) { PerspectiveManager.getInstance().setPerspective(startupPerspective); } }; PerspectiveManager.getInstance().addPerspectivesLoadedCallback(callback); } }
/** * This method is used by things to show a 'mantle' looking alert dialog instead of a standard * alert dialog. * * @param title * @param message */ private void showMessage(String title, String message) { MessageDialogBox dialog = new MessageDialogBox(title, message, true, false, true); dialog.center(); }