Java Code Examples for com.smartgwt.client.widgets.form.DynamicForm#setValuesManager()
The following examples show how to use
com.smartgwt.client.widgets.form.DynamicForm#setValuesManager() .
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: DigitalObjectPreview.java From proarc with GNU General Public License v3.0 | 6 votes |
/** * Gets widget to zoom image in the window. * @return */ public Canvas getWindowZoomer() { SelectItem zoomItem = createZoomForm(); zoomItem.setHeight(15); zoomItem.setPickerIconSrc("[SKIN]/headerIcons/zoom.png"); zoomItem.setPickerIconHeight(15); zoomItem.setPickerIconWidth(15); zoomItem.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { onZoomChange(event); } }); DynamicForm form = new DynamicForm(); form.setValuesManager(zoomValues); form.setFields(zoomItem); form.setLayoutAlign(Alignment.CENTER); return form; }
Example 2
Source File: UserPropertiesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
private void prepareGroupsForm(boolean readOnly) { DynamicForm form2 = new DynamicForm(); form2.setValuesManager(vm); List<String> groupIds = new ArrayList<String>(); GUIGroup[] groups = user.getGroups(); if (groups != null && groups.length > 0) { for (int i = 0; i < groups.length; i++) if (groups[i].getType() == 0) groupIds.add(Long.toString(groups[i].getId())); } groupsItem = ItemFactory.newMultiComboBoxItem("groups", "groups", new GroupsDS(), groupIds.toArray(new String[0])); groupsItem.setDisabled(readOnly || "admin".equals(user.getUsername()) || ("admin" + Session.get().getTenantName()).equals(user.getUsername())); groupsItem.setValueField("id"); groupsItem.setDisplayField("name"); groupsItem.addChangedHandler(changedHandler); form2.setItems(groupsItem); addMember(form2, 2); }
Example 3
Source File: AttributeSetPropertiesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
protected void addMetadata() { form1 = new DynamicForm(); form1.setNumCols(1); form1.setValuesManager(vm); form1.setTitleOrientation(TitleOrientation.LEFT); StaticTextItem id = ItemFactory.newStaticTextItem("id", "id", Long.toString(attributeSet.getId())); id.setDisabled(true); TextItem name = ItemFactory.newSimpleTextItem("name", I18N.message("name"), attributeSet.getName()); name.setRequired(true); name.setDisabled(attributeSet.isReadonly()); if (!attributeSet.isReadonly()) name.addChangedHandler(changedHandler); TextAreaItem description = ItemFactory.newTextAreaItem("description", "description", attributeSet.getDescription()); description.setDisabled(attributeSet.isReadonly()); if (!attributeSet.isReadonly()) description.addChangedHandler(changedHandler); form1.setItems(id, name, description); form1.setWidth(200); }
Example 4
Source File: ZonalOCRTemplateSettings.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void prepareForm() { form = new DynamicForm(); form.setWidth100(); form.setAlign(Alignment.LEFT); form.setColWidths("1px, 100%"); vm = new ValuesManager(); form.setValuesManager(vm); final StaticTextItem fileNameWaring = ItemFactory.newStaticTextItem("fileNameWarning", I18N.message("attention"), I18N.message("filenamewarning")); fileNameWaring.setRequired(true); TextItem name = ItemFactory.newTextItem("name", "name", ocrPanel.getSelectedOcrTemplate().getName()); name.setRequired(true); name.setDisabled(ocrPanel.getSelectedOcrTemplate().getId() != 0L); StaticTextItem id = ItemFactory.newStaticTextItem("id", I18N.message("id"), "" + ocrPanel.getSelectedOcrTemplate().getId()); id.setVisible(ocrPanel.getSelectedOcrTemplate().getId() != 0L); SpinnerItem batch = ItemFactory.newSpinnerItem("batch", "batch", Session.get().getConfigAsInt("zonalocr.batch")); batch.setStep(50); batch.setMin(1); TextAreaItem description = ItemFactory.newTextAreaItem("description", "description", ocrPanel.getSelectedOcrTemplate().getDescription()); description.setHeight(200); if (Session.get().isDefaultTenant()) form.setItems(id, name, description, batch); else form.setItems(id, name, description); }
Example 5
Source File: TextContentCreate.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public TextContentCreate() { setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("createtextcontent")); setCanDragResize(true); setIsModal(true); setShowModalMask(true); setAutoSize(true); centerInPage(); DynamicForm form = new DynamicForm(); vm = new ValuesManager(); form.setValuesManager(vm); form.setTitleOrientation(TitleOrientation.TOP); form.setNumCols(1); TextItem filename = ItemFactory.newTextItem("filename", "filename", null); filename.setRequired(true); filename.setWidth(200); SelectItem template = ItemFactory.newTemplateSelector(true, null); create = new SubmitItem(); create.setTitle(I18N.message("create")); create.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onCreate(); } }); form.setItems(filename, template, create); addItem(form); }
Example 6
Source File: ZohoCheckin.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public ZohoCheckin(final GUIDocument document, final ZohoEditor parentDialog) { setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("checkin")); setWidth(400); setHeight(140); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setMembersMargin(2); DynamicForm form = new DynamicForm(); vm = new ValuesManager(); form.setValuesManager(vm); BooleanItem versionItem = new BooleanItem(); versionItem.setName("majorversion"); versionItem.setTitle(I18N.message("majorversion")); TextItem commentItem = ItemFactory.newTextItem("comment", "comment", null); commentItem.setRequired(true); commentItem.setWidth(240); checkin = new SubmitItem(); checkin.setTitle(I18N.message("checkin")); checkin.setAlign(Alignment.RIGHT); checkin.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onCheckin(document, parentDialog); } }); form.setItems(versionItem, commentItem, checkin); addItem(form); }
Example 7
Source File: ReportUploader.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void prepareForm() { form = new DynamicForm(); vm = new ValuesManager(); form.setValuesManager(vm); outputFolderSelector = new FolderSelector("outputFolder", false); outputFolderSelector.setRequired(true); outputFolderSelector.setWidth(250); outputFolderSelector.setTitle(I18N.message("outputfolder")); TextItem name = ItemFactory.newSimpleTextItem("name", "name", null); name.setRequired(true); form.setItems(name, outputFolderSelector); }
Example 8
Source File: BarcodeTemplateSettings.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void prepareForm() { form = new DynamicForm(); form.setWidth100(); form.setAlign(Alignment.LEFT); form.setColWidths("1px, 100%"); vm = new ValuesManager(); form.setValuesManager(vm); TextItem name = ItemFactory.newTextItem("name", "name", template.getName()); name.setRequired(true); name.setDisabled(template.getId() != 0L); StaticTextItem id = ItemFactory.newStaticTextItem("id", I18N.message("id"), "" + template.getId()); id.setVisible(template != null && template.getId() != 0L); TextAreaItem description = ItemFactory.newTextAreaItem("description", "description", template.getDescription()); description.setHeight(200); // The optional batch SpinnerItem batch = ItemFactory.newSpinnerItem("batch", "batch", template.getBatch()); batch.setRequired(true); batch.setMin(1); batch.setStep(10); batch.setHintStyle("hint"); // The image threshold SpinnerItem resolutionThreshold = ItemFactory.newSpinnerItem("resolutionthreshold", I18N.message("resolutionthreshold"), template.getImageThreshold()); resolutionThreshold.setRequired(true); resolutionThreshold.setWrapTitle(false); resolutionThreshold.setMin(50); resolutionThreshold.setStep(100); resolutionThreshold.setHint("pixels"); if (Session.get().isDefaultTenant() && template.getId() != 0L) form.setItems(id, name, description, batch, resolutionThreshold); else form.setItems(id, name, description); }
Example 9
Source File: TwoFactorsAuthenticationSettings.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private void init(GUIParameter[] parameters) { DynamicForm form = new DynamicForm(); form.setWidth(1); form.setValuesManager(vm); form.setTitleOrientation(TitleOrientation.LEFT); form.setNumCols(1); Map<String, String> settings = Util.convertToMap(parameters); final RadioGroupItem enable2fa = ItemFactory.newBooleanSelector("enable2fa", I18N.message("enable2fa")); enable2fa.setValue("true".equals(settings.get("enabled")) ? "yes" : "no"); enable2fa.setWrapTitle(false); enable2fa.setWrap(false); enable2fa.setRequired(true); enable2fa.setDisabled(Session.get().isDemo()); form.setFields(enable2fa); /* * GoogleAuthenticator section */ DynamicForm googleForm = new DynamicForm(); googleForm.setValuesManager(vm); googleForm.setTitleOrientation(TitleOrientation.TOP); googleForm.setIsGroup(true); googleForm.setGroupTitle("Google Authenticator"); googleForm.setNumCols(1); final RadioGroupItem enableGoolge = ItemFactory.newBooleanSelector("enableGoolge", I18N.message("enablegoogleauthenticator")); enableGoolge.setValue("true".equals(settings.get(Constants.TWOFA_GOOGLE_AUTHENTICATOR + ".enabled")) ? "yes" : "no"); enableGoolge.setWrapTitle(false); enableGoolge.setWrap(false); enableGoolge.setRequired(true); enableGoolge.setDisabled(Session.get().isDemo()); googleForm.setFields(enableGoolge); /* * Yubikey section */ DynamicForm yubikeyForm = new DynamicForm(); yubikeyForm.setValuesManager(vm); yubikeyForm.setTitleOrientation(TitleOrientation.TOP); yubikeyForm.setIsGroup(true); yubikeyForm.setGroupTitle("YubiKey"); yubikeyForm.setNumCols(1); final RadioGroupItem enableYubikey = ItemFactory.newBooleanSelector("enableYubikey", I18N.message("enableyubikey")); enableYubikey.setValue("true".equals(settings.get("yubikey.enabled")) ? "yes" : "no"); enableYubikey.setWrapTitle(false); enableYubikey.setWrap(false); enableYubikey.setRequired(true); enableYubikey.setDisabled(Session.get().isDemo()); yubikeyForm.setFields(enableYubikey); IButton save = new IButton(); save.setTitle(I18N.message("save")); save.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (vm.validate()) { String tenant = Session.get().getTenantName(); final List<GUIParameter> params = new ArrayList<GUIParameter>(); params.add(new GUIParameter(tenant + ".2fa.enabled", vm.getValueAsString("enable2fa").equals("yes") ? "true" : "false")); params.add(new GUIParameter(tenant + ".2fa." + Constants.TWOFA_GOOGLE_AUTHENTICATOR + ".enabled", vm.getValueAsString("enableGoolge").equals("yes") ? "true" : "false")); params.add(new GUIParameter(tenant + ".2fa." + Constants.TWOFA_YUBIKEY + ".enabled", vm.getValueAsString("enableYubikey").equals("yes") ? "true" : "false")); SettingService.Instance.get().saveSettings(params.toArray(new GUIParameter[0]), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void arg) { Session.get().updateConfig(params); Log.info(I18N.message("settingssaved"), null); } }); } } }); VLayout panel = new VLayout(); panel.setWidth100(); panel.setMembers(form, googleForm, yubikeyForm); body.setMembers(panel); addMember(save); }
Example 10
Source File: ShareFileSettings.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ShareFileSettings(String[] settings) { setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("sharefile")); setWidth(400); setHeight(150); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(2); setMembersMargin(2); DynamicForm form = new DynamicForm(); vm = new ValuesManager(); form.setValuesManager(vm); TextItem username = ItemFactory.newEmailItem("username", "username", false); username.setValue(settings[0]); username.setRequired(true); username.setWidth(220); TextItem password = ItemFactory.newPasswordItem("password", "password", null); password.setRequired(true); password.setWidth(150); TextItem host = ItemFactory.newTextItem("host", "host", null); host.setValue(settings[2]); host.setRequired(true); host.setWidth(220); save = new SubmitItem(); save.setTitle(I18N.message("save")); save.setAlign(Alignment.RIGHT); save.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onSave(); } }); form.setItems(host, username, password, save); addItem(form); }
Example 11
Source File: SaveDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public SaveDialog() { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("savesearch")); setWidth(350); setHeight(100); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(5); setAutoSize(true); final ValuesManager vm = new ValuesManager(); final DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setWidth(350); form.setMargin(5); TextItem name = ItemFactory.newTextItem("name", "name", null); name.setRequired(true); name.setValidators(new SimpleTextValidator()); name.setWidth(100); TextItem description = ItemFactory.newTextItem("description", "description", null); description.setWidth(300); ButtonItem save = new ButtonItem(); save.setTitle(I18N.message("save")); save.setAutoFit(true); save.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vm.validate(); if (!vm.hasErrors()) { final GUISearchOptions options = Search.get().getOptions(); options.setName(vm.getValueAsString("name")); options.setDescription(vm.getValueAsString("description")); SearchService.Instance.get().save(Search.get().getOptions(), new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Boolean b) { if (!b) SC.warn(I18N.message("duplicateelement")); else { SavedSearchesPanel.get().addEntry( vm.getValueAsString("name"), vm.getValueAsString("description"), options.getType() == GUISearchOptions.TYPE_FULLTEXT ? I18N.message("fulltext") : I18N.message("parametric")); destroy(); } } }); } } }); form.setFields(name, description, save); addItem(form); }
Example 12
Source File: GDriveCreate.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public GDriveCreate() { setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("createdoc")); setWidth(300); setHeight(120); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(5); setMembersMargin(3); DynamicForm form = new DynamicForm(); vm = new ValuesManager(); form.setValuesManager(vm); form.setTitleOrientation(TitleOrientation.TOP); TextItem fileName = ItemFactory.newTextItem("fileName", "filename", null); fileName.setRequired(true); fileName.setWidth(200); SelectItem type = ItemFactory.newSelectItem("type", I18N.message("type")); LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); map.put("doc", "doc"); map.put("docx", "docx"); map.put("odt", "odt"); map.put("txt", "txt"); map.put("xls", "xls"); map.put("xlsx", "xlsx"); map.put("ods", "ods"); map.put("ppt", "ppt"); map.put("pptx", "pptx"); map.put("odp", "odp"); type.setValueMap(map); type.setValue("doc"); type.setWidth(50); type.setEndRow(true); type.setRequired(true); create = new SubmitItem(); create.setTitle(I18N.message("create")); create.setAlign(Alignment.RIGHT); create.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onCreate(); } }); form.setItems(fileName, type, create); addItem(form); }
Example 13
Source File: Registration.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public Registration(String[] reg) { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("registration")); setWidth(350); setHeight(150); setIsModal(true); setShowModalMask(true); centerInPage(); setAutoSize(true); final DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setMargin(5); form.setNumCols(2); form.setTitleOrientation(TitleOrientation.TOP); TextItem regName = ItemFactory.newTextItem("reg_name", "name", null); regName.setWrapTitle(false); regName.setValue(reg[0]); TextItem regEmail = ItemFactory.newEmailItem("reg_email", "email", false); regEmail.setWrapTitle(false); regEmail.setValue(reg[1]); TextItem regOrganization = ItemFactory.newTextItem("reg_organization", "organization", null); regOrganization.setWrapTitle(false); regOrganization.setValue(reg[2]); TextItem regWebsite = ItemFactory.newTextItem("reg_website", "website", null); regWebsite.setWidth(180); regWebsite.setWrapTitle(false); regWebsite.setValue(reg[3]); ButtonItem apply = new ButtonItem(); apply.setTitle(I18N.message("apply")); apply.setAutoFit(true); apply.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vm.validate(); if (!vm.hasErrors()) { SettingService.Instance.get().saveRegistration(form.getValueAsString("reg_name"), form.getValueAsString("reg_email"), form.getValueAsString("reg_organization"), form.getValueAsString("reg_website"), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { SC.warn(caught.getMessage()); } @Override public void onSuccess(Void ret) { afterSave(); Registration.this.destroy(); } }); } } }); form.setFields(regName, regEmail, regOrganization, regWebsite, apply); addItem(form); }
Example 14
Source File: StatusDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public StatusDialog(StateWidget widget) { this.widget = widget; setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("editworkflowstate", I18N.message("task"))); setCanDragResize(true); setIsModal(true); setShowModalMask(true); setMargin(3); setAutoSize(true); setWidth(400); centerInPage(); form = new DynamicForm(); form.setTitleOrientation(TitleOrientation.TOP); form.setNumCols(1); form.setValuesManager(vm); TextItem name = ItemFactory.newTextItem("name", "name", widget.getTransition().getText()); name.setRequired(true); ButtonItem save = new ButtonItem("save", I18N.message("save")); save.setAutoFit(true); save.addClickHandler(new ClickHandler() { @SuppressWarnings("unchecked") public void onClick(ClickEvent event) { Map<String, Object> values = (Map<String, Object>) vm.getValues(); if (vm.validate()) { if (vm.validate()) { StatusDialog.this.widget.getWfState().setName((String) values.get("name")); StatusDialog.this.widget.setContents("<b>" + (String) values.get("name") + "</b>"); StatusDialog.this.widget.getDrawingPanel().getDiagramController().update(); destroy(); } } } }); form.setItems(name, save); addItem(form); }
Example 15
Source File: TwoFactorsAuthenticationPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public TwoFactorsAuthenticationPanel(GUIUser user, boolean withNotify) { super(); this.user = user; DynamicForm form = new DynamicForm(); form.setWidth100(); form.setValuesManager(vm); form.setTitleOrientation(TitleOrientation.LEFT); notify = ItemFactory.newCheckbox("notify", "notifyuser"); notify.setValue(false); notify.setDisabled(true); SelectItem method = ItemFactory.new2AFMethodSelector("factor", user.getSecondFactor()); method.setWidth(250); method.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { removeMember(setupPanel); if (event.getValue() == null || event.getValue().toString().isEmpty()) { setupPanel = new TwoFactorsAuthenticationSetup(); TwoFactorsAuthenticationPanel.this.user.setKey(null); TwoFactorsAuthenticationPanel.this.user.setSecondFactor(null); notify.setValue(false); notify.setDisabled(true); } else if (Constants.TWOFA_GOOGLE_AUTHENTICATOR.equals(event.getValue().toString())) { setupPanel = new GoogleAuthenticatorSetup(TwoFactorsAuthenticationPanel.this.user); notify.setValue(true); notify.setDisabled(false); } else if (Constants.TWOFA_YUBIKEY.equals(event.getValue().toString())) { setupPanel = new YubiKeySetup(TwoFactorsAuthenticationPanel.this.user); notify.setValue(false); notify.setDisabled(true); } addMember(setupPanel); } }); if (withNotify) form.setItems(method, notify); else form.setItems(method); setMembers(form); }
Example 16
Source File: SetPassword.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public SetPassword(final long userId) { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("changepassword")); setWidth(300); setHeight(140); setIsModal(true); setShowModalMask(true); centerInPage(); setAutoSize(true); final ValuesManager vm = new ValuesManager(); final DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setWidth(350); MatchesFieldValidator equalsValidator = new MatchesFieldValidator(); equalsValidator.setOtherField(NEWPASSWORDAGAIN); equalsValidator.setErrorMessage(I18N.message("passwordnotmatch")); LengthRangeValidator sizeValidator = new LengthRangeValidator(); sizeValidator.setErrorMessage( I18N.message("errorfieldminlenght", Integer.toString(Session.get().getUser().getPasswordMinLenght()))); sizeValidator.setMin(Session.get().getUser().getPasswordMinLenght()); PasswordItem newPass = new PasswordItem(); newPass.setName(NEWPASSWORD); newPass.setTitle(I18N.message(NEWPASSWORD)); newPass.setRequired(true); newPass.setAutoComplete(AutoComplete.NONE); newPass.setValidators(equalsValidator, sizeValidator); PasswordItem newPassAgain = new PasswordItem(); newPassAgain.setName(NEWPASSWORDAGAIN); newPassAgain.setTitle(I18N.message(NEWPASSWORDAGAIN)); newPassAgain.setAutoComplete(AutoComplete.NONE); newPassAgain.setWrapTitle(false); newPassAgain.setRequired(true); final CheckboxItem notify = ItemFactory.newCheckbox(NOTIFY, "notifycredentials"); notify.setValue(false); final ButtonItem apply = new ButtonItem(); apply.setTitle(I18N.message("apply")); apply.setAutoFit(true); apply.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vm.validate(); if (!vm.hasErrors()) { apply.setDisabled(true); SecurityService.Instance.get().changePassword(Session.get().getUser().getId(), userId, null, vm.getValueAsString(NEWPASSWORD), notify.getValueAsBoolean(), new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { SC.warn(caught.getMessage()); apply.setDisabled(false); } @Override public void onSuccess(Integer ret) { apply.setDisabled(false); if (ret.intValue() > 0) { // Alert the user and maintain the popup // opened if (ret == 1) Log.warn(I18N.message("wrongpassword"), null); else if (ret == 2) Log.warn(I18N.message("passwdnotnotified"), null); else Log.warn(I18N.message("genericerror"), null); } SetPassword.this.destroy(); } }); } } }); form.setFields(newPass, newPassAgain, notify, apply); addItem(form); }
Example 17
Source File: AutomationTriggerProperties.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private void refresh() { vm.clearValues(); vm.clearErrors(false); if (formsContainer.getMembers() != null) formsContainer.removeMembers(formsContainer.getMembers()); DynamicForm form2 = new DynamicForm(); form2.setWidth100(); form2.setTitleOrientation(TitleOrientation.TOP); form2.setValuesManager(vm); form2.setNumCols(1); final TextAreaItem automation = ItemFactory.newTextAreaItemForAutomation("automation", "automation", trigger.getAutomation(), changedHandler, false); automation.setStartRow(false); automation.setWidth("*"); automation.setDisabled(trigger.getRoutine()!=null); form2.setItems(automation); DynamicForm form1 = new DynamicForm(); form1.setNumCols(2); form1.setTitleOrientation(TitleOrientation.TOP); form1.setValuesManager(vm); form1.setHeight100(); SelectItem events = ItemFactory.newEventsSelector("events", I18N.message("triggeron"), changedHandler, true, true, true); events.setRowSpan(3); events.setValues(trigger.getEventsArray()); SpacerItem spacer = new SpacerItem(); spacer.setHeight(100); SelectItem routine = ItemFactory.newAutomationRoutineSelector("routine", trigger.getRoutine() != null ? trigger.getRoutine().getId() : null, changedHandler, true); routine.setEndRow(true); routine.addChangedHandler(changedHandler); ChangedHandler cngHandler = new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { if (event == null) { automation.setDisabled(false); } else { automation.setDisabled(event.getValue() != null && !event.getValue().toString().isEmpty()); } } }; routine.addChangedHandler(cngHandler); form1.setItems(events, folderSelector, routine, spacer); formsContainer.setMembers(form1, form2); }
Example 18
Source File: ContactsUploader.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ContactsUploader() { setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("uploadcontacts")); setWidth(400); setHeight(125); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); form = new DynamicForm(); vm = new ValuesManager(); form.setValuesManager(vm); sendButton = new SubmitItem(); sendButton.setTitle(I18N.message("send")); sendButton.setDisabled(true); sendButton.setAlign(Alignment.RIGHT); sendButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onSend(); } }); form.setItems(sendButton); // Create a new uploader panel and attach it to the window uploader = new MultiUploader(); uploader.setMaximumFiles(1); uploader.setStyleName("upload"); uploader.setFileInputPrefix("LDOC_CNT"); uploader.setHeight("30px"); uploader.reset(); // Add a finish handler which will load the image once the upload // finishes uploader.addOnFinishUploadHandler(onFinishUploaderHandler); addItem(uploader); addItem(form); }
Example 19
Source File: ChangePassword.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ChangePassword() { super(); GUIUser user = Session.get().getUser(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("changepassword")); setWidth(300); setIsModal(true); setShowModalMask(true); centerInPage(); setAutoSize(true); final ValuesManager vm = new ValuesManager(); final DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setWidth(350); form.setMargin(5); PasswordItem password = new PasswordItem(); password.setName(PASSWORD); password.setTitle(I18N.message(PASSWORD)); password.setRequired(true); MatchesFieldValidator equalsValidator = new MatchesFieldValidator(); equalsValidator.setOtherField(NEWPASSWORDAGAIN); equalsValidator.setErrorMessage(I18N.message("passwordnotmatch")); LengthRangeValidator sizeValidator = new LengthRangeValidator(); sizeValidator .setErrorMessage(I18N.message("errorfieldminlenght", Integer.toString(user.getPasswordMinLenght()))); sizeValidator.setMin(user.getPasswordMinLenght()); PasswordItem newPass = new PasswordItem(); newPass.setName(NEWPASSWORD); newPass.setTitle(I18N.message(NEWPASSWORD)); newPass.setRequired(true); newPass.setValidators(equalsValidator, sizeValidator); PasswordItem newPassAgain = new PasswordItem(); newPassAgain.setName(NEWPASSWORDAGAIN); newPassAgain.setTitle(I18N.message(NEWPASSWORDAGAIN)); newPassAgain.setWrapTitle(false); newPassAgain.setRequired(true); final ButtonItem apply = new ButtonItem(); apply.setTitle(I18N.message("apply")); apply.setAutoFit(true); apply.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vm.validate(); if (!vm.hasErrors()) { if (vm.getValueAsString(PASSWORD).equals(vm.getValueAsString(NEWPASSWORD))) { Map<String, String> errors = new HashMap<String, String>(); errors.put(NEWPASSWORD, I18N.message("useanotherpassword")); vm.setErrors(errors, true); return; } apply.setDisabled(true); SecurityService.Instance.get().changePassword(user.getId(), user.getId(), vm.getValueAsString(PASSWORD), vm.getValueAsString(NEWPASSWORD), false, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { apply.setDisabled(false); SC.warn(caught.getMessage()); } @Override public void onSuccess(Integer ret) { apply.setDisabled(false); if (ret.intValue() > 0) { // Alert the user and maintain the popup // opened if (ret == 1) SC.warn(I18N.message("wrongpassword")); else if (ret == 2) SC.warn(I18N.message("passwdnotnotified")); else SC.warn(I18N.message("genericerror")); } else { SC.say(I18N.message("yourpasswordhaschanged")); Log.info(I18N.message("event.user.passwordchanged"), null); } // Close the popup ChangePassword.this.destroy(); } }); } } }); form.setFields(password, newPass, newPassAgain, apply); addItem(form); }
Example 20
Source File: ReplaceVersionFile.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ReplaceVersionFile(GUIDocument document, String fileVersion) { this.document = document; this.fileVersion = fileVersion; setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("replacefile")); setWidth(420); setCanDragResize(true); setIsModal(true); setShowModalMask(true); setAutoSize(true); centerInPage(); DynamicForm form = new DynamicForm(); vm = new ValuesManager(); form.setValuesManager(vm); TextItem commentItem = ItemFactory.newTextItem("comment", "comment", null); commentItem.setRequired(true); commentItem.setWidth(250); form.setItems(commentItem); // Create a new uploader panel and attach it to the window multiUploader = new MultiUploader(); multiUploader.setStyleName("upload"); multiUploader.setWidth("300px"); multiUploader.setHeight("60px"); multiUploader.setFileInputPrefix("LDOC"); multiUploader.setMaximumFiles(1); multiUploader.addOnFinishUploadHandler(onFinishUploaderHandler); multiUploader.reset(); saveButton = new IButton(I18N.message("save")); saveButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) { onSave(); } }); saveButton.setDisabled(true); VLayout layout = new VLayout(); layout.setMembersMargin(5); layout.setMargin(2); layout.addMember(form); layout.addMember(multiUploader); layout.addMember(saveButton); addItem(layout); }