Java Code Examples for com.smartgwt.client.util.SC#ask()
The following examples show how to use
com.smartgwt.client.util.SC#ask() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImportParentChooser.java From proarc with GNU General Public License v3.0 | 6 votes |
private void onParentSelection(final Record selection) { String parentOwner = selection.getAttribute(SearchDataSource.FIELD_OWNER); String username = Editor.getInstance().getUser().getAttribute(UserDataSource.FIELD_USERNAME); if (parentOwnerCheck && !username.equals(parentOwner)) { SC.ask(i18n.ImportParentChooser_SelectAction_ParentOwnerCheck_Msg(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value != null && value) { setParentSelection(selection); } } }); } else { setParentSelection(selection); } }
Example 2
Source File: SubscriptionListGrid.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
protected ClickHandler createDeleteHandler(final ListGridRecord ruleRecord) { return new ClickHandler() { @Override public void onClick(ClickEvent event) { boolean subscribed = ruleRecord.getAttributeAsBoolean(SUBSCRIBED).booleanValue(); if (subscribed) { SC.say(i18n.deleteOnlyWhenUnsubbscribed()); } else { SC.ask(i18n.deleteSubscriptionQuestion(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { String role = getLoggedInUserRole(); String uuid = ruleRecord.getAttribute(UUID); getMainEventBus().fireEvent(new DeleteRuleEvent(currentSession(), uuid, role)); removeData(ruleRecord); } } }); } } }; }
Example 3
Source File: ShareFileDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void onImport() { final Record[] selection = tree.getSelectedRecords(); if (selection == null) return; final String[] ids = new String[selection.length]; for (int i = 0; i < selection.length; i++) ids[i] = selection[i].getAttributeAsString("iid"); SC.ask(I18N.message("importfromsfile", Session.get().getCurrentFolder().getName()), new BooleanCallback() { @Override public void execute(Boolean choice) { if (choice.booleanValue()) { ShareFileDialog.this.destroy(); ContactingServer.get().show(); ShareFileService.Instance.get().importDocuments(Session.get().getCurrentFolder().getId(), ids, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(Integer count) { ContactingServer.get().hide(); FolderNavigator.get().reload(); SC.say(I18N.message("importeddocs2", count.toString())); } }); } } }); }
Example 4
Source File: ZohoDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void onImport() { final Record[] selection = tree.getSelectedRecords(); if (selection == null) return; final List<String> docIds = new ArrayList<String>(); final List<String> folderCompositeIds = new ArrayList<String>(); for (Record record : selection) { if ("folder".equals(record.getAttributeAsString("type"))) folderCompositeIds.add(record.getAttributeAsString("name") + ":" + record.getAttributeAsString("id")); else docIds.add(record.getAttributeAsString("id")); } SC.ask(I18N.message("importfromzoho", Session.get().getCurrentFolder().getName()), new BooleanCallback() { @Override public void execute(Boolean choice) { if (choice.booleanValue()) { ZohoDialog.this.destroy(); ContactingServer.get().show(); ZohoService.Instance.get().importDocuments(Session.get().getCurrentFolder().getId(), folderCompositeIds.toArray(new String[0]), docIds.toArray(new String[0]), new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(Integer count) { ContactingServer.get().hide(); FolderNavigator.get().reload(); SC.say(I18N.message("importeddocs2", count.toString())); } }); } } }); }
Example 5
Source File: DropboxDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void onImport() { final Record[] selection = tree.getSelectedRecords(); if (selection == null) return; final String[] paths = new String[selection.length]; for (int i = 0; i < selection.length; i++) paths[i] = selection[i].getAttributeAsString("path"); SC.ask(I18N.message("importfromdbox", Session.get().getCurrentFolder().getName()), new BooleanCallback() { @Override public void execute(Boolean choice) { if (choice.booleanValue()) { DropboxDialog.this.destroy(); ContactingServer.get().show(); DropboxService.Instance.get().importDocuments(Session.get().getCurrentFolder().getId(), paths, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(Integer count) { ContactingServer.get().hide(); FolderNavigator.get().reload(); SC.say(I18N.message("importeddocs2", count.toString())); } }); } } }); }
Example 6
Source File: ModsCustomDataSource.java From proarc with GNU General Public License v3.0 | 5 votes |
protected void onValidationError() { String msg = i18n.SaveAction_IgnoreRemoteInvalid_Msg(getValidationMessage()); SC.ask(i18n.SaveAction_Title(), msg, new BooleanCallback() { @Override public void execute(Boolean value) { // save again if (value != null && value) { updateRecord.setAttribute(DigitalObjectResourceApi.MODS_CUSTOM_IGNOREVALIDATION, true); getInstance().updateData(updateRecord, DescriptionSaveHandler.this, updateRequest); } } }); }
Example 7
Source File: SaveAction.java From proarc with GNU General Public License v3.0 | 5 votes |
private static void askSave(final BooleanCallback result, ClientMessages i18n) { SC.ask(i18n.SaveAction_Ask_Msg(), new BooleanCallback() { @Override public void execute(Boolean value) { result.execute(value); } }); }
Example 8
Source File: SaveAction.java From proarc with GNU General Public License v3.0 | 5 votes |
private static void askIgnoreValidation(final BooleanCallback result, ClientMessages i18n) { SC.ask(i18n.SaveAction_IgnoreInvalid_Msg(), new BooleanCallback() { @Override public void execute(Boolean value) { result.execute(value); } }); }
Example 9
Source File: DeleteAction.java From proarc with GNU General Public License v3.0 | 5 votes |
public void askAndDelete(final Object[] selection) { if (selection == null || selection.length == 0) { return ; } if (optionsForm != null) { optionsForm.clearValues(); final Dialog d = new Dialog(i18n.DeleteAction_Window_Title()); d.getDialogLabelContainer().setContents(i18n.DeleteAction_Window_Msg(String.valueOf(selection.length))); d.getDialogContentContainer().setMembers(optionsForm); d.addYesButton((ClickEvent event) -> { Record options = optionsForm.getValuesAsRecord(); d.destroy(); delete(selection, options); }); d.addNoButton(new Dialog.DialogCloseHandler() { @Override public void onClose() { d.destroy(); } }); d.setWidth(400); d.show(); } else { SC.ask(i18n.DeleteAction_Window_Title(), i18n.DeleteAction_Window_Msg(String.valueOf(selection.length)), new BooleanCallback() { @Override public void execute(Boolean value) { if (value != null && value) { delete(selection); } } }); } }
Example 10
Source File: LegendController.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
void confirmBeforeReload(final String url) { SC.ask(i18n.changeLanguage(), new BooleanCallback() { public void execute(Boolean value) { if (value) { Window.Location.assign(url); } } }); }
Example 11
Source File: ShareFileDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private void onExport() { final Record selection = tree.getSelectedRecord(); if (selection == null) return; final long[] docIds = MainPanel.get().isOnDocumentsTab() ? DocumentsPanel.get().getDocumentsGrid() .getSelectedIds() : SearchPanel.get().getDocumentsGrid().getSelectedIds(); SC.ask(docIds.length == 0 ? I18N.message("exportdirtosfile", Session.get().getCurrentFolder().getName()) : I18N .message("exportdocstosfile"), new BooleanCallback() { @Override public void execute(Boolean choice) { if (choice.booleanValue()) { String targetId = selection.getAttributeAsString("iid"); long[] folderIds = new long[0]; if (docIds.length == 0 && Session.get().getCurrentFolder() != null) folderIds[0] = Session.get().getCurrentFolder().getId(); ContactingServer.get().show(); ShareFileService.Instance.get().exportDocuments(targetId, folderIds, docIds, new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(Boolean result) { ContactingServer.get().hide(); if (result.booleanValue()) { SC.say(I18N.message("sfileexportok")); ShareFileDialog.this.destroy(); } else SC.say(I18N.message("sfileexportko")); } }); } } }); }
Example 12
Source File: ZohoDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private void onExport() { final Record selection = tree.getSelectedRecord(); if (selection == null) return; final long[] docIds = MainPanel.get().isOnDocumentsTab() ? DocumentsPanel.get().getDocumentsGrid() .getSelectedIds() : SearchPanel.get().getDocumentsGrid().getSelectedIds(); SC.ask(docIds.length == 0 ? I18N.message("exportdirtozoho", Session.get().getCurrentFolder().getName()) : I18N .message("exportdocstozoho"), new BooleanCallback() { @Override public void execute(Boolean choice) { if (choice.booleanValue()) { String targetId = selection.getAttributeAsString("id"); long[] folderIds = new long[0]; if (docIds.length == 0 && Session.get().getCurrentFolder() != null) folderIds[0] = Session.get().getCurrentFolder().getId(); ContactingServer.get().show(); ZohoService.Instance.get().exportDocuments(targetId, folderIds, docIds, new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(Boolean result) { ContactingServer.get().hide(); if (result.booleanValue()) { SC.say(I18N.message("zohoexportok")); ZohoDialog.this.destroy(); } else SC.say(I18N.message("zohoexportko")); } }); } } }); }
Example 13
Source File: DropboxDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private void onExport() { final Record selection = tree.getSelectedRecord(); if (selection == null) return; final long[] docIds = MainPanel.get().isOnDocumentsTab() ? DocumentsPanel.get().getDocumentsGrid() .getSelectedIds() : SearchPanel.get().getDocumentsGrid().getSelectedIds(); SC.ask(docIds.length == 0 ? I18N.message("exportdirtodbox", Session.get().getCurrentFolder().getName()) : I18N .message("exportdocstodbox"), new BooleanCallback() { @Override public void execute(Boolean choice) { if (choice.booleanValue()) { String targetPath = selection.getAttributeAsString("path"); long[] folderIds = new long[0]; if (docIds.length == 0 && Session.get().getCurrentFolder() != null) folderIds[0] = Session.get().getCurrentFolder().getId(); ContactingServer.get().show(); DropboxService.Instance.get().exportDocuments(targetPath, folderIds, docIds, new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(Boolean result) { ContactingServer.get().hide(); if (result.booleanValue()) { SC.say(I18N.message("dboxexportok")); DropboxDialog.this.destroy(); } else SC.say(I18N.message("dboxexportko")); } }); } } }); }
Example 14
Source File: ModsCustomEditor.java From proarc with GNU General Public License v3.0 | 4 votes |
private void saveImpl(final BooleanCallback callback) { // do not use customForm.getValuesAsRecord() Record r = new Record(activeEditor.getValues()); if (LOG.isLoggable(Level.FINE)) { ClientUtils.fine(LOG, "saveCustomData: %s", ClientUtils.dump(r.getJsObj())); } r = ClientUtils.normalizeData(r); metadata.setDescription(r); if (LOG.isLoggable(Level.FINE)) { ClientUtils.fine(LOG, "saveCustomRecord: %s", ClientUtils.dump(metadata.getWrapper().getJsObj())); } DescriptionSaveHandler dsh = new DescriptionSaveHandler() { @Override protected void onSave(DescriptionMetadata dm) { super.onSave(dm); if (dm != null) { metadata = dm; Record customModsRecord = dm.getDescription(); if (customModsRecord != null) { // refresh editor with server values activeEditor.editRecord(customModsRecord); } } callback.execute(true); activeEditor.focus(); Optional.ofNullable(dm).ifPresent(f -> refresh()); } @Override protected void onConcurrencyError() { SC.ask(i18n.SaveAction_ConcurrentErrorAskReload_Msg(), new BooleanCallback() { @Override public void execute(Boolean value) { callback.execute(false); activeEditor.focus(); if (value != null && value) { refresh(); } } }); } @Override protected void onError() { super.onError(); callback.execute(false); } }; // workflow has a separate api endpoint if (this.digitalObject.getWorkflowJobId() != null) { WorkflowModsCustomDataSource.getInstance().saveDescription(metadata, digitalObject.getModelId(), digitalObject.getWorkflowJobId(), dsh, true); } else { ModsCustomDataSource.getInstance().saveDescription(metadata, dsh, true); } }