com.smartgwt.client.util.SC Java Examples
The following examples show how to use
com.smartgwt.client.util.SC.
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: NdkSipExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private void exportOrValidate(final Record export) { DSRequest dsRequest = new DSRequest(); dsRequest.setShowPrompt(false); DataSource ds = ExportDataSource.getNdk(); dsAddData(ds, export, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (RestConfig.isStatusOk(response)) { Record[] data = response.getData(); RecordList erl = errorsFromExportResult(data); if (erl.isEmpty()) { SC.say(i18n.NdkExportAction_ExportDone_Msg()); } else { DesaExportAction.ExportResultWidget.showErrors(erl.toArray()); } } } }, dsRequest); }
Example #2
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 #3
Source File: FolderNavigator.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public void onArchive(final long folderId) { LD.askForValue(I18N.message("warning"), I18N.message("archiveadvice"), "", 400, new ValueCallback() { @Override public void execute(String value) { if (value == null) return; if (value.isEmpty()) SC.warn(I18N.message("commentrequired")); else DocumentService.Instance.get().archiveFolder(folderId, value, new AsyncCallback<Long>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Long result) { Log.info(I18N.message("documentswerearchived", "" + result), null); reload(); } }); } }); }
Example #4
Source File: NdkExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
protected void exportOrValidate(final Record export) { DSRequest dsRequest = new DSRequest(); //dsRequest.setPromptStyle(PromptStyle.DIALOG); //dsRequest.setPrompt(i18n.KrameriusExportAction_Add_Msg()); dsRequest.setShowPrompt(false); DataSource ds = ExportDataSource.getNdk(); dsAddData(ds, export, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (RestConfig.isStatusOk(response)) { Record[] data = response.getData(); RecordList erl = errorsFromExportResult(data); if (erl.isEmpty()) { String dryRun = export.getAttribute(ExportResourceApi.DESA_DRYRUN_PARAM); SC.say(dryRun == null ? i18n.NdkExportAction_ExportDone_Msg() : i18n.DesaExportAction_ValidationDone_Msg()); } else { ExportResultWidget.showErrors(erl.toArray()); } } } }, dsRequest); }
Example #5
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 #6
Source File: Options.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Sends the options in the grid to the server to save them. */ private void onSave() { Record[] records = list.getRecords(); String[] values = new String[records.length]; int i = 0; for (Record record : records) values[i++] = record.getAttributeAsString("value"); ContactingServer.get().show(); AttributeSetService.Instance.get().saveOptions(setId, attribute, values, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(Void arg0) { ContactingServer.get().hide(); SC.say(I18N.message("optionssaved")); } }); }
Example #7
Source File: StampUploader.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public void onSave() { if (multiUploader.getSuccessUploads() <= 0) { SC.warn(I18N.message("filerequired")); return; } StampService.Instance.get().saveImage(stampId, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); close(); } @Override public void onSuccess(Void arg) { panel.refreshStampImage(); close(); } }); }
Example #8
Source File: EventSubscriptionWindow.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
private ClickHandler createApplyHandler() { return new ClickHandler() { @Override public void onClick(ClickEvent event) { if (controller.isSelectionValid()) { Rule rule = controller.createSimpleRuleFromSelection(); CreateSimpleRuleEvent createEvt = new CreateSimpleRuleEvent(currentSession(), rule, false, ""); EventBus.getMainEventBus().fireEvent(createEvt); // broker handles auto-subscribe EventSubscriptionWindow.this.hide(); } else { // form validation should render error message // TODO form error handling does not work yet SC.warn(i18n.validateTextBoxes()); } } }; }
Example #9
Source File: SesRequestManager.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
public void deleteRule(final SessionInfo sessionInfo, String uuid, final String role) { AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() { public void onFailure(Throwable arg0) { Toaster.getToasterInstance().addErrorMessage(arg0.getMessage()); } public void onSuccess(SesClientResponse response) { if (response.getType() == REQUIRES_LOGIN) { handleRelogin(); } else if (response.getType().equals(DELETE_RULE_SUBSCRIBED)) { SC.say(i18n.ruleSubscribed()); } else { // update list if (role.equals("ADMIN")) { getMainEventBus().fireEvent(new GetAllRulesEvent(sessionInfo)); } else { getMainEventBus().fireEvent(new GetAllOwnRulesEvent(sessionInfo, true)); } } } }; this.sesRulesService.deleteRule(sessionInfo, uuid, callback); }
Example #10
Source File: AllRulesListGrid.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
protected Canvas createDeleteRuleButton(final ListGridRecord record) { IButton deleteButton = new IButton(i18n.delete()); deleteButton.setShowDown(false); deleteButton.setShowRollOver(false); deleteButton.setLayoutAlign(CENTER); deleteButton.setPrompt(i18n.deleteThisRule()); deleteButton.setHeight(16); deleteButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { SC.ask(i18n.reallyDeleteRule(), new BooleanCallback() { public void execute(Boolean value) { if (value) { String uuid = record.getAttribute(UUID); String userRole = getLoggedInUser(); DeleteRuleEvent deleteRuleEvent = new DeleteRuleEvent(currentSession(), uuid, userRole); EventBus.getMainEventBus().fireEvent(deleteRuleEvent); } } }); } }); return deleteButton; }
Example #11
Source File: OwnRulesListGrid.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
private Canvas createDeleteRuleButtonm(final ListGridRecord ruleRecord) { IButton deleteButton = new IButton(i18n.delete()); deleteButton.setShowDown(false); deleteButton.setShowRollOver(false); deleteButton.setLayoutAlign(Alignment.CENTER); deleteButton.setPrompt(i18n.deleteThisRule()); deleteButton.setHeight(16); deleteButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { SC.ask(i18n.reallyDeleteRule(), new BooleanCallback() { public void execute(Boolean value) { if (value) { String uuid = ruleRecord.getAttribute(UUID); String userRole = getLoggedInUserRole(); EventBus.getMainEventBus().fireEvent(new DeleteRuleEvent(currentSession(), uuid, userRole)); } } }); } }); return deleteButton; }
Example #12
Source File: ShareFileSettings.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public void onSave() { if (!vm.validate()) return; ContactingServer.get().show(); ShareFileService.Instance.get().saveSettings(vm.getValueAsString("host"), vm.getValueAsString("username"), vm.getValueAsString("password"), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); SC.warn(I18N.message("connectionfailed")); } @Override public void onSuccess(Void result) { ContactingServer.get().hide(); Log.info(I18N.message("connectionestablished"), null); destroy(); } }); }
Example #13
Source File: RegisterLayout.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
protected void register() { form.validate(true); if (RegisterLayout.this.form.validate() && (Boolean) RegisterLayout.this.acceptBox.getValue()) { String userName = (String) RegisterLayout.this.userNameItem.getValue(); String name = (String) RegisterLayout.this.nameItem.getValue(); String password = DataControlsSes.createMD5((String) RegisterLayout.this.passwordItem.getValue()); String eMail = (String) RegisterLayout.this.emailItem.getValue(); boolean activated = false; if (name == null || name.equals("")) { name = ""; } // create user without parameterId and register UserDTO u = new UserDTO(userName, name, password, eMail, NOT_REGISTERED_USER, activated, new Date()); EventBus.getMainEventBus().fireEvent(new RegisterUserEvent(u)); } else if (RegisterLayout.this.form.validate() && !(Boolean) RegisterLayout.this.acceptBox.getValue()) { SC.say(i18n.acceptTermsOfUseInfo()); } }
Example #14
Source File: OptionsUploader.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public void onSend() { if (uploader.getSuccessUploads() <= 0) { SC.warn(I18N.message("filerequired")); return; } if (!vm.validate()) return; ContactingServer.get().show(); AttributeSetService.Instance.get().parseOptions(options.getSetId(), options.getAttribute(), new AsyncCallback<String[]>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); options.refresh(); ContactingServer.get().hide(); } @Override public void onSuccess(String[] ret) { options.refresh(); ContactingServer.get().hide(); destroy(); } }); }
Example #15
Source File: ArchiveExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private void exportOrValidate(final Record export) { DSRequest dsRequest = new DSRequest(); //dsRequest.setPromptStyle(PromptStyle.DIALOG); //dsRequest.setPrompt(i18n.KrameriusExportAction_Add_Msg()); dsRequest.setShowPrompt(false); DataSource ds = ExportDataSource.getArchive(); dsAddData(ds, export, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (RestConfig.isStatusOk(response)) { Record[] data = response.getData(); RecordList erl = errorsFromExportResult(data); if (erl.isEmpty()) { String target = ""; if (data != null && data.length > 0) { target = data[0].getAttribute(ExportResourceApi.RESULT_TARGET); } SC.say(i18n.ExportResultWidget_Window_Title(), i18n.ArchiveExportAction_ExportDone_Msg(target)); } else { DesaExportAction.ExportResultWidget.showErrors(erl.toArray()); } } } }, dsRequest); }
Example #16
Source File: SesRequestManager.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
/** * Sends a new password to ther user's email if it matches the registered one. * * @param name * the username * @param email * the email */ public void newPassword(String name, String email) { AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() { @Override public void onFailure(Throwable arg0) { getToasterInstance().addErrorMessage(i18n.failedGeneratePassword()); } @Override public void onSuccess(SesClientResponse response) { if (response.getType() != NEW_PASSWORD_OK) { SC.say(i18n.invalidNewPasswordInputs()); } else { SC.say(i18n.passwordSended()); getMainEventBus().fireEvent(new ChangeLayoutEvent(LayoutType.LOGIN)); } } }; sesUserService.resetPassword(name, email, callback); }
Example #17
Source File: ExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
protected final void dsAddData(DataSource dataSource, Record record, DSCallback dsCallback, DSRequest dsRequest) { DynamicForm optionsForm = createOptionsForm(); if (optionsForm == null) { dataSource.addData(record, dsCallback, dsRequest); SC.say(i18n.ExportAction_Sent_Msg()); return; } Dialog d = new Dialog(i18n.ExportAction_Request_Title()); d.getDialogContentContainer().addMember(optionsForm); IButton okButton = d.addOkButton((ClickEvent eventX) -> { setRequestOptions(record); dataSource.addData(record, dsCallback, dsRequest); d.destroy(); SC.say(i18n.ExportAction_Sent_Msg()); }); d.addCancelButton(() -> d.destroy()); d.setWidth(400); d.show(); okButton.focus(); }
Example #18
Source File: CejshExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private void exportOrValidate(final Record export) { DSRequest dsRequest = new DSRequest(); //dsRequest.setPromptStyle(PromptStyle.DIALOG); //dsRequest.setPrompt(i18n.KrameriusExportAction_Add_Msg()); dsRequest.setShowPrompt(false); DataSource ds = ExportDataSource.getCejsh(); dsAddData(ds, export, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (RestConfig.isStatusOk(response)) { Record[] data = response.getData(); RecordList erl = errorsFromExportResult(data); if (erl.isEmpty()) { String target = ""; if (data != null && data.length > 0) { target = data[0].getAttribute(ExportResourceApi.RESULT_TARGET); } SC.say(i18n.ExportResultWidget_Window_Title(), i18n.CejshExportAction_ExportDone_Msg(target)); } else { DesaExportAction.ExportResultWidget.showErrors(erl.toArray()); } } } }, dsRequest); }
Example #19
Source File: ChronicleExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private void exportOrValidate(final Record export) { DSRequest dsRequest = new DSRequest(); dsRequest.setShowPrompt(false); DataSource ds = ExportDataSource.getNdk(); dsAddData(ds, export, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (RestConfig.isStatusOk(response)) { Record[] data = response.getData(); RecordList erl = errorsFromExportResult(data); if (erl.isEmpty()) { SC.say(i18n.NdkExportAction_ExportDone_Msg()); } else { DesaExportAction.ExportResultWidget.showErrors(erl.toArray()); } } } }, dsRequest); }
Example #20
Source File: DesaExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private void exportOrValidate(final Record export) { DSRequest dsRequest = new DSRequest(); dsRequest.setPromptStyle(PromptStyle.DIALOG); dsRequest.setPrompt(i18n.KrameriusExportAction_Add_Msg()); DataSource ds = ExportDataSource.getDesa(); dsAddData(ds, export, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { if (RestConfig.isStatusOk(response)) { Record[] data = response.getData(); RecordList erl = errorsFromExportResult(data); if (erl.isEmpty()) { String dryRun = export.getAttribute(ExportResourceApi.DESA_DRYRUN_PARAM); SC.say(dryRun == null ? i18n.DesaExportAction_ExportDone_Msg() : i18n.DesaExportAction_ValidationDone_Msg()); } else { ExportResultWidget.showErrors(erl.toArray()); } } } }, dsRequest); }
Example #21
Source File: LinksPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
protected void onDownloadPackage() { if (document.getFolder().isDownload()) { String url = GWT.getHostPageBaseURL() + "zip-export?folderId=" + document.getFolder().getId(); url += "&docId=" + document.getId(); treeGrid.getRecords(); for (ListGridRecord record : treeGrid.getRecords()) { if (record.getAttributeAsBoolean("password")) { SC.warn(I18N.message("somedocsprotected")); break; } String docId = record.getAttribute("documentId"); docId = docId.substring(docId.indexOf('-') + 1); url += "&docId=" + docId; } WindowUtils.openUrl(url); } }
Example #22
Source File: DocumentsUploader.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public void onSend() { if (multiUploader.getSuccessUploads() <= 0) { SC.warn(I18N.message("filerequired")); return; } if (!vm.validate()) return; GUIFolder folder = Session.get().getCurrentFolder(); GUIDocument metadata = new GUIDocument(); metadata.setFolder(Session.get().getCurrentFolder()); metadata.setLanguage(I18N.getDefaultLocaleForDoc()); metadata.setTemplateId(folder.getTemplateId()); metadata.setTemplate(folder.getTemplate()); metadata.setAttributes(folder.getAttributes()); metadata.setTags(folder.getTags()); metadata.setOcrTemplateId(folder.getOcrTemplateId()); UpdateDialog bulk = new UpdateDialog(null, metadata, UpdateDialog.CONTEXT_UPLOAD, false); bulk.setZip(getImportZip()); bulk.setCharset(getCharset()); bulk.setImmediateIndexing(getImmediateIndexing()); bulk.show(); destroy(); }
Example #23
Source File: SesRequestManager.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
public void deleteProfile(final SessionInfo sessionInfo) { AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() { @Override public void onFailure(Throwable arg0) { Toaster.getToasterInstance().addErrorMessage(arg0.getMessage()); } @Override public void onSuccess(SesClientResponse result) { if (result.getType() == REQUIRES_LOGIN) { handleRelogin(); } SC.say(i18n.profileDelete()); } }; sesUserService.requestToDeleteProfile(sessionInfo, callback); }
Example #24
Source File: DocumentDetailsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public void onSave() { if (validate()) { try { // Check if the user has changed the extension and warn him if (!originalExtension.equalsIgnoreCase(Util.getExtension(document.getFileName()))) { LD.ask(I18N.message("filename"), I18N.message("extchangewarn"), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) saveDocument(); } }); } else { saveDocument(); } } catch (Throwable t) { SC.warn(t.getMessage()); } } }
Example #25
Source File: DocumentCheckin.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public void onFinish(IUploader uploader) { if (uploader.getStatus() == Status.SUCCESS) { sendButton.setDisabled(false); } // This check is done because IE8 works differently from Firefox String uploadedFilename = uploader.getServerInfo().getFileName(); if (uploadedFilename.lastIndexOf('/') != -1) uploadedFilename = uploadedFilename.substring(uploadedFilename.lastIndexOf('/') + 1); if (uploadedFilename.lastIndexOf('\\') != -1) uploadedFilename = uploadedFilename.substring(uploadedFilename.lastIndexOf('\\') + 1); if ("true".equals(vm.getValueAsString("checkfilename")) && !fileName.equals(uploadedFilename)) { sendButton.setDisabled(true); SC.warn(I18N.message("nosamefilename")); } }
Example #26
Source File: DigitalObjectNavigateAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private void fetchSiblings(final String pid) { SearchDataSource.getInstance().findParent(pid, null, new Callback<ResultSet, Void>() { @Override public void onFailure(Void reason) { } @Override public void onSuccess(ResultSet result) { if (result.isEmpty()) { SC.warn(i18n.DigitalObjectNavigateAction_NoParent_Msg()); } else { Record parent = result.first(); DigitalObject parentObj = DigitalObject.createOrNull(parent); if (parentObj != null) { scheduleFetchSiblings(parentObj.getPid(), pid); } } } }); }
Example #27
Source File: DropboxAuthorizationWizard.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public void onSubmit() { if (!vm.validate()) return; DropboxService.Instance.get().finishAuthorization(vm.getValueAsString("code").trim(), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(String account) { if (account != null) { destroy(); SC.say(I18N.message("correctlyauthorized", new String[] { Session.get().getInfo().getBranding().getProductName(), account })); } else SC.warn(I18N.message("unabletoauthorize")); } }); }
Example #28
Source File: DigitalObjectNavigateAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private void openSibling(final String pid, boolean cached) { if (pid != null) { RecordList rs = getSiblings(); int pidIndex = rs.findIndex(RelationDataSource.FIELD_PID, pid); if (pidIndex == -1) { // fetch if (cached) { // not found PID SC.warn("Not found " + pid); } else { fetchSiblings(pid); } } else if (navigation == Navigation.PREV && pidIndex == 0) { SC.warn(i18n.DigitalObjectNavigateAction_NoPrevSibling_Msg()); } else if (navigation == Navigation.NEXT && pidIndex + 1 >= rs.getLength()) { SC.warn(i18n.DigitalObjectNavigateAction_NoNextSibling_Msg()); } else { // open new int inc = navigation == Navigation.PREV ? -1 : 1; DigitalObject newObj = DigitalObject.create(rs.get(pidIndex + inc)); if (newObj != null) { open(newObj); } } } }
Example #29
Source File: SesRequestManager.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
public void copy(final String userID, String ruleName) { AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() { public void onFailure(Throwable arg0) { Toaster.getToasterInstance().addErrorMessage(arg0.getMessage()); } public void onSuccess(SesClientResponse result) { if (result.getType().equals(SesClientResponseType.OK)) { EventBus.getMainEventBus().fireEvent(new GetAllOwnRulesEvent(currentSession(), true)); } else if (result.getType().equals(SesClientResponseType.RULE_NAME_EXISTS)) { SC.say(i18n.copyExists()); } } }; this.sesRulesService.copy(userID, ruleName, callback); }
Example #30
Source File: Session.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public void logout() { SecurityService.Instance.get().logout(new AsyncCallback<Void>() { public void onFailure(Throwable caught) { Log.serverError(caught); SC.warn(caught.getMessage()); } @Override public void onSuccess(Void result) { CookiesManager.removeSid(); try { String tenant = Session.get().getUser().getTenant().getName(); Session.get().close(); Util.redirectToLoginUrl(tenant); } catch (Throwable t) { } } }); }