com.smartgwt.client.widgets.form.fields.RadioGroupItem Java Examples
The following examples show how to use
com.smartgwt.client.widgets.form.fields.RadioGroupItem.
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: StationSelector.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
FormItem createFilterCategorySelectionGroup(String serviceUrl) { if (stationFilterGroups.containsKey(serviceUrl)) { RadioGroupItem selector = stationFilterGroups.get(serviceUrl); return selector; } RadioGroupItem radioGroup = new RadioGroupItem("sosDataSource"); radioGroup.setShowTitle(false); radioGroup.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { Object value = event.getValue(); if (value != null) { hideInfoWindow(); controller.setStationFilter(value.toString()); controller.updateContentUponStationFilter(); } } }); stationFilterGroups.put(serviceUrl, radioGroup); return radioGroup; }
Example #2
Source File: ImportSettingsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public ImportSettingsPanel(GUIArchive archive, ChangedHandler changedHandler) { this.archive = archive; form.setValuesManager(vm); form.setTitleOrientation(TitleOrientation.TOP); TextItem description = ItemFactory.newTextItem("description", "description", archive.getDescription()); description.addChangedHandler(changedHandler); description.setDisabled(archive.getStatus() != GUIArchive.STATUS_OPENED); RadioGroupItem importTemplates = ItemFactory.newBooleanSelector("importtemplates", "importtemplates"); importTemplates.setValue(archive.getImportTemplate() == 1 ? "yes" : "no"); importTemplates.addChangedHandler(changedHandler); importTemplates.setDisabled(archive.getStatus() != GUIArchive.STATUS_OPENED); SelectItem options = ItemFactory.newImportCustomIds(); options.setWidth(200); options.setValue(Integer.toString(archive.getImportCustomId())); options.addChangedHandler(changedHandler); options.setDisabled(archive.getStatus() != GUIArchive.STATUS_OPENED); form.setFields(description, importTemplates, options); addMember(form); }
Example #3
Source File: KrameriusExportAction.java From proarc with GNU General Public License v3.0 | 6 votes |
@Override protected List<FormItem> createExportFormOptions() { List<FormItem> formItems = new ArrayList<>(); //RadioGroupItem requires specifically LinkedHashMap LinkedHashMap<String, String> radioButtonMap = new LinkedHashMap<>(); radioButtonMap.put(K4_POLICY_PUBLIC, i18n.ExportAction_Request_K4_Policy_Public()); radioButtonMap.put(K4_POLICY_PRVIATE, i18n.ExportAction_Request_K4_Policy_Private()); rgi = new RadioGroupItem(); rgi.setTitle(i18n.ExportAction_Request_K4_Policy_Msg()); rgi.setValueMap(radioButtonMap); rgi.setDefaultValue(K4_POLICY_PUBLIC); rgi.setVertical(false); formItems.add(rgi); return formItems; }
Example #4
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Simple yes/no radio button. yes=true, no=false * * @param name name of the item * @param label label of the item(optional) * * @return the new item */ public static RadioGroupItem newYesNoRadioItem(String name, String label) { RadioGroupItem item = new RadioGroupItem(filterItemName(name), I18N.message(label)); item.setVertical(false); item.setShowTitle(true); item.setWrap(false); item.setWrapTitle(false); LinkedHashMap<String, String> values = new LinkedHashMap<String, String>(); values.put("true", I18N.message("yes")); values.put("false", I18N.message("no")); item.setValueMap(values); item.setValue("true"); return item; }
Example #5
Source File: StationSelector.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
public void setSelectedFilter(String serviceURL, String filter) { RadioGroupItem selector = stationFilterGroups.get(serviceURL); if (selector == null) { // debug message .. should not happen anyway getToasterInstance().addErrorMessage("Missing expansion component for " + serviceURL); } else { selector.setValue(filter); } }
Example #6
Source File: StationSelector.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
private StationSelector(StationSelectorController controller) { stationFilterGroups = new HashMap<String, RadioGroupItem>(); controller.setStationPicker(this); initializeWindow(); initializeContent(); addCloseClickHandler(new CloseClickHandler() { public void onCloseClick(CloseClickEvent event) { closeStationpicker(); } }); }
Example #7
Source File: SelectSubscriptionForm.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
private ChangedHandler createSelectionChangedHandler() { return new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { RadioGroupItem item = (RadioGroupItem) event.getItem(); String value = item.getValueAsString(); final SimpleRuleType template = SimpleRuleType.getTypeFor(value); SelectSubscriptionForm.this.handleRuleTemplateSelection(template); } }; }
Example #8
Source File: SelectSubscriptionForm.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
private RadioGroupItem createPredefinedEventSelectionItem() { RadioGroupItem radioGroupItem = new RadioGroupItem(); radioGroupItem.setTitle(i18n.selectPredefinedEventForSubscription()); radioGroupItem.addChangedHandler(createSelectionChangedHandler()); radioGroupItem.setValueMap(createSelectionValueMap()); radioGroupItem.setDefaultValue(controller.getDefaultTemplate().name()); return radioGroupItem; }
Example #9
Source File: FormGenerator.java From proarc with GNU General Public License v3.0 | 5 votes |
public RadioGroupItem getRadioGroupItem(Field f, String lang) { RadioGroupItem item = new RadioGroupItem(f.getName(), f.getTitle(lang)); item.setVertical(false); item.setValueMap(f.getValueMap()); item.setWrap(false); item.setWrapTitle(false); if (f.getName().equals("rdaRules")) { rdaRadio = item; } return item; }
Example #10
Source File: MAMFieldValidator.java From proarc with GNU General Public License v3.0 | 5 votes |
public MAMFieldValidator(List<FormItem> items, Map<String, String> ignoredTitles, RadioGroupItem rdaRadioItem, Field field) { if (items == null) { throw new IllegalArgumentException("items cannot be null"); } this.itemsToCheck = items; this.ignoredTitles = ignoredTitles; this.rdaRadioItem = rdaRadioItem; this.field = field; }
Example #11
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static RadioGroupItem newBooleanSelector(String name, String title) { RadioGroupItem radioGroupItem = newRadioGroup(name, title); LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); map.put("yes", I18N.message("yes")); map.put("no", I18N.message("no")); radioGroupItem.setValueMap(map); return radioGroupItem; }
Example #12
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static RadioGroupItem newRadioGroup(String name, String title) { RadioGroupItem radioGroupItem = new RadioGroupItem(); radioGroupItem.setName(filterItemName(name)); radioGroupItem.setVertical(false); radioGroupItem.setTitle(I18N.message(title)); radioGroupItem.setWidth(80); return radioGroupItem; }
Example #13
Source File: ConversionDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ConversionDialog(GUIDocument document) { this.document = document; setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("convert") + " - " + document.getFileName()); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setAutoSize(true); final RadioGroupItem action = ItemFactory.newRadioGroup("action", I18N.message("action")); action.setRequired(true); action.setEndRow(true); final SelectItem format = ItemFactory.newConversionFormatItem(document.getFileName()); format.setEndRow(true); format.setRequired(true); final ButtonItem convert = new ButtonItem(); convert.setStartRow(false); convert.setTitle(I18N.message("convert")); convert.setAutoFit(true); convert.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onConvert(); } }); FolderService.Instance.get().getFolder(document.getFolder().getId(), false, false, false, new AsyncCallback<GUIFolder>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(GUIFolder folder) { convert.setDisabled(!folder.isDownload() && !folder.isWrite()); LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); if (folder.isDownload()) map.put("download", I18N.message("download")); if (folder.isWrite()) map.put("save", I18N.message("save")); action.setValueMap(map); action.setValue("download"); form.setFields(format, action, convert); addItem(form); } }); }
Example #14
Source File: DigitalObjectSearchView.java From proarc with GNU General Public License v3.0 | 4 votes |
private DynamicForm createFilter() { DynamicForm form = new DynamicForm(); form.setBrowserSpellCheck(false); form.setValidateOnExit(true); form.setSaveOnEnter(true); form.setAutoHeight(); form.setWidth100(); form.setNumCols(6); final RadioGroupItem filterType = new RadioGroupItem(DigitalObjectResourceApi.SEARCH_TYPE_PARAM); filterType.setVertical(false); filterType.setShowTitle(false); filterType.setWrap(false); // setRedrawOnChange(true) enforces evaluation of other FormItem.setShowIfCondition filterType.setRedrawOnChange(true); filterType.setColSpan(5); final LinkedHashMap<String, String> filterMap = new LinkedHashMap<String, String>(); filterMap.put(FILTER_ALPHABETICAL, i18n.DigitalObjectSearchView_FilterGroupAlphabetical_Title()); filterMap.put(FILTER_LAST_CREATED, i18n.DigitalObjectSearchView_FilterGroupLastCreated_Title()); filterMap.put(FILTER_LAST_MODIFIED, i18n.DigitalObjectSearchView_FilterGroupLastModified_Title()); if (!Editor.getInstance().hasPermission("proarc.permission.repository.search.groupOwner")) { filterMap.put(FILTER_PHRASE, i18n.DigitalObjectSearchView_FilterGroupPhrase_Title()); } filterMap.put(FILTER_QUERY, i18n.DigitalObjectSearchView_FilterGroupAdvanced_Title()); if (Editor.getInstance().hasPermission("proarc.permission.admin")) { filterMap.put(FILTER_DELETED, i18n.DigitalObjectSearchView_FilterGroupDeleted_Title()); } filterType.setValueMap(filterMap); filterType.setValue(FILTER_LAST_CREATED); FormItemIfFunction showIfAdvanced = new StringMatchFunction(filterType, FILTER_QUERY, FILTER_DELETED); FormItemIfFunction showIfPhrase = new StringMatchFunction(filterType, FILTER_PHRASE); FormItemIfFunction showIfCreatedModifiedQuery = new StringMatchFunction(filterType, FILTER_LAST_CREATED, FILTER_LAST_MODIFIED, FILTER_QUERY, FILTER_DELETED, FILTER_ALPHABETICAL); FormItemIfFunction showIfAplhabetical = new StringMatchFunction(filterType, FILTER_LAST_CREATED, FILTER_LAST_MODIFIED, FILTER_ALPHABETICAL); final TextItem phrase = createAdvancedItem(DigitalObjectResourceApi.SEARCH_PHRASE_PARAM, i18n.DigitalObjectSearchView_FilterPhrase_Title(), showIfPhrase); phrase.setValidators(new RequiredIfValidator(new RequiredIfFunction() { @Override public boolean execute(FormItem formItem, Object value) { return FILTER_PHRASE.equals(filterType.getValueAsString()); } }), new LengthRangeValidator() {{ setMax(1000); }}); SubmitItem submit = new SubmitItem("search", i18n.DigitalObjectSearchView_FilterSearchButton_Title()); form.setFields(filterType, createSpacerItem("100%", null), phrase, createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_TITLE_PARAM, i18n.DigitalObjectSearchView_FilterAdvancedTitle_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced), createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_IDENTIFIER_PARAM, i18n.DigitalObjectSearchView_FilterAdvancedIdentifier_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced), createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_CREATOR_PARAM, i18n.DigitalObjectSearchView_FilterAdvancedCreator_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced), createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_LABEL_PARAM, i18n.DigitalObjectSearchView_FilterAdvancedLabel_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced), createAdvancedItem(DigitalObjectResourceApi.SEARCH_OWNER_PARAM, i18n.DigitalObjectSearchView_FilterAdvancedOwner_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced), createModelItem(i18n.DigitalObjectSearchView_FilterAdvancedModel_Title(), showIfCreatedModifiedQuery), createSortItem(i18n.DigitalObjectSearchView_FilterSort_Title(), showIfAplhabetical), createRememberModelItem(i18n.DigitalObjectSearchView_FilterAdvancedModel_Remember_Title(), showIfCreatedModifiedQuery), createSpacerItem("100%", showIfCreatedModifiedQuery), submit); form.addSubmitValuesHandler(new SubmitValuesHandler() { @Override public void onSubmitValues(SubmitValuesEvent event) { if (filters.validate(false)) { filter(); } } }); return form; }
Example #15
Source File: ExternalAppsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private Tab prepareExternalCall(GUIParameter[] settings) { VLayout pane = new VLayout(); Tab extCall = new Tab(); extCall.setTitle(I18N.message("externalcall")); DynamicForm extCallForm = new DynamicForm(); extCallForm.setWidth(400); extCallForm.setIsGroup(true); extCallForm.setNumCols(2); extCallForm.setPadding(2); extCallForm.setGroupTitle(I18N.message("externalcall")); extCallForm.setValuesManager(vm); extCallForm.setTitleOrientation(TitleOrientation.LEFT); final RadioGroupItem extCallEnabled = ItemFactory.newBooleanSelector("extCallEnabled", "enabled"); extCallEnabled.setRequired(true); extCallEnabled.setRedrawOnChange(true); extCallEnabled.setValue("no"); TextItem extCallName = ItemFactory.newTextItem("extCallName", I18N.message("name"), null); TextItem extCallBaseUrl = ItemFactory.newTextItem("extCallBaseUrl", I18N.message("baseurl"), null); extCallBaseUrl.setWidth(300); TextItem extCallSuffix = ItemFactory.newTextItem("extCallSuffix", I18N.message("suffix"), null); extCallSuffix.setWidth(300); TextItem extCallWindow = ItemFactory.newTextItem("extCallWindow", I18N.message("targetwindow"), "_blank"); extCallForm.setItems(extCallEnabled, extCallName, extCallBaseUrl, extCallSuffix, extCallWindow); // Use a second form to group the parameters section DynamicForm parametersForm = new DynamicForm(); parametersForm.setWidth(400); parametersForm.setIsGroup(true); parametersForm.setGroupTitle(I18N.message("parameters")); parametersForm.setNumCols(4); extCallForm.setPadding(2); parametersForm.setValuesManager(vm); extCallParamUser = ItemFactory.newCheckbox("extCallParamUser", "user"); extCallParamTitle = ItemFactory.newCheckbox("extCallParamTitle", "filename"); parametersForm.setItems(extCallParamUser, extCallParamTitle); pane.setMembers(extCallForm, parametersForm); extCall.setPane(pane); String tenant = Session.get().getTenantName(); for (GUIParameter s : settings) { if ((tenant + ".extcall.enabled").equals(s.getName())) extCallEnabled.setValue("true".equals(s.getValue()) ? "yes" : "no"); else if ((tenant + ".extcall.name").equals(s.getName())) extCallName.setValue(s.getValue()); else if ((tenant + ".extcall.baseurl").equals(s.getName())) extCallBaseUrl.setValue(s.getValue()); else if ((tenant + ".extcall.suffix").equals(s.getName())) extCallSuffix.setValue(s.getValue()); else if ((tenant + ".extcall.window").equals(s.getName())) extCallWindow.setValue(s.getValue()); else if ((tenant + ".extcall.params").equals(s.getName())) { String[] tokens = s.getValue().split(","); for (String param : tokens) { if ("user".equals(param.trim())) extCallParamUser.setValue("true"); else if ("filename".equals(param.trim())) extCallParamTitle.setValue("true"); } } } return extCall; }
Example #16
Source File: FolderExtendedPropertiesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public FolderExtendedPropertiesPanel(GUIFolder folder, ChangedHandler changedHandler, ChangedHandler templateChangedHandler) { super(folder, changedHandler); setWidth100(); setHeight100(); setMembersMargin(1); RadioGroupItem locked = ItemFactory.newBooleanSelector("locked", "templatelocked"); locked.setValue(folder.getTemplateLocked() == 1 ? "yes" : "no"); locked.addChangedHandler(changedHandler); locked.setEndRow(true); ButtonItem applyMetadata = new ButtonItem(I18N.message("applytosubfolders")); applyMetadata.setAutoFit(true); applyMetadata.setEndRow(true); applyMetadata.setDisabled(!folder.isWrite()); applyMetadata.setColSpan(1); applyMetadata.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { ContactingServer.get().show(); FolderService.Instance.get().applyMetadata(folder.getId(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(Void v) { ContactingServer.get().hide(); } }); } }); form1 = new DynamicForm(); form1.setWidth(200); form1.setNumCols(1); form1.setTitleOrientation(TitleOrientation.TOP); form1.setItems(locked, applyMetadata); propertiesPanel = new ExtendedPropertiesPanel(folder, changedHandler, templateChangedHandler, folder.isWrite(), false, true); setMembers(form1, propertiesPanel); }
Example #17
Source File: ContactsImportSettings.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ContactsImportSettings() { setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("uploadcontacts")); setWidth(380); setHeight(330); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); form = new DynamicForm(); SelectItem separated = ItemFactory.newSelectItem("separatedby", "separatedby"); separated.setWidth(80); LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); map.put(",", ","); map.put(";", ";"); separated.setValueMap(map); separated.setValue(","); SelectItem delimiter = ItemFactory.newSelectItem("textdelimiter", "textdelimiter"); delimiter.setWidth(80); LinkedHashMap<String, String> map2 = new LinkedHashMap<String, String>(); map2.put("\"", "\""); map2.put("'", "'"); delimiter.setValueMap(map2); delimiter.setValue("\""); RadioGroupItem skip = ItemFactory.newBooleanSelector("skipfirstrow", "skipfirstrow"); skip.setValue("yes"); SpinnerItem firstName = ItemFactory.newSpinnerItem("firstname", "firstname", 1); firstName.setRequired(true); firstName.setWidth(60); firstName.setMin(1); firstName.setHint(I18N.message("columnindex")); SpinnerItem lastName = ItemFactory.newSpinnerItem("lastname", "lastname", 2); lastName.setRequired(true); lastName.setWidth(60); lastName.setMin(1); lastName.setHint(I18N.message("columnindex")); SpinnerItem email = ItemFactory.newSpinnerItem("email", "email", 3); email.setRequired(true); email.setWidth(60); email.setMin(1); email.setHint(I18N.message("columnindex")); SpinnerItem company = ItemFactory.newSpinnerItem("company", "company", 4); company.setRequired(true); company.setWidth(60); company.setMin(1); company.setHint(I18N.message("columnindex")); SpinnerItem phone = ItemFactory.newSpinnerItem("phone", "phone", 5); phone.setRequired(true); phone.setWidth(60); phone.setMin(1); phone.setHint(I18N.message("columnindex")); SpinnerItem mobile = ItemFactory.newSpinnerItem("mobile", "cell", 6); mobile.setRequired(true); mobile.setWidth(60); mobile.setMin(1); mobile.setHint(I18N.message("columnindex")); SpinnerItem address = ItemFactory.newSpinnerItem("address", "address", 7); address.setRequired(true); address.setWidth(60); address.setMin(1); address.setHint(I18N.message("columnindex")); SubmitItem importButton = new SubmitItem(); importButton.setTitle(I18N.message("iimport")); importButton.setEndRow(true); importButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onImport(); } }); form.setItems(separated, delimiter, skip, firstName, lastName, email, company, phone, mobile, address, importButton); addItem(form); }
Example #18
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 #19
Source File: AntivirusPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private void initGUI(GUIParameter[] settings) { final DynamicForm form = new DynamicForm(); form.setTitleOrientation(TitleOrientation.LEFT); form.setAlign(Alignment.LEFT); RadioGroupItem enabled = ItemFactory.newBooleanSelector("enabled", I18N.message("enabled")); enabled.setWrapTitle(false); enabled.setRequired(true); TextItem command = ItemFactory.newTextItem("command", "ClamAV", null); command.setWidth(400); TextItem includes = ItemFactory.newTextItem("includes", "include", null); includes.setWidth(400); TextItem excludes = ItemFactory.newTextItem("excludes", "exclude", null); excludes.setWidth(400); TextItem timeout = ItemFactory.newSpinnerItem("timeout", "timeout", (Integer) null); timeout.setHint(I18N.message("seconds")); for (GUIParameter setting : settings) { if ((Session.get().getTenantName() + ".antivirus.enabled").equals(setting.getName())) enabled.setValue("true".equals(setting.getValue()) ? "yes" : "no"); else if ("antivirus.command".equals(setting.getName())) command.setValue(setting.getValue()); else if ((Session.get().getTenantName() + ".antivirus.excludes").equals(setting.getName())) excludes.setValue(setting.getValue()); else if ((Session.get().getTenantName() + ".antivirus.includes").equals(setting.getName())) includes.setValue(setting.getValue()); else if ((Session.get().getTenantName() + ".antivirus.timeout").equals(setting.getName())) timeout.setValue(Integer.parseInt(setting.getValue())); } IButton save = new IButton(); save.setTitle(I18N.message("save")); save.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (form.validate()) { GUIParameter[] params = new GUIParameter[Session.get().isDefaultTenant() ? 4 : 3]; params[0] = new GUIParameter(Session.get().getTenantName() + ".antivirus.enabled", "" + ("yes".equals(form.getValueAsString("enabled")))); params[1] = new GUIParameter(Session.get().getTenantName() + ".antivirus.excludes", form.getValueAsString("excludes").trim()); params[2] = new GUIParameter(Session.get().getTenantName() + ".antivirus.includes", form.getValueAsString("includes").trim()); params[3] = new GUIParameter(Session.get().getTenantName() + ".antivirus.timeout", form.getValueAsString("timeout").trim()); if (Session.get().isDefaultTenant()) params[4] = new GUIParameter("antivirus.command", form.getValueAsString("command").trim()); SettingService.Instance.get().saveSettings(params, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void ret) { Log.info(I18N.message("settingssaved"), null); } }); } } }); if (Session.get().isDefaultTenant()) form.setFields(enabled, command, includes, excludes, timeout); else form.setFields(enabled, includes, excludes, timeout); Tab tab = new Tab(); tab.setTitle(I18N.message("antivirus")); tab.setPane(form); TabSet tabs = new TabSet(); tabs.setWidth100(); tabs.setHeight100(); tabs.setTabs(tab); setMembers(tabs, save); }