Java Code Examples for com.smartgwt.client.widgets.form.fields.TextItem#setValue()
The following examples show how to use
com.smartgwt.client.widgets.form.fields.TextItem#setValue() .
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: EventNameForm.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
private TextItem createAbonnementNameItem() { aboNameItem = new TextItem(); aboNameItem.setRequired(true); aboNameItem.setTextBoxStyle("n52_sensorweb_client_abo_name_textbox"); aboNameItem.setTitle(i18n.aboName()); aboNameItem.setWidth("*"); // fill form column aboNameItem.setKeyPressFilter("[0-9a-zA-Z_]"); aboNameItem.setValue(controller.createSuggestedAbonnementName()); aboNameItem.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { TextItem nameItem = (TextItem) event.getSource(); String currentAbonnementName = (String) nameItem.getValue(); controller.setSelectedAbonnementName(currentAbonnementName); } }); return aboNameItem; }
Example 2
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * Creates a new TextItem. * * @param name The item name (mandatory) * @param title The item title (mandatory) * @param value The item value (optional) * * @return the text item */ public static TextItem newTextItem(String name, String title, String value) { TextItem item = new TextItem(); item.setName(filterItemName(name)); item.setTitle(I18N.message(title)); if (value != null) item.setValue(value); else item.setValue(""); item.setWrapTitle(false); item.setRequiredMessage(I18N.message("fieldrequired")); return item; }
Example 3
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); }
Example 4
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 5
Source File: ContactDetails.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public ContactDetails(final GUIContact contact, final Contacts parent) { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("contact")); setWidth(500); setAutoHeight(); setIsModal(true); setShowModalMask(true); centerInPage(); setAutoSize(true); final ValuesManager vm = new ValuesManager(); final DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setMargin(5); form.setNumCols(3); form.setTitleOrientation(TitleOrientation.TOP); TextItem firstName = ItemFactory.newTextItem("firstname", "firstname", contact.getFirstName()); TextItem lastName = ItemFactory.newTextItem("lastname", "lastname", contact.getLastName()); TextItem email = ItemFactory.newEmailItem("email", "email", false); email.setRequired(true); email.setValue(contact.getEmail()); TextItem address = ItemFactory.newTextItem("address", "address", contact.getAddress()); TextItem phone = ItemFactory.newTextItem("phone", "phone", contact.getPhone()); TextItem cell = ItemFactory.newTextItem("cell", "cell", contact.getMobile()); TextItem company = ItemFactory.newTextItem("company", "company", contact.getCompany()); company.setWidth(180); 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()) { GUIContact c = new GUIContact(); c.setId(contact.getId()); c.setUserId(Session.get().getUser().getId()); c.setFirstName(vm.getValueAsString("firstname")); c.setLastName(vm.getValueAsString("lastname")); c.setEmail(vm.getValueAsString("email")); c.setAddress(vm.getValueAsString("address")); c.setPhone(vm.getValueAsString("phone")); c.setMobile(vm.getValueAsString("cell")); c.setCompany(vm.getValueAsString("company")); ContactService.Instance.get().save(c, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { SC.warn(caught.getMessage()); } @Override public void onSuccess(Void ret) { ContactDetails.this.destroy(); if (parent != null) parent.refresh(); } }); } } }); form.setFields(email, firstName, lastName, company, address, phone, cell, save); addItem(form); }
Example 6
Source File: TagsSettingsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onDraw() { DynamicForm parametersForm = new DynamicForm(); parametersForm.setValuesManager(vm); parametersForm.setTitleOrientation(TitleOrientation.LEFT); parametersForm.setNumCols(2); parametersForm.setColWidths(1, "*"); parametersForm.setPadding(5); SelectItem mode = ItemFactory.newTagInputMode("mode", "inputmode"); SpinnerItem maxsize = ItemFactory.newSpinnerItem("maxsize", I18N.message("maxsize"), (Long) null); maxsize.setRequired(true); SpinnerItem minsize = ItemFactory.newSpinnerItem("minsize", I18N.message("minsize"), (Long) null); minsize.setRequired(true); SpinnerItem cloudElements = ItemFactory.newSpinnerItem("cloudElements", I18N.message("tagcloudelements"), (Long) null); cloudElements.setRequired(true); cloudElements.setWrapTitle(false); TextItem vocabulary = ItemFactory.newTextItem("vocabulary", I18N.message("vocabulary"), null); vocabulary.setRequired(true); vocabulary.setWidth(300); parametersForm.setItems(mode, maxsize, minsize, cloudElements, vocabulary); addMember(parametersForm); for (GUIParameter p : settings) { if (p.getName().endsWith("tag.mode")) mode.setValue(p.getValue()); if (p.getName().endsWith("tag.maxsize")) maxsize.setValue(p.getValue()); if (p.getName().endsWith("tag.minsize")) minsize.setValue(p.getValue()); if (p.getName().endsWith("tag.vocabulary")) vocabulary.setValue(p.getValue()); if (p.getName().endsWith("tagcloud.maxtags")) cloudElements.setValue(p.getValue()); } IButton save = new IButton(); save.setTitle(I18N.message("save")); save.addClickHandler(new ClickHandler() { @SuppressWarnings("unchecked") public void onClick(ClickEvent event) { final Map<String, Object> values = (Map<String, Object>) vm.getValues(); if (vm.validate()) { List<GUIParameter> params = new ArrayList<GUIParameter>(); params.add(new GUIParameter(Session.get().getTenantName() + ".tag.mode", values.get("mode") .toString())); params.add(new GUIParameter(Session.get().getTenantName() + ".tag.maxsize", values.get("maxsize") .toString())); params.add(new GUIParameter(Session.get().getTenantName() + ".tag.minsize", values.get("minsize") .toString())); params.add(new GUIParameter(Session.get().getTenantName() + ".tag.vocabulary", values.get( "vocabulary").toString())); params.add(new GUIParameter(Session.get().getTenantName() + ".tagcloud.maxtags", values.get( "cloudElements").toString())); 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 ret) { Session.get() .getInfo() .setConfig(Session.get().getTenantName() + ".tag.mode", values.get("mode").toString()); Session.get() .getInfo() .setConfig(Session.get().getTenantName() + ".tag.maxsize", values.get("maxsize").toString()); Session.get() .getInfo() .setConfig(Session.get().getTenantName() + ".tag.minsize", values.get("minsize").toString()); Session.get() .getInfo() .setConfig(Session.get().getTenantName() + ".tagcloud.maxtags", values.get("cloudElements").toString()); Log.info(I18N.message("settingssaved"), null); } }); } } }); addMember(save); }
Example 7
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 8
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); }